Decompiled source of MrhumaTunes v1.1.2

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

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

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MrhumaTunes 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 = "MrhumaTunes";

		public const string PLUGIN_NAME = "MrhumaTunes";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}