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 buvkss custom boombox v1.0.3
boombox.dll
Decompiled 6 months 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; using boombox.NetcodePatcher; [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("boombox")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("boombox")] [assembly: AssemblyTitle("boombox")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 CustomBoombox { [BepInPlugin("com.seu.boombox", "Minha Boombox Custom", "1.0.0")] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class <CarregarMusicas>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MonoBehaviour motor; private string[] <arquivos>5__1; private string[] <>s__2; private int <>s__3; private string <arquivo>5__4; private string <path>5__5; private UnityWebRequest <www>5__6; private AudioClip <clip>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CarregarMusicas>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <arquivos>5__1 = null; <>s__2 = null; <arquivo>5__4 = null; <path>5__5 = null; <www>5__6 = null; <clip>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (Carregando || MinhasMusicas.Count > 0) { return false; } Carregando = true; <arquivos>5__1 = (from f in Directory.GetFiles(PastaMod) where f.ToLower().EndsWith(".mp3") || f.ToLower().EndsWith(".wav") || f.ToLower().EndsWith(".ogg") select f).ToArray(); <>s__2 = <arquivos>5__1; <>s__3 = 0; break; case 1: <>1__state = -3; if ((int)<www>5__6.result == 1) { <clip>5__7 = DownloadHandlerAudioClip.GetContent(<www>5__6); ((Object)<clip>5__7).name = Path.GetFileName(<arquivo>5__4); MinhasMusicas.Add(<clip>5__7); Debug.Log((object)("[BOOMBOX] OK: " + ((Object)<clip>5__7).name)); <clip>5__7 = null; } <>m__Finally1(); <www>5__6 = null; <path>5__5 = null; <arquivo>5__4 = null; <>s__3++; break; } if (<>s__3 < <>s__2.Length) { <arquivo>5__4 = <>s__2[<>s__3]; <path>5__5 = "file:///" + <arquivo>5__4.Replace("\\", "/"); <www>5__6 = UnityWebRequestMultimedia.GetAudioClip(<path>5__5, (AudioType)0); <>1__state = -3; <>2__current = <www>5__6.SendWebRequest(); <>1__state = 1; return true; } <>s__2 = null; Carregando = false; Debug.Log((object)$"[BOOMBOX] Pronto! {MinhasMusicas.Count} musicas prontas."); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<www>5__6 != null) { ((IDisposable)<www>5__6).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static List<AudioClip> MinhasMusicas = new List<AudioClip>(); public static bool Carregando = false; public static string PastaMod; public static ManualLogSource Log; private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; PastaMod = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); new Harmony("com.seu.boombox").PatchAll(); Log.LogInfo((object)"[BOOMBOX] Mod carregado. Aguardando rádio aparecer para carregar..."); } [IteratorStateMachine(typeof(<CarregarMusicas>d__5))] public static IEnumerator CarregarMusicas(MonoBehaviour motor) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CarregarMusicas>d__5(0) { motor = motor }; } } [HarmonyPatch(typeof(BoomboxItem), "Start")] public class PatchStart { private static void Postfix(BoomboxItem __instance) { if (Plugin.MinhasMusicas.Count == 0 && !Plugin.Carregando) { ((MonoBehaviour)__instance).StartCoroutine(Plugin.CarregarMusicas((MonoBehaviour)(object)__instance)); } } } [HarmonyPatch(typeof(BoomboxItem), "StartMusic")] public class PatchMusic { private static void Prefix(ref AudioClip[] ___musicAudios) { if (Plugin.MinhasMusicas.Count > 0) { ___musicAudios = Plugin.MinhasMusicas.ToArray(); } } } } namespace boombox.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }