Class: PAKFile::FileEntryPAK

Inherits:
FileEntry show all
Defined in:
lib/pakspy.rb

Overview

File located inside the PAK itself

Instance Attribute Summary

Attributes inherited from FileEntry

#name

Instance Method Summary collapse

Constructor Details

#initialize(pack, entry) ⇒ FileEntryPAK

Returns a new instance of FileEntryPAK.



194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/pakspy.rb', line 194

def initialize(pack, entry)
  super pack

  # name   - max 58 byte null terminated string
  # offset - 4 byte integer (little endian)
  # size   - 4 byte integer (little endian)
  data = entry.unpack "a56VV"

  @name   = data[0].rstrip
  @offset = data[1]
  @size   = data[2]
end

Instance Method Details

#readObject



207
208
209
210
# File 'lib/pakspy.rb', line 207

def read
  @pack.pak_file.seek @offset
  @pack.pak_file.read @size
end