Compare commits
2 Commits
v1.0.44-ma
...
v1.0.46-ma
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cf5c00ce0e | ||
![]() |
9c185d5577 |
@@ -29,12 +29,7 @@ namespace Torch.Server
|
||||
private const string STEAMCMD_DIR = "steamcmd";
|
||||
private const string STEAMCMD_ZIP = "temp.zip";
|
||||
private static readonly string STEAMCMD_EXE = "steamcmd.exe";
|
||||
private static readonly string RUNSCRIPT_FILE = "runscript.txt";
|
||||
|
||||
private const string RUNSCRIPT = @"force_install_dir ../
|
||||
login anonymous
|
||||
app_update 298740
|
||||
quit";
|
||||
private const string STEAMCMD_ARGS = "+force_install_dir \"{0}\" +login anonymous +app_update 298740 +quit";
|
||||
private TorchServer _server;
|
||||
|
||||
internal Persistent<TorchConfig> ConfigPersistent { get; }
|
||||
@@ -140,10 +135,6 @@ quit";
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
|
||||
var runScriptPath = Path.Combine(path, RUNSCRIPT_FILE);
|
||||
if (!File.Exists(runScriptPath))
|
||||
File.WriteAllText(runScriptPath, RUNSCRIPT);
|
||||
|
||||
var steamCmdExePath = Path.Combine(path, STEAMCMD_EXE);
|
||||
if (!File.Exists(steamCmdExePath))
|
||||
{
|
||||
@@ -166,8 +157,9 @@ quit";
|
||||
}
|
||||
|
||||
log.Info("Checking for DS updates.");
|
||||
var steamCmdProc = new ProcessStartInfo(steamCmdExePath, "+runscript runscript.txt")
|
||||
var steamCmdProc = new ProcessStartInfo(steamCmdExePath)
|
||||
{
|
||||
Arguments = string.Format(STEAMCMD_ARGS, Environment.GetEnvironmentVariable("TORCH_GAME_PATH") ?? "../"),
|
||||
WorkingDirectory = path,
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
|
@@ -130,17 +130,17 @@ namespace Torch.Server.Views
|
||||
//blocking
|
||||
editor.Edit<string>(idList, "Mods");
|
||||
|
||||
modList.RemoveAll(m =>
|
||||
{
|
||||
var mod = m.ToString();
|
||||
return idList.Any(mod.Equals);
|
||||
});
|
||||
modList.Clear();
|
||||
modList.AddRange(idList.Select(id =>
|
||||
{
|
||||
var info = new ModItemInfo(ModItemUtils.Create(id));
|
||||
if (!ModItemUtils.TryParse(id, out var item))
|
||||
return null;
|
||||
|
||||
var info = new ModItemInfo(item);
|
||||
tasks.Add(Task.Run(info.UpdateModInfoAsync));
|
||||
return info;
|
||||
}));
|
||||
}).Where(b => b is not null));
|
||||
|
||||
_instanceManager.DedicatedConfig.Mods.Clear();
|
||||
foreach (var mod in modList)
|
||||
_instanceManager.DedicatedConfig.Mods.Add(mod);
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Sandbox.Engine.Networking;
|
||||
using Torch.API;
|
||||
@@ -19,6 +20,43 @@ namespace Torch.Utils
|
||||
return new MyObjectBuilder_Checkpoint.ModItem(ulong.Parse(arr[0]), arr[1]);
|
||||
}
|
||||
|
||||
public static bool TryParse(string str, out MyObjectBuilder_Checkpoint.ModItem item)
|
||||
{
|
||||
item = default;
|
||||
|
||||
var arr = str.Split('-');
|
||||
|
||||
if (arr.Length is 0 or > 2)
|
||||
return false;
|
||||
|
||||
if (!ulong.TryParse(arr[0], out var id))
|
||||
return false;
|
||||
|
||||
if (arr.Length == 1 || !TryParseServiceName(arr[1], out var serviceName))
|
||||
serviceName = GetDefaultServiceName();
|
||||
|
||||
item = new(id, serviceName);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TryParseServiceName(string str, out string serviceName)
|
||||
{
|
||||
if (str.Equals("steam", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
serviceName = "Steam";
|
||||
return true;
|
||||
}
|
||||
if (str.Equals("mod.io", StringComparison.OrdinalIgnoreCase) ||
|
||||
str.Equals("eos", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
serviceName = "mod.io";
|
||||
return true;
|
||||
}
|
||||
|
||||
serviceName = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
//because KEEEN!
|
||||
public static string GetDefaultServiceName()
|
||||
{
|
||||
|
Reference in New Issue
Block a user