Class: Cabriolet::Models::LITFile

Inherits:
Object
  • Object
show all
Defined in:
lib/cabriolet/models/lit_header.rb

Overview

Represents a Microsoft Reader LIT file structure

LIT files have a complex structure with:

  • Primary and secondary headers

  • Piece table pointing to various data structures

  • Internal directory with IFCM/AOLL/AOLI chunks

  • DataSpace sections with transformation layers (compression/encryption)

  • Manifest mapping internal to original filenames

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLITFile

Returns a new instance of LITFile.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cabriolet/models/lit_header.rb', line 19

def initialize
  @version = 0
  @header_guid = ""
  @piece3_guid = ""
  @piece4_guid = ""
  @content_offset = 0
  @timestamp = 0
  @language_id = 0
  @creator_id = 0
  @entry_chunklen = 0
  @count_chunklen = 0
  @entry_unknown = 0
  @count_unknown = 0
  @drm_level = 0
  @sections = []
  @directory = nil
  @manifest = nil
end

Instance Attribute Details

#content_offsetObject

Returns the value of attribute content_offset.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def content_offset
  @content_offset
end

#count_chunklenObject

Returns the value of attribute count_chunklen.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def count_chunklen
  @count_chunklen
end

#count_unknownObject

Returns the value of attribute count_unknown.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def count_unknown
  @count_unknown
end

#creator_idObject

Returns the value of attribute creator_id.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def creator_id
  @creator_id
end

#directoryObject

Returns the value of attribute directory.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def directory
  @directory
end

#drm_levelObject

Returns the value of attribute drm_level.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def drm_level
  @drm_level
end

#entry_chunklenObject

Returns the value of attribute entry_chunklen.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def entry_chunklen
  @entry_chunklen
end

#entry_unknownObject

Returns the value of attribute entry_unknown.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def entry_unknown
  @entry_unknown
end

#header_guidObject

Returns the value of attribute header_guid.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def header_guid
  @header_guid
end

#language_idObject

Returns the value of attribute language_id.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def language_id
  @language_id
end

#manifestObject

Returns the value of attribute manifest.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def manifest
  @manifest
end

#piece3_guidObject

Returns the value of attribute piece3_guid.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def piece3_guid
  @piece3_guid
end

#piece4_guidObject

Returns the value of attribute piece4_guid.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def piece4_guid
  @piece4_guid
end

#sectionsObject

Returns the value of attribute sections.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def sections
  @sections
end

#timestampObject

Returns the value of attribute timestamp.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def timestamp
  @timestamp
end

#versionObject

Returns the value of attribute version.



14
15
16
# File 'lib/cabriolet/models/lit_header.rb', line 14

def version
  @version
end

Instance Method Details

#encrypted?Boolean

Check if the LIT file has DRM encryption

Returns:

  • (Boolean)

    true if DRM is present



41
42
43
# File 'lib/cabriolet/models/lit_header.rb', line 41

def encrypted?
  drm_level.positive?
end

#section(name) ⇒ LITSection?

Get section by name

Parameters:

  • name (String)

    Section name

Returns:

  • (LITSection, nil)

    The section or nil if not found



49
50
51
# File 'lib/cabriolet/models/lit_header.rb', line 49

def section(name)
  sections.find { |s| s.name == name }
end