Пример #1
0
 public function parseReplay()
 {
     if (!$this->init) {
         if ($this->debug) {
             $this->debug("Tried to use parseReplay without initializing");
         }
         return false;
     }
     if (class_exists("SC2Replay") || (include 'sc2replay.php')) {
         $tmp = new SC2Replay();
         if ($this->debug) {
             $tmp->setDebug($this->debug);
         }
         $tmp->parseReplay($this);
         return $tmp;
     } else {
         if ($this->debug) {
             $this->debug("Unable to find or load class SC2Replay");
         }
         return false;
     }
 }
Пример #2
0
 $debug = 0;
 if ($_POST['debug'] == 1 || $_POST['test'] == 1) {
     echo sprintf("<b>Debugging is on.</b><br />\n");
     $debug = 2;
 }
 $a = new MPQFile($tmpname, true, $debug);
 $init = $a->getState();
 if (isset($_POST['test']) && $_POST['test'] == 1) {
     if (class_exists("SC2Replay") || (include 'sc2replay.php')) {
         //$bool = $a->insertChatLogMessage("testing testing", "testguy", 1);
         //$bool = $a->insertChatLogMessage("testing 2", 1, 5);
         //$a->saveAs("testfile.SC2Replay", true);
         //$a = new MPQFile("testfile.SC2Replay", true, 2);
         $byte = 0;
         $b = new SC2Replay($a);
         $b->setDebug(true);
         $tmp = $b->parseDetailsValue($a->readFile("replay.details"), $byte);
         echo "<pre>";
         var_dump($tmp);
         echo "</pre>";
         die;
     }
 }
 if ($init == false) {
     echo "Error parsing uploaded file, make sure it is a valid MPQ archive!<br />\n";
 } else {
     if ($a->getFileType() == "SC2replay") {
         echo sprintf("Version: %s<br />\n", $a->getVersionString());
         $b = $a->parseReplay();
         $parseDurationString .= sprintf("Parsed replay in %d ms.<br />\n", (microtime_float() - $start) * 1000);
         $players = $b->getPlayers();