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()); }
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; }