Please disclose if any significant portion of your mod was created 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 Bonk MusicPack v1.1.0
BonkMusicPack.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [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 BonkMusicPack { [BepInPlugin("Bonk.Bonk_MusicPack", "Bonk MusicPack", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string GUID = "Bonk.Bonk_MusicPack"; public const string NAME = "Bonk MusicPack"; public const string VERSION = "1.1.0"; private static readonly string[] AudioExtensions = new string[3] { ".mp3", ".ogg", ".wav" }; private const string TrackingFileName = "installed_songs.txt"; private void Awake() { try { SyncSongs(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to install songs: " + ex)); } } private void SyncSongs() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string text = Path.Combine(Paths.BepInExRootPath, Path.Combine("Custom Songs", "Boombox Music")); Directory.CreateDirectory(text); List<string> list = (from f in Directory.GetFiles(directoryName, "*", SearchOption.AllDirectories) where AudioExtensions.Contains(Path.GetExtension(f).ToLowerInvariant()) select f).ToList(); int num = 0; int num2 = 0; HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (string item in list) { string fileName = Path.GetFileName(item); if (!hashSet.Add(fileName)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Duplicate song name skipped: " + fileName)); continue; } string text2 = Path.Combine(text, fileName); if (File.Exists(text2) && new FileInfo(text2).Length == new FileInfo(item).Length) { num2++; continue; } File.Copy(item, text2, overwrite: true); num++; } int num3 = 0; string path = Path.Combine(directoryName, "installed_songs.txt"); if (File.Exists(path)) { foreach (string item2 in from l in File.ReadAllLines(path) where l.Length > 0 select l) { if (!hashSet.Contains(item2)) { string path2 = Path.Combine(text, item2); if (File.Exists(path2)) { File.Delete(path2); num3++; } } } } try { File.WriteAllLines(path, hashSet.OrderBy<string, string>((string n) => n, StringComparer.Ordinal).ToArray()); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not write installed_songs.txt: " + ex.Message)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Songs ready in {text}: {num} copied, {num2} already there, {num3} old removed ({hashSet.Count} in pack)."); } } }