using System;
using System.Collections;
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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("RecordPlayerPack")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Plays Music Located In the Folder")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RecordPlayerPack")]
[assembly: AssemblyTitle("RecordPlayerPack")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RecordPlayerPack;
[BepInPlugin("RecordPlayerPack", "RecordPlayerPack", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource Logger;
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
new Harmony("RecordPlayerPack").PatchAll(Assembly.GetExecutingAssembly());
}
}
[HarmonyPatch]
internal static class Plugin_Patches
{
private static AudioClip loadedClip;
private static readonly string audioFileName = "recp.ogg";
[HarmonyPatch(typeof(StartOfRound), "Start")]
[HarmonyPostfix]
public static void Start_Postfix(ref StartOfRound __instance)
{
if (!((Object)(object)loadedClip != (Object)null))
{
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), audioFileName);
((MonoBehaviour)__instance).StartCoroutine(LoadAudio(path));
}
}
[HarmonyPatch(typeof(AnimatedObjectTrigger), "TriggerAnimation")]
[HarmonyPrefix]
private static void TriggerAnimation_Postfix(AnimatedObjectTrigger __instance)
{
if ((Object)(object)__instance.playWhileTrue != (Object)null && ((Object)__instance.playWhileTrue).name == "RecordPlayerJazz")
{
__instance.playWhileTrue = loadedClip;
}
}
public static IEnumerator LoadAudio(string path)
{
UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(path, (AudioType)14);
try
{
yield return request.SendWebRequest();
loadedClip = DownloadHandlerAudioClip.GetContent(request);
}
finally
{
((IDisposable)request)?.Dispose();
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "RecordPlayerPack";
public const string PLUGIN_NAME = "RecordPlayerPack";
public const string PLUGIN_VERSION = "1.0.0";
}