Decompiled source of DoomReloadSFX v1.1.0

DoomReload.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using DoomReload.Patches;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DoomReload")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DoomReload")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("53e10d71-d4c0-4a08-ba40-39f4f97ef6a6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DoomReload
{
	[BepInPlugin("Ex.DoomReloadSFXMod", "Ex Doom Reload SFX Mod", "1.0.0")]
	public class DoomReloadBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.DoomReloadSFXMod";

		private const string modName = "Ex Doom Reload SFX Mod";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Ex.DoomReloadSFXMod");

		private static DoomReloadBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip newgunReloadSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.DoomReloadSFXMod");
			mls.LogInfo((object)"Doom Reload SFX mod has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "DoomReload.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "DoomReloadSFX";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newgunReloadSFX = val.LoadAsset<AudioClip>("Assets/E1M1.mp3");
			harmony.PatchAll(typeof(DoomReloadBase));
			harmony.PatchAll(typeof(DoomReloadPatch));
			mls.LogInfo((object)"Doom Reload SFX mod has loaded.");
		}
	}
}
namespace DoomReload.Patches
{
	[HarmonyPatch(typeof(ShotgunItem))]
	internal class DoomReloadPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void DoomReloadSFXPatch(ref AudioClip ___gunReloadSFX)
		{
			___gunReloadSFX = DoomReloadBase.newgunReloadSFX;
		}
	}
}