Decompiled source of BigWalk SkipIntro v1.0.1

BepInEx/plugins/BigWalk.SkipIntro.dll

Decompiled 13 hours 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 BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BigWalk.SkipIntro")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Skips the splash screen and microphone check on startup.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+01b4108d2031a39da824d14cb10907331a29f141")]
[assembly: AssemblyProduct("BigWalk.SkipIntro")]
[assembly: AssemblyTitle("BigWalk.SkipIntro")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 BigWalk.SkipIntro
{
	[BepInPlugin("com.bigwalk.skipintro", "Big Walk — Skip Intro", "1.0.1")]
	public class Plugin : BasePlugin
	{
		public const string Guid = "com.bigwalk.skipintro";

		internal static ConfigEntry<bool> SkipSplash;

		internal static ConfigEntry<bool> SkipMicCheck;

		internal static ManualLogSource Trace;

		public override void Load()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			Trace = ((BasePlugin)this).Log;
			SkipSplash = ((BasePlugin)this).Config.Bind<bool>("General", "SkipSplash", true, "Skip the splash screen on startup.");
			SkipMicCheck = ((BasePlugin)this).Config.Bind<bool>("General", "SkipMicCheck", true, "Skip the microphone check screen on startup.");
			Harmony val = new Harmony("com.bigwalk.skipintro");
			if (SkipSplash.Value)
			{
				val.PatchAll(typeof(SplashMenuPatch));
				((BasePlugin)this).Log.LogInfo((object)"Patched SplashMenu.");
			}
			if (SkipMicCheck.Value)
			{
				val.PatchAll(typeof(MicCheckMenuPatch));
				((BasePlugin)this).Log.LogInfo((object)"Patched MicCheckMenu.");
			}
			if (!SkipSplash.Value && !SkipMicCheck.Value)
			{
				((BasePlugin)this).Log.LogInfo((object)"Both skips disabled by config; nothing patched.");
			}
		}
	}
	[HarmonyPatch(typeof(SplashMenu), "OnEnable")]
	internal static class SplashMenuPatch
	{
		private static void Postfix(SplashMenu __instance)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			try
			{
				__instance.ActionContinue();
				Plugin.Trace.LogInfo((object)"Splash auto-continued.");
			}
			catch (Exception ex)
			{
				ManualLogSource trace = Plugin.Trace;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(23, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to skip splash: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				trace.LogError(val);
			}
		}
	}
	[HarmonyPatch(typeof(MicCheckMenu), "OnEnable")]
	internal static class MicCheckMenuPatch
	{
		private static void Postfix(MicCheckMenu __instance)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			try
			{
				__instance.ActionContinue();
				Plugin.Trace.LogInfo((object)"Mic check auto-continued.");
			}
			catch (Exception ex)
			{
				ManualLogSource trace = Plugin.Trace;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(26, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to skip mic check: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				trace.LogError(val);
			}
		}
	}
}