Class: Omnizip::Formats::Msi::Entry
- Inherits:
-
Object
- Object
- Omnizip::Formats::Msi::Entry
- Defined in:
- lib/omnizip/formats/msi/entry.rb
Overview
MSI File Entry
Represents a single file within an MSI package. File information is assembled from File, Component, and Directory tables.
Constant Summary
Constants included from Constants
Constants::BINARY_TYPE, Constants::CATEGORY_BINARY, Constants::CATEGORY_CABINET, Constants::CATEGORY_CONDITION, Constants::CATEGORY_DEFAULT, Constants::CATEGORY_DOUBLE, Constants::CATEGORY_FILENAME, Constants::CATEGORY_GUID, Constants::CATEGORY_IDENTIFIER, Constants::CATEGORY_LANGUAGE, Constants::CATEGORY_LOWERCASE, Constants::CATEGORY_PATH, Constants::CATEGORY_SHORTCUT, Constants::CATEGORY_TEMPLATE, Constants::CATEGORY_TEXT, Constants::CATEGORY_UPPERCASE, Constants::CATEGORY_VERSION, Constants::COLUMNS_STREAM, Constants::COMPONENT_TABLE, Constants::COMP_ATTR_64BIT, Constants::COMP_ATTR_DISABLE_REGISTRY, Constants::COMP_ATTR_LOCAL_ONLY, Constants::COMP_ATTR_NEVER_OVERWRITE, Constants::COMP_ATTR_ODBC, Constants::COMP_ATTR_OPTIONAL, Constants::COMP_ATTR_PERMANENT, Constants::COMP_ATTR_REGISTRY_KEY_PATH, Constants::COMP_ATTR_SHARED, Constants::COMP_ATTR_SHARED_DLL, Constants::COMP_ATTR_SOURCE_ONLY, Constants::COMP_ATTR_TRANSITIVE, Constants::COMP_ATTR_UNINSTALL_ON_SUPERSEDE, Constants::DIRECTORY_TABLE, Constants::EMBEDDED_CAB_PREFIX, Constants::FILE_ATTR_CHECKSUM, Constants::FILE_ATTR_COMPRESSED, Constants::FILE_ATTR_HIDDEN, Constants::FILE_ATTR_NONCOMPRESSED, Constants::FILE_ATTR_PATCHADDED, Constants::FILE_ATTR_READONLY, Constants::FILE_ATTR_SYSTEM, Constants::FILE_ATTR_VITAL, Constants::FILE_TABLE, Constants::INT16_TYPE, Constants::INT32_TYPE, Constants::MEDIA_TABLE, Constants::OBJECT_TYPE, Constants::PROGRAM_FILES, Constants::PROGRAM_FILES_X64, Constants::SOURCE_DIR, Constants::STREAMS_TABLE, Constants::STRING_DATA_STREAM, Constants::STRING_POOL_STREAM, Constants::STRING_TYPE, Constants::SYSTEM_FOLDER, Constants::SYSTEM_X64_FOLDER, Constants::TABLES_STREAM, Constants::TARGET_DIR, Constants::WINDOWS_FOLDER
Instance Attribute Summary collapse
-
#attributes ⇒ Integer
File attributes.
-
#component ⇒ String
Component key.
-
#creation_time ⇒ Time?
Creation time (from CAB).
-
#file_key ⇒ String
File key (primary key from File table).
-
#filename ⇒ String
Filename from File table (may be "short|long" format).
-
#language ⇒ String
File language.
-
#last_write_time ⇒ Time?
Last write time (from CAB).
-
#long_name ⇒ String
Long filename (extracted from filename).
-
#path ⇒ String
Full installation path.
-
#sequence ⇒ Integer
Sequence number (maps to Media table).
-
#short_name ⇒ String
Short filename (8.3 format).
-
#size ⇒ Integer
File size in bytes.
-
#version ⇒ String
File version.
Instance Method Summary collapse
-
#attributes_string ⇒ String
Get file attributes as string.
-
#compressed? ⇒ Boolean
Check if file is compressed.
-
#directory? ⇒ Boolean
Check if entry is a directory.
-
#display_name ⇒ String
Get display filename (prefers long name).
- #entry_directory? ⇒ Boolean
- #entry_mtime ⇒ Object
- #entry_name ⇒ Object
- #entry_size ⇒ Object
-
#file? ⇒ Boolean
Check if entry is a file.
-
#parse_filename(filename) ⇒ Object
Parse filename field.
-
#vital? ⇒ Boolean
Check if file is vital (must be present for installation).
-
#windows_path ⇒ String
Get path for display (Windows-style backslashes).
Methods included from Constants
Instance Attribute Details
#attributes ⇒ Integer
Returns File attributes.
50 51 52 |
# File 'lib/omnizip/formats/msi/entry.rb', line 50 def attributes @attributes end |
#component ⇒ String
Returns Component key.
26 27 28 |
# File 'lib/omnizip/formats/msi/entry.rb', line 26 def component @component end |
#creation_time ⇒ Time?
Returns Creation time (from CAB).
53 54 55 |
# File 'lib/omnizip/formats/msi/entry.rb', line 53 def creation_time @creation_time end |
#file_key ⇒ String
Returns File key (primary key from File table).
23 24 25 |
# File 'lib/omnizip/formats/msi/entry.rb', line 23 def file_key @file_key end |
#filename ⇒ String
Returns Filename from File table (may be "short|long" format).
29 30 31 |
# File 'lib/omnizip/formats/msi/entry.rb', line 29 def filename @filename end |
#language ⇒ String
Returns File language.
47 48 49 |
# File 'lib/omnizip/formats/msi/entry.rb', line 47 def language @language end |
#last_write_time ⇒ Time?
Returns Last write time (from CAB).
56 57 58 |
# File 'lib/omnizip/formats/msi/entry.rb', line 56 def last_write_time @last_write_time end |
#long_name ⇒ String
Returns Long filename (extracted from filename).
32 33 34 |
# File 'lib/omnizip/formats/msi/entry.rb', line 32 def long_name @long_name end |
#path ⇒ String
Returns Full installation path.
20 21 22 |
# File 'lib/omnizip/formats/msi/entry.rb', line 20 def path @path end |
#sequence ⇒ Integer
Returns Sequence number (maps to Media table).
41 42 43 |
# File 'lib/omnizip/formats/msi/entry.rb', line 41 def sequence @sequence end |
#short_name ⇒ String
Returns Short filename (8.3 format).
35 36 37 |
# File 'lib/omnizip/formats/msi/entry.rb', line 35 def short_name @short_name end |
#size ⇒ Integer
Returns File size in bytes.
38 39 40 |
# File 'lib/omnizip/formats/msi/entry.rb', line 38 def size @size end |
#version ⇒ String
Returns File version.
44 45 46 |
# File 'lib/omnizip/formats/msi/entry.rb', line 44 def version @version end |
Instance Method Details
#attributes_string ⇒ String
Get file attributes as string
89 90 91 92 93 94 95 96 |
# File 'lib/omnizip/formats/msi/entry.rb', line 89 def attributes_string attrs = [] attrs << "Archive" attrs << "ReadOnly" if @attributes&.anybits?(FILE_ATTR_READONLY) attrs << "Hidden" if @attributes&.anybits?(FILE_ATTR_HIDDEN) attrs << "System" if @attributes&.anybits?(FILE_ATTR_SYSTEM) attrs.join(", ") end |
#compressed? ⇒ Boolean
Check if file is compressed
75 76 77 |
# File 'lib/omnizip/formats/msi/entry.rb', line 75 def compressed? @attributes&.anybits?(FILE_ATTR_COMPRESSED) end |
#directory? ⇒ Boolean
Check if entry is a directory
61 62 63 |
# File 'lib/omnizip/formats/msi/entry.rb', line 61 def directory? false end |
#display_name ⇒ String
Get display filename (prefers long name)
121 122 123 |
# File 'lib/omnizip/formats/msi/entry.rb', line 121 def display_name @long_name || @short_name || @filename || "" end |
#entry_directory? ⇒ Boolean
15 |
# File 'lib/omnizip/formats/msi/entry.rb', line 15 def entry_directory? = false |
#entry_mtime ⇒ Object
17 |
# File 'lib/omnizip/formats/msi/entry.rb', line 17 def entry_mtime = nil |
#entry_name ⇒ Object
14 |
# File 'lib/omnizip/formats/msi/entry.rb', line 14 def entry_name = path |
#entry_size ⇒ Object
16 |
# File 'lib/omnizip/formats/msi/entry.rb', line 16 def entry_size = size |
#file? ⇒ Boolean
Check if entry is a file
68 69 70 |
# File 'lib/omnizip/formats/msi/entry.rb', line 68 def file? true end |
#parse_filename(filename) ⇒ Object
Parse filename field
MSI File.Filename can be:
- "short|long" - both short and long names
- "name" - just the name
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/omnizip/formats/msi/entry.rb', line 105 def parse_filename(filename) @filename = filename if filename&.include?("|") parts = filename.split("|", 2) @short_name = parts[0] @long_name = parts[1] else @long_name = filename @short_name = nil end end |
#vital? ⇒ Boolean
Check if file is vital (must be present for installation)
82 83 84 |
# File 'lib/omnizip/formats/msi/entry.rb', line 82 def vital? @attributes&.anybits?(FILE_ATTR_VITAL) end |
#windows_path ⇒ String
Get path for display (Windows-style backslashes)
128 129 130 |
# File 'lib/omnizip/formats/msi/entry.rb', line 128 def windows_path @path&.gsub("/", "\\") end |