Decompiled source of JamalioBoombox v1.2.1

BepinEx/plugins/JamalioBoombox.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 Microsoft.CodeAnalysis;

[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("JamalioBoombox")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Custom Boombox Music")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JamalioBoombox")]
[assembly: AssemblyTitle("JamalioBoombox")]
[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 JamalioBoombox
{
	[BepInPlugin("JamalioBoombox", "JamalioBoombox", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly string NewSongsFolder = Path.Combine(Paths.PluginPath, "jamalio-JamalioBoombox", "New Songs");

		private readonly string BoomboxMusicFolder = Path.Combine(Paths.BepInExRootPath, "Custom Songs", "Boombox Music");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin JamalioBoombox is loaded!");
			if (!Directory.Exists(BoomboxMusicFolder))
			{
				Directory.CreateDirectory(BoomboxMusicFolder);
			}
			if (!Directory.Exists(NewSongsFolder))
			{
				Directory.CreateDirectory(NewSongsFolder);
			}
			if (Directory.GetFiles(NewSongsFolder).Length != 0)
			{
				DeleteOldSongs();
				AddNewSongs();
			}
		}

		private void DeleteOldSongs()
		{
			string[] files = Directory.GetFiles(BoomboxMusicFolder, "*.mp3");
			string[] files2 = Directory.GetFiles(BoomboxMusicFolder, "*.wav");
			string[] files3 = Directory.GetFiles(BoomboxMusicFolder, "*.ogg");
			int num = 0;
			string[] array = new string[files.Length + files2.Length + files3.Length];
			string[] array2 = files;
			foreach (string text in array2)
			{
				array[num] = text;
				num++;
			}
			string[] array3 = files2;
			foreach (string text in array3)
			{
				array[num] = text;
				num++;
			}
			string[] array4 = files3;
			foreach (string text in array4)
			{
				array[num] = text;
				num++;
			}
			string[] array5 = array;
			string[] array6 = array5;
			foreach (string path in array6)
			{
				File.Delete(path);
			}
		}

		private void AddNewSongs()
		{
			string[] files = Directory.GetFiles(NewSongsFolder, "*.mp3");
			string[] files2 = Directory.GetFiles(NewSongsFolder, "*.wav");
			string[] files3 = Directory.GetFiles(NewSongsFolder, "*.ogg");
			int num = 0;
			string[] array = new string[files.Length + files2.Length + files3.Length];
			string[] array2 = files;
			foreach (string text in array2)
			{
				array[num] = text;
				num++;
			}
			string[] array3 = files2;
			foreach (string text in array3)
			{
				array[num] = text;
				num++;
			}
			string[] array4 = files3;
			foreach (string text in array4)
			{
				array[num] = text;
				num++;
			}
			string[] array5 = array;
			string[] array6 = array5;
			foreach (string text2 in array6)
			{
				File.Move(text2, Path.Combine(BoomboxMusicFolder, Path.GetFileName(text2)));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "JamalioBoombox";

		public const string PLUGIN_NAME = "JamalioBoombox";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}