コード例 #1
0
 private static function GetFolders($Version)
 {
     $NewVersionPath = LauncherAPI::$VersionsPath . $Version;
     $VersionFolder = 'FreedomNet.' . LauncherAPI::VersionToString($Version);
     if (is_dir($NewVersionPath)) {
         $Iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($NewVersionPath), RecursiveIteratorIterator::SELF_FIRST);
         $Folders = [];
         foreach ($Iterator as $File) {
             if ($File->isDir()) {
                 $Folders[] = $File->getRealpath();
             }
         }
         $Folders = Text::UniqueSingle($Folders);
         if (Text::ASearch($Folders, substr(LauncherAPI::$VersionsPath, 0, -1)) != false) {
             unset($Folders[Text::ASearch($Folders, substr(LauncherAPI::$VersionsPath, 0, -1))]);
         }
         if ($Folders[0] == $NewVersionPath) {
             unset($Folders[0]);
         }
         $FinalList = [];
         foreach ($Folders as $Folder) {
             $InVersionFolder = str_replace($NewVersionPath, '', $Folder);
             $FinalList[] = $VersionFolder . $InVersionFolder;
         }
         return $FinalList;
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: api.php プロジェクト: anonymous33rus/FreedomCore
         break;
     case 'checkupdate-build':
         if (!Text::IsRequestSet($_REQUEST, ['last_build'])) {
             API::GenerateResponse(1404, true);
         } else {
             $UpdateStatus = LauncherAPI::CheckForUpdateByBuild($_REQUEST['last_build'], true);
             if (!$UpdateStatus) {
                 echo Text::SimpleJson(1200, 'status', 'No Update Needed');
             } else {
                 echo Text::SimpleJson(1201, 'status', $UpdateStatus);
             }
         }
         break;
     case 'downloadupdatelist':
         if (Text::IsRequestSet($_REQUEST, ['assembly_version', 'updating_to'])) {
             if (LauncherAPI::VersionToString($_REQUEST['updating_to']) < LauncherAPI::VersionToString($_REQUEST['assembly_version'])) {
                 echo Text::SimpleJson(1403, 'status', 'Can\'t upgrade to lower version');
             } else {
                 $Build = LauncherAPI::BuildUpdateList($_REQUEST['updating_to']);
                 if (!$Build) {
                     echo Text::SimpleJson(1500, 'status', 'Specified Update Version does not exists');
                 } else {
                     Text::toJson(LauncherAPI::BuildUpdateList($_REQUEST['updating_to']), ['JSON_UNESCAPED_UNICODE']);
                 }
             }
         } else {
             echo "Not Set!";
         }
         break;
 }
 break;