Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DookieMuzik2 v1.2.1
CustomBoomboxFix.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; 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("CustomBoomboxFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CustomBoomboxFix")] [assembly: AssemblyTitle("CustomBoomboxFix")] [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 CustomBoomboxFix { [BepInPlugin("CustomBoomboxFix", "CustomBoomboxFix", "1.0.0")] public class Plugin : BaseUnityPlugin { private string CustomSongsPluginPath => Path.Combine(Paths.PluginPath, "Custom Songs"); private string TargetPath => Path.Combine(Paths.BepInExRootPath, "Custom Songs", "Boombox Music"); private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CustomBoomboxFix is loaded!"); CreatePluginCustomSongsFolder(); DeleteAllFilesInTargetPath(); SearchAndCopyCustomSongs(); CopyMusicFiles(); } private void CreatePluginCustomSongsFolder() { if (!Directory.Exists(CustomSongsPluginPath)) { Directory.CreateDirectory(CustomSongsPluginPath); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Created 'Custom Songs' folder in plugin directory."); } } private void CopyMusicFiles() { if (!Directory.Exists(TargetPath)) { Directory.CreateDirectory(TargetPath); } IEnumerable<string> enumerable = Directory.GetFiles(CustomSongsPluginPath, "*.mp3").Concat(Directory.GetFiles(CustomSongsPluginPath, "*.wav")); foreach (string item in enumerable) { string fileName = Path.GetFileName(item); string text = Path.Combine(TargetPath, fileName); if (!File.Exists(text)) { File.Copy(item, text); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Copied " + fileName + " to Boombox Music folder.")); } } } private void DeleteAllFilesInTargetPath() { try { if (Directory.Exists(TargetPath)) { string[] files = Directory.GetFiles(TargetPath); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Deleting files in '" + TargetPath + "'...")); string[] array = files; foreach (string path in array) { File.Delete(path); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Deleted files in '" + TargetPath + "'")); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Target path '" + TargetPath + "' does not exist.")); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("An error occurred while trying to delete files: " + ex.Message)); } } private void SearchAndCopyCustomSongs() { string[] directories = Directory.GetDirectories(Paths.PluginPath); string[] array = directories; foreach (string path in array) { string text = Path.Combine(path, "Custom Songs"); if (!Directory.Exists(text)) { continue; } IEnumerable<string> enumerable = Directory.GetFiles(text, "*.mp3").Concat(Directory.GetFiles(text, "*.wav")); foreach (string item in enumerable) { string fileName = Path.GetFileName(item); string text2 = Path.Combine(TargetPath, fileName); if (!File.Exists(text2)) { File.Copy(item, text2); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Copied " + fileName + " from " + text + " to Boombox Music folder.")); } } } } } public static class PluginInfo { public const string PLUGIN_GUID = "CustomBoomboxFix"; public const string PLUGIN_NAME = "CustomBoomboxFix"; public const string PLUGIN_VERSION = "1.0.0"; } }