Пример #1
0
 /**
  * Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
  * server.
  *
  * @throws Update\Exception
  * @return void
  */
 public function syn()
 {
     if (!isset($this->options["host"]) || empty($this->options["host"])) {
         $this->options["host"] = $this->default_host;
     }
     if (!isset($this->options["port"]) || empty($this->options["port"])) {
         $this->options["port"] = $this->default_port;
     }
     $this->initTransport($this->options, '\\ManiaLivePlugins\\Standard\\TeamSpeak\\TeamSpeak3\\Transport\\UDP');
     $this->transport->setAdapter($this);
     \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Profiler::init(spl_object_hash($this));
     $this->getTransport()->send(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String::fromHex(32));
     if (!preg_match_all("/,?(\\d+),?/", $this->getTransport()->read(32), $matches) || !isset($matches[1])) {
         throw new Update\Exception("invalid reply from the server");
     }
     $this->build_numbers = $matches[1];
     \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit("updateConnected", $this);
 }
Пример #2
0
 /**
  * Deploys snapshot data on the selected virtual server. If no virtual server is selected (ID 0),
  * the data will be used to create a new virtual server from scratch.
  *
  * @param  string $data
  * @param  string $mode
  * @return void
  */
 public function snapshotDeploy($data, $mode = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SNAPSHOT_STRING)
 {
     switch ($mode) {
         case \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SNAPSHOT_BASE64:
             $data = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String::fromBase64($data);
             break;
         case \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SNAPSHOT_HEXDEC:
             $data = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String::fromHex($data);
             break;
         default:
             $data = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String::factory($data);
             break;
     }
     $this->request("serversnapshotdeploy " . $data);
 }