コード例 #1
0
ファイル: UserDataTest.php プロジェクト: Rogiel/php-mpq
 public function testParse()
 {
     $parser = $this->createMemoryParser(hex2bin(self::TEST_USER_DATA));
     $userData = UserData::parse($parser);
     $this->assertEquals(512, $userData->getSize());
     $this->assertEquals(1024, $userData->getHeaderOffset());
     $this->assertEquals(1, $userData->getHeader());
     $this->assertEquals(hex2bin(self::TEST_USER_RAW_DATA), $userData->getRawContent());
 }
コード例 #2
0
ファイル: MPQFile.php プロジェクト: Rogiel/php-mpq
 public function parse()
 {
     if ($this->isParsed()) {
         return;
     }
     $parser = new BinaryStreamParser($this->stream);
     $signature = $this->parseSignature($parser);
     if ($signature == "MPQ27") {
         $this->userData = UserData::parse($parser);
         $this->stream->seek($this->getUserDataOffset());
         $signature = $this->parseSignature($parser);
     }
     if ($signature == "MPQ26") {
         $this->header = Header::parse($parser);
     }
     $this->hashTable = $this->parseHashTable();
     $this->blockTable = $this->parseBlockTable();
     $this->parsed = true;
 }