Decompiled source of FnafPowerOutage v1.0.1

FnafPowerOutage/FnafPowerOutage.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 FnafPowerOutage.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("FnafPowerOutage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FnafPowerOutage")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("30dedb46-5e2f-4907-98c0-4faa8f523b66")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FnafPowerOutage
{
	[BepInPlugin("atg.FnafPowerOutage", "Fnaf Power Outage", "1.0.1")]
	public class PowerOutageBase : BaseUnityPlugin
	{
		private const string modGUID = "atg.FnafPowerOutage";

		private const string modName = "Fnaf Power Outage";

		private const string modVersion = "1.0.1";

		private Harmony harmony = new Harmony("atg.FnafPowerOutage");

		private static PowerOutageBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] newSFX;

		private void Awake()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("atg.FnafPowerOutage");
			mls.LogInfo((object)"Starting Fnaf Power Outage");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "FnafPowerOutage.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "toreadormarch";
			mls.LogInfo((object)text3);
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/toreadormarch.mp3");
			harmony.PatchAll(typeof(HudManagerPatch));
			mls.LogInfo((object)"FnafPowerOutage Mod is loaded");
			harmony.PatchAll(typeof(PowerOutageBase));
		}
	}
}
namespace FnafPowerOutage.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HudManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void powerOutageAudioPatch(ref AudioClip ___radiationWarningAudio)
		{
			AudioClip[] newSFX = PowerOutageBase.newSFX;
			if (newSFX != null && newSFX.Length != 0)
			{
				AudioClip val = newSFX[0];
				___radiationWarningAudio = val;
			}
		}
	}
}