Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1.     public function parse()
  2.     {
  3.         $this->data->version = $this->readLong();
  4.         if ($this->data->version == 0 || $this->data->version == 1) {
  5.             $this->data->subVersion = $this->data->version;
  6.         } else {
  7.             $this->data->subVersion = $this->readLong();
  8.         }
  9.  
  10.         if ($this->data->subVersion == 1) {
  11.             $this->data->mainCustomCodeComment = $this->readString();
  12.             $this->data->mainCustomCode = $this->readTriggerStruct();
  13.         } elseif ($this->data->subVersion == 0) {
  14.             $this->data->mainCustomCodeComment = '';
  15.             $this->data->mainCustomCode = '';
  16.         } else {
  17.             throw new \Exception("Unexpected version value of '{$this->data->version}'");
  18.         }
  19.  
  20.         if ($this->data->version <= 1) {
  21.             $this->skip(4);
  22.         }
  23.  
  24.         $this->data->customTriggers = [];
  25.         while (!$this->endOfFile()) {
  26.             $this->data->customTriggers[] = $this->readTriggerStruct();
  27.         }
  28.     }
  29.  
  30.     public function readTriggerStruct()
  31.     {
  32.         $length = $this->readLong();
  33.         if ($length == 0) {
  34.             return null;
  35.         }
  36.  
  37.         return $this->readString();
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement