Class: Mix1::Package::File

Inherits:
Object
  • Object
show all
Defined in:
lib/mix1.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, mix_crc: nil, content_offset: nil, content_length: nil, data: nil) ⇒ File

Returns a new instance of File.



338
339
340
341
342
343
344
# File 'lib/mix1.rb', line 338

def initialize(name:, mix_crc: nil, content_offset: nil, content_length: nil, data: nil)
  @name = name
  @mix_crc = mix_crc
  @content_offset = content_offset
  @content_length = content_length
  @data = data
end

Instance Attribute Details

#content_lengthObject

Returns the value of attribute content_length.



336
337
338
# File 'lib/mix1.rb', line 336

def content_length
  @content_length
end

#content_offsetObject

Returns the value of attribute content_offset.



336
337
338
# File 'lib/mix1.rb', line 336

def content_offset
  @content_offset
end

#dataObject

Returns the value of attribute data.



336
337
338
# File 'lib/mix1.rb', line 336

def data
  @data
end

#mix_crcObject

Returns the value of attribute mix_crc.



336
337
338
# File 'lib/mix1.rb', line 336

def mix_crc
  @mix_crc
end

#nameObject

Returns the value of attribute name.



336
337
338
# File 'lib/mix1.rb', line 336

def name
  @name
end

Instance Method Details

#data_crcObject



352
353
354
# File 'lib/mix1.rb', line 352

def data_crc
  Digest::CRC32.hexdigest(@data)
end

#file_crcObject



346
347
348
349
350
# File 'lib/mix1.rb', line 346

def file_crc
  return "e6fe46b8" if @name.downcase == ".w3dhub.patch"

  Digest::CRC32.hexdigest(@name.upcase)
end