Decompiled source of ShyGuyPatcherPatcher v0.0.2

ShyGuyPatcherPatcher.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: AssemblyCompany("ShyGuyPatcherPatcher")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Disables the Scopophobia spawn settings patcher, allowing the Shy Guy monster to be configured by overhaul mods like Lethal Quantities / Advanced Company")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("ShyGuyPatcherPatcher")]
[assembly: AssemblyTitle("ShyGuyPatcherPatcher")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.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 ShyGuyPatcherPatcher
{
	[BepInPlugin("DBJ.ShyGuyPatcherPatcher", "ShyGuyPatcherPatcher", "0.0.1")]
	public class ShyGuyPatcherPatcherBase : BaseUnityPlugin
	{
		private const string modGUID = "DBJ.ShyGuyPatcherPatcher";

		private const string modName = "ShyGuyPatcherPatcher";

		private const string modVersion = "0.0.1";

		private static readonly Harmony harmony = new Harmony("DBJ.ShyGuyPatcherPatcher");

		private static readonly ManualLogSource mls = Logger.CreateLogSource("DBJ.ShyGuyPatcherPatcher");

		private static Assembly assembly;

		private static bool Scopophobia_UpdateSpawnRates()
		{
			mls.LogInfo((object)"Scopophobia.UpdateSpawnRates() successfully intercepted!");
			return false;
		}

		private void Awake()
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			mls.LogInfo((object)"[Awake Log 1 / 5] Initializing ShyGuyPatcherPatcher...");
			try
			{
				assembly = AppDomain.CurrentDomain.Load("Scopophobia");
				mls.LogInfo((object)$"[Awake Log 2 / 5] Found Scopophobia: {assembly}");
			}
			catch (FileNotFoundException)
			{
				mls.LogWarning((object)"[Awake Log 2 / 5] Scopophobia not found! Aborting...");
				return;
			}
			MethodInfo method = assembly.GetType("Scopophobia.Patches.ShyGuySpawnSettings").GetMethod("UpdateSpawnRates", BindingFlags.Static | BindingFlags.NonPublic);
			mls.LogInfo((object)$"[Awake Log 3 / 5] Found Scopophobia.UpdateSpawnRates: {method}");
			MethodInfo method2 = typeof(ShyGuyPatcherPatcherBase).GetMethod("Scopophobia_UpdateSpawnRates", BindingFlags.Static | BindingFlags.NonPublic);
			mls.LogInfo((object)$"[Awake Log 4 / 5] Found ShyGuyPatcherPatcherBase.Scopophobia_UpdateSpawnRates: {method2}");
			harmony.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			mls.LogInfo((object)"[Awake Log 5 / 5] Patched Scopohobia.UpdateSpawnRates()! There should be an interception message from me on BeginEnemySpawning()");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ShyGuyPatcherPatcher";

		public const string PLUGIN_NAME = "ShyGuyPatcherPatcher";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}