Decompiled source of ZapGunReplaceSFX v1.0.0

ZapGunReplaceSFX/ZAPGUNSFX.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ZAPGUNSFX")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZAPGUNSFX")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("afdec8d1-6559-4ad5-8dba-9e1c0837188c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ZapGunReplaceSFX;

internal class LoaderSFX
{
	public static AudioClip LoadFromDiskToAudioClip(string path, AudioType type)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Invalid comparison between Unknown and I4
		ManualLogSource mls = ZapGunReplace.mls;
		AudioClip result = null;
		UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(path, type);
		try
		{
			audioClip.SendWebRequest();
			try
			{
				while (!audioClip.isDone)
				{
				}
				if ((int)audioClip.result != 1)
				{
					mls.LogError((object)("Failed to load MPEG AudioClip from path: " + path + " Full error: " + audioClip.error));
				}
				else
				{
					result = DownloadHandlerAudioClip.GetContent(audioClip);
				}
			}
			catch (Exception ex)
			{
				mls.LogError((object)(ex.Message + ", " + ex.StackTrace));
			}
		}
		finally
		{
			((IDisposable)audioClip)?.Dispose();
		}
		return result;
	}
}
[HarmonyPatch(typeof(PatcherTool))]
internal class PatcherZapGun
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void ZapGunPatcher(ref AudioClip ___scanAnomaly, ref AudioClip ___detectAnomaly)
	{
		string path = ZapGunReplace.pathDLL + "\\startScan.mp3";
		string path2 = ZapGunReplace.pathDLL + "\\detectAnomaly.mp3";
		AudioClip val = LoaderSFX.LoadFromDiskToAudioClip(path, (AudioType)13);
		AudioClip val2 = LoaderSFX.LoadFromDiskToAudioClip(path2, (AudioType)13);
		___scanAnomaly = val;
		___detectAnomaly = val2;
	}
}
[BepInPlugin("IllegalArgumentExeption.ZapGunReplaceSFX", "ZapGunReplaceSFX", "1.0.0")]
public class ZapGunReplace : BaseUnityPlugin
{
	public static string pathDLL;

	private readonly Harmony harmony = new Harmony("IllegalArgumentExeption.ZapGunReplaceSFX");

	private static ZapGunReplace instance;

	public static ManualLogSource mls;

	private void Awake()
	{
		if ((Object)(object)instance == (Object)null)
		{
			instance = this;
		}
		string location = ((BaseUnityPlugin)instance).Info.Location;
		string text = "ZAPGUNSFX.dll";
		pathDLL = location.TrimEnd(text.ToCharArray());
		harmony.PatchAll(typeof(PatcherZapGun));
		mls = Logger.CreateLogSource("IllegalArgumentExeption.ZapGunReplaceSFXмод загружен");
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "IllegalArgumentExeption.ZapGunReplaceSFX";

	public const string PLUGIN_NAME = "ZapGunReplaceSFX";

	public const string PLUGIN_VERSION = "1.0.0";
}