Compare commits

...

2 Commits
2.0.3 ... 2.0.5

Author SHA1 Message Date
zznty
b0f491ac88 do not exit without autostart 2023-04-25 16:32:52 +07:00
zznty
a426ad9e02 fix steam redist missing on automatic download 2023-04-22 21:22:46 +07:00

View File

@@ -30,7 +30,8 @@ namespace Torch.Server
private const string TOOL_DIR = "tool"; private const string TOOL_DIR = "tool";
private const string TOOL_ZIP = "temp.zip"; private const string TOOL_ZIP = "temp.zip";
private static readonly string TOOL_EXE = "DepotDownloader.exe"; private static readonly string TOOL_EXE = "DepotDownloader.exe";
private const string TOOL_ARGS = "-app 298740 -depot 298741 -dir \"{0}\""; private const string TOOL_ARGS = "-app 298740 -depot {1} -dir \"{0}\"";
private static readonly int[] Depots = { 298741, 1004 };
private TorchServer _server; private TorchServer _server;
internal Persistent<TorchConfig> ConfigPersistent { get; } internal Persistent<TorchConfig> ConfigPersistent { get; }
@@ -122,6 +123,8 @@ namespace Torch.Server
Config.TempAutostart = false; Config.TempAutostart = false;
_server.Start(); _server.Start();
} }
uiThread.Join();
} }
} }
@@ -160,18 +163,26 @@ namespace Torch.Server
} }
log.Info("Checking for DS updates."); log.Info("Checking for DS updates.");
var steamCmdProc = new ProcessStartInfo(steamCmdExePath) foreach (var depot in Depots)
{ {
Arguments = string.Format(TOOL_ARGS, configuration.GetValue("gamePath", "../")), await DownloadDepot(depot);
WorkingDirectory = path, }
RedirectStandardOutput = true
}; async Task DownloadDepot(int depotId)
var cmd = Process.Start(steamCmdProc)!; {
var steamCmdProc = new ProcessStartInfo(steamCmdExePath)
{
Arguments = string.Format(TOOL_ARGS, configuration.GetValue("gamePath", "../"), depotId),
WorkingDirectory = path,
RedirectStandardOutput = true
};
var cmd = Process.Start(steamCmdProc)!;
while (!cmd.HasExited) while (!cmd.HasExited)
{ {
if (await cmd.StandardOutput.ReadLineAsync() is { } line) if (await cmd.StandardOutput.ReadLineAsync() is { } line)
log.Info(line); log.Info(line);
}
} }
} }
} }