Decompiled source of MuteInstruments v1.0.0

MuteInstrumentsPlugin.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using FMOD.Studio;
using HarmonyLib;

[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("ClassLibrary1")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyTitle("ClassLibrary1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MuteInstruments;

[BepInPlugin("com.yourname.muteinstruments", "Mute Instruments", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"=== Mute Instruments (Low Level) Initialized ===");
	}

	[HarmonyPatch(typeof(System), "loadBankFile")]
	[HarmonyPrefix]
	private static bool Prefix(ref string filename)
	{
		if (filename.ToLower().Contains("instruments.bank"))
		{
			string text = Path.Combine(Paths.PluginPath, "MuteInstruments", "instruments.bank");
			if (File.Exists(text))
			{
				Console.WriteLine("[MuteMod] INTERCEPTED! Swapping game path:\nOld: " + filename + "\nNew: " + text);
				filename = text;
			}
			else
			{
				Console.WriteLine("[MuteMod] ERROR: Replacement file missing at: " + text);
			}
		}
		return true;
	}
}