Esempio n. 1
0
 public function __construct(BinaryStreamParser $parser)
 {
     $parser->readBytes(44);
     $numDeps = $parser->readByte();
     $parser->readBytes(3);
     while ($numDeps > 0) {
         while ($parser->readByte() !== 0) {
         }
         $numDeps--;
     }
     $numAttribs = $parser->readUInt32();
     $attribs = array();
     while ($numAttribs > 0) {
         $keyLen = $parser->readUInt16();
         $key = $parser->readBytes($keyLen);
         $locale = hex2bin(dechex($parser->readUInt32()));
         $valueLen = $parser->readUInt16();
         $value = $parser->readBytes($valueLen);
         $attribs[$key][$locale] = $value;
         $numAttribs--;
     }
     if (isset($attribs['DocInfo/Name'])) {
         $this->name = $attribs['DocInfo/Name'];
     }
     if (isset($attribs['DocInfo/DescShort'])) {
         $this->shortDescription = $attribs['DocInfo/DescShort'];
     }
     if (isset($attribs['DocInfo/DescLong'])) {
         $this->longDescription = $attribs['DocInfo/DescLong'];
     }
 }
Esempio n. 2
0
 public static function parse(BinaryStreamParser $parser)
 {
     $data = new UserData();
     $data->size = $parser->readUInt32();
     $data->headerOffset = $parser->readUInt32();
     $data->header = $parser->readUInt32();
     $data->rawContent = $parser->readBytes($data->size - 12);
     return $data;
 }
Esempio n. 3
0
 public function __construct(Stream $stream)
 {
     $stream = new BinaryStreamParser($stream);
     $this->source = $stream->readByte();
     $this->namespace = $stream->readUInt32();
     $count = $stream->readUInt32();
     for ($i = 0; $i < $count; $i++) {
         $namespace = $stream->readUInt32();
         $attrid = $stream->readUInt32();
         $scope = $stream->readByte();
         $value = trim(strrev($stream->readBytes(4)));
         if (!isset($this->attributes[$scope])) {
             $this->attributes[$scope] = array();
         }
         $this->attributes[$scope][$attrid] = new Attribute($attrid, $namespace, $scope, $value);
     }
 }
Esempio n. 4
0
 public function __construct(BinaryStreamParser $parser)
 {
     $magic = $parser->readBytes(4);
     if ($magic !== 'IpaM') {
         throw new MapException('Invalid MapInfo magic header');
     }
     $this->version = $parser->readUInt32();
     if ($this->version >= 0x18) {
         $this->unknown1 = $parser->readUInt32();
         $this->unknown2 = $parser->readUInt32();
     }
     $this->width = $parser->readUInt32();
     $this->height = $parser->readUInt32();
     $this->smallPreviewType = $parser->readUInt32();
     if ($this->smallPreviewType == 2) {
         $this->smallPreviewPath = $parser->readCString();
     }
     $this->largePreviewType = $parser->readUInt32();
     if ($this->largePreviewType == 2) {
         $this->largePreviewPath = $parser->readCString();
     }
     if ($this->version >= 0x1f) {
         $this->unknown3 = $parser->readCString();
     }
     if ($this->version >= 0x26) {
         $this->unknown4 = $parser->readCString();
     }
     if ($this->version >= 0x1f) {
         $this->unknown5 = $parser->readUInt32();
     }
     $this->unknown6 = $parser->readUInt32();
     $this->fogType = $parser->readCString();
     $this->tileSet = $parser->readCString();
     $this->cameraLeft = $parser->readUInt32();
     $this->cameraBottom = $parser->readUInt32();
     $this->cameraRight = $parser->readUInt32();
     $this->cameraTop = $parser->readUInt32();
     $this->baseHeight = $parser->readUInt32() / 4096;
     // -------------------------------------------------------------------------------------------------------------
     $this->loadScreenType = $parser->readUInt32();
     $this->loadScreenPath = $parser->readCString();
     $this->unknown7 = $parser->readBytes($parser->readUInt16());
     $this->loadScreenScaling = $parser->readUInt32();
     $this->textPosition = $parser->readUInt32();
     $this->textPositionOffsetX = $parser->readUInt32();
     $this->textPositionOffsetY = $parser->readUInt32();
     $this->textPositionSizeX = $parser->readUInt32();
     $this->textPositionSizeY = $parser->readUInt32();
     $this->dataFlags = $parser->readUInt32();
     $this->unknown8 = $parser->readUInt32();
     if ($this->version >= 0x19) {
         $this->unknown9 = $parser->readBytes(8);
     }
     if ($this->version >= 0x1f) {
         $this->unknown10 = $parser->readBytes(9);
     }
     if ($this->version >= 0x20) {
         $this->unknown11 = $parser->readBytes(4);
     }
     // there are more fields, but the implementation of them have been ommited
 }