using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MinecraftStrongholdLevelFix.Patcher")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MinecraftStrongholdLevelFix.Patcher")] [assembly: AssemblyTitle("MinecraftStrongholdLevelFix.Patcher")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MinecraftStrongholdLevelFix.Patcher { public static class ValuableVolumeVisualizerPatcher { public static IEnumerable TargetDLLs { get; } = new string[1] { "Assembly-CSharp.dll" }; public static void Patch(AssemblyDefinition assembly) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) ModuleDefinition mainModule = assembly.MainModule; if (mainModule.GetType("ValuableVolumeVisualizer") == null) { AssemblyNameReference val = ((IEnumerable)mainModule.AssemblyReferences).First((AssemblyNameReference reference) => reference.Name == "UnityEngine.CoreModule"); TypeReference val2 = new TypeReference("UnityEngine", "MonoBehaviour", mainModule, (IMetadataScope)(object)val); TypeDefinition val3 = new TypeDefinition(string.Empty, "ValuableVolumeVisualizer", (TypeAttributes)1048577, val2); MethodDefinition val4 = new MethodDefinition(".ctor", (MethodAttributes)6150, mainModule.TypeSystem.Void); MethodReference val5 = new MethodReference(".ctor", mainModule.TypeSystem.Void, val2) { HasThis = true }; val4.Body.GetILProcessor().Append(Instruction.Create(OpCodes.Ldarg_0)); val4.Body.GetILProcessor().Append(Instruction.Create(OpCodes.Call, val5)); val4.Body.GetILProcessor().Append(Instruction.Create(OpCodes.Ret)); val3.Methods.Add(val4); mainModule.Types.Add(val3); } } } }