Decompiled source of Boombox Music Pack v1.0.0

LC_BoomBoxMod.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LC_BoomBoxMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LC_BoomBoxMod")]
[assembly: AssemblyTitle("LC_BoomBoxMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 LC_BoomBoxMod
{
	[BepInPlugin("tech.penguins.LC_BoomBoxMod", "LC_BoomBox_Mod", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string PluginId = "tech.penguins.LC_BoomBoxMod";

		private const string PluginName = "LC_BoomBox_Mod";

		private const string PluginVersion = "1.0.0";

		private Harmony harmony;

		internal static AudioClip[] newMusicAudios;

		internal static ManualLogSource Log;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LC_BoomBoxMod is loaded!");
			string path = Path.GetDirectoryName(((object)this).GetType().Assembly.Location) ?? "";
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(path, "LC_BoomBoxMod.assets"));
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load audio assets!");
				return;
			}
			newMusicAudios = val.LoadAllAssets<AudioClip>();
			harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "tech.penguins.LC_BoomBoxMod");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LC_BoomBoxMod finished patching!");
		}

		private void OnDestroy()
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Plugin LC_BoomBoxMod OnDestroy called. Unpatching.");
			Harmony obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LC_BoomBoxMod";

		public const string PLUGIN_NAME = "LC_BoomBoxMod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LC_BoomBoxMod.Patches
{
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class BoomboxAudioPatcher
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void AddInAudioClips(ref AudioClip[] ___musicAudios)
		{
			AudioClip[] array = (AudioClip[])(object)new AudioClip[Plugin.newMusicAudios.Length + ___musicAudios.Length];
			Plugin.newMusicAudios.CopyTo(array, 0);
			___musicAudios.CopyTo(array, Plugin.newMusicAudios.Length);
			___musicAudios = array;
		}
	}
}