Exemple #1
0
 public function __construct(Stream $stream)
 {
     $buffer = '';
     while ($read = $stream->readBytes(10240)) {
         $buffer .= $read;
     }
     $this->resource = self::createImageResourceFromTGA($buffer);
     $buffer = NULL;
 }
Exemple #2
0
 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;
 }
Exemple #3
0
 /**
  * {@inheritdoc}
  */
 public function eof()
 {
     return $this->stream->eof();
 }
Exemple #4
0
 private function readSector(Sector $sector)
 {
     $this->stream->seek($this->file->getUserDataOffset() + $this->block->getFilePos() + $sector->getStart());
     $compressedStream = $this->createCompressedStream($sector);
     return $compressedStream->readBytes($this->block->getSize());
 }