Class: Mapi::Pst::Index64
Overview
will maybe inherit from Index64, in order to get the same #type function.
Constant Summary collapse
- UNPACK_STR =
'TTvvV'
- SIZE =
24
- BLOCK_SIZE =
512
- COUNT_MAX =
bit of a guess really. 512 / 24 = 21, but doesn’t leave enough header room
20
Instance Attribute Summary collapse
-
#u2 ⇒ Object
this is the extra item on the end of the UNPACK_STR above.
Attributes inherited from Index
#id, #offset, #pst, #size, #u1
Class Method Summary collapse
- .load_chain(io, header) ⇒ Object
-
.load_idx_rec(io, offset, linku1, start_val) ⇒ Object
almost identical to load code for Index, just different offsets and unpack strings.
Instance Method Summary collapse
-
#initialize(data) ⇒ Index64
constructor
A new instance of Index64.
- #inspect ⇒ Object
Methods inherited from Index
Constructor Details
#initialize(data) ⇒ Index64
Returns a new instance of Index64.
414 415 416 417 418 |
# File 'lib/mapi/pst.rb', line 414 def initialize data data = Pst.unpack data, UNPACK_STR if String === data @u2 = data.pop super data end |
Instance Attribute Details
#u2 ⇒ Object
this is the extra item on the end of the UNPACK_STR above
412 413 414 |
# File 'lib/mapi/pst.rb', line 412 def u2 @u2 end |
Class Method Details
.load_chain(io, header) ⇒ Object
424 425 426 |
# File 'lib/mapi/pst.rb', line 424 def self.load_chain io, header load_idx_rec io, header.index1, 0, 0 end |
.load_idx_rec(io, offset, linku1, start_val) ⇒ Object
almost identical to load code for Index, just different offsets and unpack strings. can probably merge them, or write a generic load_tree function or something.
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
# File 'lib/mapi/pst.rb', line 430 def self.load_idx_rec io, offset, linku1, start_val io.seek offset buf = io.read BLOCK_SIZE idxs = [] item_count = buf[ITEM_COUNT_OFFSET_64] raise "have too many active items in index (#{item_count})" if item_count > COUNT_MAX #idx = Index.new buf[BACKLINK_OFFSET, Index::SIZE] #raise 'blah 1' unless idx.id == linku1 if buf[LEVEL_INDICATOR_OFFSET_64] == 0 # leaf pointers # split the data into item_count index objects buf[0, SIZE * item_count].scan(/.{#{SIZE}}/mo).each_with_index do |data, i| idx = new data # first entry raise 'blah 3' if i == 0 and start_val != 0 and idx.id != start_val #idx.pst = self break if idx.id == 0 idxs << idx end else # node pointers # split the data into item_count table pointers buf[0, SIZE * item_count].scan(/.{#{SIZE}}/mo).each_with_index do |data, i| start, u1, offset = Pst.unpack data, 'T3' # for the first value, we expect the start to be equal raise 'blah 3' if i == 0 and start_val != 0 and start != start_val break if start == 0 idxs += load_idx_rec io, offset, u1, start end end idxs end |
Instance Method Details
#inspect ⇒ Object
420 421 422 |
# File 'lib/mapi/pst.rb', line 420 def inspect super.sub(/>$/, ', u2=%p>' % u2) end |