Decompiled source of RestartOverdose v1.0.1

RestartOverdose.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameConsole;
using GameConsole.CommandTree;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using plog;
using plog.Models;

[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: AssemblyCompany("RestartOverdose")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+86be9d7178620fbe0b47984f8f34663330307003")]
[assembly: AssemblyProduct("RestartOverdose")]
[assembly: AssemblyTitle("RestartOverdose")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class ExtensionMarkerAttribute : Attribute
	{
		public ExtensionMarkerAttribute(string name)
		{
		}
	}
}
public static class A_Lot_of_Songs_Recommandation
{
	[Description("TWC Sound Team \"FLiPFORCE\" - ON.UR.MARKS...")]
	public static void ON_UR_MARKS()
	{
	}

	[Description("GOAT SONG: https://www.youtube.com/watch?v=23Y0NZ3jg5w")]
	public static void Xterfusion()
	{
	}

	[Description("Yooh - RPG")]
	public static void RPG()
	{
	}

	[Description("o!mLN4 Sound Team - Illusion's End ~ Reflection's Awakening")]
	public static void Illusions_End()
	{
	}
}
namespace RestartOverdose
{
	[HarmonyPatch(typeof(Console))]
	public class ConsolePatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("Awake")]
		public static void AddConsoleCommands(Console __instance)
		{
			__instance.RegisterCommand((ICommand)(object)new CommandsToRegister(__instance));
		}
	}
	public sealed class CommandsToRegister : CommandRoot, IConsoleLogger
	{
		public override string Name => "restartoverdose";

		public override string Description => "";

		public Logger Log { get; } = new Logger("RestartOverdose");


		public CommandsToRegister(Console con)
			: base(con)
		{
		}//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown


		protected override Branch BuildTree(Console con)
		{
			return CommandRoot.Branch(((CommandRoot)this).Name, (Node[])(object)new Node[2]
			{
				(Node)CommandRoot.Leaf<bool>("setoverride", (Action<bool>)delegate(bool val)
				{
					Setting.overrideRestart = val;
				}, false),
				(Node)CommandRoot.Leaf("getoverride", (Action)delegate
				{
					Log.Info($"overrideRestart: {Setting.overrideRestart}", (IEnumerable<Tag>)null, (string)null, (object)null);
				}, false)
			});
		}
	}
	[Description("Where's S?")]
	public class M
	{
		private readonly List<CodeMatch> _list = new List<CodeMatch>();

		public static M operator >>(M m, OpCode op)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			m._list.Add(new CodeMatch((OpCode?)op, (object)null, (string)null));
			return m;
		}

		public static M operator >>(M m, (OpCode op, object operand) t)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			m._list.Add(new CodeMatch((OpCode?)t.op, t.operand, (string)null));
			return m;
		}

		public static M operator >>(M m, Func<CodeInstruction, bool> pred)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			m._list.Add(new CodeMatch(pred, (string)null));
			return m;
		}

		public static M operator <<(M m, OpCode op)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			m._list.Add(new CodeMatch((OpCode?)op, (object)null, (string)null));
			return m;
		}

		public static M operator <<(M m, (OpCode op, object operand) t)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			m._list.Add(new CodeMatch((OpCode?)t.op, t.operand, (string)null));
			return m;
		}

		public static M operator <<(M m, Func<CodeInstruction, bool> pred)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			m._list.Add(new CodeMatch(pred, (string)null));
			return m;
		}

		public static implicit operator CodeMatch[](M m)
		{
			return m._list.ToArray();
		}
	}
	[Description("运算符Extension太好玩了有没有懂的")]
	public static class OperatorExtension
	{
		[SpecialName]
		public sealed class <G>$8048A6C8BE30A622530249B904B537EB<$T0>
		{
			[SpecialName]
			public static class <M>$2789E59A55056F0AD9E820EBD5BCDFBF
			{
			}

			[ExtensionMarker("<M>$2789E59A55056F0AD9E820EBD5BCDFBF")]
			public static $T0 operator >>($T0 source, Action<$T0> action)
			{
				throw null;
			}

			[ExtensionMarker("<M>$2789E59A55056F0AD9E820EBD5BCDFBF")]
			public static $T0 operator <<($T0 _, $T0 source2)
			{
				throw null;
			}
		}

		public static T op_RightShift<T>(T source, Action<T> action)
		{
			action(source);
			return source;
		}

		public static T op_LeftShift<T>(T _, T source2)
		{
			return source2;
		}
	}
	[BepInPlugin("greycsont.ultrakill.restartoverdose", "RestartOverdose", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			Logger <<= ((BaseUnityPlugin)this).Logger;
			_ = "Plugin greycsont.ultrakill.restartoverdose is loaded!" >> (Action<string>)Logger.LogInfo;
			GameObject gameObject = ((Component)this).gameObject;
			((Object)gameObject).hideFlags = ((Object)gameObject).hideFlags << (HideFlags)4;
			_ = "greycsont.ultrakill.restartoverdose" >> delegate(string id)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				new Harmony(id).PatchAll();
			};
		}
	}
	public static class Setting
	{
		public static bool overrideRestart;
	}
	[Description("<<  <<  << << << | >>  >>  >> >> >>")]
	[HarmonyPatch(typeof(StatsManager))]
	public static class StatsManagerPatch
	{
		[Description("<< <<  <<  << << << | >> >>  >>  >> >> >>")]
		[HarmonyTranspiler]
		[HarmonyPatch("Restart")]
		public static IEnumerable<CodeInstruction> RestartTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			val.MatchForward(false, (CodeMatch[])(new M() << OpCodes.Ldarg_0 << (OpCodes.Ldfld, AccessTools.Field(typeof(StatsManager), "currentCheckPoint")) >> OpCodes.Ldnull >> OpCodes.Call >> ((CodeInstruction i) => i.opcode == OpCodes.Brfalse_S || i.opcode == OpCodes.Brfalse)));
			val.Advance(4);
			Label label = (Label)val.Operand;
			Label label2 = il.DefineLabel();
			return val.SetInstruction(new CodeInstruction(OpCodes.Brtrue_S, (object)label2)).Advance(1).AddLabels((IEnumerable<Label>)new Label[1] { label2 })
				.Insert((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Setting), "overrideRestart")),
					new CodeInstruction(OpCodes.Brfalse_S, (object)label)
				})
				.InstructionEnumeration();
		}
	}
	internal static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "greycsont.ultrakill.restartoverdose";

		public const string PLUGIN_NAME = "RestartOverdose";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}