Class: LibMsPack::MsCab::MsCabdFile

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/libmspack/mscab.rb

Overview

A structure which represents a single file in a cabinet or cabinet set.

Instance Method Summary collapse

Instance Method Details

#attribsFixnum

File attributes.

The following attributes are defined:

  • MSCAB_ATTRIB_RDONLY indicates the file is write protected.
  • MSCAB_ATTRIB_HIDDEN indicates the file is hidden.
  • MSCAB_ATTRIB_SYSTEM indicates the file is a operating system file.
  • MSCAB_ATTRIB_ARCH indicates the file is "archived".
  • MSCAB_ATTRIB_EXEC indicates the file is an executable program.
  • MSCAB_ATTRIB_UTF_NAME indicates the filename is in UTF8 format rather than ISO-8859-1.

Returns:

  • (Fixnum)


161
162
163
# File 'lib/libmspack/mscab.rb', line 161

def attribs
    self[:attribs]
end

#datetimeTime

File's last modified datetime.

Returns:

  • (Time)


168
169
170
# File 'lib/libmspack/mscab.rb', line 168

def datetime
    Time.gm(self[:date_y], self[:date_m], self[:date_d], self[:time_h], self[:time_m], self[:time_s])
end

#filenameString

The filename of the file.

String of up to 255 bytes in length, it may be in either ISO-8859-1 or UTF8 format, depending on the file attributes.

Returns:

  • (String)


138
139
140
# File 'lib/libmspack/mscab.rb', line 138

def filename
    self[:filename]
end

#folderMsCabdFolder?

Folder that contains this file.

Returns:



175
176
177
178
# File 'lib/libmspack/mscab.rb', line 175

def folder
    return nil if self[:folder].pointer.address.zero?
    self[:folder]
end

#lengthFixnum

The uncompressed length of the file, in bytes.

Returns:

  • (Fixnum)


145
146
147
# File 'lib/libmspack/mscab.rb', line 145

def length
    self[:length]
end

#nextMsCabdFile?

The next file in the cabinet or cabinet set, or nil if this is the final file.

Returns:



128
129
130
131
# File 'lib/libmspack/mscab.rb', line 128

def next
    return nil if self[:next].pointer.address.zero?
    self[:next]
end

#offsetFixnum

The uncompressed offset of this file in its folder.

Returns:

  • (Fixnum)


183
184
185
# File 'lib/libmspack/mscab.rb', line 183

def offset
    self[:offset]
end