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 vonmod v1.0.0
vonmod\vonmod.dll
Decompiled 12 hours agousing System; using System.Collections; 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 BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [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 VonMod { [BepInPlugin("TheGoonburgers.vonmod", "vonmod", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "TheGoonburgers.vonmod"; public const string Name = "vonmod"; public const string Version = "1.0.0"; internal static ManualLogSource Log; internal static AudioClip[] Songs = (AudioClip[])(object)new AudioClip[0]; internal static bool Ready; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; new Harmony("TheGoonburgers.vonmod").PatchAll(typeof(BoomboxPatches)); GameObject val = new GameObject("vonmod_Loader") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)val); ((MonoBehaviour)val.AddComponent<LoaderHost>()).StartCoroutine(LoadSongs(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location))); } private static IEnumerator LoadSongs(string pluginDir) { string text = Path.Combine(pluginDir, "songs"); if (!Directory.Exists(text)) { Log.LogError((object)("Songs folder missing: " + text)); yield break; } string[] array = Directory.GetFiles(text, "*.mp3").OrderBy<string, string>((string f) => f, StringComparer.OrdinalIgnoreCase).ToArray(); List<AudioClip> loaded = new List<AudioClip>(); string[] array2 = array; foreach (string file in array2) { UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip(new Uri(file).AbsoluteUri, (AudioType)13); try { DownloadHandlerAudioClip val = (DownloadHandlerAudioClip)req.downloadHandler; val.streamAudio = false; val.compressed = true; yield return req.SendWebRequest(); if ((int)req.result != 1) { Log.LogError((object)("Could not load " + Path.GetFileName(file) + ": " + req.error)); continue; } AudioClip content = DownloadHandlerAudioClip.GetContent(req); ((Object)content).name = Path.GetFileNameWithoutExtension(file); loaded.Add(content); Log.LogInfo((object)$"Loaded {((Object)content).name} ({content.length:F0}s)"); } finally { ((IDisposable)req)?.Dispose(); } } Songs = loaded.ToArray(); Ready = Songs.Length != 0; Log.LogInfo((object)$"vonmod ready: {Songs.Length} tracks on the boombox. O'Block."); BoomboxItem[] array3 = Object.FindObjectsOfType<BoomboxItem>(); for (int num2 = 0; num2 < array3.Length; num2++) { BoomboxPatches.Apply(array3[num2]); } } } internal class LoaderHost : MonoBehaviour { } internal static class BoomboxPatches { internal static void Apply(BoomboxItem box) { if (Plugin.Ready && !((Object)(object)box == (Object)null) && box.musicAudios != Plugin.Songs) { box.musicAudios = Plugin.Songs; } } [HarmonyPatch(typeof(BoomboxItem), "Start")] [HarmonyPostfix] private static void StartPostfix(BoomboxItem __instance) { Apply(__instance); } [HarmonyPatch(typeof(BoomboxItem), "StartMusic")] [HarmonyPrefix] private static void StartMusicPrefix(BoomboxItem __instance) { Apply(__instance); } } }