コード例 #1
0
function SetupUnpacked($nameOfProgram)
{
    global $dirMyPrograms, $nl;
    $curDir = $dirMyPrograms . '/' . $nameOfProgram;
    if (($programConfig = ParseConfig($curDir)) == false) {
        return false;
    }
    if (($programName = getProgramName($nameOfProgram)) == false) {
        return false;
    }
    if (generateZzzBat($curDir, $programName, $programConfig) == false) {
        return false;
    }
    if (generateDosBoxConf($curDir) == false) {
        return false;
    }
    if (generateStartGameBat($curDir) == false) {
        return false;
    }
}
コード例 #2
0
<?php

require_once dirname(__FILE__) . '/Config.php';
$dh = dir($dirMyDownloads);
if (!$dh) {
    echo 'Can not read directory: ' . $dirMyDownloads;
    exit(1);
}
$unzipExe = $rootDir . '/tools/unzip.exe';
$unzipOptions = '-o -qq';
while ($file = $dh->read()) {
    if ($file == '.' || $file == '..' || is_dir($dirMyDownloads . '/' . $file)) {
        continue;
    }
    if (($nameOfProgram = getProgramName($file)) == false) {
        continue;
    }
    if (!preg_match('/^(.*)\\.zip$/', $file, $result)) {
        continue;
    }
    $nameOfDirectory = $result[1];
    if (is_dir($dirMyPrograms . '/' . $nameOfDirectory)) {
        echo 'Program exist: ' . $nameOfProgram . "\n";
        continue;
    }
    echo 'Try installing: ' . $nameOfProgram . $nl;
    $commandline = $unzipExe . ' ' . $unzipOptions . ' "' . str_replace('/', '\\', $dirMyDownloads . '/' . $file . '"');
    $commandlineReturn = '';
    system($commandline, &$commandlineReturn);
    if ($commandlineReturn !== 0 || !is_dir($rootDir . '/Scripts/' . $nameOfDirectory)) {
        echo 'Error while unpack: ' . $nameOfProgram . "\n";