diff --git a/Torch.API/Torch.API.csproj b/Torch.API/Torch.API.csproj index 9ae0e18..30dd9fd 100644 --- a/Torch.API/Torch.API.csproj +++ b/Torch.API/Torch.API.csproj @@ -1,7 +1,6 @@  - net6-windows - 10 + net7-windows Torch API Torch Copyright © Torch API 2017 @@ -17,7 +16,7 @@ - + all diff --git a/Torch.Server.Tests/Torch.Server.Tests.csproj b/Torch.Server.Tests/Torch.Server.Tests.csproj index 5456dfb..a17cd59 100644 --- a/Torch.Server.Tests/Torch.Server.Tests.csproj +++ b/Torch.Server.Tests/Torch.Server.Tests.csproj @@ -1,7 +1,6 @@  - net6-windows - 10 + net7-windows 1591,0649 Torch Server Tests Torch @@ -18,8 +17,8 @@ - - + + diff --git a/Torch.Server/Managers/InstanceManager.cs b/Torch.Server/Managers/InstanceManager.cs index a39e19d..0849374 100644 --- a/Torch.Server/Managers/InstanceManager.cs +++ b/Torch.Server/Managers/InstanceManager.cs @@ -90,8 +90,7 @@ namespace Torch.Server.Managers } catch (Exception ex) { - Log.Error("Failed to load world at path: " + f); - continue; + Log.Error(ex, "Failed to load world at path: " + f); } } @@ -137,7 +136,7 @@ namespace Torch.Server.Managers } catch (Exception ex) { - Log.Error("Failed to load world at path: " + worldPath); + Log.Error(ex, "Failed to load world at path: " + worldPath); DedicatedConfig.LoadWorld = null; return; } diff --git a/Torch.Server/Torch.Server.csproj b/Torch.Server/Torch.Server.csproj index 5ead82f..9e7f812 100644 --- a/Torch.Server/Torch.Server.csproj +++ b/Torch.Server/Torch.Server.csproj @@ -1,21 +1,19 @@  Exe - net6-windows + net7-windows win-x64 - 10 - true publish\ false Torch Server Torch Copyright © Torch API 2017 - false ..\bin\$(Platform)\$(Configuration)\ true en en true + true @@ -35,22 +33,22 @@ - + - - - - - - - + + + + + + + all compile - + all diff --git a/Torch.Tests/Torch.Tests.csproj b/Torch.Tests/Torch.Tests.csproj index 6fad7af..5009d52 100644 --- a/Torch.Tests/Torch.Tests.csproj +++ b/Torch.Tests/Torch.Tests.csproj @@ -1,7 +1,6 @@  - net6-windows - 10 + net7-windows 1591,0649 Torch Tests Torch @@ -18,8 +17,8 @@ - - + + diff --git a/Torch/Managers/PatchManager/DecoratedMethod.cs b/Torch/Managers/PatchManager/DecoratedMethod.cs index e24fd04..e880059 100644 --- a/Torch/Managers/PatchManager/DecoratedMethod.cs +++ b/Torch/Managers/PatchManager/DecoratedMethod.cs @@ -21,8 +21,6 @@ namespace Torch.Managers.PatchManager { internal class DecoratedMethod : MethodRewritePattern { - private static Action IsAppliedSetter; - [ReflectedMethodInfo(typeof(MethodBase), nameof(MethodBase.GetMethodFromHandle), Parameters = new[] {typeof(RuntimeMethodHandle)})] private static MethodInfo _getMethodFromHandle = null!; @@ -37,10 +35,6 @@ namespace Torch.Managers.PatchManager internal DecoratedMethod(MethodBase method) : base(null) { _method = method; - if (IsAppliedSetter == null) - { - IsAppliedSetter = typeof(ILHook).GetProperty(nameof(ILHook.IsApplied)).CreateSetter(); - } } internal bool HasChanged() @@ -62,16 +56,14 @@ namespace Torch.Managers.PatchManager _log.Log(PrintMode != 0 ? LogLevel.Info : LogLevel.Debug, $"Begin patching {_method.DeclaringType?.FullName}#{_method.Name}({string.Join(", ", _method.GetParameters().Select(x => x.ParameterType.Name))})"); - if (_hook == null) - _hook = new ILHook(_method, Manipulator, new ILHookConfig {ManualApply = true}); - IsAppliedSetter(_hook, false); + _hook ??= new ILHook(_method, Manipulator, false); try { _hook.Apply(); } catch (InvalidProgramException e) { - IsAppliedSetter(_hook, false); + _hook.Undo(); PrintMode = PrintModeEnum.Emitted | PrintModeEnum.Original; try { diff --git a/Torch/Patches/ScriptCompilerPatch.cs b/Torch/Patches/ScriptCompilerPatch.cs index a87c701..6e42373 100644 --- a/Torch/Patches/ScriptCompilerPatch.cs +++ b/Torch/Patches/ScriptCompilerPatch.cs @@ -112,7 +112,7 @@ namespace Torch.Patches do { ins[i] = new(OpCodes.Nop); - } while (ins[--i].OpCode.OperandType != OperandType.ShortInlineBrTarget); + } while (ins[--i].OpCode.FlowControl != FlowControl.Cond_Branch); ins[index] = new(OpCodes.Ret); } diff --git a/Torch/Plugins/AssemblyRewriter.cs b/Torch/Plugins/AssemblyRewriter.cs index 43bb4a4..a0030c6 100644 --- a/Torch/Plugins/AssemblyRewriter.cs +++ b/Torch/Plugins/AssemblyRewriter.cs @@ -62,7 +62,7 @@ internal static class AssemblyRewriter { using var module = ModuleDefinition.ReadModule(inputStream, new() { - AssemblyResolver = _zipResolver + AssemblyResolver = resolver }); foreach (var fieldDefinition in FindAllToRewrite(module)) { diff --git a/Torch/Torch.csproj b/Torch/Torch.csproj index bf6070b..6b45e06 100644 --- a/Torch/Torch.csproj +++ b/Torch/Torch.csproj @@ -1,7 +1,6 @@  - net6-windows - 10 + net7-windows Torch Torch Copyright © Torch API 2017 @@ -22,15 +21,15 @@ - - + + - - - + + +