Compare commits
1 Commits
v1.0.44-ma
...
v1.0.45-ma
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9c185d5577 |
@@ -130,17 +130,17 @@ namespace Torch.Server.Views
|
|||||||
//blocking
|
//blocking
|
||||||
editor.Edit<string>(idList, "Mods");
|
editor.Edit<string>(idList, "Mods");
|
||||||
|
|
||||||
modList.RemoveAll(m =>
|
modList.Clear();
|
||||||
{
|
|
||||||
var mod = m.ToString();
|
|
||||||
return idList.Any(mod.Equals);
|
|
||||||
});
|
|
||||||
modList.AddRange(idList.Select(id =>
|
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));
|
tasks.Add(Task.Run(info.UpdateModInfoAsync));
|
||||||
return info;
|
return info;
|
||||||
}));
|
}).Where(b => b is not null));
|
||||||
|
|
||||||
_instanceManager.DedicatedConfig.Mods.Clear();
|
_instanceManager.DedicatedConfig.Mods.Clear();
|
||||||
foreach (var mod in modList)
|
foreach (var mod in modList)
|
||||||
_instanceManager.DedicatedConfig.Mods.Add(mod);
|
_instanceManager.DedicatedConfig.Mods.Add(mod);
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Sandbox.Engine.Networking;
|
using Sandbox.Engine.Networking;
|
||||||
using Torch.API;
|
using Torch.API;
|
||||||
@@ -19,6 +20,43 @@ namespace Torch.Utils
|
|||||||
return new MyObjectBuilder_Checkpoint.ModItem(ulong.Parse(arr[0]), arr[1]);
|
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!
|
//because KEEEN!
|
||||||
public static string GetDefaultServiceName()
|
public static string GetDefaultServiceName()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user