Decompiled source of DevTools v1.1.1

DevTools.dll

Decompiled 10 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Xml.Linq;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DevTools.GUI;
using Microsoft.CodeAnalysis;
using On;
using TestingLib;
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: AssemblyCompany("DevTools")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Development Tools for Lethal Company. Powered by TestingLib.")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyProduct("DevTools")]
[assembly: AssemblyTitle("DevTools")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.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 DevTools
{
	public class MethodListing
	{
		public Type type;

		public MethodBase methodBase;

		public string value;

		public Type valueType;

		public Visibility visibility;

		public bool state;

		public MethodListing(Type _type, MethodBase _methodBase, string _value, Visibility _visiblity)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			type = _type;
			methodBase = _methodBase;
			value = _value;
			valueType = _value.GetType();
			state = false;
			visibility = _visiblity;
		}

		public MethodListing(Type _type, MethodBase _methodBase, int _value, Visibility _visiblity)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			type = _type;
			methodBase = _methodBase;
			value = _value.ToString();
			valueType = _value.GetType();
			state = false;
			visibility = _visiblity;
		}

		public MethodListing(Type _type, MethodBase _methodBase, bool _value, Visibility _visiblity)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			type = _type;
			methodBase = _methodBase;
			value = _value.ToString();
			valueType = _value.GetType();
			state = false;
			visibility = _visiblity;
		}
	}
	internal class Patcher
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_StartHost <0>__GameNetworkManager_StartHost;

			public static hook_StartAClient <1>__MenuManager_StartAClient;

			public static Action <2>__PlayerSpawn;
		}

		internal static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			object obj = <>O.<0>__GameNetworkManager_StartHost;
			if (obj == null)
			{
				hook_StartHost val = GameNetworkManager_StartHost;
				<>O.<0>__GameNetworkManager_StartHost = val;
				obj = (object)val;
			}
			GameNetworkManager.StartHost += (hook_StartHost)obj;
			object obj2 = <>O.<1>__MenuManager_StartAClient;
			if (obj2 == null)
			{
				hook_StartAClient val2 = MenuManager_StartAClient;
				<>O.<1>__MenuManager_StartAClient = val2;
				obj2 = (object)val2;
			}
			MenuManager.StartAClient += (hook_StartAClient)obj2;
		}

		private static void MenuManager_StartAClient(orig_StartAClient orig, MenuManager self)
		{
			orig.Invoke(self);
			if (GameNetworkManager.Instance.disableSteam)
			{
				InitializePatcher();
				return;
			}
			Patch.UnpatchAll();
			OnEvent.PlayerSpawn -= PlayerSpawn;
		}

		private static void GameNetworkManager_StartHost(orig_StartHost orig, GameNetworkManager self)
		{
			orig.Invoke(self);
			InitializePatcher();
		}

		private static void InitializePatcher()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Invalid comparison between Unknown and I4
			ModMenu.canOpenDevToolsMenu = true;
			if (!ModMenu.menuExists && DevConfig.addModMenu.Value)
			{
				Plugin.myGUIObject = new GameObject("DevToolsGUI");
				Object.DontDestroyOnLoad((Object)(object)Plugin.myGUIObject);
				((Object)Plugin.myGUIObject).hideFlags = (HideFlags)61;
				Plugin.myGUIObject.AddComponent<ModMenu>();
				ModMenu.menuExists = true;
				ModMenu.menuMethods = new List<MethodListing>();
				foreach (MethodListing allMethod in DevConfig.allMethods)
				{
					if ((int)allMethod.visibility == 0 || (int)allMethod.visibility == 2)
					{
						ModMenu.menuMethods.Add(allMethod);
					}
				}
			}
			InvokeMethodsMarkedAs((Available)0);
			OnEvent.PlayerSpawn += PlayerSpawn;
		}

		private static void PlayerSpawn()
		{
			InvokeMethodsMarkedAs((Available)1);
		}

		private static void InvokeMethodsMarkedAs(Available availability)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			int num = 0;
			foreach (MethodListing allMethod in DevConfig.allMethods)
			{
				if (((MemberInfo)allMethod.type).GetCustomAttribute<DevTools>().Time != availability || ((int)allMethod.visibility != 0 && (int)allMethod.visibility != 3))
				{
					continue;
				}
				if (allMethod.valueType == typeof(bool))
				{
					if (allMethod.value == true.ToString())
					{
						allMethod.methodBase.Invoke(null, null);
						num++;
						if (ModMenu.menuExists && allMethod.type.Name == "Patch")
						{
							allMethod.state = true;
						}
					}
				}
				else if (allMethod.valueType == typeof(string))
				{
					if (allMethod.value != "")
					{
						allMethod.methodBase.Invoke(null, new object[1] { allMethod.value });
						num++;
						if (ModMenu.menuExists && allMethod.type.Name == "Patch")
						{
							allMethod.state = true;
						}
					}
				}
				else if (allMethod.valueType == typeof(int) && int.Parse(allMethod.value) != 0)
				{
					allMethod.methodBase.Invoke(null, new object[1] { int.Parse(allMethod.value) });
					num++;
					if (ModMenu.menuExists && allMethod.type.Name == "Patch")
					{
						allMethod.state = true;
					}
				}
			}
			string[] array = ((object)availability).GetType().ToString().Split(new char[1] { '+' });
			Plugin.Logger.LogInfo((object)$"Invoked {num} methods marked as: {array[1]}.{availability}");
		}
	}
	[BepInPlugin("DevTools", "DevTools", "1.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		internal static GameObject myGUIObject;

		internal static string TestingLibLocation;

		public static DevConfig DevToolsConfig { get; internal set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin DevTools is loaded!");
			TestingLibLocation = Chainloader.PluginInfos["hamunii.testinglib"].Location;
			DevToolsConfig = new DevConfig(((BaseUnityPlugin)this).Config);
			Patcher.Init();
			if (DevConfig.addModMenu.Value)
			{
				ToggleGUI.Init();
			}
		}
	}
	public class DevConfig
	{
		public static List<ConfigEntry<bool>> boolConfigs;

		public static List<ConfigEntry<string>> stringConfigs;

		public static List<ConfigEntry<int>> intConfigs;

		public static List<Type> allTypes;

		public static List<MethodListing> allMethods;

		private static List<string> methodNames;

		internal static ConfigEntry<bool> addModMenu;

		public DevConfig(ConfigFile cfg)
		{
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Invalid comparison between Unknown and I4
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Invalid comparison between Unknown and I4
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			boolConfigs = new List<ConfigEntry<bool>>();
			stringConfigs = new List<ConfigEntry<string>>();
			intConfigs = new List<ConfigEntry<int>>();
			allTypes = new List<Type>();
			methodNames = new List<string>();
			allMethods = new List<MethodListing>();
			XDocument xDocument = new XDocument();
			try
			{
				xDocument = XDocument.Load(Path.Combine(Path.GetDirectoryName(Plugin.TestingLibLocation), "TestingLib.xml"));
			}
			catch (Exception arg)
			{
				Plugin.Logger.LogError((object)$"Could not load 'TestingLib.xml'!\n{arg}");
			}
			IEnumerable<string> queryText = from c in xDocument.Root.Descendants("member")
				where c.Attribute("name") != null
				select c.Element("summary").Value;
			foreach (string item in from c in xDocument.Root.Descendants("member")
				where c.Attribute("name") != null
				select c.Attribute("name").Value)
			{
				methodNames.Add(item);
			}
			addModMenu = cfg.Bind<bool>("DevTools Menu", "Add menu", true, "Add DevTools Menu to quick menu.");
			Type[] array = new Type[3]
			{
				typeof(Execute),
				typeof(Patch),
				typeof(Tools)
			};
			foreach (Type type in array)
			{
				if (((MemberInfo)type).GetCustomAttribute<DevTools>() == null || (int)((MemberInfo)type).GetCustomAttribute<DevTools>().Visibility == 1)
				{
					continue;
				}
				allTypes.Add(type);
				MethodBase[] methods = type.GetMethods();
				methods = methods;
				foreach (MethodBase methodBase in methods)
				{
					if (IsMethodBlacklisted(methodBase))
					{
						DevTools customAttribute = ((MemberInfo)methodBase).GetCustomAttribute<DevTools>();
						if (customAttribute != null && (int)customAttribute.Visibility == 2)
						{
							allMethods.Add(new MethodListing(type, methodBase, _value: true, customAttribute.Visibility));
						}
					}
					else
					{
						AddConfigEntry(type, methodBase, queryText, cfg);
					}
				}
			}
			((Dictionary<ConfigDefinition, string>)((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(cfg, null)).Clear();
			cfg.Save();
		}

		public static bool IsMethodBlacklisted(MethodBase method)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Invalid comparison between Unknown and I4
			if (method.Name == "Equals" || method.Name == "GetHashCode" || method.Name == "GetType" || method.Name == "ToString" || (((MemberInfo)method).GetCustomAttribute<DevTools>() != null && ((int)((MemberInfo)method).GetCustomAttribute<DevTools>().Visibility == 1 || (int)((MemberInfo)method).GetCustomAttribute<DevTools>().Visibility == 2)))
			{
				return true;
			}
			return false;
		}

		private static void AddConfigEntry(Type type, MethodBase method, IEnumerable<string> queryText, ConfigFile cfg)
		{
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			string text;
			if (methodNames.Find((string x) => x.Contains(method.Name)) != null)
			{
				text = queryText.ElementAt(methodNames.FindIndex((string x) => x.Contains(method.Name))).Trim();
				string[] array = text.Split(new char[1] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
				List<string> list = new List<string>();
				string[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					StringBuilder stringBuilder = new StringBuilder(array2[i]);
					list.Add(stringBuilder.ToString().Trim());
				}
				text = string.Join("\n", list);
			}
			else
			{
				text = "Description not found.";
			}
			ParameterInfo[] parameters = method.GetParameters();
			if (parameters.Length == 0)
			{
				boolConfigs.Add(cfg.Bind<bool>(type.Name + "." + method.Name, "Patch", true, text ?? ""));
				DevTools customAttribute = ((MemberInfo)method).GetCustomAttribute<DevTools>();
				if (customAttribute == null)
				{
					customAttribute = ((MemberInfo)type).GetCustomAttribute<DevTools>();
				}
				allMethods.Add(new MethodListing(type, method, boolConfigs[boolConfigs.Count - 1].Value, customAttribute.Visibility));
			}
			else if (parameters[0].ParameterType == typeof(bool))
			{
				boolConfigs.Add(cfg.Bind<bool>(type.Name + "." + method.Name, parameters[0].Name, true, text ?? ""));
				DevTools customAttribute2 = ((MemberInfo)method).GetCustomAttribute<DevTools>();
				if (customAttribute2 == null)
				{
					customAttribute2 = ((MemberInfo)type).GetCustomAttribute<DevTools>();
				}
				allMethods.Add(new MethodListing(type, method, boolConfigs[boolConfigs.Count - 1].Value, customAttribute2.Visibility));
			}
			else if (parameters[0].ParameterType == typeof(string))
			{
				stringConfigs.Add(cfg.Bind<string>(type.Name + "." + method.Name, parameters[0].Name, "", text ?? ""));
				DevTools customAttribute3 = ((MemberInfo)method).GetCustomAttribute<DevTools>();
				if (customAttribute3 == null)
				{
					customAttribute3 = ((MemberInfo)type).GetCustomAttribute<DevTools>();
				}
				allMethods.Add(new MethodListing(type, method, stringConfigs[stringConfigs.Count - 1].Value, customAttribute3.Visibility));
			}
			else if (parameters[0].ParameterType == typeof(int) || parameters[0].ParameterType.IsEnum)
			{
				intConfigs.Add(cfg.Bind<int>(type.Name + "." + method.Name, parameters[0].Name, 0, text ?? ""));
				DevTools customAttribute4 = ((MemberInfo)method).GetCustomAttribute<DevTools>();
				if (customAttribute4 == null)
				{
					customAttribute4 = ((MemberInfo)type).GetCustomAttribute<DevTools>();
				}
				allMethods.Add(new MethodListing(type, method, intConfigs[intConfigs.Count - 1].Value, customAttribute4.Visibility));
			}
		}
	}
	internal class ToggleGUI
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OpenQuickMenu <0>__QuickMenuManager_OpenQuickMenu;

			public static hook_CloseQuickMenu <1>__QuickMenuManager_CloseQuickMenu;

			public static hook_LeaveGameConfirm <2>__QuickMenuManager_LeaveGameConfirm;
		}

		internal static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			object obj = <>O.<0>__QuickMenuManager_OpenQuickMenu;
			if (obj == null)
			{
				hook_OpenQuickMenu val = QuickMenuManager_OpenQuickMenu;
				<>O.<0>__QuickMenuManager_OpenQuickMenu = val;
				obj = (object)val;
			}
			QuickMenuManager.OpenQuickMenu += (hook_OpenQuickMenu)obj;
			object obj2 = <>O.<1>__QuickMenuManager_CloseQuickMenu;
			if (obj2 == null)
			{
				hook_CloseQuickMenu val2 = QuickMenuManager_CloseQuickMenu;
				<>O.<1>__QuickMenuManager_CloseQuickMenu = val2;
				obj2 = (object)val2;
			}
			QuickMenuManager.CloseQuickMenu += (hook_CloseQuickMenu)obj2;
			object obj3 = <>O.<2>__QuickMenuManager_LeaveGameConfirm;
			if (obj3 == null)
			{
				hook_LeaveGameConfirm val3 = QuickMenuManager_LeaveGameConfirm;
				<>O.<2>__QuickMenuManager_LeaveGameConfirm = val3;
				obj3 = (object)val3;
			}
			QuickMenuManager.LeaveGameConfirm += (hook_LeaveGameConfirm)obj3;
		}

		private static void QuickMenuManager_OpenQuickMenu(orig_OpenQuickMenu orig, QuickMenuManager self)
		{
			orig.Invoke(self);
			ModMenu.DevToolsMenuOpen = true;
		}

		private static void QuickMenuManager_CloseQuickMenu(orig_CloseQuickMenu orig, QuickMenuManager self)
		{
			orig.Invoke(self);
			ModMenu.DevToolsMenuOpen = false;
		}

		private static void QuickMenuManager_LeaveGameConfirm(orig_LeaveGameConfirm orig, QuickMenuManager self)
		{
			orig.Invoke(self);
			ModMenu.DevToolsMenuOpen = false;
			ModMenu.canOpenDevToolsMenu = false;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "DevTools";

		public const string PLUGIN_NAME = "DevTools";

		public const string PLUGIN_VERSION = "1.1.1";
	}
}
namespace DevTools.GUI
{
	internal class ModMenu : MonoBehaviour
	{
		public bool isMenuOpen;

		private float MENUWIDTH = 800f;

		private float MENUHEIGHT = 400f;

		private float MENUX;

		private float MENUY;

		private float ITEMWIDTH = 300f;

		private float CENTERX;

		private float scrollStart;

		private GUIStyle menuStyle;

		private GUIStyle enableButtonStyle;

		private GUIStyle hScrollStyle;

		private GUIStyle vScrollStyle;

		private Vector2 scrollPosition;

		internal static bool DevToolsMenuOpen = false;

		internal static bool canOpenDevToolsMenu = true;

		public static List<MethodListing> menuMethods;

		internal static bool menuExists = false;

		private void Awake()
		{
			isMenuOpen = false;
			MENUWIDTH = Screen.width / 6;
			MENUHEIGHT = Screen.width / 4;
			ITEMWIDTH = MENUWIDTH / 1.2f;
			MENUX = (float)Screen.width - MENUWIDTH;
			MENUY = (float)(Screen.height / 2) - MENUHEIGHT / 2f;
			CENTERX = MENUX + (MENUWIDTH / 2f - ITEMWIDTH / 2f);
			scrollStart = MENUY + 30f;
		}

		private Texture2D MakeTex(int width, int height, Color col)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = col;
			}
			Texture2D val = new Texture2D(width, height);
			val.SetPixels(array);
			val.Apply();
			return val;
		}

		private void IntitializeMenu()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			if (menuStyle == null)
			{
				menuStyle = new GUIStyle(GUI.skin.box);
				enableButtonStyle = new GUIStyle(GUI.skin.button);
				hScrollStyle = new GUIStyle(GUI.skin.horizontalScrollbar);
				vScrollStyle = new GUIStyle(GUI.skin.verticalScrollbar);
				menuStyle.normal.textColor = Color.white;
				menuStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.01f, 0.1f, 0.9f));
				menuStyle.fontSize = 18;
				((Object)menuStyle.normal.background).hideFlags = (HideFlags)61;
				enableButtonStyle.normal.textColor = Color.white;
				enableButtonStyle.normal.background = MakeTex(2, 2, new Color(0f, 0.01f, 0.2f, 0.9f));
				enableButtonStyle.hover.background = MakeTex(2, 2, new Color(0.4f, 0.01f, 0.1f, 0.9f));
				((Object)enableButtonStyle.normal.background).hideFlags = (HideFlags)61;
				hScrollStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.01f, 0.1f, 0f));
			}
		}

		private void OnGUI()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			if (menuStyle == null)
			{
				IntitializeMenu();
			}
			if (!canOpenDevToolsMenu || !DevToolsMenuOpen)
			{
				return;
			}
			GUI.Box(new Rect(MENUX, MENUY, MENUWIDTH, MENUHEIGHT), "DevTools Menu", menuStyle);
			scrollPosition = GUI.BeginScrollView(new Rect(MENUX, MENUY + 30f, MENUWIDTH, MENUHEIGHT - 50f), scrollPosition, new Rect(MENUX, scrollStart, ITEMWIDTH, (float)(menuMethods.Count * 30)), false, true, hScrollStyle, vScrollStyle);
			int num = 0;
			foreach (MethodListing menuMethod in menuMethods)
			{
				if (menuMethod.state)
				{
					if (GUI.Button(new Rect(CENTERX, MENUY + 30f + (float)(num * 30), ITEMWIDTH, 30f), menuMethod.type.Name + "." + menuMethod.methodBase.Name, enableButtonStyle))
					{
						if (menuMethod.methodBase.Name != "PatchAll")
						{
							menuMethod.state = false;
						}
						menuMethods.Find((MethodListing x) => x.methodBase.Name.Equals("UnpatchAll")).methodBase.Invoke(null, null);
						foreach (MethodListing menuMethod2 in menuMethods)
						{
							if (menuMethod2.type.Name == "Patch" && menuMethod2.state && menuMethod2.methodBase.Name != "PatchAll")
							{
								menuMethod2.methodBase.Invoke(null, null);
							}
						}
					}
				}
				else if (GUI.Button(new Rect(CENTERX, MENUY + 30f + (float)(num * 30), ITEMWIDTH, 30f), menuMethod.type.Name + "." + menuMethod.methodBase.Name))
				{
					menuMethod.methodBase.Invoke(null, null);
					if (menuMethod.type.Name == "Patch" && menuMethod.methodBase.Name != "PatchAll")
					{
						menuMethod.state = true;
					}
					if (menuMethod.methodBase.Name == "PatchAll")
					{
						foreach (MethodListing menuMethod3 in menuMethods)
						{
							if (menuMethod3.type.Name == "Patch" && menuMethod3.methodBase.Name != "UnpatchAll" && menuMethod3.methodBase.Name != "PatchAll")
							{
								menuMethod3.state = true;
							}
						}
					}
					else if (menuMethod.methodBase.Name == "UnpatchAll")
					{
						foreach (MethodListing menuMethod4 in menuMethods)
						{
							menuMethod4.state = false;
						}
					}
				}
				num++;
			}
			GUI.EndScrollView();
		}
	}
}