Decompiled source of DisableCompanysDenoise v1.0.2

DisableCompany'sDenoise.dll

Decompiled a day ago
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.Configuration;
using Dissonance.Audio.Capture;
using Dissonance.Config;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("DisableCompany'sDenoise")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4a1030da860b75887819cfb7c6afd215fcd5409d")]
[assembly: AssemblyProduct("DisableCompany'sDenoise")]
[assembly: AssemblyTitle("DisableCompany'sDenoise")]
[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.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;
		}
	}
	[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;
		}
	}
}
public class MainPatch
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class DissonanceVoicePatch
	{
		public static ConfigEntry<bool> enableNoiseSuppression;

		public static void initConfig()
		{
			enableNoiseSuppression = Plugin.config.Bind<bool>("DissonanceVoice", "Enable Noise Suppression", false, "Enable Dissonance Voice Noise Suppression(Need to restart Game)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "SpawnPlayerAnimation")]
		public static void Update(ref PlayerControllerB __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			NoiseSuppressionLevels denoiseAmount = (NoiseSuppressionLevels)(enableNoiseSuppression.Value ? 1 : (-1));
			Debug.Log((object)($"Enabled? : {enableNoiseSuppression.Value}Noise Suppression Level: " + ((object)(NoiseSuppressionLevels)(ref denoiseAmount)).ToString()));
			VoiceSettings.Instance.DenoiseAmount = denoiseAmount;
			VoiceSettings.Instance.BackgroundSoundRemovalEnabled = enableNoiseSuppression.Value;
			VoiceSettings.Instance.VadSensitivity = (VadSensitivityLevels)3;
		}
	}
}
[BepInPlugin("DisableCompanysDenoise", "DisableCompanysDenoise", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
	public static ConfigFile config;

	public static Plugin Instance { get; private set; }

	private void Awake()
	{
		Instance = this;
		config = ((BaseUnityPlugin)this).Config;
		MainPatch.DissonanceVoicePatch.initConfig();
		Harmony.CreateAndPatchAll(typeof(MainPatch.DissonanceVoicePatch), (string)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Disable Company's Denoise v1.0.0 has loaded!");
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}