コード例 #1
0
ファイル: TIVarFile.php プロジェクト: adriweb/tivars_lib
 /**
  *  Updates the length fields in both the header and the var entry, as well as the checksum
  */
 private function refreshMetadataFields()
 {
     // todo : recompute correctly for multiple var entries
     $this->varEntry['data_length2'] = $this->varEntry['data_length'] = count($this->varEntry['data']);
     $this->header['entries_len'] = $this->varEntry['data_length'] + ($this->calcModel->getFlags() >= TIFeatureFlags::hasFlash) ? self::varEntryNewLength : self::varEntryOldLength;
     $this->computedChecksum = $this->computeChecksumFromInstanceData();
 }
コード例 #2
0
ファイル: TIVarFile.php プロジェクト: adriweb/ticonverter
 private function makeVarEntryFromFile()
 {
     $calcFlags = $this->calcModel->getFlags();
     $dataSectionOffset = 8 + 3 + 42 + 2;
     // after header
     fseek($this->file, $dataSectionOffset);
     $this->varEntry = [];
     $this->varEntry['constBytes'] = $this->get_raw_bytes(2);
     $this->varEntry['data_length'] = $this->get_raw_bytes(1)[0] + ($this->get_raw_bytes(1)[0] << 8);
     $this->varEntry['typeID'] = $this->get_raw_bytes(1)[0];
     $this->varEntry['varname'] = $this->get_string_bytes(8);
     $this->varEntry['version'] = $calcFlags >= TIFeatureFlags::hasFlash ? $this->get_raw_bytes(1)[0] : null;
     $this->varEntry['archivedFlag'] = $calcFlags >= TIFeatureFlags::hasFlash ? $this->get_raw_bytes(1)[0] : null;
     $this->varEntry['data_length2'] = $this->get_raw_bytes(1)[0] + ($this->get_raw_bytes(1)[0] << 8);
     $this->varEntry['data'] = $this->get_raw_bytes($this->varEntry['data_length']);
 }