Class: LibMsPack::MsCab::MsCabdFile
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- LibMsPack::MsCab::MsCabdFile
- Defined in:
- lib/libmspack/mscab.rb
Overview
A structure which represents a single file in a cabinet or cabinet set.
Instance Method Summary collapse
-
#attribs ⇒ Fixnum
File attributes.
-
#datetime ⇒ Time
File's last modified datetime.
-
#filename ⇒ String
The filename of the file.
-
#folder ⇒ MsCabdFolder?
Folder that contains this file.
-
#getFilename ⇒ String
The filename of the file.
-
#length ⇒ Fixnum
The uncompressed length of the file, in bytes.
-
#next ⇒ MsCabdFile?
The next file in the cabinet or cabinet set, or nil if this is the final file.
-
#offset ⇒ Fixnum
The uncompressed offset of this file in its folder.
Instance Method Details
#attribs ⇒ Fixnum
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.
174 175 176 |
# File 'lib/libmspack/mscab.rb', line 174 def attribs self[:attribs] end |
#datetime ⇒ Time
File's last modified datetime.
181 182 183 |
# File 'lib/libmspack/mscab.rb', line 181 def datetime Time.gm(self[:date_y], self[:date_m], self[:date_d], self[:time_h], self[:time_m], self[:time_s]) end |
#filename ⇒ String
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.
138 139 140 |
# File 'lib/libmspack/mscab.rb', line 138 def filename self[:filename] end |
#folder ⇒ MsCabdFolder?
Folder that contains this file.
188 189 190 191 |
# File 'lib/libmspack/mscab.rb', line 188 def folder return nil if self[:folder].pointer.address.zero? self[:folder] end |
#getFilename ⇒ String
The filename of the file.
145 146 147 148 149 150 151 152 153 |
# File 'lib/libmspack/mscab.rb', line 145 def getFilename str = filename.dup if (attribs & Constants::MSCAB_ATTRIB_UTF_NAME) == Constants::MSCAB_ATTRIB_UTF_NAME str.force_encoding(Encoding::UTF_8) else str.force_encoding(Encoding::ISO_8859_1) end str end |
#length ⇒ Fixnum
The uncompressed length of the file, in bytes.
158 159 160 |
# File 'lib/libmspack/mscab.rb', line 158 def length self[:length] end |
#next ⇒ MsCabdFile?
The next file in the cabinet or cabinet set, or nil if this is the final file.
128 129 130 131 |
# File 'lib/libmspack/mscab.rb', line 128 def next return nil if self[:next].pointer.address.zero? self[:next] end |
#offset ⇒ Fixnum
The uncompressed offset of this file in its folder.
196 197 198 |
# File 'lib/libmspack/mscab.rb', line 196 def offset self[:offset] end |