using System;
using System.Diagnostics;
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 Microsoft.CodeAnalysis;
using UnityEngine;
[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("SoulWithMae")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+baa4b8edc3a25a899520149443b1032fbd9a9b6f")]
[assembly: AssemblyProduct("AudioLogger")]
[assembly: AssemblyTitle("AudioLogger")]
[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 AudioLogger
{
[BepInPlugin("AudioLogger", "AudioLogger", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource StaticLogger;
private readonly Harmony _harmony = new Harmony("AudioLogger");
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AudioLogger is loaded!");
StaticLogger = ((BaseUnityPlugin)this).Logger;
_harmony.PatchAll(Assembly.GetExecutingAssembly());
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "AudioLogger";
public const string PLUGIN_NAME = "AudioLogger";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace AudioLogger.Patching
{
public static class AudioPatches
{
[HarmonyPatch(typeof(AudioSource))]
internal static class PlayClipAtPointPatch
{
[HarmonyPatch("PlayClipAtPoint", new Type[]
{
typeof(AudioClip),
typeof(Vector3),
typeof(float)
})]
[HarmonyPostfix]
public static void Postfix(AudioClip clip, ref Vector3 position, float volume)
{
string name = ((Object)clip).name;
string text = ((object)(Vector3)(ref position)).ToString();
Plugin.StaticLogger.LogInfo((object)("Playing " + name + " at position " + text));
}
}
[HarmonyPatch(typeof(AudioSource))]
internal static class PlayOneShotPatch
{
[HarmonyPatch("PlayOneShotHelper", new Type[]
{
typeof(AudioSource),
typeof(AudioClip),
typeof(float)
})]
[HarmonyPostfix]
public static void Postfix(AudioSource source, ref AudioClip clip, float volumeScale)
{
string name = ((Object)clip).name;
string name2 = ((Object)((Component)source).gameObject).name;
Plugin.StaticLogger.LogInfo((object)("Playing one-shot " + name + " from " + name2));
}
}
[HarmonyPatch(typeof(AudioSource))]
internal static class PlayPatch
{
[HarmonyPostfix]
[HarmonyPatch("Play", new Type[] { })]
public static void Postfix(AudioSource __instance)
{
string name = ((Object)__instance.clip).name;
string name2 = ((Object)((Component)__instance).gameObject).name;
Plugin.StaticLogger.LogInfo((object)("Playing " + name + " from " + name2));
}
}
[HarmonyPatch(typeof(AudioSource))]
internal static class PlayDoublePatch
{
[HarmonyPostfix]
[HarmonyPatch("Play", new Type[] { typeof(ulong) })]
public static void Postfix(AudioSource __instance)
{
string name = ((Object)__instance.clip).name;
string name2 = ((Object)((Component)__instance).gameObject).name;
Plugin.StaticLogger.LogInfo((object)("Playing " + name + " from " + name2));
}
}
}
}