Decompiled source of FastStartup v1.0.1

BepInEx/plugins/CTNOriginals.FastStartup.dll

Decompiled 3 months 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.Logging;
using FastStartup.Utils;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("MainMenuAssembly")]
[assembly: IgnoresAccessChecksTo("SPZGameAssembly")]
[assembly: AssemblyCompany("CTNOriginals.FastStartup")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4113f7f3502841ecb59f6090e968dd735e825b93")]
[assembly: AssemblyProduct("FastStartup")]
[assembly: AssemblyTitle("CTNOriginals.FastStartup")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FastStartup
{
	[BepInPlugin("CTNOriginals.FastStartup", "FastStartup", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static Harmony Harmony = new Harmony("CTNOriginals.FastStartup");

		public static bool DebugMode = false;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)("Plugin CTNOriginals.FastStartup is loaded! (" + (DebugMode ? "Debug" : "Release") + ")"));
			Harmony.PatchAll();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CTNOriginals.FastStartup";

		public const string PLUGIN_NAME = "FastStartup";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace FastStartup.Utils
{
	public static class CLogger
	{
		public static void Log(string message)
		{
			SendLog(message, "Log");
		}

		public static void LogInfo(string message)
		{
			SendLog(message, "LogInfo");
		}

		public static void LogError(string message)
		{
			SendLog(message, "LogError");
		}

		public static void LogWarning(string message)
		{
			SendLog(message, "LogWarning");
		}

		public static void LogDebug(string message)
		{
			SendLog(message, "LogDebug");
		}

		public static void LogFatal(string message)
		{
			SendLog(message, "LogFatal");
		}

		public static void LogMessage(string message)
		{
			SendLog(message, "LogMessage");
		}

		public static void LogException(string message, SystemException exception)
		{
			SendLog(message, "LogException", exception);
		}

		private static void SendLog(string message, string level = null, SystemException exception = null)
		{
			if (!Plugin.DebugMode && (level == "LogDebug" || level == "LogInfo"))
			{
				return;
			}
			switch (level)
			{
			case "LogInfo":
				Plugin.Logger.LogInfo((object)message);
				break;
			case "LogError":
				Plugin.Logger.LogError((object)message);
				break;
			case "LogWarning":
				Plugin.Logger.LogWarning((object)message);
				break;
			case "LogDebug":
				Plugin.Logger.LogDebug((object)message);
				break;
			case "LogFatal":
				Plugin.Logger.LogFatal((object)message);
				break;
			case "LogMessage":
				Plugin.Logger.LogMessage((object)message);
				break;
			case "LogException":
				if (exception == null)
				{
					Plugin.Logger.LogError((object)(message ?? ""));
				}
				Plugin.Logger.LogError((object)(message + "\nMessage: " + exception.Message + "\nSource: " + exception.Source + "\n" + exception.GetBaseException().StackTrace + "\n"));
				break;
			default:
				if (level != "Log")
				{
					Debug.Log((object)("[" + level + "]: " + message));
				}
				else
				{
					Debug.Log((object)message);
				}
				break;
			}
		}
	}
}
namespace FastStartup.Patches
{
	[HarmonyPatch(typeof(Preloader))]
	public static class PreloaderPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void StartPatch(ref Preloader __instance)
		{
			CLogger.LogDebug("Preloader.Start");
			Preloader obj = __instance;
			obj.StateIndex++;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}