Decompiled source of Log Cleanup v1.0.0

LogCleanup.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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LogCleanup")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LogCleanup")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7da20b5e-913b-4300-9a89-9d18bf867810")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LogCleanup;

[BepInPlugin("goldenrevolver.LogCleanup", "Log Cleanup", "1.0.0")]
public class LogCleanupPlugin : BaseUnityPlugin
{
	public const string GUID = "goldenrevolver.LogCleanup";

	public const string NAME = "Log Cleanup";

	public const string VERSION = "1.0.0";

	protected void Awake()
	{
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
	}
}
[HarmonyPatch]
internal static class LoggingPatches
{
	private static bool doneSuppressing;

	private const string fuckYou = "Only custom filters can be played. Please add a custom filter or an audioclip to the audiosource (Amb_MainMenu).";

	[HarmonyPatch(typeof(FejdStartup), "Start")]
	[HarmonyPrefix]
	[HarmonyPriority(799)]
	public static void DisableSuppression()
	{
		doneSuppressing = true;
	}

	[HarmonyPatch(typeof(ZLog), "LogWarning")]
	[HarmonyPrefix]
	public static bool SuppressBaseGameWarning(object o)
	{
		return doneSuppressing || !(o is string s) || !IsUnwanted(s);
	}

	private static bool IsUnwanted(string s)
	{
		switch (s)
		{
		case "Fetching PlatformPrefs 'GuiScale' before loading defaults":
		case "Set button \"CamZoomIn\" to None!":
		case "Set button \"CamZoomOut\" to None!":
		case "Missing audio clip in music respawn":
			return true;
		default:
			return false;
		}
	}

	[HarmonyPatch(typeof(Logger), "InternalLogEvent", new Type[]
	{
		typeof(object),
		typeof(LogEventArgs)
	})]
	[HarmonyPrefix]
	public static bool SuppressTheSpecialLogDirectlyInBepInEx(object sender, LogEventArgs eventArgs)
	{
		return doneSuppressing || !(eventArgs.Data is string text) || !(text == "Only custom filters can be played. Please add a custom filter or an audioclip to the audiosource (Amb_MainMenu).");
	}
}