Decompiled source of GameplayElementEraserFix v1.0.1

GameplayElementEraserFix.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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("GameplayElementEraserFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Nines (Natives)")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GameplayElementEraserFix")]
[assembly: AssemblyTitle("GameplayElementEraserFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 GameplayElementEraserFix
{
	[BepInPlugin("GameplayElementEraserFix", "GameplayElementEraserFix", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		internal static Harmony harmonyInstance;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin GameplayElementEraserFix is loaded!");
			harmonyInstance = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
		}

		private void OnDestroy()
		{
			Harmony obj = harmonyInstance;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
		}

		private static bool AssetButton_IsLocked(AssetButton assetButton)
		{
			if (assetButton == null)
			{
				return false;
			}
			return assetButton.IsLocked;
		}

		[HarmonyPatch(typeof(PlaceGameplayTool), "Update")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PlaceGameplayTool_Update(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.PropertyGetter(typeof(AssetButton), "IsLocked"), (string)null)
			}).ThrowIfInvalid("Could not find call to AssetButton.IsLocked").RemoveInstruction()
				.Insert((CodeInstruction[])(object)new CodeInstruction[1] { CodeInstruction.Call((Expression<Action>)(() => AssetButton_IsLocked(null))) })
				.Instructions();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GameplayElementEraserFix";

		public const string PLUGIN_NAME = "GameplayElementEraserFix";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}