Class: Cabriolet::Models::HLPFile
- Inherits:
-
Object
- Object
- Cabriolet::Models::HLPFile
- Defined in:
- lib/cabriolet/models/hlp_file.rb
Overview
HLP internal file model
Represents a file within an HLP archive. HLP files contain an internal file system where each file can be compressed using LZSS MODE_MSHELP.
Instance Attribute Summary collapse
-
#compressed ⇒ Object
Returns the value of attribute compressed.
-
#compressed_length ⇒ Object
Returns the value of attribute compressed_length.
-
#data ⇒ Object
Returns the value of attribute data.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#length ⇒ Object
Returns the value of attribute length.
-
#offset ⇒ Object
Returns the value of attribute offset.
Instance Method Summary collapse
-
#compressed? ⇒ Boolean
Check if file is compressed.
-
#initialize(filename: nil, offset: 0, length: 0, compressed_length: 0, compressed: true) ⇒ HLPFile
constructor
Initialize HLP file.
-
#read_size ⇒ Integer
Get the size to read from archive.
Constructor Details
#initialize(filename: nil, offset: 0, length: 0, compressed_length: 0, compressed: true) ⇒ HLPFile
Initialize HLP file
20 21 22 23 24 25 26 27 28 |
# File 'lib/cabriolet/models/hlp_file.rb', line 20 def initialize(filename: nil, offset: 0, length: 0, compressed_length: 0, compressed: true) @filename = filename @offset = offset @length = length @compressed_length = compressed_length @compressed = compressed @data = nil end |
Instance Attribute Details
#compressed ⇒ Object
Returns the value of attribute compressed.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def compressed @compressed end |
#compressed_length ⇒ Object
Returns the value of attribute compressed_length.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def compressed_length @compressed_length end |
#data ⇒ Object
Returns the value of attribute data.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def data @data end |
#filename ⇒ Object
Returns the value of attribute filename.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def filename @filename end |
#length ⇒ Object
Returns the value of attribute length.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def length @length end |
#offset ⇒ Object
Returns the value of attribute offset.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def offset @offset end |
Instance Method Details
#compressed? ⇒ Boolean
Check if file is compressed
33 34 35 |
# File 'lib/cabriolet/models/hlp_file.rb', line 33 def compressed? @compressed end |
#read_size ⇒ Integer
Get the size to read from archive
40 41 42 |
# File 'lib/cabriolet/models/hlp_file.rb', line 40 def read_size compressed? ? @compressed_length : @length end |