Decompiled source of KeepPlaying v1.0.0

KeepPlaying.dll

Decompiled 20 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TheDogeThatSilent")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("大狗叫制作 - TheDogeThatSilent")]
[assembly: AssemblyDescription("Boombox keeps playing music when switching item slots")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KeepPlaying")]
[assembly: AssemblyTitle("KeepPlaying")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 KeepPlaying
{
	[BepInPlugin("TheDogeThatSilent.KeepPlaying", "KeepPlaying", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"大狗叫制作 - KeepPlaying v1.0.0");
			new Harmony("TheDogeThatSilent.KeepPlaying").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"KeepPlaying patches applied!");
		}
	}
	internal static class PluginInfo
	{
		public const string PLUGIN_GUID = "TheDogeThatSilent.KeepPlaying";

		public const string PLUGIN_NAME = "KeepPlaying";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	[HarmonyPatch(typeof(BoomboxItem), "PocketItem")]
	internal static class PocketItemPatch
	{
		internal static void Prefix(BoomboxItem __instance)
		{
			if (__instance.isPlayingMusic)
			{
				StartMusicPatch.SuppressStop = true;
			}
		}

		internal static void Postfix()
		{
			StartMusicPatch.SuppressStop = false;
		}
	}
	[HarmonyPatch(typeof(BoomboxItem), "StartMusic")]
	internal static class StartMusicPatch
	{
		internal static bool SuppressStop;

		internal static bool Prefix(bool startMusic, bool pitchDown)
		{
			if (!startMusic && !pitchDown && SuppressStop)
			{
				return false;
			}
			return true;
		}
	}
}