Decompiled source of Skip Intro v1.0.0

SkipIntro.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.IO;
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;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SkipIntro")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Skip Intro")]
[assembly: AssemblyTitle("SkipIntro")]
[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;
		}
	}
}
namespace SkipIntro
{
	[HarmonyPatch(typeof(MovieScene))]
	internal class PatchesMovieClass
	{
		[HarmonyPostfix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static void Postfix7(MovieScene __instance)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Invalid comparison between Unknown and I4
			if (Plugin.PluginConfig.Enabled.Value && Plugin.PluginConfig.SkipMovie.Value && (Object)(object)__instance != (Object)null && MovieScene.MovieKindList.Count > 0 && (int)MovieScene.MovieKindList[0] == 0)
			{
				try
				{
					__instance.RemoveMovie();
				}
				catch
				{
				}
			}
		}
	}
	[HarmonyPatch(typeof(LogoScene))]
	internal class PatchesLogoSceneClass
	{
		[HarmonyPostfix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static void Postfix7(LogoScene __instance)
		{
			if (Plugin.PluginConfig.Enabled.Value && Plugin.PluginConfig.SkipLogo.Value)
			{
				__instance.SetStep((EStep)7);
			}
		}
	}
	[BepInPlugin("SkipIntro", "Skip Intro", "1.0.0")]
	public class Plugin : BasePlugin
	{
		internal static ManualLogSource Log;

		internal static PluginConfig PluginConfig;

		public override void Load()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("SkipIntro");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			PluginConfig = new PluginConfig(((BasePlugin)this).Config);
			Harmony val2 = new Harmony("SkipIntro");
			val2.PatchAll();
		}
	}
	internal class PluginConfig
	{
		public ConfigFile Config;

		private FileSystemWatcher _watcher;

		internal ConfigEntry<bool> Enabled;

		internal ConfigEntry<bool> SkipLogo;

		internal ConfigEntry<bool> SkipMovie;

		public PluginConfig(ConfigFile config)
		{
			Config = config;
			Initialize();
			InitializeWatcher();
		}

		public void Initialize()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_002d: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_005e: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_008f: Expected O, but got Unknown
			Enabled = Config.Bind<bool>(new ConfigDefinition("General", "Enabled"), true, new ConfigDescription("Enable plugin patches.", (AcceptableValueBase)null, Array.Empty<object>()));
			SkipLogo = Config.Bind<bool>(new ConfigDefinition("General", "SkipLogo"), true, new ConfigDescription("Skip game logo scenes automatically.", (AcceptableValueBase)null, Array.Empty<object>()));
			SkipMovie = Config.Bind<bool>(new ConfigDefinition("General", "SkipMovie"), true, new ConfigDescription("Skip intro movie automatically.", (AcceptableValueBase)null, Array.Empty<object>()));
		}

		public void InitializeWatcher()
		{
			_watcher = new FileSystemWatcher(Path.GetDirectoryName(Config.ConfigFilePath))
			{
				Filter = Path.GetFileName(Config.ConfigFilePath),
				NotifyFilter = (NotifyFilters.Size | NotifyFilters.LastWrite),
				IncludeSubdirectories = false
			};
			_watcher.Changed += delegate
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				RefreshConfig();
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("SkipIntro");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" config reloaded!");
				}
				log.LogInfo(val);
			};
			_watcher.EnableRaisingEvents = true;
		}

		public void RefreshConfig()
		{
			try
			{
				Config.Reload();
			}
			catch (Exception)
			{
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SkipIntro";

		public const string PLUGIN_NAME = "Skip Intro";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}