Decompiled source of Boombox Autonext v1.0.0

BoomboxAutoNext.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 HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MyUnityGameMod1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyUnityGameMod1")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("097cc7bf-3ca7-40f4-ab51-90e209aaa088")]
[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 BoomboxAutoNext
{
	[BepInPlugin("rattenbonkers.BoomboxAutoNext", "BoomboxAutoNext", "1.0.0")]
	public class BoomboxAutoNext : BaseUnityPlugin
	{
		private const string MyGUID = "rattenbonkers.BoomboxAutoNext";

		private const string PluginName = "BoomboxAutoNext";

		private const string VersionString = "1.0.0";

		private static readonly Harmony Harmony = new Harmony("rattenbonkers.BoomboxAutoNext");

		public static ManualLogSource Log = new ManualLogSource("BoomboxAutoNext");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: BoomboxAutoNext, VersionString: 1.0.0 is loading...");
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: BoomboxAutoNext, VersionString: 1.0.0 is loaded.");
			Log = ((BaseUnityPlugin)this).Logger;
		}
	}
}
namespace BoomboxAutoNext.Patches
{
	[HarmonyPatch(typeof(BoomboxItem), "Start")]
	internal class BoomboxItem_Start
	{
		private static void Postfix(BoomboxItem __instance)
		{
			BoomboxAutoNext.Log.LogInfo((object)"Disabling Boombox loop");
			__instance.boomboxAudio.loop = false;
		}
	}
	[HarmonyPatch(typeof(BoomboxItem), "Update")]
	internal class BoomboxItem_Update
	{
		private static void Postfix(BoomboxItem __instance)
		{
			if (__instance.isPlayingMusic && !__instance.boomboxAudio.isPlaying)
			{
				BoomboxAutoNext.Log.LogInfo((object)"Boombox clip ended, playing next clip");
				__instance.boomboxAudio.clip = __instance.musicAudios[__instance.musicRandomizer.Next(0, __instance.musicAudios.Length)];
				__instance.boomboxAudio.Play();
			}
		}
	}
}