Decompiled source of MenuMusicMute v1.0.0

BepInEx/plugins/MenuMute.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;

[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: AssemblyCompany("MenuMute")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MenuMute")]
[assembly: AssemblyTitle("MenuMute")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MenuMute
{
	public class HarmonyPatches
	{
		private static Harmony instance;

		public const string InstanceId = "com.graze.gorillatag.menumute";

		public static bool IsPatched { get; private set; }

		internal static void ApplyHarmonyPatches()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (!IsPatched)
			{
				if (instance == null)
				{
					instance = new Harmony("com.graze.gorillatag.menumute");
				}
				instance.PatchAll(Assembly.GetExecutingAssembly());
				IsPatched = true;
			}
		}

		internal static void RemoveHarmonyPatches()
		{
			if (instance != null && IsPatched)
			{
				instance.UnpatchSelf();
				IsPatched = false;
			}
		}
	}
	[BepInPlugin("com.graze.gorillatag.menumute", "MenuMute", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Plugin()
		{
			HarmonyPatches.ApplyHarmonyPatches();
		}
	}
	internal class PluginInfo
	{
		public const string GUID = "com.graze.gorillatag.menumute";

		public const string Name = "MenuMute";

		public const string Version = "1.0.0";
	}
}
namespace MenuMute.Patches
{
	[HarmonyPatch(typeof(MenuManager))]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class ExamplePatch
	{
		private static void Postfix(MenuManager __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "MainMenu")
			{
				((Component)__instance).gameObject.GetComponent<AudioSource>().clip = null;
			}
		}
	}
}