Class: Exerb::Win32::Struct::VersionInfoBlock

Inherits:
Base
  • Object
show all
Defined in:
lib/exerb/win32/struct/version_info_block.rb

Overview

#

Instance Attribute Summary collapse

Attributes inherited from Base

#position

Instance Method Summary collapse

Methods inherited from Base

read, #size, #update

Constructor Details

#initializeVersionInfoBlock

Returns a new instance of VersionInfoBlock.



22
23
24
25
26
27
28
# File 'lib/exerb/win32/struct/version_info_block.rb', line 22

def initialize
  @total_length = 0
  @value_length = 0
  @type         = 0
  @key          = ""
  @data         = ""
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



30
31
32
# File 'lib/exerb/win32/struct/version_info_block.rb', line 30

def data
  @data
end

#keyObject

Returns the value of attribute key.



30
31
32
# File 'lib/exerb/win32/struct/version_info_block.rb', line 30

def key
  @key
end

#total_lengthObject

Returns the value of attribute total_length.



30
31
32
# File 'lib/exerb/win32/struct/version_info_block.rb', line 30

def total_length
  @total_length
end

#typeObject

Returns the value of attribute type.



30
31
32
# File 'lib/exerb/win32/struct/version_info_block.rb', line 30

def type
  @type
end

#value_lengthObject

Returns the value of attribute value_length.



30
31
32
# File 'lib/exerb/win32/struct/version_info_block.rb', line 30

def value_length
  @value_length
end

Instance Method Details

#packObject



32
33
34
# File 'lib/exerb/win32/struct/version_info_block.rb', line 32

def pack
  return Exerb::Utility.alignment(self.pack_header + self.pack_string, 4) + @data.to_s
end

#pack_headerObject



36
37
38
# File 'lib/exerb/win32/struct/version_info_block.rb', line 36

def pack_header
  return [@total_length, @value_length, @type].pack('SSS')
end

#read(io) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/exerb/win32/struct/version_info_block.rb', line 49

def read(io)
  @total_length = io.read(2).unpack('S')[0]
  @value_length = io.read(2).unpack('S')[0]
  @type         = io.read(2).unpack('S')[0]
  @key          = self.read_string(io)
  @data         = io.read(@value_length)

  return self
end

#unpackObject

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/exerb/win32/struct/version_info_block.rb', line 45

def unpack
  raise NotImplementedError
end