From 9c22948ce9e2ec0ff70748f6f19d1fd11ed931ec Mon Sep 17 00:00:00 2001 From: zznty <94796179+zznty@users.noreply.github.com> Date: Tue, 21 Feb 2023 22:43:30 +0700 Subject: [PATCH] fix keen compiler assemblies fuckery --- Torch/Managers/FilesystemManager.cs | 2 +- Torch/Patches/ScriptCompilerPatch.cs | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Torch/Managers/FilesystemManager.cs b/Torch/Managers/FilesystemManager.cs index d63368e..7cc8c45 100644 --- a/Torch/Managers/FilesystemManager.cs +++ b/Torch/Managers/FilesystemManager.cs @@ -62,7 +62,7 @@ namespace Torch.Managers { File.Delete(source); } - catch (IOException) + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { var tempFilePath = Path.Combine(path, file + ".old"); if (File.Exists(tempFilePath)) diff --git a/Torch/Patches/ScriptCompilerPatch.cs b/Torch/Patches/ScriptCompilerPatch.cs index 8a7b012..706847c 100644 --- a/Torch/Patches/ScriptCompilerPatch.cs +++ b/Torch/Patches/ScriptCompilerPatch.cs @@ -58,11 +58,10 @@ namespace Torch.Patches typeof(TypeConverter).Assembly.Location, typeof(System.Diagnostics.TraceSource).Assembly.Location, typeof(System.Security.Policy.Evidence).Assembly.Location, - typeof(ProtoBuf.Meta.RuntimeTypeModel).Assembly.Location, - typeof(ProtoContractAttribute).Assembly.Location, Path.Combine(baseDir, "System.Xml.ReaderWriter.dll"), Path.Combine(baseDir, "netstandard.dll"), Path.Combine(baseDir, "System.Runtime.dll"), + Path.Combine(MyFileSystem.ExePath, "ProtoBuf.Net.Core.dll"), Path.Combine(MyFileSystem.ExePath, "Sandbox.Game.dll"), Path.Combine(MyFileSystem.ExePath, "Sandbox.Common.dll"), Path.Combine(MyFileSystem.ExePath, "Sandbox.Graphics.dll"), @@ -84,14 +83,6 @@ namespace Torch.Patches using var batch = MyScriptCompiler.Static.Whitelist.OpenBatch(); batch.AllowTypes(MyWhitelistTarget.ModApi, typeof(ConcurrentQueue<>)); - batch.AllowNamespaceOfTypes(MyWhitelistTarget.Both, typeof(ImmutableArray), typeof(ArrayExtensions)); - batch.AllowTypes(MyWhitelistTarget.ModApi, typeof(ProtoContractAttribute).Assembly.GetExportedTypes() - .Where(b => b.Namespace == "ProtoBuf" && b.Name.Contains("Attribute")) - .Concat(new[] - { - typeof(DataFormat), typeof(MemberSerializationOptions), typeof(ImplicitFields) - }).ToArray()); - batch.AllowTypes(MyWhitelistTarget.ModApi, typeof(WorkData)); return false; }