Decompiled source of OrmuzFunBag v1.0.0

OrmuzFunBag.dll

Decompiled 11 months 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 System.Threading.Tasks;
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: AssemblyCompany("OrmuzFunBag")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OrmuzFunBag")]
[assembly: AssemblyTitle("OrmuzFunBag")]
[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 OrmuzFunBag
{
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class BoomboxPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void StartPatch(BoomboxItem __instance)
		{
			AudioClip cancion = Plugin.Instance.cancion;
			__instance.musicAudios = (AudioClip[])(object)new AudioClip[1] { cancion };
		}
	}
	[BepInPlugin("OrmuzFunBag", "Ormuz's Fun Bag", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string PLUGIN_GUID = "OrmuzFunBag";

		private const string PLUGIN_NAME = "Ormuz's Fun Bag";

		private const string PLUGIN_VERSION = "1.0.0";

		private readonly Harmony harmony = new Harmony("OrmuzFunBag");

		public AudioClip cancion;

		public static Plugin Instance;

		internal ManualLogSource logSource;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logSource = Logger.CreateLogSource("Ormuz's Fun Bag");
			logSource.LogInfo((object)"Mod de prueba de Mariano");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(BoomboxPatch));
			GetAudioClip();
		}

		private async void GetAudioClip()
		{
			string text = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\cancion.mp3";
			UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)13);
			try
			{
				UnityWebRequestAsyncOperation asyncWebRequest = www.SendWebRequest();
				while (!((AsyncOperation)asyncWebRequest).isDone)
				{
					await Task.Delay(25);
				}
				if ((int)www.result == 2)
				{
					logSource.LogError((object)"Error loading song");
					Debug.Log((object)www.error);
				}
				else
				{
					AudioClip content = DownloadHandlerAudioClip.GetContent(www);
					Instance.cancion = content;
					logSource.LogInfo((object)"Correctly loaded song");
				}
			}
			finally
			{
				((IDisposable)www)?.Dispose();
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "OrmuzFunBag";

		public const string PLUGIN_NAME = "OrmuzFunBag";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}