Decompiled source of Push to Mute v1.0.1

REPO Push To Mute Mod.dll

Decompiled a month 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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Voice.Unity;
using PushToMute.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("REPO Push To Mute Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REPO Push To Mute Mod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0a7dc1cd-8ecc-4619-a325-f7c30d04644c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace PushToMute
{
	internal class Configuration
	{
		public static ConfigEntry<KeyCode>? MuteButtonKeyBind;

		public static void Init(ConfigFile config)
		{
			MuteButtonKeyBind = config.Bind<KeyCode>("Keybinds", "Push to Mute Button", (KeyCode)120, "The push-to-mute keybind");
		}
	}
	[BepInPlugin("MadChefBanana.PushToMute", "Push to Mute", "1.0.0")]
	public class PushToMute : BaseUnityPlugin
	{
		public static readonly ManualLogSource Logger = Logger.CreateLogSource("PushToMute");

		internal static PushToMute Instance { get; private set; }

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)"MadChefBanana's Push to Mute mod has loaded!");
		}

		internal void Patch()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony = harmony;
			}
			Harmony.PatchAll(typeof(RecorderPatch));
		}

		internal void Unpatch()
		{
			Harmony harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}
namespace PushToMute.Patches
{
	[HarmonyPatch(typeof(Recorder))]
	internal class RecorderPatch
	{
		private static bool muteKeyDown;

		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void Update_Postfix(Recorder __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			Configuration.Init(((BaseUnityPlugin)PushToMute.Instance).Config);
			KeyCode value = Configuration.MuteButtonKeyBind.Value;
			if (Input.GetKeyDown(value))
			{
				muteKeyDown = true;
			}
			if (Input.GetKeyUp(value))
			{
				muteKeyDown = false;
			}
			__instance.TransmitEnabled = !muteKeyDown;
		}
	}
}