Beispiel #1
0
 /**
  * Initializes the instance.
  *
  * @param CHM $chm The parent CHM file.
  */
 public function __construct(CHM $chm)
 {
     $reader = $chm->getReader();
     $this->chm = $chm;
     $stringLength = $reader->readCompressedUInt32();
     $this->path = $reader->readString($stringLength);
     $this->contentSectionIndex = $reader->readCompressedUInt32();
     $this->offset = $reader->readCompressedUInt32();
     $this->length = $reader->readCompressedUInt32();
     $pathLength = strlen($this->path);
     if (substr($this->path, -1) === '/') {
         $this->type = static::TYPE_DIRECTORY;
     } elseif ($this->path[0] === '/') {
         if ($pathLength > 1 && ($this->path[1] === '#' || $this->path[1] === '$')) {
             $this->type = static::TYPE_SPECIAL_FILE;
         } else {
             $this->type = static::TYPE_FILE;
         }
     } else {
         $this->type = static::TYPE_METADATA;
     }
     $this->cachedContents = null;
 }