Decompiled source of DeadRadios v1.0.0

BepInEx/plugins/DeadRadios/DeadRadios.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("DeadRadios")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DeadRadios")]
[assembly: AssemblyTitle("DeadRadios")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 DeadRadios
{
	[BepInPlugin("com.BetaTester704.whiteknuckle.deadradios", "DeadRadios", "1.0.0")]
	public class DeadRadiosPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.BetaTester704.whiteknuckle.deadradios";

		public const string PluginName = "DeadRadios";

		public const string PluginVersion = "1.0.0";

		internal static ManualLogSource Log;

		private Harmony harmony;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			harmony = new Harmony("com.BetaTester704.whiteknuckle.deadradios");
			PatchTargets();
			Log.LogInfo((object)"DeadRadios Loaded");
		}

		private void PatchTargets()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_005a: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.Method(typeof(ENV_Radio), "Start", (Type[])null, (Type[])null);
			if (!(methodInfo == null))
			{
				harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(DeadRadiosPlugin), "ENV_Radio_Start_Prefix", (Type[])null), new HarmonyMethod(typeof(DeadRadiosPlugin), "ENV_Radio_Start_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		private static void ENV_Radio_Start_Prefix(ENV_Radio __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				__instance.playOnStart = false;
			}
		}

		private static void ENV_Radio_Start_Postfix(ENV_Radio __instance)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.aud == (Object)null))
			{
				__instance.aud.Stop();
			}
		}
	}
}