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

#initialize ⇒ LITFile

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_offset ⇒ Object

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_chunklen ⇒ Object

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_unknown ⇒ Object

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_id ⇒ Object

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

#directory ⇒ Object

Returns the value of attribute directory.



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

def directory
  @directory
end

#drm_level ⇒ Object

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_chunklen ⇒ Object

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_unknown ⇒ Object

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_guid ⇒ Object

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_id ⇒ Object

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

#manifest ⇒ Object

Returns the value of attribute manifest.



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

def manifest
  @manifest
end

#piece3_guid ⇒ Object

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_guid ⇒ Object

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

#sections ⇒ Object

Returns the value of attribute sections.



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

def sections
  @sections
end

#timestamp ⇒ Object

Returns the value of attribute timestamp.



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

def timestamp
  @timestamp
end

#version ⇒ Object

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