diff --git a/NLog-user.config b/NLog-user.config deleted file mode 100644 index 9b10655..0000000 --- a/NLog-user.config +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NLog.config b/NLog.config index 350ac1f..deab41a 100644 --- a/NLog.config +++ b/NLog.config @@ -3,8 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - diff --git a/Torch.API/ModAPI/TorchAPI.cs b/Torch.API/ModAPI/TorchAPI.cs index 60560c8..40a2822 100644 --- a/Torch.API/ModAPI/TorchAPI.cs +++ b/Torch.API/ModAPI/TorchAPI.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices.WindowsRuntime; using System.Text; using System.Threading.Tasks; diff --git a/Torch.API/Torch.API.csproj b/Torch.API/Torch.API.csproj index 290f645..d8cf975 100644 --- a/Torch.API/Torch.API.csproj +++ b/Torch.API/Torch.API.csproj @@ -1,205 +1,106 @@ - - - + - {FBA5D932-6254-4A1E-BAF4-E229FA94E3C2} - Library - Properties - Torch.API - Torch.API - v4.6.1 - 512 - - - - 7.3 - - - true - $(SolutionDir)\bin\x64\Debug\ - DEBUG;TRACE - full + net6-windows + Torch API + Torch + Copyright © Torch API 2017 + false + $(SolutionDir)\bin\$(Platform)\$(Configuration)\ + True + False x64 - prompt - MinimumRecommendedRules.ruleset + Debug;Release + AnyCPU - - $(SolutionDir)\bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - $(SolutionDir)\bin\x64\Release\Torch.API.xml + + $(SolutionDir)\bin\$(Platform)\$(Configuration)\Torch.API.xml 1591 + - - + + - False ..\GameBinaries\HavokWrapper.dll False - - - ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll - True - - - ..\packages\NLog.4.4.12\lib\net45\NLog.dll - True - - - - False + + ..\GameBinaries\Sandbox.Common.dll False + False - False ..\GameBinaries\Sandbox.Game.dll False + False - False ..\GameBinaries\Sandbox.Graphics.dll False + False - False ..\GameBinaries\SpaceEngineers.Game.dll False + False - False ..\GameBinaries\SpaceEngineers.ObjectBuilders.dll False - - False - ..\GameBinaries\SpaceEngineers.ObjectBuilders.XmlSerializers.dll - False - - - - - - - - - - - - - ..\GameBinaries\VRage.dll False - False ..\GameBinaries\VRage.Audio.dll False + False ..\GameBinaries\VRage.Dedicated.dll False - False ..\GameBinaries\VRage.Game.dll False - - False - ..\GameBinaries\VRage.Game.XmlSerializers.dll - False - False ..\GameBinaries\VRage.Input.dll False + False ..\GameBinaries\VRage.Library.dll False - False ..\GameBinaries\VRage.Math.dll False + False - False ..\GameBinaries\VRage.Render.dll False + False - False ..\GameBinaries\VRage.Render11.dll False + False - False ..\GameBinaries\VRage.Scripting.dll False + False - - Properties\AssemblyVersion.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - + \ No newline at end of file diff --git a/Torch.API/WebAPI/PluginQuery.cs b/Torch.API/WebAPI/PluginQuery.cs index 60af524..3143f36 100644 --- a/Torch.API/WebAPI/PluginQuery.cs +++ b/Torch.API/WebAPI/PluginQuery.cs @@ -1,82 +1,45 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Http; -using System.Text; +using System.Net.Http.Json; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; using System.Threading.Tasks; -using Newtonsoft.Json; using NLog; namespace Torch.API.WebAPI { public class PluginQuery { - private const string ALL_QUERY = "https://torchapi.com/api/plugins"; - private const string PLUGIN_QUERY = "https://torchapi.com/api/plugins/item/{0}"; + private const string ALL_QUERY = "https://torchapi.com/api/plugins/"; + private const string PLUGIN_QUERY = "https://torchapi.com/api/plugins/item/{0}/"; private readonly HttpClient _client; private static readonly Logger Log = LogManager.GetCurrentClassLogger(); private static PluginQuery _instance; - public static PluginQuery Instance => _instance ?? (_instance = new PluginQuery()); + public static PluginQuery Instance => _instance ??= new(); private PluginQuery() { - _client = new HttpClient(); + _client = new(); } - public async Task QueryAll() + public async Task QueryAll() { - var h = await _client.GetAsync(ALL_QUERY); - if (!h.IsSuccessStatusCode) - { - Log.Error($"Plugin query returned response {h.StatusCode}"); - return null; - } - - var r = await h.Content.ReadAsStringAsync(); - - PluginResponse response; - try - { - response = JsonConvert.DeserializeObject(r); - } - catch (Exception ex) - { - Log.Error(ex, "Failed to deserialize plugin query response!"); - return null; - } - return response; + return (PluginsResponse) await _client.GetFromJsonAsync(ALL_QUERY, typeof(PluginsResponse), CancellationToken.None); } - public async Task QueryOne(Guid guid) + public Task QueryOne(Guid guid) { - return await QueryOne(guid.ToString()); + return QueryOne(guid.ToString()); } - public async Task QueryOne(string guid) + public async Task QueryOne(string guid) { - - var h = await _client.GetAsync(string.Format(PLUGIN_QUERY, guid)); - if (!h.IsSuccessStatusCode) - { - Log.Error($"Plugin query returned response {h.StatusCode}"); - return null; - } - - var r = await h.Content.ReadAsStringAsync(); - - PluginFullItem response; - try - { - response = JsonConvert.DeserializeObject(r); - } - catch (Exception ex) - { - Log.Error(ex, "Failed to deserialize plugin query response!"); - return null; - } - return response; + return (PluginItem) await _client.GetFromJsonAsync(string.Format(PLUGIN_QUERY, guid), typeof(PluginItem), + CancellationToken.None); } public async Task DownloadPlugin(Guid guid, string path = null) @@ -91,39 +54,31 @@ namespace Torch.API.WebAPI return await DownloadPlugin(item, path); } - public async Task DownloadPlugin(PluginFullItem item, string path = null) + public async Task DownloadPlugin(PluginItem item, string path = null) { try { - path = path ?? $"Plugins\\{item.Name}.zip"; - string relpath = Path.GetDirectoryName(path); + path ??= Path.Combine(Directory.GetCurrentDirectory(), "Plugins", $"{item.Name}.zip"); - Directory.CreateDirectory(relpath); - - var h = await _client.GetAsync(string.Format(PLUGIN_QUERY, item.ID)); - string res = await h.Content.ReadAsStringAsync(); - var response = JsonConvert.DeserializeObject(res); + var response = await QueryOne(item.Id); if (response.Versions.Length == 0) { Log.Error($"Selected plugin {item.Name} does not have any versions to download!"); return false; } var version = response.Versions.FirstOrDefault(v => v.Version == response.LatestVersion); - if (version == null) + if (version is null) { Log.Error($"Could not find latest version for selected plugin {item.Name}"); return false; } - var s = await _client.GetStreamAsync(version.URL); + var s = await _client.GetStreamAsync(version.Url); if(File.Exists(path)) File.Delete(path); - using (var f = File.Create(path)) - { - await s.CopyToAsync(f); - await f.FlushAsync(); - } + await using var f = File.Create(path); + await s.CopyToAsync(f); } catch (Exception ex) { @@ -134,37 +89,15 @@ namespace Torch.API.WebAPI } } - public class PluginResponse + public record PluginsResponse(PluginItem[] Plugins); + + public record PluginItem(Guid Id, string Name, string Author, string Description, string LatestVersion, + VersionItem[] Versions) { - public PluginItem[] Plugins; - public int Count; + [JsonIgnore] + public bool Installed { get; set; } } - public class PluginItem - { - public string ID; - public string Name { get; set; } - public string Author; - public string Description; - public string LatestVersion; - public bool Installed { get; set; } = false; - - public override string ToString() - { - return Name; - } - } - - public class PluginFullItem : PluginItem - { - public VersionItem[] Versions; - } - - public class VersionItem - { - public string Version; - public string Note; - public bool IsBeta; - public string URL; - } + public record VersionItem(string Version, string Note, [property: JsonPropertyName("is_beta")] bool IsBeta, + string Url); } diff --git a/Torch.API/packages.config b/Torch.API/packages.config deleted file mode 100644 index fbd3f14..0000000 --- a/Torch.API/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Torch.Client.Tests/Torch.Client.Tests.csproj b/Torch.Client.Tests/Torch.Client.Tests.csproj index c1dc43a..cf64ce4 100644 --- a/Torch.Client.Tests/Torch.Client.Tests.csproj +++ b/Torch.Client.Tests/Torch.Client.Tests.csproj @@ -1,98 +1,51 @@ - - - + - {632E78C0-0DAC-4B71-B411-2F1B333CC310} - Library - Properties - Torch.Client.Tests - Torch.Client.Tests - v4.6.1 - 512 - - - + net461 1591,0649 + Torch Client Tests + Torch + Copyright © Torch API 2017 + false + MinimumRecommendedRules.ruleset + $(SolutionDir)\bin-test\$(Platform)\$(Configuration)\ - true - $(SolutionDir)\bin-test\x64\Debug\ - DEBUG;TRACE full - x64 - prompt - MinimumRecommendedRules.ruleset - $(SolutionDir)\bin-test\x64\Release\ - TRACE - true pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - $(SolutionDir)\bin-test\x64\Release\Torch.Client.Tests.xml + $(SolutionDir)\bin-test\$(Platform)\$(Configuration)\Torch.Client.Tests.xml + + + + + + + + + + + + all + + - - ..\packages\NLog.4.4.12\lib\net45\NLog.dll - True - - - - - - - - ..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - - - ..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - - - ..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - - - ..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - - - Properties\AssemblyVersion.cs - - - + - - {fba5d932-6254-4a1e-baf4-e229fa94e3c2} - Torch.API - - - {e36df745-260b-4956-a2e8-09f08b2e7161} - Torch.Client - - - {c3c8b671-6ad1-44aa-a8da-e0c0dc0fedf5} - Torch.Tests - - - {7e01635c-3b67-472e-bcd6-c5539564f214} - Torch - True - + + + + - - + + - - - - - - \ No newline at end of file diff --git a/Torch.Client.Tests/packages.config b/Torch.Client.Tests/packages.config deleted file mode 100644 index 30eb495..0000000 --- a/Torch.Client.Tests/packages.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/Torch.Client/Torch.Client.csproj b/Torch.Client/Torch.Client.csproj index 1ecb37a..3aac86a 100644 --- a/Torch.Client/Torch.Client.csproj +++ b/Torch.Client/Torch.Client.csproj @@ -1,81 +1,68 @@ - - - + - {E36DF745-260B-4956-A2E8-09F08B2E7161} WinExe - Properties - Torch.Client - Torch.Client - v4.6.1 - 512 + net461 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 true - - - + Torch Client + Torch + Copyright © Torch API 2017 + false + MinimumRecommendedRules.ruleset + $(SolutionDir)\bin\$(Platform)\$(Configuration)\ + true + true + copy "$(SolutionDir)NLog.config" "$(TargetDir)" + + copy "$(SolutionDir)NLog.config" "$(TargetDir)" + + copy "$(SolutionDir)NLog.config" "$(TargetDir)" + - true - $(SolutionDir)\bin\x64\Debug\ - DEBUG;TRACE full - x64 - prompt - MinimumRecommendedRules.ruleset - true - $(SolutionDir)\bin\x64\Release\ - TRACE - true pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - true - $(SolutionDir)\bin\x64\Release\Torch.Client.xml + $(SolutionDir)\bin\$(Platform)\$(Configuration)\Torch.Client.xml 1591 torchicon.ico + + copy "$(SolutionDir)NLog.config" "$(TargetDir)" + + + + + + + - - ..\packages\NLog.4.4.12\lib\net45\NLog.dll - True - - False ..\GameBinaries\Sandbox.Common.dll False + False ..\GameBinaries\Sandbox.Game.dll False - False ..\GameBinaries\Sandbox.Graphics.dll False + False ..\GameBinaries\SpaceEngineers.Game.dll False - - - - - - - 4.0 - + ..\GameBinaries\VRage.dll False @@ -89,18 +76,18 @@ False - False ..\GameBinaries\VRage.Input.dll False + False ..\GameBinaries\VRage.Library.dll False - False ..\GameBinaries\VRage.Math.dll False + False ..\GameBinaries\VRage.Render.dll @@ -119,65 +106,17 @@ - - Properties\AssemblyVersion.cs - - - - - - - - - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - + - - {fba5d932-6254-4a1e-baf4-e229fa94e3c2} - Torch.API - False - - - {7E01635C-3B67-472E-BCD6-C5539564F214} - Torch - False - + + - + + - - - - - copy "$(SolutionDir)NLog.config" "$(TargetDir)" - - \ No newline at end of file diff --git a/Torch.Client/packages.config b/Torch.Client/packages.config deleted file mode 100644 index 9d88a31..0000000 --- a/Torch.Client/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Torch.Mod/Torch.Mod.shproj b/Torch.Mod/Torch.Mod.shproj index bc7cbf1..68fbcbe 100644 --- a/Torch.Mod/Torch.Mod.shproj +++ b/Torch.Mod/Torch.Mod.shproj @@ -7,7 +7,6 @@ - diff --git a/Torch.Server.Tests/Torch.Server.Tests.csproj b/Torch.Server.Tests/Torch.Server.Tests.csproj index 3c02a7c..eb8f250 100644 --- a/Torch.Server.Tests/Torch.Server.Tests.csproj +++ b/Torch.Server.Tests/Torch.Server.Tests.csproj @@ -1,107 +1,39 @@ - - - + - {9EFD1D91-2FA2-47ED-B537-D8BC3B0E543E} - Library - Properties - Torch.Server.Tests - Torch.Server.Tests - v4.8 - 512 - - - + net6-windows 1591,0649 - - - true - $(SolutionDir)\bin-test\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt + Torch Server Tests + Torch + Copyright © Torch API 2017 + false MinimumRecommendedRules.ruleset - - - $(SolutionDir)\bin-test\x64\Release\ - TRACE - true - pdbonly + $(SolutionDir)\bin-test\$(Platform)\$(Configuration)\ x64 - prompt - MinimumRecommendedRules.ruleset - $(SolutionDir)\bin-test\x64\Release\Torch.Server.Tests.xml + Debug;Release + AnyCPU + + $(SolutionDir)\bin-test\$(Platform)\$(Configuration)\Torch.Server.Tests.xml + + - - + + + - - ..\packages\NLog.4.4.12\lib\net45\NLog.dll - True - - - - - - - - - - - False ..\GameBinaries\VRage.Game.dll - - - ..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - - - ..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - - - ..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - - - ..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll + False - - Properties\AssemblyVersion.cs - - - - + - - {fba5d932-6254-4a1e-baf4-e229fa94e3c2} - Torch.API - - - {ca50886b-7b22-4cd8-93a0-c06f38d4f77d} - Torch.Server - - - {c3c8b671-6ad1-44aa-a8da-e0c0dc0fedf5} - Torch.Tests - - - {7e01635c-3b67-472e-bcd6-c5539564f214} - Torch - True - + + + + - - - - - - - - - \ No newline at end of file diff --git a/Torch.Server.Tests/packages.config b/Torch.Server.Tests/packages.config deleted file mode 100644 index 30eb495..0000000 --- a/Torch.Server.Tests/packages.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/Torch.Server/FodyWeavers.xml b/Torch.Server/FodyWeavers.xml new file mode 100644 index 0000000..d5abfed --- /dev/null +++ b/Torch.Server/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Torch.Server/FodyWeavers.xsd b/Torch.Server/FodyWeavers.xsd new file mode 100644 index 0000000..69dbe48 --- /dev/null +++ b/Torch.Server/FodyWeavers.xsd @@ -0,0 +1,74 @@ + + + + + + + + + + + Used to control if the On_PropertyName_Changed feature is enabled. + + + + + Used to control if the Dependent properties feature is enabled. + + + + + Used to control if the IsChanged property feature is enabled. + + + + + Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form. + + + + + Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project. + + + + + Used to control if equality checks should use the Equals method resolved from the base class. + + + + + Used to control if equality checks should use the static Equals method resolved from the base class. + + + + + Used to turn off build warnings from this weaver. + + + + + Used to turn off build warnings about mismatched On_PropertyName_Changed methods. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/Torch.Server/Initializer.cs b/Torch.Server/Initializer.cs index c88e617..062b63c 100644 --- a/Torch.Server/Initializer.cs +++ b/Torch.Server/Initializer.cs @@ -229,37 +229,11 @@ quit"; } } - private void LogException(Exception ex) - { - if (ex is AggregateException ag) - { - foreach (var e in ag.InnerExceptions) - LogException(e); - - return; - } - - Log.Fatal(ex); - - if (ex is ReflectionTypeLoadException extl) - { - foreach (var exl in extl.LoaderExceptions) - LogException(exl); - - return; - } - - if (ex.InnerException != null) - { - LogException(ex.InnerException); - } - } - private void HandleException(object sender, UnhandledExceptionEventArgs e) { _server.FatalException = true; var ex = (Exception)e.ExceptionObject; - LogException(ex); + Log.Fatal(ex.ToStringDemystified()); if (MyFakes.ENABLE_MINIDUMP_SENDING) { string path = Path.Combine(MyFileSystem.UserDataPath, "Minidump.dmp"); @@ -274,7 +248,7 @@ quit"; Console.WriteLine("Restarting in 5 seconds."); Thread.Sleep(5000); var exe = typeof(Program).Assembly.Location; - Config.WaitForPID = Process.GetCurrentProcess().Id.ToString(); + Config.WaitForPID = Environment.ProcessId.ToString(); Process.Start(exe, Config.ToString()); } else @@ -282,7 +256,7 @@ quit"; MessageBox.Show("Torch encountered a fatal error and needs to close. Please check the logs for details."); } - Process.GetCurrentProcess().Kill(); + Environment.Exit(1); } } } diff --git a/Torch.Server/Managers/EntityControlManager.cs b/Torch.Server/Managers/EntityControlManager.cs index 65d1e8f..b121fdf 100644 --- a/Torch.Server/Managers/EntityControlManager.cs +++ b/Torch.Server/Managers/EntityControlManager.cs @@ -40,15 +40,7 @@ namespace Torch.Server.Managers protected abstract EntityControlViewModel Create(EntityViewModel evm); -#pragma warning disable 649 - [ReflectedGetter(Name = "Keys")] - private static readonly Func, ICollection> _weakTableKeys; -#pragma warning restore 649 - - /// - /// Warning: Creates a giant list, avoid if possible. - /// - internal ICollection Keys => _weakTableKeys(_models); + internal IEnumerable Keys => _models.Select(b => b.Key); internal EntityControlViewModel GetOrCreate(EntityViewModel evm) { diff --git a/Torch.Server/Managers/InstanceManager.cs b/Torch.Server/Managers/InstanceManager.cs index 706b81f..2fb87f8 100644 --- a/Torch.Server/Managers/InstanceManager.cs +++ b/Torch.Server/Managers/InstanceManager.cs @@ -319,9 +319,6 @@ namespace Torch.Server.Managers checkpoint.Mods = null; checkpoint.Settings = null; } - - OnPropertyChanged(nameof(Checkpoint)); - OnPropertyChanged(nameof(WorldConfiguration)); } } } diff --git a/Torch.Server/Patches/CheckpointLoadPatch.cs b/Torch.Server/Patches/CheckpointLoadPatch.cs new file mode 100644 index 0000000..e4f0ef5 --- /dev/null +++ b/Torch.Server/Patches/CheckpointLoadPatch.cs @@ -0,0 +1,39 @@ +using System.Reflection; +using NLog; +using Sandbox.Engine.Networking; +using Torch.API.Managers; +using Torch.Managers.PatchManager; +using Torch.Server.Managers; +using Torch.Utils; +using VRage.Game; + +namespace Torch.Patches; + +[PatchShim] +public static class CheckpointLoadPatch +{ + private static readonly ILogger Log = LogManager.GetCurrentClassLogger(); + + [ReflectedMethodInfo(typeof(MyLocalCache), "LoadCheckpoint")] + private static MethodInfo LoadCheckpointMethod = null!; + + public static void Patch(PatchContext context) + { + context.GetPattern(LoadCheckpointMethod).AddPrefix(); + } + + private static bool Prefix(ref MyObjectBuilder_Checkpoint __result) + { +#pragma warning disable CS0618 + var world = TorchBase.Instance.Managers.GetManager().DedicatedConfig.SelectedWorld; +#pragma warning restore CS0618 + if (world is null) + { + Log.Error("Selected world is null"); + return false; + } + + __result = world.Checkpoint; + return false; + } +} \ No newline at end of file diff --git a/Torch.Server/Program.cs b/Torch.Server/Program.cs index b5265a8..a42cc5b 100644 --- a/Torch.Server/Program.cs +++ b/Torch.Server/Program.cs @@ -4,11 +4,12 @@ using System.IO; using System.IO.Compression; using System.Linq; using System.Net; -using System.Reflection; using System.ServiceProcess; using System.Text; using System.Threading; +#if TORCH_SERVICE using Microsoft.VisualBasic.Devices; +#endif using NLog; using NLog.Fluent; using NLog.Targets; @@ -26,46 +27,27 @@ namespace Torch.Server { Target.Register("FlowDocument"); //Ensures that all the files are downloaded in the Torch directory. - var workingDir = new FileInfo(typeof(Program).Assembly.Location).Directory.ToString(); + var workingDir = new FileInfo(typeof(Program).Assembly.Location).Directory!.FullName; var binDir = Path.Combine(workingDir, "DedicatedServer64"); Directory.SetCurrentDirectory(workingDir); - - //HACK for block skins update - var badDlls = new[] - { - "System.Security.Principal.Windows.dll", - "VRage.Platform.Windows.dll" - }; - - try - { - foreach (var file in badDlls) + + if (Directory.Exists(binDir)) + foreach (var file in Directory.GetFiles(binDir, "System.*.dll")) { - if (File.Exists(file)) - File.Delete(file); + File.Delete(file); } - } - catch (Exception e) - { - var log = LogManager.GetCurrentClassLogger(); - log.Error($"Error updating. Please delete the following files from the Torch root folder manually:\r\n{string.Join("\r\n", badDlls)}"); - log.Error(e); - return; - } - - if (!TorchLauncher.IsTorchWrapped()) - { - TorchLauncher.Launch(Assembly.GetEntryAssembly().FullName, args, binDir); - return; - } + TorchLauncher.Launch(workingDir, binDir); + // Breaks on Windows Server 2019 +#if TORCH_SERVICE if (!new ComputerInfo().OSFullName.Contains("Server 2019") && !Environment.UserInteractive) { using (var service = new TorchService(args)) ServiceBase.Run(service); return; } +#endif var initializer = new Initializer(workingDir); if (!initializer.Initialize(args)) diff --git a/Torch.Server/Properties/launchSettings.json b/Torch.Server/Properties/launchSettings.json new file mode 100644 index 0000000..84581c4 --- /dev/null +++ b/Torch.Server/Properties/launchSettings.json @@ -0,0 +1,11 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "Torch.Server": { + "commandName": "Project", + "commandLineArgs": "-noupdate", + "use64Bit": true, + "hotReloadEnabled": false + } + } +} diff --git a/Torch.Server/Themes/Dark Theme Animated.xaml b/Torch.Server/Themes/Dark Theme Animated.xaml index f7f4841..c5baf1c 100644 --- a/Torch.Server/Themes/Dark Theme Animated.xaml +++ b/Torch.Server/Themes/Dark Theme Animated.xaml @@ -4,11 +4,9 @@ - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + @@ -115,7 +23,7 @@ Markdown="{StaticResource Markdown}"/> - + @@ -132,11 +40,18 @@ Markdown="{StaticResource Markdown}"/> -