Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | protected function readData():void{ |
||
28 | |||
29 | // get the root info block of the AARC file (4+4+4+4 = 16 bytes) |
||
30 | $rootInfo = unpack($this::AARC_ROOT, fread($this->fh, 16)); |
||
31 | |||
32 | if($rootInfo['ArchiveType'] !== "\x43\x52\x41\x41"){ // CRAA |
||
33 | throw new WSDBException('invalid AARC'); |
||
34 | } |
||
35 | |||
36 | // get the root data info block |
||
37 | $blockInfo = $this->blocktable[$rootInfo['Index']]; |
||
38 | |||
39 | fseek($this->fh, $blockInfo['Offset']); |
||
40 | |||
41 | // read the data block info (4+20+8 = 32 bytes) |
||
42 | for($i = 0; $i < $rootInfo['Blockcount']; $i++){ |
||
43 | $data = unpack($this::AARC_DATA, fread($this->fh, 32)); |
||
44 | $hash = bin2hex($data['Hash']); |
||
45 | unset($data['Hash']); |
||
46 | $this->data[$hash] = $data; |
||
47 | } |
||
52 |