Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a426ad9e02 | ||
![]() |
ba75b1583a | ||
![]() |
45068ea932 |
@@ -30,7 +30,8 @@ namespace Torch.Server
|
||||
private const string TOOL_DIR = "tool";
|
||||
private const string TOOL_ZIP = "temp.zip";
|
||||
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;
|
||||
|
||||
internal Persistent<TorchConfig> ConfigPersistent { get; }
|
||||
@@ -102,8 +103,19 @@ namespace Torch.Server
|
||||
}
|
||||
#endif
|
||||
|
||||
var gameThread = new Thread(() =>
|
||||
var uiThread = new Thread(() =>
|
||||
{
|
||||
var ui = new TorchUI(_server);
|
||||
|
||||
SynchronizationContext.SetSynchronizationContext(
|
||||
new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
|
||||
|
||||
ui.ShowDialog();
|
||||
});
|
||||
|
||||
uiThread.SetApartmentState(ApartmentState.STA);
|
||||
uiThread.Start();
|
||||
|
||||
_server.Init();
|
||||
|
||||
if (Config.Autostart || Config.TempAutostart)
|
||||
@@ -111,16 +123,6 @@ namespace Torch.Server
|
||||
Config.TempAutostart = false;
|
||||
_server.Start();
|
||||
}
|
||||
});
|
||||
|
||||
gameThread.Start();
|
||||
|
||||
var ui = new TorchUI(_server);
|
||||
|
||||
SynchronizationContext.SetSynchronizationContext(
|
||||
new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
|
||||
|
||||
ui.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,9 +161,16 @@ namespace Torch.Server
|
||||
}
|
||||
|
||||
log.Info("Checking for DS updates.");
|
||||
foreach (var depot in Depots)
|
||||
{
|
||||
await DownloadDepot(depot);
|
||||
}
|
||||
|
||||
async Task DownloadDepot(int depotId)
|
||||
{
|
||||
var steamCmdProc = new ProcessStartInfo(steamCmdExePath)
|
||||
{
|
||||
Arguments = string.Format(TOOL_ARGS, configuration.GetValue("gamePath", "../")),
|
||||
Arguments = string.Format(TOOL_ARGS, configuration.GetValue("gamePath", "../"), depotId),
|
||||
WorkingDirectory = path,
|
||||
RedirectStandardOutput = true
|
||||
};
|
||||
@@ -175,3 +184,4 @@ namespace Torch.Server
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace Torch.Server
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
[STAThread]
|
||||
[MTAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var configurationBuilder = new ConfigurationBuilder()
|
||||
|
@@ -47,7 +47,7 @@ namespace Torch.Utils
|
||||
|
||||
private static void CopyNative()
|
||||
{
|
||||
if (ApplicationContext.Current.GameFilesDirectory.Attributes.HasFlag(FileAttributes.ReadOnly))
|
||||
if (ApplicationContext.Current.IsService || ApplicationContext.Current.GameFilesDirectory.Attributes.HasFlag(FileAttributes.ReadOnly))
|
||||
{
|
||||
Log.Warn("Torch directory is readonly. You should copy steam_api64.dll, Havok.dll from bin manually");
|
||||
return;
|
||||
|
Reference in New Issue
Block a user