Module: Msf::Util::DotNetDeserialization::Types::Primitives::MemberValues::Factory

Included in:
RecordValues::ClassWithId, RecordValues::ClassWithMembersAndTypes, RecordValues::SystemClassWithMembersAndTypes
Defined in:
lib/msf/util/dot_net_deserialization/types/primitives.rb

Instance Method Summary collapse

Instance Method Details

#from_member_values(class_info:, member_type_info:, member_values:, **kwargs) ⇒ Object

Raises:

  • (::ArgumentError)

181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/msf/util/dot_net_deserialization/types/primitives.rb', line 181

def from_member_values(class_info:, member_type_info:, member_values:, **kwargs)
  raise ::ArgumentError, 'Invalid class_info type' unless class_info.is_a? Types::General::ClassInfo
  raise ::ArgumentError, 'Invalid member_type_info type' unless member_type_info.is_a? Types::General::MemberTypeInfo
  raise ::ArgumentError, 'Invalid member count' unless class_info.member_count == member_values.length

  kwargs[:class_info] = class_info
  kwargs[:member_type_info] = member_type_info
  kwargs[:member_values] = MemberValues.new(
    member_values,
    class_info: class_info,
    member_type_info: member_type_info
  )

  # pass class_info and member_type_info as *both* a value and a parameter
  self.new(kwargs, class_info: class_info, member_type_info: member_type_info)
end