コード例 #1
0
ファイル: ITSP.php プロジェクト: mlocati/chm-lib
 /**
  * Initialize the instance.
  *
  * @param Reader $reader The reader that provides the data.
  *
  * @throws UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid.
  * @throws Exception Throws an Exception in case of errors.
  */
 public function __construct(Reader $reader)
 {
     parent::__construct($reader);
     if ($this->headerSignature !== 'ITSP') {
         throw UnexpectedHeaderException::create('ITSP', $this->headerSignature);
     }
     if ($this->headerVersion !== 1) {
         throw new Exception('Unsupported ITSP version number: ' . $this->headerVersion);
     }
     /* Unknown (10) */
     $reader->readUInt32();
     $this->directoryChunkSize = $reader->readUInt32();
     $this->quickRefDensity = $reader->readUInt32();
     $this->indexDepth = $reader->readUInt32();
     $this->rootIndexChunkNumber = $reader->readInt32();
     $this->firstPMGLChunkNumber = $reader->readUInt32();
     $this->lastPMGLChunkNumber = $reader->readUInt32();
     /* Unknown (-1) */
     $reader->readInt32();
     $this->numberOfDirectoryChunks = $reader->readUInt32();
     $this->generatorLanguage = new Language($reader->readUInt32());
     $this->systemGUID = $reader->readGUID();
     /* Again the size of this header (84) */
     $reader->readUInt32();
     /* Unknown (-1) */
     $reader->readInt32();
     /* Unknown (-1) */
     $reader->readInt32();
     /* Unknown (-1) */
     $reader->readInt32();
 }
コード例 #2
0
ファイル: ITSF.php プロジェクト: mlocati/chm-lib
 /**
  * Initialize the instance.
  *
  * @param Reader $reader The reader that provides the data.
  *
  * @throws UnexpectedHeaderException Throws an UnexpectedHeaderException if the header signature is not valid.
  * @throws Exception Throws an Exception in case of errors.
  */
 public function __construct(Reader $reader)
 {
     parent::__construct($reader);
     if ($this->headerSignature !== 'ITSF') {
         throw UnexpectedHeaderException::create('ITSF', $this->headerSignature);
     }
     if ($this->headerVersion < 2 || $this->headerVersion > 3) {
         throw new Exception('Unsupported ITSF version number: ' . $this->headerVersion);
     }
     /* Unknown (1) */
     $reader->readUInt32();
     $this->timestamp = $reader->readUInt32();
     $this->originalOSLanguage = new Language($reader->readUInt32());
     $this->directoryGUID = $reader->readGUID();
     $this->streamGUID = $reader->readGUID();
     $this->sectionOffset = $reader->readUInt64();
     $this->sectionLength = $reader->readUInt64();
     $this->directoryOffset = $reader->readUInt64();
     $this->directoryLength = $reader->readUInt64();
     if ($this->headerLength >= 96) {
         $this->contentOffset = $reader->readUInt64();
     } else {
         $this->contentOffset = $this->directoryOffset + $this->directoryLength;
     }
 }