Decompiled source of Pingu Modpack v69.420.0

2018-LC_API/LC_API.dll

Decompiled 6 months ago
using System;
using System.Collections.Concurrent;
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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LC_API.BundleAPI;
using LC_API.Comp;
using LC_API.Data;
using LC_API.Extensions;
using LC_API.GameInterfaceAPI;
using LC_API.ManualPatches;
using LC_API.ServerAPI;
using Microsoft.CodeAnalysis;
using Steamworks;
using Steamworks.Data;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("LC_API")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Utilities for plugin devs")]
[assembly: AssemblyFileVersion("2.1.1.0")]
[assembly: AssemblyInformationalVersion("2.1.1")]
[assembly: AssemblyProduct("LC_API")]
[assembly: AssemblyTitle("LC_API")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.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 LC_API
{
	internal static class CheatDatabase
	{
		private const string DAT_CD_BROADCAST = "LC_API_CD_Broadcast";

		private const string SIG_REQ_GUID = "LC_API_ReqGUID";

		private const string SIG_SEND_MODS = "LC_APISendMods";

		private static Dictionary<string, PluginInfo> PluginsLoaded = new Dictionary<string, PluginInfo>();

		public static void RunLocalCheatDetector()
		{
			PluginsLoaded = Chainloader.PluginInfos;
			using Dictionary<string, PluginInfo>.ValueCollection.Enumerator enumerator = PluginsLoaded.Values.GetEnumerator();
			while (enumerator.MoveNext())
			{
				switch (enumerator.Current.Metadata.GUID)
				{
				case "mikes.lethalcompany.mikestweaks":
				case "mom.llama.enhancer":
				case "Posiedon.GameMaster":
				case "LethalCompanyScalingMaster":
				case "verity.amberalert":
					ModdedServer.SetServerModdedOnly();
					break;
				}
			}
		}

		public static void OtherPlayerCheatDetector()
		{
			Plugin.Log.LogWarning((object)"Asking all other players for their mod list..");
			GameTips.ShowTip("Mod List:", "Asking all other players for installed mods..");
			GameTips.ShowTip("Mod List:", "Check the logs for more detailed results.\n<size=13>(Note that if someone doesnt show up on the list, they may not have LC_API installed)</size>");
			Networking.Broadcast("LC_API_CD_Broadcast", "LC_API_ReqGUID");
		}

		internal static void CDNetGetString(string data, string signature)
		{
			if (data == "LC_API_CD_Broadcast" && signature == "LC_API_ReqGUID")
			{
				string text = "";
				foreach (PluginInfo value in PluginsLoaded.Values)
				{
					text = text + "\n" + value.Metadata.GUID;
				}
				Networking.Broadcast(GameNetworkManager.Instance.localPlayerController.playerUsername + " responded with these mods:" + text, "LC_APISendMods");
			}
			if (signature == "LC_APISendMods")
			{
				GameTips.ShowTip("Mod List:", data);
				Plugin.Log.LogWarning((object)data);
			}
		}
	}
	[BepInPlugin("LC_API", "LC_API", "2.1.1")]
	public sealed class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private ConfigEntry<bool> configOverrideModServer;

		private ConfigEntry<bool> configLegacyAssetLoading;

		private ConfigEntry<bool> configDisableBundleLoader;

		public static bool Initialized { get; private set; }

		private void Awake()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			configOverrideModServer = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Force modded server browser", false, "Should the API force you into the modded server browser?");
			configLegacyAssetLoading = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Legacy asset bundle loading", false, "Should the BundleLoader use legacy asset loading? Turning this on may help with loading assets from older plugins.");
			configDisableBundleLoader = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable BundleLoader", false, "Should the BundleLoader be turned off? Enable this if you are having problems with mods that load assets using a different method from LC_API's BundleLoader.");
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogWarning((object)"\n.____    _________           _____  __________ .___  \r\n|    |   \\_   ___ \\         /  _  \\ \\______   \\|   | \r\n|    |   /    \\  \\/        /  /_\\  \\ |     ___/|   | \r\n|    |___\\     \\____      /    |    \\|    |    |   | \r\n|_______ \\\\______  /______\\____|__  /|____|    |___| \r\n        \\/       \\//_____/        \\/                 \r\n                                                     ");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LC_API Starting up..");
			if (configOverrideModServer.Value)
			{
				ModdedServer.SetServerModdedOnly();
			}
			Harmony val = new Harmony("ModAPI");
			MethodInfo methodInfo = AccessTools.Method(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyCreated", (Type[])null, (Type[])null);
			AccessTools.Method(typeof(GameNetworkManager), "LobbyDataIsJoinable", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(ServerPatch), "OnLobbyCreate", (Type[])null, (Type[])null);
			MethodInfo methodInfo3 = AccessTools.Method(typeof(MenuManager), "Awake", (Type[])null, (Type[])null);
			MethodInfo methodInfo4 = AccessTools.Method(typeof(ServerPatch), "CacheMenuManager", (Type[])null, (Type[])null);
			MethodInfo methodInfo5 = AccessTools.Method(typeof(HUDManager), "AddChatMessage", (Type[])null, (Type[])null);
			MethodInfo methodInfo6 = AccessTools.Method(typeof(ServerPatch), "ChatInterpreter", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo3, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)methodInfo5, new HarmonyMethod(methodInfo6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			Networking.GetString = (Action<string, string>)Delegate.Combine(Networking.GetString, new Action<string, string>(CheatDatabase.CDNetGetString));
			Networking.GetListString = (Action<List<string>, string>)Delegate.Combine(Networking.GetListString, new Action<List<string>, string>(Networking.LCAPI_NET_SYNCVAR_SET));
		}

		internal void Start()
		{
			Initialize();
		}

		internal void OnDestroy()
		{
			Initialize();
		}

		internal void Initialize()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			if (!Initialized)
			{
				Initialized = true;
				if (!configDisableBundleLoader.Value)
				{
					BundleLoader.Load(configLegacyAssetLoading.Value);
				}
				GameObject val = new GameObject("API");
				Object.DontDestroyOnLoad((Object)val);
				val.AddComponent<LC_APIManager>();
				((BaseUnityPlugin)this).Logger.LogInfo((object)"LC_API Started!");
				CheatDatabase.RunLocalCheatDetector();
			}
		}

		internal static void PatchMethodManual(MethodInfo method, MethodInfo patch, Harmony harmony)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmony.Patch((MethodBase)method, new HarmonyMethod(patch), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LC_API";

		public const string PLUGIN_NAME = "LC_API";

		public const string PLUGIN_VERSION = "2.1.1";
	}
}
namespace LC_API.ServerAPI
{
	public static class ModdedServer
	{
		private static bool moddedOnly;

		[Obsolete("Use SetServerModdedOnly() instead. This will be removed/private in a future update.")]
		public static bool setModdedOnly;

		public static bool ModdedOnly => moddedOnly;

		public static void SetServerModdedOnly()
		{
			moddedOnly = true;
			Plugin.Log.LogMessage((object)"A plugin has set your game to only allow you to play with other people who have mods!");
		}

		public static void OnSceneLoaded()
		{
			if (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) && ModdedOnly)
			{
				GameNetworkManager instance = GameNetworkManager.Instance;
				instance.gameVersionNum += 16440;
				setModdedOnly = true;
			}
		}
	}
	public static class Networking
	{
		public static Action<string, string> GetString = delegate
		{
		};

		public static Action<List<string>, string> GetListString = delegate
		{
		};

		public static Action<int, string> GetInt = delegate
		{
		};

		public static Action<float, string> GetFloat = delegate
		{
		};

		public static Action<Vector3, string> GetVector3 = delegate
		{
		};

		private static Dictionary<string, string> syncStringVars = new Dictionary<string, string>();

		public static void Broadcast(string data, string signature)
		{
			if (data.Contains("/"))
			{
				Plugin.Log.LogError((object)"Invalid character in broadcasted string event! ( / )");
				return;
			}
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data + "/" + signature + "/" + NetworkBroadcastDataType.BDstring.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(List<string> data, string signature)
		{
			string text = "";
			foreach (string datum in data)
			{
				if (datum.Contains("/"))
				{
					Plugin.Log.LogError((object)"Invalid character in broadcasted string event! ( / )");
					return;
				}
				if (datum.Contains("\n"))
				{
					Plugin.Log.LogError((object)"Invalid character in broadcasted string event! ( NewLine )");
					return;
				}
				text = text + datum + "\n";
			}
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data?.ToString() + "/" + signature + "/" + NetworkBroadcastDataType.BDlistString.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(int data, string signature)
		{
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data + "/" + signature + "/" + NetworkBroadcastDataType.BDint.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(float data, string signature)
		{
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data + "/" + signature + "/" + NetworkBroadcastDataType.BDfloat.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(Vector3 data, string signature)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			HUDManager instance = HUDManager.Instance;
			string[] obj = new string[9] { "<size=0>NWE/", null, null, null, null, null, null, null, null };
			Vector3 val = data;
			obj[1] = ((object)(Vector3)(ref val)).ToString();
			obj[2] = "/";
			obj[3] = signature;
			obj[4] = "/";
			obj[5] = NetworkBroadcastDataType.BDvector3.ToString();
			obj[6] = "/";
			obj[7] = GameNetworkManager.Instance.localPlayerController.playerClientId.ToString();
			obj[8] = "/</size>";
			instance.AddTextToChatOnServer(string.Concat(obj), -1);
		}

		public static void RegisterSyncVariable(string name)
		{
			if (!syncStringVars.ContainsKey(name))
			{
				syncStringVars.Add(name, "");
			}
			else
			{
				Plugin.Log.LogError((object)("Cannot register Sync Variable! A Sync Variable has already been registered with name " + name));
			}
		}

		public static void SetSyncVariable(string name, string value)
		{
			if (syncStringVars.ContainsKey(name))
			{
				syncStringVars[name] = value;
				Broadcast(new List<string> { name, value }, "LCAPI_NET_SYNCVAR_SET");
			}
			else
			{
				Plugin.Log.LogError((object)("Cannot set the value of Sync Variable " + name + " as it is not registered!"));
			}
		}

		private static void SetSyncVariableB(string name, string value)
		{
			if (syncStringVars.ContainsKey(name))
			{
				syncStringVars[name] = value;
			}
			else
			{
				Plugin.Log.LogError((object)("Cannot set the value of Sync Variable " + name + " as it is not registered!"));
			}
		}

		internal static void LCAPI_NET_SYNCVAR_SET(List<string> list, string arg2)
		{
			if (arg2 == "LCAPI_NET_SYNCVAR_SET")
			{
				SetSyncVariableB(list[0], list[1]);
			}
		}

		public static string GetSyncVariable(string name)
		{
			if (syncStringVars.ContainsKey(name))
			{
				return syncStringVars[name];
			}
			Plugin.Log.LogError((object)("Cannot get the value of Sync Variable " + name + " as it is not registered!"));
			return "";
		}

		private static void GotString(string data, string signature)
		{
		}

		private static void GotInt(int data, string signature)
		{
		}

		private static void GotFloat(float data, string signature)
		{
		}

		private static void GotVector3(Vector3 data, string signature)
		{
		}
	}
}
namespace LC_API.ManualPatches
{
	internal static class ServerPatch
	{
		internal static bool OnLobbyCreate(GameNetworkManager __instance, Result result, Lobby lobby)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if ((int)result != 1)
			{
				Debug.LogError((object)$"Lobby could not be created! {result}", (Object)(object)__instance);
			}
			__instance.lobbyHostSettings.lobbyName = "[MODDED]" + __instance.lobbyHostSettings.lobbyName.ToString();
			Plugin.Log.LogMessage((object)"server pre-setup success");
			return true;
		}

		internal static bool CacheMenuManager(MenuManager __instance)
		{
			LC_APIManager.MenuManager = __instance;
			return true;
		}

		internal static bool ChatInterpreter(HUDManager __instance, string chatMessage)
		{
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			if (!chatMessage.Contains("NWE") || !chatMessage.Contains("<size=0>"))
			{
				return true;
			}
			string[] array = chatMessage.Split(new char[1] { '/' });
			if (array.Length < 5)
			{
				if (array.Length >= 3)
				{
					if (!int.TryParse(array[4], out var result))
					{
						Plugin.Log.LogWarning((object)"Failed to parse player ID!!");
						return false;
					}
					if ((result == (int)GameNetworkManager.Instance.localPlayerController.playerClientId) & !LC_APIManager.netTester)
					{
						return false;
					}
					Enum.TryParse<NetworkBroadcastDataType>(array[3], out var result2);
					switch (result2)
					{
					case NetworkBroadcastDataType.BDstring:
						Networking.GetString(array[1], array[2]);
						break;
					case NetworkBroadcastDataType.BDint:
						Networking.GetInt(int.Parse(array[1]), array[2]);
						break;
					case NetworkBroadcastDataType.BDfloat:
						Networking.GetFloat(float.Parse(array[1]), array[2]);
						break;
					case NetworkBroadcastDataType.BDvector3:
					{
						string[] array2 = array[1].Replace("(", "").Replace(")", "").Split(new char[1] { ',' });
						Vector3 arg = default(Vector3);
						if (array2.Length == 3)
						{
							if (float.TryParse(array2[0], out var result3) && float.TryParse(array2[1], out var result4) && float.TryParse(array2[2], out var result5))
							{
								arg.x = result3;
								arg.y = result4;
								arg.z = result5;
							}
							else
							{
								Plugin.Log.LogError((object)"Vector3 Network receive fail. This is a failure of the API, and it should be reported as a bug.");
							}
						}
						else
						{
							Plugin.Log.LogError((object)"Vector3 Network receive fail. This is a failure of the API, and it should be reported as a bug.");
						}
						Networking.GetVector3(arg, array[2]);
						break;
					}
					case NetworkBroadcastDataType.BDlistString:
					{
						string[] source = array[1].Split(new char[1] { '\n' });
						Networking.GetListString(source.ToList(), array[2]);
						break;
					}
					}
					_ = LC_APIManager.netTester;
					return false;
				}
				Plugin.Log.LogError((object)"Generic Network receive fail. This is a failure of the API, and it should be reported as a bug.");
				Plugin.Log.LogError((object)$"Generic Network receive fail (expected 5+ data fragments, got {array.Length}). This is a failure of the API, and it should be reported as a bug.");
				return true;
			}
			if (!int.TryParse(array[4], out var result6))
			{
				Plugin.Log.LogWarning((object)("Failed to parse player ID '" + array[4] + "'!!"));
				return false;
			}
			if ((result6 == (int)GameNetworkManager.Instance.localPlayerController.playerClientId) & !LC_APIManager.netTester)
			{
				return false;
			}
			if (!Enum.TryParse<NetworkBroadcastDataType>(array[3], out var result7))
			{
				Plugin.Log.LogError((object)("Unknown datatype - unable to parse '" + array[3] + "' into a known data type!"));
				return false;
			}
			switch (result7)
			{
			case NetworkBroadcastDataType.BDstring:
				Networking.GetString.InvokeActionSafe(array[1], array[2]);
				break;
			case NetworkBroadcastDataType.BDint:
				Networking.GetInt.InvokeActionSafe(int.Parse(array[1]), array[2]);
				break;
			case NetworkBroadcastDataType.BDfloat:
				Networking.GetFloat.InvokeActionSafe(float.Parse(array[1]), array[2]);
				break;
			case NetworkBroadcastDataType.BDvector3:
			{
				string text = array[1].Trim('(', ')');
				string[] array3 = text.Split(new char[1] { ',' });
				Vector3 param = default(Vector3);
				float result8;
				float result9;
				float result10;
				if (array3.Length != 3)
				{
					Plugin.Log.LogError((object)$"Vector3 Network receive fail (expected 3 numbers, got {array3.Length} number(?)(s) instead). This is a failure of the API, and it should be reported as a bug. (passing an empty Vector3 in its place)");
				}
				else if (float.TryParse(array3[0], out result8) && float.TryParse(array3[1], out result9) && float.TryParse(array3[2], out result10))
				{
					param.x = result8;
					param.y = result9;
					param.z = result10;
				}
				else
				{
					Plugin.Log.LogError((object)("Vector3 Network receive fail (failed to parse '" + text + "' as numbers). This is a failure of the API, and it should be reported as a bug."));
				}
				Networking.GetVector3.InvokeActionSafe(param, array[2]);
				break;
			}
			}
			_ = LC_APIManager.netTester;
			return false;
		}

		internal static bool ChatCommands(HUDManager __instance, CallbackContext context)
		{
			if (__instance.chatTextField.text.ToLower().Contains("/modcheck"))
			{
				CheatDatabase.OtherPlayerCheatDetector();
				return false;
			}
			return true;
		}
	}
}
namespace LC_API.GameInterfaceAPI
{
	public static class GameState
	{
		private static readonly Action NothingAction = delegate
		{
		};

		public static int AlivePlayerCount { get; private set; }

		public static ShipState ShipState { get; private set; }

		public static event Action PlayerDied;

		public static event Action LandOnMoon;

		public static event Action WentIntoOrbit;

		public static event Action ShipStartedLeaving;

		internal static void GSUpdate()
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null))
			{
				if (StartOfRound.Instance.shipHasLanded && ShipState != ShipState.OnMoon)
				{
					ShipState = ShipState.OnMoon;
					GameState.LandOnMoon.InvokeActionSafe();
				}
				if (StartOfRound.Instance.inShipPhase && ShipState != 0)
				{
					ShipState = ShipState.InOrbit;
					GameState.WentIntoOrbit.InvokeActionSafe();
				}
				if (StartOfRound.Instance.shipIsLeaving && ShipState != ShipState.LeavingMoon)
				{
					ShipState = ShipState.LeavingMoon;
					GameState.ShipStartedLeaving.InvokeActionSafe();
				}
				if (AlivePlayerCount < StartOfRound.Instance.livingPlayers)
				{
					GameState.PlayerDied.InvokeActionSafe();
				}
				AlivePlayerCount = StartOfRound.Instance.livingPlayers;
			}
		}

		static GameState()
		{
			GameState.PlayerDied = NothingAction;
			GameState.LandOnMoon = NothingAction;
			GameState.WentIntoOrbit = NothingAction;
			GameState.ShipStartedLeaving = NothingAction;
		}
	}
	public class GameTips
	{
		private static List<string> tipHeaders = new List<string>();

		private static List<string> tipBodys = new List<string>();

		private static float lastMessageTime;

		public static void ShowTip(string header, string body)
		{
			tipHeaders.Add(header);
			tipBodys.Add(body);
		}

		public static void UpdateInternal()
		{
			lastMessageTime -= Time.deltaTime;
			if ((tipHeaders.Count > 0) & (lastMessageTime < 0f))
			{
				lastMessageTime = 5f;
				if ((Object)(object)HUDManager.Instance != (Object)null)
				{
					HUDManager.Instance.DisplayTip(tipHeaders[0], tipBodys[0], false, false, "LC_Tip1");
				}
				tipHeaders.RemoveAt(0);
				tipBodys.RemoveAt(0);
			}
		}
	}
}
namespace LC_API.Extensions
{
	public static class DelegateExtensions
	{
		private static readonly PropertyInfo PluginGetLogger = AccessTools.Property(typeof(BaseUnityPlugin), "Logger");

		public static void InvokeActionSafe(this Action action)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			if (action == null)
			{
				return;
			}
			Delegate[] invocationList = action.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((Action)@delegate)();
				}
				catch (Exception ex)
				{
					Plugin.Log.LogError((object)"Exception while invoking hook callback!");
					string asmName = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					PluginInfo val = ((IEnumerable<PluginInfo>)Chainloader.PluginInfos.Values).FirstOrDefault((Func<PluginInfo, bool>)((PluginInfo pi) => ((object)pi.Instance).GetType().Assembly.FullName == asmName));
					if (val == null)
					{
						Plugin.Log.LogError((object)ex.ToString());
						break;
					}
					((ManualLogSource)PluginGetLogger.GetValue(val.Instance)).LogError((object)ex.ToString());
				}
			}
		}

		public static void InvokeActionSafe<T>(this Action<T> action, T param)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			if (action == null)
			{
				return;
			}
			Delegate[] invocationList = action.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((Action<T>)@delegate)(param);
				}
				catch (Exception ex)
				{
					Plugin.Log.LogError((object)"Exception while invoking hook callback!");
					string asmName = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					PluginInfo val = ((IEnumerable<PluginInfo>)Chainloader.PluginInfos.Values).FirstOrDefault((Func<PluginInfo, bool>)((PluginInfo pi) => ((object)pi.Instance).GetType().Assembly.FullName == asmName));
					if (val == null)
					{
						Plugin.Log.LogError((object)ex.ToString());
						break;
					}
					((ManualLogSource)PluginGetLogger.GetValue(val.Instance)).LogError((object)ex.ToString());
				}
			}
		}

		public static void InvokeActionSafe<T1, T2>(this Action<T1, T2> action, T1 param1, T2 param2)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (action == null)
			{
				return;
			}
			Delegate[] invocationList = action.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((Action<T1, T2>)@delegate)(param1, param2);
				}
				catch (Exception ex)
				{
					Plugin.Log.LogError((object)"Exception while invoking hook callback!");
					string asmName = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					PluginInfo val = ((IEnumerable<PluginInfo>)Chainloader.PluginInfos.Values).FirstOrDefault((Func<PluginInfo, bool>)((PluginInfo pi) => ((object)pi.Instance).GetType().Assembly.FullName == asmName));
					if (val == null)
					{
						Plugin.Log.LogError((object)ex.ToString());
						break;
					}
					((ManualLogSource)PluginGetLogger.GetValue(val.Instance)).LogError((object)ex.ToString());
				}
			}
		}

		internal static void InvokeParameterlessDelegate<T>(this T paramlessDelegate) where T : Delegate
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			if ((Delegate?)paramlessDelegate == (Delegate?)null)
			{
				return;
			}
			Delegate[] invocationList = paramlessDelegate.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					((T)@delegate).DynamicInvoke();
				}
				catch (Exception ex)
				{
					Plugin.Log.LogError((object)"Exception while invoking hook callback!");
					string asmName = @delegate.GetMethodInfo().DeclaringType.Assembly.FullName;
					PluginInfo val = ((IEnumerable<PluginInfo>)Chainloader.PluginInfos.Values).FirstOrDefault((Func<PluginInfo, bool>)((PluginInfo pi) => ((object)pi.Instance).GetType().Assembly.FullName == asmName));
					if (val == null)
					{
						Plugin.Log.LogError((object)ex.ToString());
						break;
					}
					((ManualLogSource)PluginGetLogger.GetValue(val.Instance)).LogError((object)ex.ToString());
				}
			}
		}
	}
}
namespace LC_API.Data
{
	internal enum NetworkBroadcastDataType
	{
		Unknown,
		BDint,
		BDfloat,
		BDvector3,
		BDstring,
		BDlistString
	}
	public enum ShipState
	{
		InOrbit,
		OnMoon,
		LeavingMoon
	}
}
namespace LC_API.Comp
{
	internal class LC_APIManager : MonoBehaviour
	{
		public static MenuManager MenuManager;

		public static bool netTester;

		private static int playerCount;

		private static bool wanttoCheckMods;

		private static float lobbychecktimer;

		public void Update()
		{
			GameState.GSUpdate();
			GameTips.UpdateInternal();
			if ((((Object)(object)HUDManager.Instance != (Object)null) & netTester) && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				Networking.Broadcast("testerData", "testerSignature");
			}
			if (!ModdedServer.setModdedOnly)
			{
				ModdedServer.OnSceneLoaded();
			}
			else if (ModdedServer.ModdedOnly && (Object)(object)MenuManager != (Object)null && Object.op_Implicit((Object)(object)MenuManager.versionNumberText))
			{
				((TMP_Text)MenuManager.versionNumberText).text = $"v{GameNetworkManager.Instance.gameVersionNum - 16440}\nMOD";
			}
			if ((Object)(object)GameNetworkManager.Instance != (Object)null)
			{
				if (playerCount < GameNetworkManager.Instance.connectedPlayers)
				{
					lobbychecktimer = -4.5f;
					wanttoCheckMods = true;
				}
				playerCount = GameNetworkManager.Instance.connectedPlayers;
			}
			if (lobbychecktimer < 0f)
			{
				lobbychecktimer += Time.deltaTime;
			}
			else if (wanttoCheckMods)
			{
				wanttoCheckMods = false;
				CD();
			}
		}

		private void CD()
		{
			CheatDatabase.OtherPlayerCheatDetector();
		}
	}
}
namespace LC_API.BundleAPI
{
	public static class BundleLoader
	{
		[Obsolete("Use OnLoadedBundles instead. This will be removed/private in a future update.")]
		public delegate void OnLoadedAssetsDelegate();

		[Obsolete("Use GetLoadedAsset instead. This will be removed/private in a future update.")]
		public static ConcurrentDictionary<string, Object> assets = new ConcurrentDictionary<string, Object>();

		[Obsolete("Use OnLoadedBundles instead. This will be removed/private in a future update.")]
		public static OnLoadedAssetsDelegate OnLoadedAssets = LoadAssetsCompleted;

		public static bool AssetsInLegacyDirectory { get; private set; }

		public static bool LegacyLoadingEnabled { get; private set; }

		public static event Action OnLoadedBundles;

		internal static void Load(bool legacyLoading)
		{
			LegacyLoadingEnabled = legacyLoading;
			Plugin.Log.LogMessage((object)"BundleAPI will now load all asset bundles...");
			string path = Path.Combine(Paths.BepInExRootPath, "Bundles");
			if (!Directory.Exists(path))
			{
				Directory.CreateDirectory(path);
				Plugin.Log.LogMessage((object)"BundleAPI Created legacy bundle directory in BepInEx/Bundles");
			}
			string[] array = (from x in Directory.GetFiles(path, "*", SearchOption.AllDirectories)
				where !x.EndsWith(".manifest", StringComparison.CurrentCultureIgnoreCase)
				select x).ToArray();
			AssetsInLegacyDirectory = array.Length != 0;
			if (!AssetsInLegacyDirectory)
			{
				Plugin.Log.LogMessage((object)"BundleAPI got no assets to load from legacy directory");
			}
			if (AssetsInLegacyDirectory)
			{
				Plugin.Log.LogWarning((object)"The path BepInEx > Bundles is outdated and should not be used anymore! Bundles will be loaded from BepInEx > plugins from now on");
				LoadAllAssetsFromDirectory(array, legacyLoading);
			}
			path = Path.Combine(Paths.BepInExRootPath, "plugins");
			array = (from x in Directory.GetFiles(path, "*", SearchOption.AllDirectories)
				where !x.EndsWith(".dll", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".json", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".png", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".md", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".old", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".txt", StringComparison.CurrentCultureIgnoreCase)
				select x).ToArray();
			if (array.Length == 0)
			{
				Plugin.Log.LogMessage((object)"BundleAPI got no assets to load from plugins folder");
			}
			else
			{
				LoadAllAssetsFromDirectory(array, legacyLoading);
			}
			OnLoadedAssets.InvokeParameterlessDelegate();
			BundleLoader.OnLoadedBundles.InvokeActionSafe();
		}

		private static void LoadAllAssetsFromDirectory(string[] array, bool legacyLoading)
		{
			if (legacyLoading)
			{
				Plugin.Log.LogMessage((object)("BundleAPI got " + array.Length + " AssetBundles to load!"));
				for (int i = 0; i < array.Length; i++)
				{
					try
					{
						SaveAsset(array[i], legacyLoading);
					}
					catch (Exception)
					{
						Plugin.Log.LogError((object)("Failed to load an assetbundle! Path: " + array[i]));
					}
				}
				return;
			}
			Plugin.Log.LogMessage((object)("BundleAPI got " + array.Length + " AssetBundles to load!"));
			for (int j = 0; j < array.Length; j++)
			{
				try
				{
					SaveAsset(array[j], legacyLoading);
				}
				catch (Exception)
				{
					Plugin.Log.LogError((object)("Failed to load an assetbundle! Path: " + array[j]));
				}
			}
		}

		public static void SaveAsset(string path, bool legacyLoad)
		{
			AssetBundle val = AssetBundle.LoadFromFile(path);
			try
			{
				string[] allAssetNames = val.GetAllAssetNames();
				foreach (string text in allAssetNames)
				{
					Plugin.Log.LogMessage((object)("Got asset for load: " + text));
					Object val2 = val.LoadAsset(text);
					if (val2 == (Object)null)
					{
						Plugin.Log.LogWarning((object)$"Skipped/failed loading an asset (from bundle '{((Object)val).name}') - Asset path: {val2}");
						continue;
					}
					string key = (legacyLoad ? text.ToUpper() : text.ToLower());
					if (assets.ContainsKey(key))
					{
						Plugin.Log.LogError((object)"BundleAPI got duplicate asset!");
						break;
					}
					assets.TryAdd(key, val2);
					Plugin.Log.LogMessage((object)("Loaded asset: " + val2.name));
				}
			}
			finally
			{
				if (val != null)
				{
					val.Unload(false);
				}
			}
		}

		public static TAsset GetLoadedAsset<TAsset>(string itemPath) where TAsset : Object
		{
			Object value = null;
			if (LegacyLoadingEnabled)
			{
				assets.TryGetValue(itemPath.ToUpper(), out value);
			}
			if (value == (Object)null)
			{
				assets.TryGetValue(itemPath.ToLower(), out value);
			}
			return (TAsset)(object)value;
		}

		private static void LoadAssetsCompleted()
		{
			Plugin.Log.LogMessage((object)"BundleAPI finished loading all assets.");
		}

		static BundleLoader()
		{
			BundleLoader.OnLoadedBundles = LoadAssetsCompleted;
		}
	}
}

5Bit-VoiceHUD/VoiceHUD.dll

Decompiled 6 months 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.Logging;
using Dissonance;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;
using VoiceHUD.Configuration;

[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("VoiceHUD")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Displays push-to-talk icon on voice activation")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+f1e0a0cfa0a629002418c9e0aa3a753676e33192")]
[assembly: AssemblyProduct("VoiceHUD")]
[assembly: AssemblyTitle("VoiceHUD")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 VoiceHUD
{
	[BepInPlugin("5Bit.VoiceHUD", "VoiceHUD", "1.0.4")]
	public class VoiceHUD : BaseUnityPlugin
	{
		private const string modGUID = "5Bit.VoiceHUD";

		private const string modName = "VoiceHUD";

		private const string modVersion = "1.0.4";

		private readonly Harmony harmony = new Harmony("5Bit.VoiceHUD");

		private static VoiceHUD Instance;

		internal static ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("5Bit.VoiceHUD");
			Config.Init();
			harmony.PatchAll();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "VoiceHUD";

		public const string PLUGIN_NAME = "VoiceHUD";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace VoiceHUD.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class VoiceHUDPatch
	{
		private static Color Start = new Color(0f, 255f, 0f, 255f);

		private static Color Center = new Color(165f, 255f, 0f, 255f);

		private static Color End = new Color(255f, 0f, 0f, 255f);

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Update()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			if (!IngamePlayerSettings.Instance.settings.micEnabled || IngamePlayerSettings.Instance.settings.pushToTalk || (Object)(object)StartOfRound.Instance.voiceChatModule == (Object)null)
			{
				return;
			}
			VoicePlayerState val = StartOfRound.Instance.voiceChatModule.FindPlayer(StartOfRound.Instance.voiceChatModule.LocalPlayerName);
			if (val.IsSpeaking)
			{
				float num = Mathf.Clamp(val.Amplitude * 35f, 0f, 1f);
				if (Config.ColorsEnabled)
				{
					((Graphic)HUDManager.Instance.PTTIcon).color = GetColorByVolume(num * 100f);
				}
				((Behaviour)HUDManager.Instance.PTTIcon).enabled = num > 0.01f;
			}
		}

		public static Color GetColorByVolume(float volume)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (volume < 20f)
			{
				return Start;
			}
			if (volume > 70f)
			{
				return End;
			}
			return Center;
		}
	}
}
namespace VoiceHUD.Configuration
{
	internal static class Config
	{
		private const string CONFIG_FILE_NAME = "VoiceHUD.cfg";

		private static ConfigFile config;

		private static ConfigEntry<bool> colorsEnabled;

		public static bool ColorsEnabled => colorsEnabled.Value;

		public static void Init()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			string text = Path.Combine(Paths.ConfigPath, "VoiceHUD.cfg");
			config = new ConfigFile(text, true);
			colorsEnabled = config.Bind<bool>("Config", "Colors enabled", false, "Change icon color based on volume.");
		}
	}
}

AlexCodesGames-AdditionalSuits/AdditionalSuits.dll.old

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AdditionalSuits")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdditionalSuits")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0c25b026-8574-4dd2-9af2-4265f618ef8a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AdditionalSuits;

[BepInPlugin("ACS.AdditionalSuits", "AdditionalSuits", "1.0.2")]
public class AdditionalSuitsBase : BaseUnityPlugin
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void StartPatch(ref StartOfRound __instance)
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			try
			{
				if (SuitsLoaded)
				{
					return;
				}
				for (int i = 0; i < __instance.unlockablesList.unlockables.Count; i++)
				{
					UnlockableItem val = __instance.unlockablesList.unlockables[i];
					mls.LogInfo((object)("AdditionalSuits - processing unlockable {index=" + i + ", name=" + val.unlockableName + "}"));
					if (!((Object)(object)val.suitMaterial == (Object)null) && val.alreadyUnlocked)
					{
						string[] files = Directory.GetFiles(SuitTextureFolder, "*.png");
						string[] array = files;
						foreach (string text in array)
						{
							mls.LogInfo((object)("AdditionalSuits - adding suit {file=" + text + "}"));
							UnlockableItem val2 = JsonUtility.FromJson<UnlockableItem>(JsonUtility.ToJson((object)val));
							Material val3 = Object.Instantiate<Material>(val2.suitMaterial);
							Texture2D val4 = new Texture2D(2, 2);
							ImageConversion.LoadImage(val4, File.ReadAllBytes(Path.Combine(SuitTextureFolder, text)));
							val3.mainTexture = (Texture)(object)val4;
							val2.suitMaterial = val3;
							string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
							val2.unlockableName = fileNameWithoutExtension.Replace("_", " ").Substring(2);
							__instance.unlockablesList.unlockables.Add(val2);
						}
						SuitsLoaded = true;
						break;
					}
				}
			}
			catch (Exception ex)
			{
				mls.LogInfo((object)("AdditionalSuits - initialization failed!\nERROR: " + ex));
			}
		}
	}

	private static AdditionalSuitsBase Instance;

	private const string modGUID = "ACS.AdditionalSuits";

	private const string modName = "AdditionalSuits";

	private const string modVersion = "1.0.2";

	private readonly Harmony harmony = new Harmony("ACS.AdditionalSuits");

	public static ManualLogSource mls;

	public static bool SuitsLoaded;

	public static string SuitTextureFolder;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		mls = Logger.CreateLogSource("ACS.AdditionalSuits");
		mls.LogInfo((object)"AdditionalSuits - initializing...");
		SuitTextureFolder = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "resAdditionalSuits");
		harmony.PatchAll();
		mls.LogInfo((object)"AdditionalSuits - initialized!");
	}
}

AllToasters-SpectateEnemies/SpectateEnemy.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SpectateEnemy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+7904f0b2b5b1b7b06ac7cb8f9ab6fa3d2d5f98dc")]
[assembly: AssemblyProduct("SpectateEnemy")]
[assembly: AssemblyTitle("SpectateEnemy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.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 SpectateEnemy
{
	[BepInPlugin("SpectateEnemy", "SpectateEnemy", "1.3.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static int spectatedEnemyIndex = -1;

		public static bool spectatingEnemies = false;

		public static MethodInfo raycastSpectate = null;

		private ConfigEntry<bool> spectateTurrets;

		private ConfigEntry<bool> spectateLandmines;

		private ConfigEntry<bool> spectatePassives;

		public static bool doSpectateTurrets;

		public static bool doSpectateLandmines;

		public static bool doSpectatePassives;

		private Harmony harmony;

		private void Awake()
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			spectateTurrets = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "Spectate Turrets", false, "Enables spectating turrets.");
			doSpectateTurrets = spectateTurrets.Value;
			spectateLandmines = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "Spectate Landmines", false, "Enables spectating landmines.");
			doSpectateLandmines = spectateLandmines.Value;
			spectatePassives = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "Spectate Passives", false, "Enables spectating passive enemies, such as Docile Locust Bees and Manticoils.");
			doSpectatePassives = spectatePassives.Value;
			harmony = new Harmony("SpectateEnemy");
			harmony.PatchAll();
			raycastSpectate = AccessTools.Method(typeof(PlayerControllerB), "RaycastSpectateCameraAroundPivot", (Type[])null, (Type[])null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SpectateEnemy loaded!");
		}
	}
	public class Spectatable : MonoBehaviour
	{
		public SpectatableType type = SpectatableType.Enemy;

		public string enemyName = "Enemy";
	}
	public enum SpectatableType
	{
		Enemy,
		Turret,
		Landmine
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SpectateEnemy";

		public const string PLUGIN_NAME = "SpectateEnemy";

		public const string PLUGIN_VERSION = "1.3.0";
	}
}
namespace SpectateEnemy.Patches
{
	[HarmonyPatch(typeof(EnemyAI), "Start")]
	public class EnemyAI_Patches
	{
		private static void Postfix(EnemyAI __instance)
		{
			if (Plugin.doSpectatePassives || (!(__instance.enemyType.enemyName == "Docile Locust Bees") && !(__instance.enemyType.enemyName == "Manticoil")))
			{
				Spectatable spectatable = ((Component)__instance).gameObject.AddComponent<Spectatable>();
				spectatable.enemyName = __instance.enemyType.enemyName;
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager), "Disconnect")]
	public class GameNetworkManager_Patches
	{
		private static void Postfix()
		{
			Plugin.spectatedEnemyIndex = -1;
			Plugin.spectatingEnemies = false;
		}
	}
	[HarmonyPatch(typeof(HUDManager), "Update")]
	public class HUDManager_Patches
	{
		private static void Postfix(HUDManager __instance)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (!GameNetworkManager.Instance.localPlayerController.isPlayerDead || TimeOfDay.Instance.shipLeavingAlertCalled)
			{
				return;
			}
			TextMeshProUGUI holdButtonToEndGameEarlyText = __instance.holdButtonToEndGameEarlyText;
			((TMP_Text)holdButtonToEndGameEarlyText).text = ((TMP_Text)holdButtonToEndGameEarlyText).text + "\n\n\n\n\nSwitch to " + (Plugin.spectatingEnemies ? "Players" : "Enemies") + ": [E]\nToggle Flashlight : [RMB] (Click)";
			MovementActions movement = __instance.playerActions.Movement;
			if (((MovementActions)(ref movement)).PingScan.WasReleasedThisFrame())
			{
				Light component = ((Component)__instance.playersManager.spectateCamera).GetComponent<Light>();
				if ((Object)(object)component != (Object)null)
				{
					((Behaviour)component).enabled = !((Behaviour)component).enabled;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Landmine), "Start")]
	public class Landmine_Patches
	{
		private static void Postfix(Landmine __instance)
		{
			if (Plugin.doSpectateLandmines)
			{
				Spectatable spectatable = ((Component)__instance).gameObject.AddComponent<Spectatable>();
				spectatable.type = SpectatableType.Landmine;
				((Object)spectatable).name = "Landmine";
			}
		}
	}
	internal class Handler
	{
		public static Spectatable[] spectatorList;

		public static bool Spectate()
		{
			if (Plugin.spectatingEnemies)
			{
				if (spectatorList.Length == 0)
				{
					Plugin.spectatingEnemies = false;
					return true;
				}
				Plugin.spectatedEnemyIndex++;
				if (Plugin.spectatedEnemyIndex >= spectatorList.Length)
				{
					Plugin.spectatedEnemyIndex = 0;
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "Interact_performed")]
	public class PlayerControllerB_Interact
	{
		private static bool Prefix(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerDead && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject))
			{
				Plugin.spectatingEnemies = !Plugin.spectatingEnemies;
				if (Plugin.spectatingEnemies)
				{
					Handler.spectatorList = Object.FindObjectsByType<Spectatable>((FindObjectsSortMode)0);
					if (Handler.spectatorList.Length == 0)
					{
						Plugin.spectatingEnemies = false;
						return true;
					}
					if (Plugin.spectatedEnemyIndex == -1 || Plugin.spectatedEnemyIndex >= Handler.spectatorList.Length)
					{
						Plugin.spectatedEnemyIndex = 0;
					}
					__instance.spectatedPlayerScript = null;
				}
				else
				{
					__instance.spectatedPlayerScript = ((IEnumerable<PlayerControllerB>)__instance.playersManager.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => !x.isPlayerDead));
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "Use_performed")]
	public class PlayerControllerB_Use
	{
		private static bool Prefix(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerDead && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject))
			{
				return Handler.Spectate();
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
	public class PlayerControllerB_LateUpdate
	{
		private static void Postfix(PlayerControllerB __instance)
		{
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.spectatingEnemies)
			{
				return;
			}
			if (Handler.spectatorList.Length == 0)
			{
				Plugin.spectatingEnemies = false;
				return;
			}
			if (Plugin.spectatedEnemyIndex >= Handler.spectatorList.Length)
			{
				Plugin.spectatedEnemyIndex = 0;
			}
			Spectatable obj = Handler.spectatorList[Plugin.spectatedEnemyIndex];
			if ((Object)(object)obj == (Object)null)
			{
				Plugin.spectatedEnemyIndex++;
				if (Plugin.spectatedEnemyIndex >= Handler.spectatorList.Length)
				{
					Plugin.spectatedEnemyIndex = 0;
				}
				return;
			}
			Vector3? spectatePosition = GetSpectatePosition(obj);
			if (!spectatePosition.HasValue)
			{
				Plugin.spectatedEnemyIndex++;
				if (Plugin.spectatedEnemyIndex >= Handler.spectatorList.Length)
				{
					Plugin.spectatedEnemyIndex = 0;
				}
				return;
			}
			if (obj.enemyName == "Enemy")
			{
				TryFixName(ref obj);
			}
			__instance.spectateCameraPivot.position = spectatePosition.Value + GetZoomDistance(obj);
			((TMP_Text)HUDManager.Instance.spectatingPlayerText).text = "(Spectating: " + obj.enemyName + ")";
			Plugin.raycastSpectate.Invoke(__instance, Array.Empty<object>());
		}

		private static void TryFixName(ref Spectatable obj)
		{
			EnemyAI val = default(EnemyAI);
			Turret val2 = default(Turret);
			Landmine val3 = default(Landmine);
			if (((Component)obj).gameObject.TryGetComponent<EnemyAI>(ref val))
			{
				obj.enemyName = val.enemyType.enemyName;
			}
			else if (((Component)obj).gameObject.TryGetComponent<Turret>(ref val2))
			{
				obj.enemyName = "Turret";
			}
			else if (((Component)obj).gameObject.TryGetComponent<Landmine>(ref val3))
			{
				obj.enemyName = "Landmine";
			}
		}

		private static Vector3 GetZoomDistance(Spectatable obj)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			if (obj.enemyName == "ForestGiant")
			{
				return Vector3.up * 3f;
			}
			if (obj.enemyName == "MouthDog" || obj.enemyName == "Jester")
			{
				return Vector3.up * 2f;
			}
			return Vector3.up;
		}

		private static Vector3? GetSpectatePosition(Spectatable obj)
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (obj.type == SpectatableType.Enemy)
			{
				EnemyAI component = ((Component)obj).GetComponent<EnemyAI>();
				if ((Object)(object)component != (Object)null)
				{
					return ((Object)(object)component.eye == (Object)null) ? ((Component)component).transform.position : component.eye.position;
				}
			}
			else if (obj.type == SpectatableType.Turret)
			{
				Turret component2 = ((Component)obj).GetComponent<Turret>();
				if ((Object)(object)component2 != (Object)null)
				{
					return ((Component)component2.centerPoint).transform.position;
				}
			}
			else
			{
				if (obj.type == SpectatableType.Landmine)
				{
					return ((Component)obj).transform.position;
				}
				Debug.LogError((object)("[SpectateEnemy]: Error when spectating: no handler for SpectatableType " + obj.type));
			}
			return null;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "SpectateNextPlayer")]
	public class PlayerControllerB_SpectateNext
	{
		private static bool Prefix()
		{
			return !Plugin.spectatingEnemies;
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
	public class StartOfRound_Patches
	{
		private static void Postfix()
		{
			Plugin.spectatedEnemyIndex = -1;
			Plugin.spectatingEnemies = false;
		}
	}
	[HarmonyPatch(typeof(Turret), "Start")]
	public class Turret_Patches
	{
		private static void Postfix(Turret __instance)
		{
			if (Plugin.doSpectateTurrets)
			{
				Spectatable spectatable = ((Component)__instance).gameObject.AddComponent<Spectatable>();
				spectatable.type = SpectatableType.Turret;
				spectatable.enemyName = "Turret";
			}
		}
	}
}

anormaltwig-LateCompany/LateCompanyV1.0.4.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("LateCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LateCompany")]
[assembly: AssemblyTitle("LateCompany")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LateCompany
{
	public static class PluginInfo
	{
		public const string GUID = "twig.latecompany";

		public const string PrintName = "Late Company";

		public const string Version = "1.0.4";
	}
	[BepInPlugin("twig.latecompany", "Late Company", "1.0.4")]
	internal class Plugin : BaseUnityPlugin
	{
		private ConfigEntry<bool> configLateJoinOrbitOnly;

		public static bool OnlyLateJoinInOrbit;

		public void Awake()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			configLateJoinOrbitOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Late join orbit only", true, "Don't allow joining while the ship is not in orbit.");
			OnlyLateJoinInOrbit = configLateJoinOrbitOnly.Value;
			Harmony val = new Harmony("twig.latecompany");
			val.PatchAll(typeof(Plugin).Assembly);
			((BaseUnityPlugin)this).Logger.Log((LogLevel)16, (object)"Late Company loaded!");
		}
	}
}
namespace LateCompany.Patches
{
	[HarmonyPatch(typeof(GameNetworkManager), "LeaveLobbyAtGameStart")]
	[HarmonyWrapSafe]
	internal static class LeaveLobbyAtGameStart_Patch
	{
		[HarmonyPrefix]
		private static bool Prefix()
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager), "ConnectionApproval")]
	[HarmonyWrapSafe]
	internal static class ConnectionApproval_Patch
	{
		[HarmonyPostfix]
		private static void Postfix(ConnectionApprovalRequest request, ConnectionApprovalResponse response)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (request.ClientNetworkId != NetworkManager.Singleton.LocalClientId && response.Reason.Contains("Game has already started") && GameNetworkManager.Instance.gameHasStarted && (StartOfRound.Instance.inShipPhase || !Plugin.OnlyLateJoinInOrbit))
			{
				response.Reason = "";
				response.CreatePlayerObject = false;
				response.Approved = true;
				response.Pending = false;
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")]
	[HarmonyWrapSafe]
	internal class OnPlayerConnectedClientRpc_Patch
	{
		public static MethodInfo BeginSendClientRpc = typeof(RoundManager).GetMethod("__beginSendClientRpc", BindingFlags.Instance | BindingFlags.NonPublic);

		public static MethodInfo EndSendClientRpc = typeof(RoundManager).GetMethod("__endSendClientRpc", BindingFlags.Instance | BindingFlags.NonPublic);

		[HarmonyPostfix]
		private static void Postfix(ulong clientId, int connectedPlayers, ulong[] connectedPlayerIdsOrdered, int assignedPlayerObjectId, int serverMoneyAmount, int levelID, int profitQuota, int timeUntilDeadline, int quotaFulfilled, int randomSeed)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			StartOfRound instance = StartOfRound.Instance;
			PlayerControllerB val = instance.allPlayerScripts[assignedPlayerObjectId];
			if (instance.connectedPlayersAmount + 1 >= instance.allPlayerScripts.Length)
			{
				GameNetworkManager.Instance.SetLobbyJoinable(false);
			}
			val.DisablePlayerModel(instance.allPlayerObjects[assignedPlayerObjectId], true, true);
			if (((NetworkBehaviour)instance).IsServer && !instance.inShipPhase)
			{
				RoundManager instance2 = RoundManager.Instance;
				ClientRpcParams val2 = default(ClientRpcParams);
				val2.Send = new ClientRpcSendParams
				{
					TargetClientIds = new List<ulong> { clientId }
				};
				ClientRpcParams val3 = val2;
				FastBufferWriter val4 = (FastBufferWriter)BeginSendClientRpc.Invoke(instance2, new object[3] { 1193916134u, val3, 0 });
				BytePacker.WriteValueBitPacked(val4, StartOfRound.Instance.randomMapSeed);
				BytePacker.WriteValueBitPacked(val4, StartOfRound.Instance.currentLevelID);
				EndSendClientRpc.Invoke(instance2, new object[4] { val4, 1193916134u, val3, 0 });
				FastBufferWriter val5 = (FastBufferWriter)BeginSendClientRpc.Invoke(instance2, new object[3] { 2729232387u, val3, 0 });
				EndSendClientRpc.Invoke(instance2, new object[4] { val5, 2729232387u, val3, 0 });
			}
			instance.livingPlayers = instance.connectedPlayersAmount + 1;
			for (int i = 0; i < instance.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val6 = instance.allPlayerScripts[i];
				if (val6.isPlayerControlled && val6.isPlayerDead)
				{
					instance.livingPlayers--;
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")]
	[HarmonyWrapSafe]
	internal class OnPlayerDC_Patch
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			if (StartOfRound.Instance.inShipPhase || !Plugin.OnlyLateJoinInOrbit)
			{
				GameNetworkManager.Instance.SetLobbyJoinable(true);
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "StartGame")]
	[HarmonyWrapSafe]
	internal class StartGame_Patch
	{
		[HarmonyPrefix]
		public static void Prefix()
		{
			if (Plugin.OnlyLateJoinInOrbit)
			{
				GameNetworkManager.Instance.SetLobbyJoinable(false);
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "SetShipReadyToLand")]
	[HarmonyWrapSafe]
	internal class SetShipReadyToLand_Patch
	{
		[HarmonyPrefix]
		public static void Postfix()
		{
			if (Plugin.OnlyLateJoinInOrbit && StartOfRound.Instance.connectedPlayersAmount + 1 < StartOfRound.Instance.allPlayerScripts.Length)
			{
				GameNetworkManager.Instance.SetLobbyJoinable(true);
			}
		}
	}
}

ATK-ShipClock/ShipClock.dll.old

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ShipClock")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ShipClock")]
[assembly: AssemblyTitle("ShipClock")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace ShipClock
{
	[BepInPlugin("atk.lethalcompany.shipclock", "Ship Clock", "0.9.0")]
	public class Main : BaseUnityPlugin
	{
		private const string PluginGuid = "atk.lethalcompany.shipclock";

		private const string PluginName = "Ship Clock";

		private const string PluginVersion = "0.9.0";

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("atk.lethalcompany.shipclock");
			val.PatchAll(typeof(Patches));
		}
	}
	[HarmonyPatch]
	internal class Patches
	{
		[HarmonyPatch(typeof(TimeOfDay), "SetInsideLightingDimness")]
		[HarmonyPostfix]
		public static void SetInsideLightingDimness()
		{
			if ((Object)(object)GameNetworkManager.Instance != (Object)null && !GameNetworkManager.Instance.localPlayerController.isPlayerDead)
			{
				HUDManager.Instance.SetClockVisible(!GameNetworkManager.Instance.localPlayerController.isInsideFactory);
			}
		}
	}
}

BepInEx-BepInEx_MLLoader/BepInEx.MelonLoader.Loader/AssetRipper.VersionUtilities.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using AssetRipper.VersionUtilities.Extensions;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("VersionUtilities.Tests")]
[assembly: AssemblyCompany("AssetRipper")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright (c) 2022 ds5678")]
[assembly: AssemblyDescription("Managed library for handling Unity versions")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1.0")]
[assembly: AssemblyProduct("AssetRipper.VersionUtilities")]
[assembly: AssemblyTitle("AssetRipper.VersionUtilities")]
[assembly: AssemblyVersion("1.2.1.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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;
		}
	}
}
namespace AssetRipper.VersionUtilities
{
	public struct CompactUnityVersion24 : IEquatable<CompactUnityVersion24>, IComparable, IComparable<CompactUnityVersion24>
	{
		private const int majorOffset = 3;

		private const int buildOffset = 9;

		private const int typeOffset = 6;

		private const uint bitMask3 = 7u;

		private const uint bitMask5 = 31u;

		private const uint bitMask6 = 63u;

		private const uint bitMask7 = 127u;

		private readonly byte m_MajorMinorByte;

		private readonly ushort m_BuildTypeShort;

		public const ushort MajorMaxValue = 2042;

		private byte MajorRaw => (byte)((ulong)(m_MajorMinorByte >> 3) & 0x1FuL);

		public ushort Major => ConvertMajorRawToNormal(MajorRaw);

		public byte Minor => (byte)(m_MajorMinorByte & 7u);

		public byte Build => (byte)((ulong)(m_BuildTypeShort >> 9) & 0x7FuL);

		public UnityVersionType Type => (UnityVersionType)((ulong)(m_BuildTypeShort >> 6) & 7uL);

		public byte TypeNumber => (byte)(m_BuildTypeShort & 0x3Fu);

		public static CompactUnityVersion24 MinVersion { get; } = new CompactUnityVersion24((byte)0, (ushort)0);


		public static CompactUnityVersion24 MaxVersion { get; } = new CompactUnityVersion24(byte.MaxValue, ushort.MaxValue);


		public CompactUnityVersion24(ushort major)
		{
			m_MajorMinorByte = (byte)(ConvertMajorRawToNormal(major) << 3);
			m_BuildTypeShort = 0;
		}

		public CompactUnityVersion24(ushort major, byte minor)
		{
			m_MajorMinorByte = (byte)((ConvertMajorRawToNormal(major) << 3) | CastToThreeBits(minor));
			m_BuildTypeShort = 0;
		}

		public CompactUnityVersion24(ushort major, byte minor, byte build)
		{
			m_MajorMinorByte = (byte)((ConvertMajorRawToNormal(major) << 3) | CastToThreeBits(minor));
			m_BuildTypeShort = (ushort)(CastToSevenBits(build) << 9);
		}

		public CompactUnityVersion24(ushort major, byte minor, byte build, UnityVersionType type)
		{
			m_MajorMinorByte = (byte)((ConvertMajorRawToNormal(major) << 3) | CastToThreeBits(minor));
			m_BuildTypeShort = (ushort)((CastToSevenBits(build) << 9) | (CastToThreeBits((byte)type) << 6));
		}

		public CompactUnityVersion24(ushort major, byte minor, byte build, UnityVersionType type, byte typeNumber)
		{
			m_MajorMinorByte = (byte)((ConvertMajorRawToNormal(major) << 3) | CastToThreeBits(minor));
			m_BuildTypeShort = (ushort)((CastToSevenBits(build) << 9) | (CastToThreeBits((byte)type) << 6) | CastToSixBits(typeNumber));
		}

		private CompactUnityVersion24(byte majorMinorByte, ushort buildTypeShort)
		{
			m_MajorMinorByte = majorMinorByte;
			m_BuildTypeShort = buildTypeShort;
		}

		public void GetBits(out byte majorMinorByte, out ushort buildTypeShort)
		{
			majorMinorByte = m_MajorMinorByte;
			buildTypeShort = m_BuildTypeShort;
		}

		public static CompactUnityVersion24 FromBits(byte majorMinorByte, ushort buildTypeShort)
		{
			return new CompactUnityVersion24(majorMinorByte, buildTypeShort);
		}

		private static ushort ConvertMajorRawToNormal(byte raw)
		{
			if (raw >= 6)
			{
				return (ushort)(raw + 2011);
			}
			return raw;
		}

		private static byte ConvertMajorRawToNormal(ushort major)
		{
			if (major < 6)
			{
				return (byte)major;
			}
			if (major >= 2017 && major <= 2042)
			{
				return (byte)(major - 2011);
			}
			throw new ArgumentOutOfRangeException("major");
		}

		private static byte CastToThreeBits(byte b)
		{
			if ((uint)b > 7u)
			{
				throw new ArgumentOutOfRangeException("b");
			}
			return b;
		}

		private static byte CastToSixBits(byte b)
		{
			if ((uint)b > 63u)
			{
				throw new ArgumentOutOfRangeException("b");
			}
			return b;
		}

		private static byte CastToSevenBits(byte b)
		{
			if ((uint)b > 127u)
			{
				throw new ArgumentOutOfRangeException("b");
			}
			return b;
		}

		public override string ToString()
		{
			return $"{Major}.{Minor}.{Build}{Type.ToCharacter()}{TypeNumber}";
		}

		public int CompareTo(object? obj)
		{
			if (!(obj is CompactUnityVersion24 other))
			{
				return 1;
			}
			return CompareTo(other);
		}

		public int CompareTo(CompactUnityVersion24 other)
		{
			if (this > other)
			{
				return 1;
			}
			if (this < other)
			{
				return -1;
			}
			return 0;
		}

		public override bool Equals(object? obj)
		{
			if (obj is CompactUnityVersion24 compactUnityVersion)
			{
				return this == compactUnityVersion;
			}
			return false;
		}

		public bool Equals(CompactUnityVersion24 other)
		{
			return this == other;
		}

		public override int GetHashCode()
		{
			return (m_MajorMinorByte << 16) | m_BuildTypeShort;
		}

		public static implicit operator UnityVersion(CompactUnityVersion24 version)
		{
			return new UnityVersion(version.Major, version.Minor, version.Build, version.Type, version.TypeNumber);
		}

		public static implicit operator CompactUnityVersion32(CompactUnityVersion24 version)
		{
			return new CompactUnityVersion32(version.Major, version.Minor, version.Build, version.Type, version.TypeNumber);
		}

		public static explicit operator CompactUnityVersion24(UnityVersion version)
		{
			return new CompactUnityVersion24(version.Major, (byte)version.Minor, (byte)version.Build, version.Type, version.TypeNumber);
		}

		public static explicit operator CompactUnityVersion24(CompactUnityVersion32 version)
		{
			return new CompactUnityVersion24(version.Major, version.Minor, version.Build, version.Type, version.TypeNumber);
		}

		public static bool operator ==(CompactUnityVersion24 left, CompactUnityVersion24 right)
		{
			if (left.m_MajorMinorByte == right.m_MajorMinorByte)
			{
				return left.m_BuildTypeShort == right.m_BuildTypeShort;
			}
			return false;
		}

		public static bool operator !=(CompactUnityVersion24 left, CompactUnityVersion24 right)
		{
			if (left.m_MajorMinorByte == right.m_MajorMinorByte)
			{
				return left.m_BuildTypeShort != right.m_BuildTypeShort;
			}
			return true;
		}

		public static bool operator >(CompactUnityVersion24 left, CompactUnityVersion24 right)
		{
			if (left.m_MajorMinorByte <= right.m_MajorMinorByte)
			{
				if (left.m_MajorMinorByte == right.m_MajorMinorByte)
				{
					return left.m_BuildTypeShort > right.m_BuildTypeShort;
				}
				return false;
			}
			return true;
		}

		public static bool operator >=(CompactUnityVersion24 left, CompactUnityVersion24 right)
		{
			if (left.m_MajorMinorByte <= right.m_MajorMinorByte)
			{
				if (left.m_MajorMinorByte == right.m_MajorMinorByte)
				{
					return left.m_BuildTypeShort >= right.m_BuildTypeShort;
				}
				return false;
			}
			return true;
		}

		public static bool operator <(CompactUnityVersion24 left, CompactUnityVersion24 right)
		{
			if (left.m_MajorMinorByte >= right.m_MajorMinorByte)
			{
				if (left.m_MajorMinorByte == right.m_MajorMinorByte)
				{
					return left.m_BuildTypeShort < right.m_BuildTypeShort;
				}
				return false;
			}
			return true;
		}

		public static bool operator <=(CompactUnityVersion24 left, CompactUnityVersion24 right)
		{
			if (left.m_MajorMinorByte >= right.m_MajorMinorByte)
			{
				if (left.m_MajorMinorByte == right.m_MajorMinorByte)
				{
					return left.m_BuildTypeShort <= right.m_BuildTypeShort;
				}
				return false;
			}
			return true;
		}
	}
	public struct CompactUnityVersion32 : IEquatable<CompactUnityVersion32>, IComparable, IComparable<CompactUnityVersion32>
	{
		private const int majorOffset = 24;

		private const int minorOffset = 20;

		private const int buildOffset = 12;

		private const int typeOffset = 8;

		private const uint byteMask = 255u;

		private const uint bitMask4 = 15u;

		private readonly uint m_data;

		public const ushort MajorMaxValue = 2266;

		private byte MajorRaw => (byte)((m_data >> 24) & 0xFFu);

		public ushort Major => ConvertMajorRawToNormal(MajorRaw);

		public byte Minor => (byte)((m_data >> 20) & 0xFu);

		public byte Build => (byte)((m_data >> 12) & 0xFFu);

		public UnityVersionType Type => (UnityVersionType)((m_data >> 8) & 0xFu);

		public byte TypeNumber => (byte)(m_data & 0xFFu);

		public static CompactUnityVersion32 MinVersion { get; } = new CompactUnityVersion32(0u);


		public static CompactUnityVersion32 MaxVersion { get; } = new CompactUnityVersion32(uint.MaxValue);


		public CompactUnityVersion32(ushort major)
		{
			m_data = (uint)(ConvertMajorRawToNormal(major) << 24);
		}

		public CompactUnityVersion32(ushort major, byte minor)
		{
			m_data = (uint)((ConvertMajorRawToNormal(major) << 24) | (CastToFourBits(minor) << 20));
		}

		public CompactUnityVersion32(ushort major, byte minor, byte build)
		{
			m_data = (uint)((ConvertMajorRawToNormal(major) << 24) | (CastToFourBits(minor) << 20) | (build << 12));
		}

		public CompactUnityVersion32(ushort major, byte minor, byte build, UnityVersionType type)
		{
			m_data = (uint)((ConvertMajorRawToNormal(major) << 24) | (CastToFourBits(minor) << 20) | (build << 12)) | ((uint)CastToFourBits(type) << 8);
		}

		public CompactUnityVersion32(ushort major, byte minor, byte build, UnityVersionType type, byte typeNumber)
		{
			m_data = (uint)((ConvertMajorRawToNormal(major) << 24) | (CastToFourBits(minor) << 20) | (build << 12)) | ((uint)CastToFourBits(type) << 8) | typeNumber;
		}

		private CompactUnityVersion32(uint data)
		{
			m_data = data;
		}

		public uint GetBits()
		{
			return m_data;
		}

		public static CompactUnityVersion32 FromBits(uint bits)
		{
			return new CompactUnityVersion32(bits);
		}

		private static ushort ConvertMajorRawToNormal(byte raw)
		{
			if (raw >= 6)
			{
				return (ushort)(raw + 2011);
			}
			return raw;
		}

		private static byte ConvertMajorRawToNormal(ushort major)
		{
			if (major < 6)
			{
				return (byte)major;
			}
			if (major >= 2017 && major <= 2266)
			{
				return (byte)(major - 2011);
			}
			throw new ArgumentOutOfRangeException("major");
		}

		private static byte CastToFourBits(byte b)
		{
			if ((uint)b > 15u)
			{
				throw new ArgumentOutOfRangeException("b");
			}
			return b;
		}

		private static UnityVersionType CastToFourBits(UnityVersionType type)
		{
			if (type > (UnityVersionType)15)
			{
				throw new ArgumentOutOfRangeException("type");
			}
			return type;
		}

		public override string ToString()
		{
			return $"{Major}.{Minor}.{Build}{Type.ToCharacter()}{TypeNumber}";
		}

		public int CompareTo(object? obj)
		{
			if (!(obj is CompactUnityVersion32 other))
			{
				return 1;
			}
			return CompareTo(other);
		}

		public int CompareTo(CompactUnityVersion32 other)
		{
			if (this > other)
			{
				return 1;
			}
			if (this < other)
			{
				return -1;
			}
			return 0;
		}

		public override bool Equals(object? obj)
		{
			if (obj is CompactUnityVersion32 compactUnityVersion)
			{
				return this == compactUnityVersion;
			}
			return false;
		}

		public bool Equals(CompactUnityVersion32 other)
		{
			return this == other;
		}

		public override int GetHashCode()
		{
			uint data = m_data;
			return data.GetHashCode();
		}

		public static implicit operator UnityVersion(CompactUnityVersion32 version)
		{
			return new UnityVersion(version.Major, version.Minor, version.Build, version.Type, version.TypeNumber);
		}

		public static explicit operator CompactUnityVersion32(UnityVersion version)
		{
			return new CompactUnityVersion32(version.Major, (byte)version.Minor, (byte)version.Build, version.Type, version.TypeNumber);
		}

		public static bool operator ==(CompactUnityVersion32 left, CompactUnityVersion32 right)
		{
			return left.m_data == right.m_data;
		}

		public static bool operator !=(CompactUnityVersion32 left, CompactUnityVersion32 right)
		{
			return left.m_data != right.m_data;
		}

		public static bool operator >(CompactUnityVersion32 left, CompactUnityVersion32 right)
		{
			return left.m_data > right.m_data;
		}

		public static bool operator >=(CompactUnityVersion32 left, CompactUnityVersion32 right)
		{
			return left.m_data >= right.m_data;
		}

		public static bool operator <(CompactUnityVersion32 left, CompactUnityVersion32 right)
		{
			return left.m_data < right.m_data;
		}

		public static bool operator <=(CompactUnityVersion32 left, CompactUnityVersion32 right)
		{
			return left.m_data <= right.m_data;
		}
	}
	public readonly struct UnityVersion : IEquatable<UnityVersion>, IComparable, IComparable<UnityVersion>
	{
		private const ulong subMajorMask = 281474976710655uL;

		private const ulong subMinorMask = 4294967295uL;

		private const ulong subBuildMask = 65535uL;

		private const ulong subTypeMask = 255uL;

		private const int majorOffset = 48;

		private const int minorOffset = 32;

		private const int buildOffset = 16;

		private const int typeOffset = 8;

		private const ulong byteMask = 255uL;

		private const ulong ushortMask = 65535uL;

		private readonly ulong m_data;

		public ushort Major => (ushort)((m_data >> 48) & 0xFFFF);

		public ushort Minor => (ushort)((m_data >> 32) & 0xFFFF);

		public ushort Build => (ushort)((m_data >> 16) & 0xFFFF);

		public UnityVersionType Type => (UnityVersionType)((m_data >> 8) & 0xFF);

		public byte TypeNumber => (byte)(m_data & 0xFF);

		public static UnityVersion MinVersion { get; } = new UnityVersion(0uL);


		public static UnityVersion MaxVersion { get; } = new UnityVersion(ulong.MaxValue);


		public bool IsEqual(ushort major)
		{
			return this == From(major);
		}

		public bool IsEqual(ushort major, ushort minor)
		{
			return this == From(major, minor);
		}

		public bool IsEqual(ushort major, ushort minor, ushort build)
		{
			return this == From(major, minor, build);
		}

		public bool IsEqual(ushort major, ushort minor, ushort build, UnityVersionType type)
		{
			return this == From(major, minor, build, type);
		}

		public bool IsEqual(ushort major, ushort minor, ushort build, UnityVersionType type, byte typeNumber)
		{
			return this == new UnityVersion(major, minor, build, type, typeNumber);
		}

		public bool IsEqual(string version)
		{
			return this == Parse(version);
		}

		public bool IsLess(ushort major)
		{
			return this < From(major);
		}

		public bool IsLess(ushort major, ushort minor)
		{
			return this < From(major, minor);
		}

		public bool IsLess(ushort major, ushort minor, ushort build)
		{
			return this < From(major, minor, build);
		}

		public bool IsLess(ushort major, ushort minor, ushort build, UnityVersionType type)
		{
			return this < From(major, minor, build, type);
		}

		public bool IsLess(ushort major, ushort minor, ushort build, UnityVersionType type, byte typeNumber)
		{
			return this < new UnityVersion(major, minor, build, type, typeNumber);
		}

		public bool IsLess(string version)
		{
			return this < Parse(version);
		}

		public bool IsLessEqual(ushort major)
		{
			return this <= From(major);
		}

		public bool IsLessEqual(ushort major, ushort minor)
		{
			return this <= From(major, minor);
		}

		public bool IsLessEqual(ushort major, ushort minor, ushort build)
		{
			return this <= From(major, minor, build);
		}

		public bool IsLessEqual(ushort major, ushort minor, ushort build, UnityVersionType type)
		{
			return this <= From(major, minor, build, type);
		}

		public bool IsLessEqual(ushort major, ushort minor, ushort build, UnityVersionType type, byte typeNumber)
		{
			return this <= new UnityVersion(major, minor, build, type, typeNumber);
		}

		public bool IsLessEqual(string version)
		{
			return this <= Parse(version);
		}

		public bool IsGreater(ushort major)
		{
			return this > From(major);
		}

		public bool IsGreater(ushort major, ushort minor)
		{
			return this > From(major, minor);
		}

		public bool IsGreater(ushort major, ushort minor, ushort build)
		{
			return this > From(major, minor, build);
		}

		public bool IsGreater(ushort major, ushort minor, ushort build, UnityVersionType type)
		{
			return this > From(major, minor, build, type);
		}

		public bool IsGreater(ushort major, ushort minor, ushort build, UnityVersionType type, byte typeNumber)
		{
			return this > new UnityVersion(major, minor, build, type, typeNumber);
		}

		public bool IsGreater(string version)
		{
			return this > Parse(version);
		}

		public bool IsGreaterEqual(ushort major)
		{
			return this >= From(major);
		}

		public bool IsGreaterEqual(ushort major, ushort minor)
		{
			return this >= From(major, minor);
		}

		public bool IsGreaterEqual(ushort major, ushort minor, ushort build)
		{
			return this >= From(major, minor, build);
		}

		public bool IsGreaterEqual(ushort major, ushort minor, ushort build, UnityVersionType type)
		{
			return this >= From(major, minor, build, type);
		}

		public bool IsGreaterEqual(ushort major, ushort minor, ushort build, UnityVersionType type, byte typeNumber)
		{
			return this >= new UnityVersion(major, minor, build, type, typeNumber);
		}

		public bool IsGreaterEqual(string version)
		{
			return this >= Parse(version);
		}

		private UnityVersion From(ushort major)
		{
			return new UnityVersion(((ulong)major << 48) | (0xFFFFFFFFFFFFuL & m_data));
		}

		private UnityVersion From(ushort major, ushort minor)
		{
			return new UnityVersion(((ulong)major << 48) | ((ulong)minor << 32) | (0xFFFFFFFFu & m_data));
		}

		private UnityVersion From(ushort major, ushort minor, ushort build)
		{
			return new UnityVersion(((ulong)major << 48) | ((ulong)minor << 32) | ((ulong)build << 16) | (0xFFFF & m_data));
		}

		private UnityVersion From(ushort major, ushort minor, ushort build, UnityVersionType type)
		{
			return new UnityVersion(((ulong)major << 48) | ((ulong)minor << 32) | ((ulong)build << 16) | ((ulong)type << 8) | (0xFF & m_data));
		}

		public UnityVersion(ushort major)
		{
			m_data = (ulong)major << 48;
		}

		public UnityVersion(ushort major, ushort minor)
		{
			m_data = ((ulong)major << 48) | ((ulong)minor << 32);
		}

		public UnityVersion(ushort major, ushort minor, ushort build)
		{
			m_data = ((ulong)major << 48) | ((ulong)minor << 32) | ((ulong)build << 16);
		}

		public UnityVersion(ushort major, ushort minor, ushort build, UnityVersionType type)
		{
			m_data = ((ulong)major << 48) | ((ulong)minor << 32) | ((ulong)build << 16) | ((ulong)type << 8);
		}

		public UnityVersion(ushort major, ushort minor, ushort build, UnityVersionType type, byte typeNumber)
		{
			m_data = ((ulong)major << 48) | ((ulong)minor << 32) | ((ulong)build << 16) | ((ulong)type << 8) | typeNumber;
		}

		private UnityVersion(ulong data)
		{
			m_data = data;
		}

		public ulong GetBits()
		{
			return m_data;
		}

		public static UnityVersion FromBits(ulong bits)
		{
			return new UnityVersion(bits);
		}

		public int CompareTo(object? obj)
		{
			if (!(obj is UnityVersion other))
			{
				return 1;
			}
			return CompareTo(other);
		}

		public int CompareTo(UnityVersion other)
		{
			if (this > other)
			{
				return 1;
			}
			if (this < other)
			{
				return -1;
			}
			return 0;
		}

		public override bool Equals(object? obj)
		{
			if (obj is UnityVersion unityVersion)
			{
				return this == unityVersion;
			}
			return false;
		}

		public bool Equals(UnityVersion other)
		{
			return this == other;
		}

		public override int GetHashCode()
		{
			ulong data = m_data;
			return 827 + 911 * data.GetHashCode();
		}

		public static UnityVersion Max(UnityVersion left, UnityVersion right)
		{
			if (!(left > right))
			{
				return right;
			}
			return left;
		}

		public static UnityVersion Min(UnityVersion left, UnityVersion right)
		{
			if (!(left < right))
			{
				return right;
			}
			return left;
		}

		public static ulong Distance(UnityVersion left, UnityVersion right)
		{
			if (left.m_data >= right.m_data)
			{
				return left.m_data - right.m_data;
			}
			return right.m_data - left.m_data;
		}

		public UnityVersion GetClosestVersion(UnityVersion[] versions)
		{
			if (versions == null)
			{
				throw new ArgumentNullException("versions");
			}
			if (versions.Length == 0)
			{
				throw new ArgumentException("Length cannot be zero", "versions");
			}
			UnityVersion unityVersion = versions[0];
			ulong num = Distance(this, unityVersion);
			for (int i = 1; i < versions.Length; i++)
			{
				ulong num2 = Distance(this, versions[i]);
				if (num2 < num)
				{
					num = num2;
					unityVersion = versions[i];
				}
			}
			return unityVersion;
		}

		public static bool operator ==(UnityVersion left, UnityVersion right)
		{
			return left.m_data == right.m_data;
		}

		public static bool operator !=(UnityVersion left, UnityVersion right)
		{
			return left.m_data != right.m_data;
		}

		public static bool operator >(UnityVersion left, UnityVersion right)
		{
			return left.m_data > right.m_data;
		}

		public static bool operator >=(UnityVersion left, UnityVersion right)
		{
			return left.m_data >= right.m_data;
		}

		public static bool operator <(UnityVersion left, UnityVersion right)
		{
			return left.m_data < right.m_data;
		}

		public static bool operator <=(UnityVersion left, UnityVersion right)
		{
			return left.m_data <= right.m_data;
		}

		public override string ToString()
		{
			return $"{Major}.{Minor}.{Build}{Type.ToCharacter()}{TypeNumber}";
		}

		public string ToString(bool hasUnderscorePrefix, bool useUnderscores, bool hasExtension)
		{
			StringBuilder stringBuilder = new StringBuilder();
			char value = (useUnderscores ? '_' : '.');
			if (hasUnderscorePrefix)
			{
				stringBuilder.Append('_');
			}
			stringBuilder.Append(Major);
			stringBuilder.Append(value);
			stringBuilder.Append(Minor);
			stringBuilder.Append(value);
			stringBuilder.Append(Build);
			stringBuilder.Append(value);
			stringBuilder.Append(Type.ToCharacter());
			stringBuilder.Append(TypeNumber);
			if (hasExtension)
			{
				stringBuilder.Append(".dll");
			}
			return stringBuilder.ToString();
		}

		public string ToStringWithoutType()
		{
			return $"{Major}.{Minor}.{Build}";
		}

		public static UnityVersion ParseFromDllName(string dllName)
		{
			if (string.IsNullOrEmpty(dllName))
			{
				throw new ArgumentNullException("dllName");
			}
			if (dllName[0] == '_')
			{
				dllName = dllName.Substring(1);
			}
			return Parse(dllName.Replace('_', '.').Replace(".dll", ""));
		}

		public static UnityVersion Parse(string version)
		{
			if (string.IsNullOrEmpty(version))
			{
				throw new ArgumentNullException("version");
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			UnityVersionType type = UnityVersionType.Final;
			int num4 = 0;
			using StringReader stringReader = new StringReader(version);
			while (true)
			{
				int num5 = stringReader.Read();
				if (num5 == -1)
				{
					throw new ArgumentException("Invalid version formatting: " + version, "version");
				}
				char c = (char)num5;
				if (c == '.')
				{
					break;
				}
				num = num * 10 + c.ParseDigit();
			}
			while (true)
			{
				int num6 = stringReader.Read();
				if (num6 == -1)
				{
					break;
				}
				char c2 = (char)num6;
				if (c2 == '.')
				{
					break;
				}
				num2 = num2 * 10 + c2.ParseDigit();
			}
			while (true)
			{
				int num7 = stringReader.Read();
				if (num7 == -1)
				{
					break;
				}
				char c3 = (char)num7;
				if (char.IsDigit(c3))
				{
					num3 = num3 * 10 + c3.ParseDigit();
					continue;
				}
				type = c3.ToUnityVersionType();
				break;
			}
			while (true)
			{
				int num8 = stringReader.Read();
				if (num8 == -1)
				{
					break;
				}
				char @this = (char)num8;
				num4 = num4 * 10 + @this.ParseDigit();
			}
			return new UnityVersion((ushort)num, (ushort)num2, (ushort)num3, type, (byte)num4);
		}
	}
	public enum UnityVersionType : byte
	{
		Alpha = 0,
		Beta = 1,
		China = 2,
		Final = 3,
		Patch = 4,
		Experimental = 5,
		MinValue = 0,
		MaxValue = 5
	}
	public static class UnityVersionTypeExtentions
	{
		[Obsolete("Changed to ToCharacter", true)]
		public static char ToLiteral(this UnityVersionType _this)
		{
			return _this.ToCharacter();
		}

		public static char ToCharacter(this UnityVersionType type)
		{
			return type switch
			{
				UnityVersionType.Alpha => 'a', 
				UnityVersionType.Beta => 'b', 
				UnityVersionType.China => 'c', 
				UnityVersionType.Final => 'f', 
				UnityVersionType.Patch => 'p', 
				UnityVersionType.Experimental => 'x', 
				_ => 'u', 
			};
		}
	}
}
namespace AssetRipper.VersionUtilities.Extensions
{
	public static class BinaryReaderExtensions
	{
		public static UnityVersion ReadUnityVersion(this BinaryReader reader)
		{
			return UnityVersion.FromBits(reader.ReadUInt64());
		}

		public static CompactUnityVersion32 ReadCompactUnityVersion32(this BinaryReader reader)
		{
			return CompactUnityVersion32.FromBits(reader.ReadUInt32());
		}

		public static CompactUnityVersion24 ReadCompactUnityVersion24(this BinaryReader reader)
		{
			byte majorMinorByte = reader.ReadByte();
			ushort buildTypeShort = reader.ReadUInt16();
			return CompactUnityVersion24.FromBits(majorMinorByte, buildTypeShort);
		}
	}
	public static class BinaryWriterExtensions
	{
		public static void Write(this BinaryWriter writer, UnityVersion version)
		{
			writer.Write(version.GetBits());
		}

		public static void Write(this BinaryWriter writer, CompactUnityVersion32 version)
		{
			writer.Write(version.GetBits());
		}

		public static void Write(this BinaryWriter writer, CompactUnityVersion24 version)
		{
			version.GetBits(out var majorMinorByte, out var buildTypeShort);
			writer.Write(majorMinorByte);
			writer.Write(buildTypeShort);
		}
	}
	public static class CharacterExtensions
	{
		internal static int ParseDigit(this char _this)
		{
			return _this - 48;
		}

		public static UnityVersionType ToUnityVersionType(this char c)
		{
			return c switch
			{
				'a' => UnityVersionType.Alpha, 
				'b' => UnityVersionType.Beta, 
				'c' => UnityVersionType.China, 
				'f' => UnityVersionType.Final, 
				'p' => UnityVersionType.Patch, 
				'x' => UnityVersionType.Experimental, 
				_ => throw new ArgumentException($"There is no version type {c}", "c"), 
			};
		}
	}
}

BepInEx-BepInEx_MLLoader/BepInEx.MelonLoader.Loader/AssetsTools.NET.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using AssetsTools.NET.Extra;
using AssetsTools.NET.Extra.Decompressors.LZ4;
using LZ4ps;
using Mono.Cecil;
using Mono.Collections.Generic;
using SevenZip;
using SevenZip.Compression.LZ;
using SevenZip.Compression.LZMA;
using SevenZip.Compression.RangeCoder;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AssetTools.NET")]
[assembly: AssemblyDescription("A remake and port of DerPopo's AssetTools")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("nesrak1")]
[assembly: AssemblyProduct("AssetTools.NET")]
[assembly: AssemblyCopyright("Written by nes")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e09d5ac2-1a2e-4ec1-94ad-3f5e22f17658")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace SevenZip
{
	internal class CRC
	{
		public static readonly uint[] Table;

		private uint _value = uint.MaxValue;

		static CRC()
		{
			Table = new uint[256];
			for (uint num = 0u; num < 256; num++)
			{
				uint num2 = num;
				for (int i = 0; i < 8; i++)
				{
					num2 = (((num2 & 1) == 0) ? (num2 >> 1) : ((num2 >> 1) ^ 0xEDB88320u));
				}
				Table[num] = num2;
			}
		}

		public void Init()
		{
			_value = uint.MaxValue;
		}

		public void UpdateByte(byte b)
		{
			_value = Table[(byte)_value ^ b] ^ (_value >> 8);
		}

		public void Update(byte[] data, uint offset, uint size)
		{
			for (uint num = 0u; num < size; num++)
			{
				_value = Table[(byte)_value ^ data[offset + num]] ^ (_value >> 8);
			}
		}

		public uint GetDigest()
		{
			return _value ^ 0xFFFFFFFFu;
		}

		private static uint CalculateDigest(byte[] data, uint offset, uint size)
		{
			CRC cRC = new CRC();
			cRC.Update(data, offset, size);
			return cRC.GetDigest();
		}

		private static bool VerifyDigest(uint digest, byte[] data, uint offset, uint size)
		{
			return CalculateDigest(data, offset, size) == digest;
		}
	}
	internal class DataErrorException : ApplicationException
	{
		public DataErrorException()
			: base("Data Error")
		{
		}
	}
	internal class InvalidParamException : ApplicationException
	{
		public InvalidParamException()
			: base("Invalid Parameter")
		{
		}
	}
	public interface ICodeProgress
	{
		void SetProgress(long inSize, long outSize);
	}
	public interface ICoder
	{
		void Code(Stream inStream, Stream outStream, long inSize, long outSize, ICodeProgress progress);
	}
	public enum CoderPropID
	{
		DefaultProp,
		DictionarySize,
		UsedMemorySize,
		Order,
		BlockSize,
		PosStateBits,
		LitContextBits,
		LitPosBits,
		NumFastBytes,
		MatchFinder,
		MatchFinderCycles,
		NumPasses,
		Algorithm,
		NumThreads,
		EndMarker
	}
	public interface ISetCoderProperties
	{
		void SetCoderProperties(CoderPropID[] propIDs, object[] properties);
	}
	public interface IWriteCoderProperties
	{
		void WriteCoderProperties(Stream outStream);
	}
	public interface ISetDecoderProperties
	{
		void SetDecoderProperties(byte[] properties);
	}
}
namespace SevenZip.Compression.RangeCoder
{
	internal class Encoder
	{
		public const uint kTopValue = 16777216u;

		private Stream Stream;

		public ulong Low;

		public uint Range;

		private uint _cacheSize;

		private byte _cache;

		private long StartPosition;

		public void SetStream(Stream stream)
		{
			Stream = stream;
		}

		public void ReleaseStream()
		{
			Stream = null;
		}

		public void Init()
		{
			StartPosition = Stream.Position;
			Low = 0uL;
			Range = uint.MaxValue;
			_cacheSize = 1u;
			_cache = 0;
		}

		public void FlushData()
		{
			for (int i = 0; i < 5; i++)
			{
				ShiftLow();
			}
		}

		public void FlushStream()
		{
			Stream.Flush();
		}

		public void CloseStream()
		{
			Stream.Close();
		}

		public void Encode(uint start, uint size, uint total)
		{
			Low += start * (Range /= total);
			Range *= size;
			while (Range < 16777216)
			{
				Range <<= 8;
				ShiftLow();
			}
		}

		public void ShiftLow()
		{
			if ((uint)Low < 4278190080u || (int)(Low >> 32) == 1)
			{
				byte b = _cache;
				do
				{
					Stream.WriteByte((byte)(b + (Low >> 32)));
					b = byte.MaxValue;
				}
				while (--_cacheSize != 0);
				_cache = (byte)((uint)Low >> 24);
			}
			_cacheSize++;
			Low = (uint)((int)Low << 8);
		}

		public void EncodeDirectBits(uint v, int numTotalBits)
		{
			for (int num = numTotalBits - 1; num >= 0; num--)
			{
				Range >>= 1;
				if (((v >> num) & 1) == 1)
				{
					Low += Range;
				}
				if (Range < 16777216)
				{
					Range <<= 8;
					ShiftLow();
				}
			}
		}

		public void EncodeBit(uint size0, int numTotalBits, uint symbol)
		{
			uint num = (Range >> numTotalBits) * size0;
			if (symbol == 0)
			{
				Range = num;
			}
			else
			{
				Low += num;
				Range -= num;
			}
			while (Range < 16777216)
			{
				Range <<= 8;
				ShiftLow();
			}
		}

		public long GetProcessedSizeAdd()
		{
			return _cacheSize + Stream.Position - StartPosition + 4;
		}
	}
	internal class Decoder
	{
		public const uint kTopValue = 16777216u;

		public uint Range;

		public uint Code;

		public Stream Stream;

		public void Init(Stream stream)
		{
			Stream = stream;
			Code = 0u;
			Range = uint.MaxValue;
			for (int i = 0; i < 5; i++)
			{
				Code = (Code << 8) | (byte)Stream.ReadByte();
			}
		}

		public void ReleaseStream()
		{
			Stream = null;
		}

		public void CloseStream()
		{
			Stream.Close();
		}

		public void Normalize()
		{
			while (Range < 16777216)
			{
				Code = (Code << 8) | (byte)Stream.ReadByte();
				Range <<= 8;
			}
		}

		public void Normalize2()
		{
			if (Range < 16777216)
			{
				Code = (Code << 8) | (byte)Stream.ReadByte();
				Range <<= 8;
			}
		}

		public uint GetThreshold(uint total)
		{
			return Code / (Range /= total);
		}

		public void Decode(uint start, uint size, uint total)
		{
			Code -= start * Range;
			Range *= size;
			Normalize();
		}

		public uint DecodeDirectBits(int numTotalBits)
		{
			uint num = Range;
			uint num2 = Code;
			uint num3 = 0u;
			for (int num4 = numTotalBits; num4 > 0; num4--)
			{
				num >>= 1;
				uint num5 = num2 - num >> 31;
				num2 -= num & (num5 - 1);
				num3 = (num3 << 1) | (1 - num5);
				if (num < 16777216)
				{
					num2 = (num2 << 8) | (byte)Stream.ReadByte();
					num <<= 8;
				}
			}
			Range = num;
			Code = num2;
			return num3;
		}

		public uint DecodeBit(uint size0, int numTotalBits)
		{
			uint num = (Range >> numTotalBits) * size0;
			uint result;
			if (Code < num)
			{
				result = 0u;
				Range = num;
			}
			else
			{
				result = 1u;
				Code -= num;
				Range -= num;
			}
			Normalize();
			return result;
		}
	}
	internal struct BitEncoder
	{
		public const int kNumBitModelTotalBits = 11;

		public const uint kBitModelTotal = 2048u;

		private const int kNumMoveBits = 5;

		private const int kNumMoveReducingBits = 2;

		public const int kNumBitPriceShiftBits = 6;

		private uint Prob;

		private static uint[] ProbPrices;

		public void Init()
		{
			Prob = 1024u;
		}

		public void UpdateModel(uint symbol)
		{
			if (symbol == 0)
			{
				Prob += 2048 - Prob >> 5;
			}
			else
			{
				Prob -= Prob >> 5;
			}
		}

		public void Encode(Encoder encoder, uint symbol)
		{
			uint num = (encoder.Range >> 11) * Prob;
			if (symbol == 0)
			{
				encoder.Range = num;
				Prob += 2048 - Prob >> 5;
			}
			else
			{
				encoder.Low += num;
				encoder.Range -= num;
				Prob -= Prob >> 5;
			}
			if (encoder.Range < 16777216)
			{
				encoder.Range <<= 8;
				encoder.ShiftLow();
			}
		}

		static BitEncoder()
		{
			ProbPrices = new uint[512];
			for (int num = 8; num >= 0; num--)
			{
				int num2 = 1 << 9 - num - 1;
				uint num3 = (uint)(1 << 9 - num);
				for (uint num4 = (uint)num2; num4 < num3; num4++)
				{
					ProbPrices[num4] = (uint)(num << 6) + (num3 - num4 << 6 >> 9 - num - 1);
				}
			}
		}

		public uint GetPrice(uint symbol)
		{
			return ProbPrices[(((Prob - symbol) ^ (int)(0 - symbol)) & 0x7FF) >> 2];
		}

		public uint GetPrice0()
		{
			return ProbPrices[Prob >> 2];
		}

		public uint GetPrice1()
		{
			return ProbPrices[2048 - Prob >> 2];
		}
	}
	internal struct BitDecoder
	{
		public const int kNumBitModelTotalBits = 11;

		public const uint kBitModelTotal = 2048u;

		private const int kNumMoveBits = 5;

		private uint Prob;

		public void UpdateModel(int numMoveBits, uint symbol)
		{
			if (symbol == 0)
			{
				Prob += 2048 - Prob >> numMoveBits;
			}
			else
			{
				Prob -= Prob >> numMoveBits;
			}
		}

		public void Init()
		{
			Prob = 1024u;
		}

		public uint Decode(Decoder rangeDecoder)
		{
			uint num = (rangeDecoder.Range >> 11) * Prob;
			if (rangeDecoder.Code < num)
			{
				rangeDecoder.Range = num;
				Prob += 2048 - Prob >> 5;
				if (rangeDecoder.Range < 16777216)
				{
					rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte();
					rangeDecoder.Range <<= 8;
				}
				return 0u;
			}
			rangeDecoder.Range -= num;
			rangeDecoder.Code -= num;
			Prob -= Prob >> 5;
			if (rangeDecoder.Range < 16777216)
			{
				rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte();
				rangeDecoder.Range <<= 8;
			}
			return 1u;
		}
	}
	internal struct BitTreeEncoder
	{
		private BitEncoder[] Models;

		private int NumBitLevels;

		public BitTreeEncoder(int numBitLevels)
		{
			NumBitLevels = numBitLevels;
			Models = new BitEncoder[1 << numBitLevels];
		}

		public void Init()
		{
			for (uint num = 1u; num < 1 << NumBitLevels; num++)
			{
				Models[num].Init();
			}
		}

		public void Encode(Encoder rangeEncoder, uint symbol)
		{
			uint num = 1u;
			int num2 = NumBitLevels;
			while (num2 > 0)
			{
				num2--;
				uint num3 = (symbol >> num2) & 1u;
				Models[num].Encode(rangeEncoder, num3);
				num = (num << 1) | num3;
			}
		}

		public void ReverseEncode(Encoder rangeEncoder, uint symbol)
		{
			uint num = 1u;
			for (uint num2 = 0u; num2 < NumBitLevels; num2++)
			{
				uint num3 = symbol & 1u;
				Models[num].Encode(rangeEncoder, num3);
				num = (num << 1) | num3;
				symbol >>= 1;
			}
		}

		public uint GetPrice(uint symbol)
		{
			uint num = 0u;
			uint num2 = 1u;
			int num3 = NumBitLevels;
			while (num3 > 0)
			{
				num3--;
				uint num4 = (symbol >> num3) & 1u;
				num += Models[num2].GetPrice(num4);
				num2 = (num2 << 1) + num4;
			}
			return num;
		}

		public uint ReverseGetPrice(uint symbol)
		{
			uint num = 0u;
			uint num2 = 1u;
			for (int num3 = NumBitLevels; num3 > 0; num3--)
			{
				uint num4 = symbol & 1u;
				symbol >>= 1;
				num += Models[num2].GetPrice(num4);
				num2 = (num2 << 1) | num4;
			}
			return num;
		}

		public static uint ReverseGetPrice(BitEncoder[] Models, uint startIndex, int NumBitLevels, uint symbol)
		{
			uint num = 0u;
			uint num2 = 1u;
			for (int num3 = NumBitLevels; num3 > 0; num3--)
			{
				uint num4 = symbol & 1u;
				symbol >>= 1;
				num += Models[startIndex + num2].GetPrice(num4);
				num2 = (num2 << 1) | num4;
			}
			return num;
		}

		public static void ReverseEncode(BitEncoder[] Models, uint startIndex, Encoder rangeEncoder, int NumBitLevels, uint symbol)
		{
			uint num = 1u;
			for (int i = 0; i < NumBitLevels; i++)
			{
				uint num2 = symbol & 1u;
				Models[startIndex + num].Encode(rangeEncoder, num2);
				num = (num << 1) | num2;
				symbol >>= 1;
			}
		}
	}
	internal struct BitTreeDecoder
	{
		private BitDecoder[] Models;

		private int NumBitLevels;

		public BitTreeDecoder(int numBitLevels)
		{
			NumBitLevels = numBitLevels;
			Models = new BitDecoder[1 << numBitLevels];
		}

		public void Init()
		{
			for (uint num = 1u; num < 1 << NumBitLevels; num++)
			{
				Models[num].Init();
			}
		}

		public uint Decode(Decoder rangeDecoder)
		{
			uint num = 1u;
			for (int num2 = NumBitLevels; num2 > 0; num2--)
			{
				num = (num << 1) + Models[num].Decode(rangeDecoder);
			}
			return num - (uint)(1 << NumBitLevels);
		}

		public uint ReverseDecode(Decoder rangeDecoder)
		{
			uint num = 1u;
			uint num2 = 0u;
			for (int i = 0; i < NumBitLevels; i++)
			{
				uint num3 = Models[num].Decode(rangeDecoder);
				num <<= 1;
				num += num3;
				num2 |= num3 << i;
			}
			return num2;
		}

		public static uint ReverseDecode(BitDecoder[] Models, uint startIndex, Decoder rangeDecoder, int NumBitLevels)
		{
			uint num = 1u;
			uint num2 = 0u;
			for (int i = 0; i < NumBitLevels; i++)
			{
				uint num3 = Models[startIndex + num].Decode(rangeDecoder);
				num <<= 1;
				num += num3;
				num2 |= num3 << i;
			}
			return num2;
		}
	}
}
namespace SevenZip.Compression.LZ
{
	internal interface IInWindowStream
	{
		void SetStream(Stream inStream);

		void Init();

		void ReleaseStream();

		byte GetIndexByte(int index);

		uint GetMatchLen(int index, uint distance, uint limit);

		uint GetNumAvailableBytes();
	}
	internal interface IMatchFinder : IInWindowStream
	{
		void Create(uint historySize, uint keepAddBufferBefore, uint matchMaxLen, uint keepAddBufferAfter);

		uint GetMatches(uint[] distances);

		void Skip(uint num);
	}
	public class BinTree : InWindow, IMatchFinder, IInWindowStream
	{
		private uint _cyclicBufferPos;

		private uint _cyclicBufferSize;

		private uint _matchMaxLen;

		private uint[] _son;

		private uint[] _hash;

		private uint _cutValue = 255u;

		private uint _hashMask;

		private uint _hashSizeSum;

		private bool HASH_ARRAY = true;

		private const uint kHash2Size = 1024u;

		private const uint kHash3Size = 65536u;

		private const uint kBT2HashSize = 65536u;

		private const uint kStartMaxLen = 1u;

		private const uint kHash3Offset = 1024u;

		private const uint kEmptyHashValue = 0u;

		private const uint kMaxValForNormalize = 2147483647u;

		private uint kNumHashDirectBytes;

		private uint kMinMatchCheck = 4u;

		private uint kFixHashSize = 66560u;

		public void SetType(int numHashBytes)
		{
			HASH_ARRAY = numHashBytes > 2;
			if (HASH_ARRAY)
			{
				kNumHashDirectBytes = 0u;
				kMinMatchCheck = 4u;
				kFixHashSize = 66560u;
			}
			else
			{
				kNumHashDirectBytes = 2u;
				kMinMatchCheck = 3u;
				kFixHashSize = 0u;
			}
		}

		public new void SetStream(Stream stream)
		{
			base.SetStream(stream);
		}

		public new void ReleaseStream()
		{
			base.ReleaseStream();
		}

		public new void Init()
		{
			base.Init();
			for (uint num = 0u; num < _hashSizeSum; num++)
			{
				_hash[num] = 0u;
			}
			_cyclicBufferPos = 0u;
			ReduceOffsets(-1);
		}

		public new void MovePos()
		{
			if (++_cyclicBufferPos >= _cyclicBufferSize)
			{
				_cyclicBufferPos = 0u;
			}
			base.MovePos();
			if (_pos == int.MaxValue)
			{
				Normalize();
			}
		}

		public new byte GetIndexByte(int index)
		{
			return base.GetIndexByte(index);
		}

		public new uint GetMatchLen(int index, uint distance, uint limit)
		{
			return base.GetMatchLen(index, distance, limit);
		}

		public new uint GetNumAvailableBytes()
		{
			return base.GetNumAvailableBytes();
		}

		public void Create(uint historySize, uint keepAddBufferBefore, uint matchMaxLen, uint keepAddBufferAfter)
		{
			if (historySize > 2147483391)
			{
				throw new Exception();
			}
			_cutValue = 16 + (matchMaxLen >> 1);
			uint keepSizeReserv = (historySize + keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + 256;
			Create(historySize + keepAddBufferBefore, matchMaxLen + keepAddBufferAfter, keepSizeReserv);
			_matchMaxLen = matchMaxLen;
			uint num = historySize + 1;
			if (_cyclicBufferSize != num)
			{
				_son = new uint[(_cyclicBufferSize = num) * 2];
			}
			uint num2 = 65536u;
			if (HASH_ARRAY)
			{
				num2 = historySize - 1;
				num2 |= num2 >> 1;
				num2 |= num2 >> 2;
				num2 |= num2 >> 4;
				num2 |= num2 >> 8;
				num2 >>= 1;
				num2 |= 0xFFFFu;
				if (num2 > 16777216)
				{
					num2 >>= 1;
				}
				_hashMask = num2;
				num2++;
				num2 += kFixHashSize;
			}
			if (num2 != _hashSizeSum)
			{
				_hash = new uint[_hashSizeSum = num2];
			}
		}

		public uint GetMatches(uint[] distances)
		{
			uint num;
			if (_pos + _matchMaxLen <= _streamPos)
			{
				num = _matchMaxLen;
			}
			else
			{
				num = _streamPos - _pos;
				if (num < kMinMatchCheck)
				{
					MovePos();
					return 0u;
				}
			}
			uint num2 = 0u;
			uint num3 = ((_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0u);
			uint num4 = _bufferOffset + _pos;
			uint num5 = 1u;
			uint num6 = 0u;
			uint num7 = 0u;
			uint num10;
			if (HASH_ARRAY)
			{
				uint num8 = CRC.Table[_bufferBase[num4]] ^ _bufferBase[num4 + 1];
				num6 = num8 & 0x3FFu;
				int num9 = (int)num8 ^ (_bufferBase[num4 + 2] << 8);
				num7 = (uint)num9 & 0xFFFFu;
				num10 = ((uint)num9 ^ (CRC.Table[_bufferBase[num4 + 3]] << 5)) & _hashMask;
			}
			else
			{
				num10 = (uint)(_bufferBase[num4] ^ (_bufferBase[num4 + 1] << 8));
			}
			uint num11 = _hash[kFixHashSize + num10];
			if (HASH_ARRAY)
			{
				uint num12 = _hash[num6];
				uint num13 = _hash[1024 + num7];
				_hash[num6] = _pos;
				_hash[1024 + num7] = _pos;
				if (num12 > num3 && _bufferBase[_bufferOffset + num12] == _bufferBase[num4])
				{
					num5 = (distances[num2++] = 2u);
					distances[num2++] = _pos - num12 - 1;
				}
				if (num13 > num3 && _bufferBase[_bufferOffset + num13] == _bufferBase[num4])
				{
					if (num13 == num12)
					{
						num2 -= 2;
					}
					num5 = (distances[num2++] = 3u);
					distances[num2++] = _pos - num13 - 1;
					num12 = num13;
				}
				if (num2 != 0 && num12 == num11)
				{
					num2 -= 2;
					num5 = 1u;
				}
			}
			_hash[kFixHashSize + num10] = _pos;
			uint num14 = (_cyclicBufferPos << 1) + 1;
			uint num15 = _cyclicBufferPos << 1;
			uint val;
			uint val2 = (val = kNumHashDirectBytes);
			if (kNumHashDirectBytes != 0 && num11 > num3 && _bufferBase[_bufferOffset + num11 + kNumHashDirectBytes] != _bufferBase[num4 + kNumHashDirectBytes])
			{
				num5 = (distances[num2++] = kNumHashDirectBytes);
				distances[num2++] = _pos - num11 - 1;
			}
			uint cutValue = _cutValue;
			while (true)
			{
				if (num11 <= num3 || cutValue-- == 0)
				{
					_son[num14] = (_son[num15] = 0u);
					break;
				}
				uint num16 = _pos - num11;
				uint num17 = ((num16 <= _cyclicBufferPos) ? (_cyclicBufferPos - num16) : (_cyclicBufferPos - num16 + _cyclicBufferSize)) << 1;
				uint num18 = _bufferOffset + num11;
				uint num19 = Math.Min(val2, val);
				if (_bufferBase[num18 + num19] == _bufferBase[num4 + num19])
				{
					while (++num19 != num && _bufferBase[num18 + num19] == _bufferBase[num4 + num19])
					{
					}
					if (num5 < num19)
					{
						num5 = (distances[num2++] = num19);
						distances[num2++] = num16 - 1;
						if (num19 == num)
						{
							_son[num15] = _son[num17];
							_son[num14] = _son[num17 + 1];
							break;
						}
					}
				}
				if (_bufferBase[num18 + num19] < _bufferBase[num4 + num19])
				{
					_son[num15] = num11;
					num15 = num17 + 1;
					num11 = _son[num15];
					val = num19;
				}
				else
				{
					_son[num14] = num11;
					num14 = num17;
					num11 = _son[num14];
					val2 = num19;
				}
			}
			MovePos();
			return num2;
		}

		public void Skip(uint num)
		{
			do
			{
				uint num2;
				if (_pos + _matchMaxLen <= _streamPos)
				{
					num2 = _matchMaxLen;
				}
				else
				{
					num2 = _streamPos - _pos;
					if (num2 < kMinMatchCheck)
					{
						MovePos();
						continue;
					}
				}
				uint num3 = ((_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0u);
				uint num4 = _bufferOffset + _pos;
				uint num9;
				if (HASH_ARRAY)
				{
					uint num5 = CRC.Table[_bufferBase[num4]] ^ _bufferBase[num4 + 1];
					uint num6 = num5 & 0x3FFu;
					_hash[num6] = _pos;
					int num7 = (int)num5 ^ (_bufferBase[num4 + 2] << 8);
					uint num8 = (uint)num7 & 0xFFFFu;
					_hash[1024 + num8] = _pos;
					num9 = ((uint)num7 ^ (CRC.Table[_bufferBase[num4 + 3]] << 5)) & _hashMask;
				}
				else
				{
					num9 = (uint)(_bufferBase[num4] ^ (_bufferBase[num4 + 1] << 8));
				}
				uint num10 = _hash[kFixHashSize + num9];
				_hash[kFixHashSize + num9] = _pos;
				uint num11 = (_cyclicBufferPos << 1) + 1;
				uint num12 = _cyclicBufferPos << 1;
				uint val;
				uint val2 = (val = kNumHashDirectBytes);
				uint cutValue = _cutValue;
				while (true)
				{
					if (num10 <= num3 || cutValue-- == 0)
					{
						_son[num11] = (_son[num12] = 0u);
						break;
					}
					uint num13 = _pos - num10;
					uint num14 = ((num13 <= _cyclicBufferPos) ? (_cyclicBufferPos - num13) : (_cyclicBufferPos - num13 + _cyclicBufferSize)) << 1;
					uint num15 = _bufferOffset + num10;
					uint num16 = Math.Min(val2, val);
					if (_bufferBase[num15 + num16] == _bufferBase[num4 + num16])
					{
						while (++num16 != num2 && _bufferBase[num15 + num16] == _bufferBase[num4 + num16])
						{
						}
						if (num16 == num2)
						{
							_son[num12] = _son[num14];
							_son[num11] = _son[num14 + 1];
							break;
						}
					}
					if (_bufferBase[num15 + num16] < _bufferBase[num4 + num16])
					{
						_son[num12] = num10;
						num12 = num14 + 1;
						num10 = _son[num12];
						val = num16;
					}
					else
					{
						_son[num11] = num10;
						num11 = num14;
						num10 = _son[num11];
						val2 = num16;
					}
				}
				MovePos();
			}
			while (--num != 0);
		}

		private void NormalizeLinks(uint[] items, uint numItems, uint subValue)
		{
			for (uint num = 0u; num < numItems; num++)
			{
				uint num2 = items[num];
				num2 = ((num2 > subValue) ? (num2 - subValue) : 0u);
				items[num] = num2;
			}
		}

		private void Normalize()
		{
			uint subValue = _pos - _cyclicBufferSize;
			NormalizeLinks(_son, _cyclicBufferSize * 2, subValue);
			NormalizeLinks(_hash, _hashSizeSum, subValue);
			ReduceOffsets((int)subValue);
		}

		public void SetCutValue(uint cutValue)
		{
			_cutValue = cutValue;
		}
	}
	public class InWindow
	{
		public byte[] _bufferBase;

		private Stream _stream;

		private uint _posLimit;

		private bool _streamEndWasReached;

		private uint _pointerToLastSafePosition;

		public uint _bufferOffset;

		public uint _blockSize;

		public uint _pos;

		private uint _keepSizeBefore;

		private uint _keepSizeAfter;

		public uint _streamPos;

		public void MoveBlock()
		{
			uint num = _bufferOffset + _pos - _keepSizeBefore;
			if (num != 0)
			{
				num--;
			}
			uint num2 = _bufferOffset + _streamPos - num;
			for (uint num3 = 0u; num3 < num2; num3++)
			{
				_bufferBase[num3] = _bufferBase[num + num3];
			}
			_bufferOffset -= num;
		}

		public virtual void ReadBlock()
		{
			if (_streamEndWasReached)
			{
				return;
			}
			while (true)
			{
				int num = (int)(0 - _bufferOffset + _blockSize - _streamPos);
				if (num == 0)
				{
					return;
				}
				int num2 = _stream.Read(_bufferBase, (int)(_bufferOffset + _streamPos), num);
				if (num2 == 0)
				{
					break;
				}
				_streamPos += (uint)num2;
				if (_streamPos >= _pos + _keepSizeAfter)
				{
					_posLimit = _streamPos - _keepSizeAfter;
				}
			}
			_posLimit = _streamPos;
			if (_bufferOffset + _posLimit > _pointerToLastSafePosition)
			{
				_posLimit = _pointerToLastSafePosition - _bufferOffset;
			}
			_streamEndWasReached = true;
		}

		private void Free()
		{
			_bufferBase = null;
		}

		public void Create(uint keepSizeBefore, uint keepSizeAfter, uint keepSizeReserv)
		{
			_keepSizeBefore = keepSizeBefore;
			_keepSizeAfter = keepSizeAfter;
			uint num = keepSizeBefore + keepSizeAfter + keepSizeReserv;
			if (_bufferBase == null || _blockSize != num)
			{
				Free();
				_blockSize = num;
				_bufferBase = new byte[_blockSize];
			}
			_pointerToLastSafePosition = _blockSize - keepSizeAfter;
		}

		public void SetStream(Stream stream)
		{
			_stream = stream;
		}

		public void ReleaseStream()
		{
			_stream = null;
		}

		public void Init()
		{
			_bufferOffset = 0u;
			_pos = 0u;
			_streamPos = 0u;
			_streamEndWasReached = false;
			ReadBlock();
		}

		public void MovePos()
		{
			_pos++;
			if (_pos > _posLimit)
			{
				if (_bufferOffset + _pos > _pointerToLastSafePosition)
				{
					MoveBlock();
				}
				ReadBlock();
			}
		}

		public byte GetIndexByte(int index)
		{
			return _bufferBase[_bufferOffset + _pos + index];
		}

		public uint GetMatchLen(int index, uint distance, uint limit)
		{
			if (_streamEndWasReached && _pos + index + limit > _streamPos)
			{
				limit = _streamPos - (uint)(int)(_pos + index);
			}
			distance++;
			uint num = _bufferOffset + _pos + (uint)index;
			uint num2;
			for (num2 = 0u; num2 < limit && _bufferBase[num + num2] == _bufferBase[num + num2 - distance]; num2++)
			{
			}
			return num2;
		}

		public uint GetNumAvailableBytes()
		{
			return _streamPos - _pos;
		}

		public void ReduceOffsets(int subValue)
		{
			_bufferOffset += (uint)subValue;
			_posLimit -= (uint)subValue;
			_pos -= (uint)subValue;
			_streamPos -= (uint)subValue;
		}
	}
	public class OutWindow
	{
		private byte[] _buffer;

		private uint _pos;

		private uint _windowSize;

		private uint _streamPos;

		private Stream _stream;

		public uint TrainSize;

		public void Create(uint windowSize)
		{
			if (_windowSize != windowSize)
			{
				_buffer = new byte[windowSize];
			}
			_windowSize = windowSize;
			_pos = 0u;
			_streamPos = 0u;
		}

		public void Init(Stream stream, bool solid)
		{
			ReleaseStream();
			_stream = stream;
			if (!solid)
			{
				_streamPos = 0u;
				_pos = 0u;
				TrainSize = 0u;
			}
		}

		public bool Train(Stream stream)
		{
			long length = stream.Length;
			uint num = (TrainSize = (uint)((length < _windowSize) ? length : _windowSize));
			stream.Position = length - num;
			_streamPos = (_pos = 0u);
			while (num != 0)
			{
				uint num2 = _windowSize - _pos;
				if (num < num2)
				{
					num2 = num;
				}
				int num3 = stream.Read(_buffer, (int)_pos, (int)num2);
				if (num3 == 0)
				{
					return false;
				}
				num -= (uint)num3;
				_pos += (uint)num3;
				_streamPos += (uint)num3;
				if (_pos == _windowSize)
				{
					_streamPos = (_pos = 0u);
				}
			}
			return true;
		}

		public void ReleaseStream()
		{
			Flush();
			_stream = null;
		}

		public void Flush()
		{
			uint num = _pos - _streamPos;
			if (num != 0)
			{
				_stream.Write(_buffer, (int)_streamPos, (int)num);
				if (_pos >= _windowSize)
				{
					_pos = 0u;
				}
				_streamPos = _pos;
			}
		}

		public void CopyBlock(uint distance, uint len)
		{
			uint num = _pos - distance - 1;
			if (num >= _windowSize)
			{
				num += _windowSize;
			}
			while (len != 0)
			{
				if (num >= _windowSize)
				{
					num = 0u;
				}
				_buffer[_pos++] = _buffer[num++];
				if (_pos >= _windowSize)
				{
					Flush();
				}
				len--;
			}
		}

		public void PutByte(byte b)
		{
			_buffer[_pos++] = b;
			if (_pos >= _windowSize)
			{
				Flush();
			}
		}

		public byte GetByte(uint distance)
		{
			uint num = _pos - distance - 1;
			if (num >= _windowSize)
			{
				num += _windowSize;
			}
			return _buffer[num];
		}
	}
}
namespace SevenZip.Compression.LZMA
{
	internal abstract class Base
	{
		public struct State
		{
			public uint Index;

			public void Init()
			{
				Index = 0u;
			}

			public void UpdateChar()
			{
				if (Index < 4)
				{
					Index = 0u;
				}
				else if (Index < 10)
				{
					Index -= 3u;
				}
				else
				{
					Index -= 6u;
				}
			}

			public void UpdateMatch()
			{
				Index = ((Index < 7) ? 7u : 10u);
			}

			public void UpdateRep()
			{
				Index = ((Index < 7) ? 8u : 11u);
			}

			public void UpdateShortRep()
			{
				Index = ((Index < 7) ? 9u : 11u);
			}

			public bool IsCharState()
			{
				return Index < 7;
			}
		}

		public const uint kNumRepDistances = 4u;

		public const uint kNumStates = 12u;

		public const int kNumPosSlotBits = 6;

		public const int kDicLogSizeMin = 0;

		public const int kNumLenToPosStatesBits = 2;

		public const uint kNumLenToPosStates = 4u;

		public const uint kMatchMinLen = 2u;

		public const int kNumAlignBits = 4;

		public const uint kAlignTableSize = 16u;

		public const uint kAlignMask = 15u;

		public const uint kStartPosModelIndex = 4u;

		public const uint kEndPosModelIndex = 14u;

		public const uint kNumPosModels = 10u;

		public const uint kNumFullDistances = 128u;

		public const uint kNumLitPosStatesBitsEncodingMax = 4u;

		public const uint kNumLitContextBitsMax = 8u;

		public const int kNumPosStatesBitsMax = 4;

		public const uint kNumPosStatesMax = 16u;

		public const int kNumPosStatesBitsEncodingMax = 4;

		public const uint kNumPosStatesEncodingMax = 16u;

		public const int kNumLowLenBits = 3;

		public const int kNumMidLenBits = 3;

		public const int kNumHighLenBits = 8;

		public const uint kNumLowLenSymbols = 8u;

		public const uint kNumMidLenSymbols = 8u;

		public const uint kNumLenSymbols = 272u;

		public const uint kMatchMaxLen = 273u;

		public static uint GetLenToPosState(uint len)
		{
			len -= 2;
			if (len < 4)
			{
				return len;
			}
			return 3u;
		}
	}
	public class Decoder : ICoder, ISetDecoderProperties
	{
		private class LenDecoder
		{
			private BitDecoder m_Choice;

			private BitDecoder m_Choice2;

			private BitTreeDecoder[] m_LowCoder = new BitTreeDecoder[16];

			private BitTreeDecoder[] m_MidCoder = new BitTreeDecoder[16];

			private BitTreeDecoder m_HighCoder = new BitTreeDecoder(8);

			private uint m_NumPosStates;

			public void Create(uint numPosStates)
			{
				for (uint num = m_NumPosStates; num < numPosStates; num++)
				{
					m_LowCoder[num] = new BitTreeDecoder(3);
					m_MidCoder[num] = new BitTreeDecoder(3);
				}
				m_NumPosStates = numPosStates;
			}

			public void Init()
			{
				m_Choice.Init();
				for (uint num = 0u; num < m_NumPosStates; num++)
				{
					m_LowCoder[num].Init();
					m_MidCoder[num].Init();
				}
				m_Choice2.Init();
				m_HighCoder.Init();
			}

			public uint Decode(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, uint posState)
			{
				if (m_Choice.Decode(rangeDecoder) == 0)
				{
					return m_LowCoder[posState].Decode(rangeDecoder);
				}
				uint num = 8u;
				if (m_Choice2.Decode(rangeDecoder) == 0)
				{
					return num + m_MidCoder[posState].Decode(rangeDecoder);
				}
				num += 8;
				return num + m_HighCoder.Decode(rangeDecoder);
			}
		}

		private class LiteralDecoder
		{
			private struct Decoder2
			{
				private BitDecoder[] m_Decoders;

				public void Create()
				{
					m_Decoders = new BitDecoder[768];
				}

				public void Init()
				{
					for (int i = 0; i < 768; i++)
					{
						m_Decoders[i].Init();
					}
				}

				public byte DecodeNormal(SevenZip.Compression.RangeCoder.Decoder rangeDecoder)
				{
					uint num = 1u;
					do
					{
						num = (num << 1) | m_Decoders[num].Decode(rangeDecoder);
					}
					while (num < 256);
					return (byte)num;
				}

				public byte DecodeWithMatchByte(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, byte matchByte)
				{
					uint num = 1u;
					do
					{
						uint num2 = (uint)(matchByte >> 7) & 1u;
						matchByte <<= 1;
						uint num3 = m_Decoders[(1 + num2 << 8) + num].Decode(rangeDecoder);
						num = (num << 1) | num3;
						if (num2 != num3)
						{
							while (num < 256)
							{
								num = (num << 1) | m_Decoders[num].Decode(rangeDecoder);
							}
							break;
						}
					}
					while (num < 256);
					return (byte)num;
				}
			}

			private Decoder2[] m_Coders;

			private int m_NumPrevBits;

			private int m_NumPosBits;

			private uint m_PosMask;

			public void Create(int numPosBits, int numPrevBits)
			{
				if (m_Coders == null || m_NumPrevBits != numPrevBits || m_NumPosBits != numPosBits)
				{
					m_NumPosBits = numPosBits;
					m_PosMask = (uint)((1 << numPosBits) - 1);
					m_NumPrevBits = numPrevBits;
					uint num = (uint)(1 << m_NumPrevBits + m_NumPosBits);
					m_Coders = new Decoder2[num];
					for (uint num2 = 0u; num2 < num; num2++)
					{
						m_Coders[num2].Create();
					}
				}
			}

			public void Init()
			{
				uint num = (uint)(1 << m_NumPrevBits + m_NumPosBits);
				for (uint num2 = 0u; num2 < num; num2++)
				{
					m_Coders[num2].Init();
				}
			}

			private uint GetState(uint pos, byte prevByte)
			{
				return ((pos & m_PosMask) << m_NumPrevBits) + (uint)(prevByte >> 8 - m_NumPrevBits);
			}

			public byte DecodeNormal(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, uint pos, byte prevByte)
			{
				return m_Coders[GetState(pos, prevByte)].DecodeNormal(rangeDecoder);
			}

			public byte DecodeWithMatchByte(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, uint pos, byte prevByte, byte matchByte)
			{
				return m_Coders[GetState(pos, prevByte)].DecodeWithMatchByte(rangeDecoder, matchByte);
			}
		}

		private OutWindow m_OutWindow = new OutWindow();

		private SevenZip.Compression.RangeCoder.Decoder m_RangeDecoder = new SevenZip.Compression.RangeCoder.Decoder();

		private BitDecoder[] m_IsMatchDecoders = new BitDecoder[192];

		private BitDecoder[] m_IsRepDecoders = new BitDecoder[12];

		private BitDecoder[] m_IsRepG0Decoders = new BitDecoder[12];

		private BitDecoder[] m_IsRepG1Decoders = new BitDecoder[12];

		private BitDecoder[] m_IsRepG2Decoders = new BitDecoder[12];

		private BitDecoder[] m_IsRep0LongDecoders = new BitDecoder[192];

		private BitTreeDecoder[] m_PosSlotDecoder = new BitTreeDecoder[4];

		private BitDecoder[] m_PosDecoders = new BitDecoder[114];

		private BitTreeDecoder m_PosAlignDecoder = new BitTreeDecoder(4);

		private LenDecoder m_LenDecoder = new LenDecoder();

		private LenDecoder m_RepLenDecoder = new LenDecoder();

		private LiteralDecoder m_LiteralDecoder = new LiteralDecoder();

		private uint m_DictionarySize;

		private uint m_DictionarySizeCheck;

		private uint m_PosStateMask;

		private bool _solid;

		public Decoder()
		{
			m_DictionarySize = uint.MaxValue;
			for (int i = 0; (long)i < 4L; i++)
			{
				m_PosSlotDecoder[i] = new BitTreeDecoder(6);
			}
		}

		private void SetDictionarySize(uint dictionarySize)
		{
			if (m_DictionarySize != dictionarySize)
			{
				m_DictionarySize = dictionarySize;
				m_DictionarySizeCheck = Math.Max(m_DictionarySize, 1u);
				uint windowSize = Math.Max(m_DictionarySizeCheck, 4096u);
				m_OutWindow.Create(windowSize);
			}
		}

		private void SetLiteralProperties(int lp, int lc)
		{
			if (lp > 8)
			{
				throw new InvalidParamException();
			}
			if (lc > 8)
			{
				throw new InvalidParamException();
			}
			m_LiteralDecoder.Create(lp, lc);
		}

		private void SetPosBitsProperties(int pb)
		{
			if (pb > 4)
			{
				throw new InvalidParamException();
			}
			uint num = (uint)(1 << pb);
			m_LenDecoder.Create(num);
			m_RepLenDecoder.Create(num);
			m_PosStateMask = num - 1;
		}

		private void Init(Stream inStream, Stream outStream)
		{
			m_RangeDecoder.Init(inStream);
			m_OutWindow.Init(outStream, _solid);
			for (uint num = 0u; num < 12; num++)
			{
				for (uint num2 = 0u; num2 <= m_PosStateMask; num2++)
				{
					uint num3 = (num << 4) + num2;
					m_IsMatchDecoders[num3].Init();
					m_IsRep0LongDecoders[num3].Init();
				}
				m_IsRepDecoders[num].Init();
				m_IsRepG0Decoders[num].Init();
				m_IsRepG1Decoders[num].Init();
				m_IsRepG2Decoders[num].Init();
			}
			m_LiteralDecoder.Init();
			for (uint num = 0u; num < 4; num++)
			{
				m_PosSlotDecoder[num].Init();
			}
			for (uint num = 0u; num < 114; num++)
			{
				m_PosDecoders[num].Init();
			}
			m_LenDecoder.Init();
			m_RepLenDecoder.Init();
			m_PosAlignDecoder.Init();
		}

		public void Code(Stream inStream, Stream outStream, long inSize, long outSize, ICodeProgress progress)
		{
			Init(inStream, outStream);
			Base.State state = default(Base.State);
			state.Init();
			uint num = 0u;
			uint num2 = 0u;
			uint num3 = 0u;
			uint num4 = 0u;
			ulong num5 = 0uL;
			if (num5 < (ulong)outSize)
			{
				if (m_IsMatchDecoders[state.Index << 4].Decode(m_RangeDecoder) != 0)
				{
					throw new DataErrorException();
				}
				state.UpdateChar();
				byte b = m_LiteralDecoder.DecodeNormal(m_RangeDecoder, 0u, 0);
				m_OutWindow.PutByte(b);
				num5++;
			}
			while (num5 < (ulong)outSize)
			{
				uint num6 = (uint)(int)num5 & m_PosStateMask;
				if (m_IsMatchDecoders[(state.Index << 4) + num6].Decode(m_RangeDecoder) == 0)
				{
					byte @byte = m_OutWindow.GetByte(0u);
					byte b2 = (state.IsCharState() ? m_LiteralDecoder.DecodeNormal(m_RangeDecoder, (uint)num5, @byte) : m_LiteralDecoder.DecodeWithMatchByte(m_RangeDecoder, (uint)num5, @byte, m_OutWindow.GetByte(num)));
					m_OutWindow.PutByte(b2);
					state.UpdateChar();
					num5++;
					continue;
				}
				uint num8;
				if (m_IsRepDecoders[state.Index].Decode(m_RangeDecoder) == 1)
				{
					if (m_IsRepG0Decoders[state.Index].Decode(m_RangeDecoder) == 0)
					{
						if (m_IsRep0LongDecoders[(state.Index << 4) + num6].Decode(m_RangeDecoder) == 0)
						{
							state.UpdateShortRep();
							m_OutWindow.PutByte(m_OutWindow.GetByte(num));
							num5++;
							continue;
						}
					}
					else
					{
						uint num7;
						if (m_IsRepG1Decoders[state.Index].Decode(m_RangeDecoder) == 0)
						{
							num7 = num2;
						}
						else
						{
							if (m_IsRepG2Decoders[state.Index].Decode(m_RangeDecoder) == 0)
							{
								num7 = num3;
							}
							else
							{
								num7 = num4;
								num4 = num3;
							}
							num3 = num2;
						}
						num2 = num;
						num = num7;
					}
					num8 = m_RepLenDecoder.Decode(m_RangeDecoder, num6) + 2;
					state.UpdateRep();
				}
				else
				{
					num4 = num3;
					num3 = num2;
					num2 = num;
					num8 = 2 + m_LenDecoder.Decode(m_RangeDecoder, num6);
					state.UpdateMatch();
					uint num9 = m_PosSlotDecoder[Base.GetLenToPosState(num8)].Decode(m_RangeDecoder);
					if (num9 >= 4)
					{
						int num10 = (int)((num9 >> 1) - 1);
						num = (2 | (num9 & 1)) << num10;
						if (num9 < 14)
						{
							num += BitTreeDecoder.ReverseDecode(m_PosDecoders, num - num9 - 1, m_RangeDecoder, num10);
						}
						else
						{
							num += m_RangeDecoder.DecodeDirectBits(num10 - 4) << 4;
							num += m_PosAlignDecoder.ReverseDecode(m_RangeDecoder);
						}
					}
					else
					{
						num = num9;
					}
				}
				if (num >= m_OutWindow.TrainSize + num5 || num >= m_DictionarySizeCheck)
				{
					if (num == uint.MaxValue)
					{
						break;
					}
					throw new DataErrorException();
				}
				m_OutWindow.CopyBlock(num, num8);
				num5 += num8;
			}
			m_OutWindow.Flush();
			m_OutWindow.ReleaseStream();
			m_RangeDecoder.ReleaseStream();
		}

		public void SetDecoderProperties(byte[] properties)
		{
			if (properties.Length < 5)
			{
				throw new InvalidParamException();
			}
			int lc = properties[0] % 9;
			int num = properties[0] / 9;
			int lp = num % 5;
			int num2 = num / 5;
			if (num2 > 4)
			{
				throw new InvalidParamException();
			}
			uint num3 = 0u;
			for (int i = 0; i < 4; i++)
			{
				num3 += (uint)(properties[1 + i] << i * 8);
			}
			SetDictionarySize(num3);
			SetLiteralProperties(lp, lc);
			SetPosBitsProperties(num2);
		}

		public bool Train(Stream stream)
		{
			_solid = true;
			return m_OutWindow.Train(stream);
		}
	}
	public class Encoder : ICoder, ISetCoderProperties, IWriteCoderProperties
	{
		private enum EMatchFinderType
		{
			BT2,
			BT4
		}

		private class LiteralEncoder
		{
			public struct Encoder2
			{
				private BitEncoder[] m_Encoders;

				public void Create()
				{
					m_Encoders = new BitEncoder[768];
				}

				public void Init()
				{
					for (int i = 0; i < 768; i++)
					{
						m_Encoders[i].Init();
					}
				}

				public void Encode(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, byte symbol)
				{
					uint num = 1u;
					for (int num2 = 7; num2 >= 0; num2--)
					{
						uint num3 = (uint)(symbol >> num2) & 1u;
						m_Encoders[num].Encode(rangeEncoder, num3);
						num = (num << 1) | num3;
					}
				}

				public void EncodeMatched(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, byte matchByte, byte symbol)
				{
					uint num = 1u;
					bool flag = true;
					for (int num2 = 7; num2 >= 0; num2--)
					{
						uint num3 = (uint)(symbol >> num2) & 1u;
						uint num4 = num;
						if (flag)
						{
							uint num5 = (uint)(matchByte >> num2) & 1u;
							num4 += 1 + num5 << 8;
							flag = num5 == num3;
						}
						m_Encoders[num4].Encode(rangeEncoder, num3);
						num = (num << 1) | num3;
					}
				}

				public uint GetPrice(bool matchMode, byte matchByte, byte symbol)
				{
					uint num = 0u;
					uint num2 = 1u;
					int num3 = 7;
					if (matchMode)
					{
						while (num3 >= 0)
						{
							uint num4 = (uint)(matchByte >> num3) & 1u;
							uint num5 = (uint)(symbol >> num3) & 1u;
							num += m_Encoders[(1 + num4 << 8) + num2].GetPrice(num5);
							num2 = (num2 << 1) | num5;
							if (num4 != num5)
							{
								num3--;
								break;
							}
							num3--;
						}
					}
					while (num3 >= 0)
					{
						uint num6 = (uint)(symbol >> num3) & 1u;
						num += m_Encoders[num2].GetPrice(num6);
						num2 = (num2 << 1) | num6;
						num3--;
					}
					return num;
				}
			}

			private Encoder2[] m_Coders;

			private int m_NumPrevBits;

			private int m_NumPosBits;

			private uint m_PosMask;

			public void Create(int numPosBits, int numPrevBits)
			{
				if (m_Coders == null || m_NumPrevBits != numPrevBits || m_NumPosBits != numPosBits)
				{
					m_NumPosBits = numPosBits;
					m_PosMask = (uint)((1 << numPosBits) - 1);
					m_NumPrevBits = numPrevBits;
					uint num = (uint)(1 << m_NumPrevBits + m_NumPosBits);
					m_Coders = new Encoder2[num];
					for (uint num2 = 0u; num2 < num; num2++)
					{
						m_Coders[num2].Create();
					}
				}
			}

			public void Init()
			{
				uint num = (uint)(1 << m_NumPrevBits + m_NumPosBits);
				for (uint num2 = 0u; num2 < num; num2++)
				{
					m_Coders[num2].Init();
				}
			}

			public Encoder2 GetSubCoder(uint pos, byte prevByte)
			{
				return m_Coders[(int)((pos & m_PosMask) << m_NumPrevBits) + (prevByte >> 8 - m_NumPrevBits)];
			}
		}

		private class LenEncoder
		{
			private BitEncoder _choice;

			private BitEncoder _choice2;

			private BitTreeEncoder[] _lowCoder = new BitTreeEncoder[16];

			private BitTreeEncoder[] _midCoder = new BitTreeEncoder[16];

			private BitTreeEncoder _highCoder = new BitTreeEncoder(8);

			public LenEncoder()
			{
				for (uint num = 0u; num < 16; num++)
				{
					_lowCoder[num] = new BitTreeEncoder(3);
					_midCoder[num] = new BitTreeEncoder(3);
				}
			}

			public void Init(uint numPosStates)
			{
				_choice.Init();
				_choice2.Init();
				for (uint num = 0u; num < numPosStates; num++)
				{
					_lowCoder[num].Init();
					_midCoder[num].Init();
				}
				_highCoder.Init();
			}

			public void Encode(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, uint symbol, uint posState)
			{
				if (symbol < 8)
				{
					_choice.Encode(rangeEncoder, 0u);
					_lowCoder[posState].Encode(rangeEncoder, symbol);
					return;
				}
				symbol -= 8;
				_choice.Encode(rangeEncoder, 1u);
				if (symbol < 8)
				{
					_choice2.Encode(rangeEncoder, 0u);
					_midCoder[posState].Encode(rangeEncoder, symbol);
				}
				else
				{
					_choice2.Encode(rangeEncoder, 1u);
					_highCoder.Encode(rangeEncoder, symbol - 8);
				}
			}

			public void SetPrices(uint posState, uint numSymbols, uint[] prices, uint st)
			{
				uint price = _choice.GetPrice0();
				uint price2 = _choice.GetPrice1();
				uint num = price2 + _choice2.GetPrice0();
				uint num2 = price2 + _choice2.GetPrice1();
				uint num3 = 0u;
				for (num3 = 0u; num3 < 8; num3++)
				{
					if (num3 >= numSymbols)
					{
						return;
					}
					prices[st + num3] = price + _lowCoder[posState].GetPrice(num3);
				}
				for (; num3 < 16; num3++)
				{
					if (num3 >= numSymbols)
					{
						return;
					}
					prices[st + num3] = num + _midCoder[posState].GetPrice(num3 - 8);
				}
				for (; num3 < numSymbols; num3++)
				{
					prices[st + num3] = num2 + _highCoder.GetPrice(num3 - 8 - 8);
				}
			}
		}

		private class LenPriceTableEncoder : LenEncoder
		{
			private uint[] _prices = new uint[4352];

			private uint _tableSize;

			private uint[] _counters = new uint[16];

			public void SetTableSize(uint tableSize)
			{
				_tableSize = tableSize;
			}

			public uint GetPrice(uint symbol, uint posState)
			{
				return _prices[posState * 272 + symbol];
			}

			private void UpdateTable(uint posState)
			{
				SetPrices(posState, _tableSize, _prices, posState * 272);
				_counters[posState] = _tableSize;
			}

			public void UpdateTables(uint numPosStates)
			{
				for (uint num = 0u; num < numPosStates; num++)
				{
					UpdateTable(num);
				}
			}

			public new void Encode(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, uint symbol, uint posState)
			{
				base.Encode(rangeEncoder, symbol, posState);
				if (--_counters[posState] == 0)
				{
					UpdateTable(posState);
				}
			}
		}

		private class Optimal
		{
			public Base.State State;

			public bool Prev1IsChar;

			public bool Prev2;

			public uint PosPrev2;

			public uint BackPrev2;

			public uint Price;

			public uint PosPrev;

			public uint BackPrev;

			public uint Backs0;

			public uint Backs1;

			public uint Backs2;

			public uint Backs3;

			public void MakeAsChar()
			{
				BackPrev = uint.MaxValue;
				Prev1IsChar = false;
			}

			public void MakeAsShortRep()
			{
				BackPrev = 0u;
				Prev1IsChar = false;
			}

			public bool IsShortRep()
			{
				return BackPrev == 0;
			}
		}

		private const uint kIfinityPrice = 268435455u;

		private static byte[] g_FastPos;

		private Base.State _state;

		private byte _previousByte;

		private uint[] _repDistances = new uint[4];

		private const int kDefaultDictionaryLogSize = 22;

		private const uint kNumFastBytesDefault = 32u;

		private const uint kNumLenSpecSymbols = 16u;

		private const uint kNumOpts = 4096u;

		private Optimal[] _optimum = new Optimal[4096];

		private IMatchFinder _matchFinder;

		private SevenZip.Compression.RangeCoder.Encoder _rangeEncoder = new SevenZip.Compression.RangeCoder.Encoder();

		private BitEncoder[] _isMatch = new BitEncoder[192];

		private BitEncoder[] _isRep = new BitEncoder[12];

		private BitEncoder[] _isRepG0 = new BitEncoder[12];

		private BitEncoder[] _isRepG1 = new BitEncoder[12];

		private BitEncoder[] _isRepG2 = new BitEncoder[12];

		private BitEncoder[] _isRep0Long = new BitEncoder[192];

		private BitTreeEncoder[] _posSlotEncoder = new BitTreeEncoder[4];

		private BitEncoder[] _posEncoders = new BitEncoder[114];

		private BitTreeEncoder _posAlignEncoder = new BitTreeEncoder(4);

		private LenPriceTableEncoder _lenEncoder = new LenPriceTableEncoder();

		private LenPriceTableEncoder _repMatchLenEncoder = new LenPriceTableEncoder();

		private LiteralEncoder _literalEncoder = new LiteralEncoder();

		private uint[] _matchDistances = new uint[548];

		private uint _numFastBytes = 32u;

		private uint _longestMatchLength;

		private uint _numDistancePairs;

		private uint _additionalOffset;

		private uint _optimumEndIndex;

		private uint _optimumCurrentIndex;

		private bool _longestMatchWasFound;

		private uint[] _posSlotPrices = new uint[256];

		private uint[] _distancesPrices = new uint[512];

		private uint[] _alignPrices = new uint[16];

		private uint _alignPriceCount;

		private uint _distTableSize = 44u;

		private int _posStateBits = 2;

		private uint _posStateMask = 3u;

		private int _numLiteralPosStateBits;

		private int _numLiteralContextBits = 3;

		private uint _dictionarySize = 4194304u;

		private uint _dictionarySizePrev = uint.MaxValue;

		private uint _numFastBytesPrev = uint.MaxValue;

		private long nowPos64;

		private bool _finished;

		private Stream _inStream;

		private EMatchFinderType _matchFinderType = EMatchFinderType.BT4;

		private bool _writeEndMark;

		private bool _needReleaseMFStream;

		private uint[] reps = new uint[4];

		private uint[] repLens = new uint[4];

		private const int kPropSize = 5;

		private byte[] properties = new byte[5];

		private uint[] tempPrices = new uint[128];

		private uint _matchPriceCount;

		private static string[] kMatchFinderIDs;

		private uint _trainSize;

		static Encoder()
		{
			g_FastPos = new byte[2048];
			kMatchFinderIDs = new string[2] { "BT2", "BT4" };
			int num = 2;
			g_FastPos[0] = 0;
			g_FastPos[1] = 1;
			for (byte b = 2; b < 22; b++)
			{
				uint num2 = (uint)(1 << (b >> 1) - 1);
				uint num3 = 0u;
				while (num3 < num2)
				{
					g_FastPos[num] = b;
					num3++;
					num++;
				}
			}
		}

		private static uint GetPosSlot(uint pos)
		{
			if (pos < 2048)
			{
				return g_FastPos[pos];
			}
			if (pos < 2097152)
			{
				return (uint)(g_FastPos[pos >> 10] + 20);
			}
			return (uint)(g_FastPos[pos >> 20] + 40);
		}

		private static uint GetPosSlot2(uint pos)
		{
			if (pos < 131072)
			{
				return (uint)(g_FastPos[pos >> 6] + 12);
			}
			if (pos < 134217728)
			{
				return (uint)(g_FastPos[pos >> 16] + 32);
			}
			return (uint)(g_FastPos[pos >> 26] + 52);
		}

		private void BaseInit()
		{
			_state.Init();
			_previousByte = 0;
			for (uint num = 0u; num < 4; num++)
			{
				_repDistances[num] = 0u;
			}
		}

		private void Create()
		{
			if (_matchFinder == null)
			{
				BinTree binTree = new BinTree();
				int type = 4;
				if (_matchFinderType == EMatchFinderType.BT2)
				{
					type = 2;
				}
				binTree.SetType(type);
				_matchFinder = binTree;
			}
			_literalEncoder.Create(_numLiteralPosStateBits, _numLiteralContextBits);
			if (_dictionarySize != _dictionarySizePrev || _numFastBytesPrev != _numFastBytes)
			{
				_matchFinder.Create(_dictionarySize, 4096u, _numFastBytes, 274u);
				_dictionarySizePrev = _dictionarySize;
				_numFastBytesPrev = _numFastBytes;
			}
		}

		public Encoder()
		{
			for (int i = 0; (long)i < 4096L; i++)
			{
				_optimum[i] = new Optimal();
			}
			for (int j = 0; (long)j < 4L; j++)
			{
				_posSlotEncoder[j] = new BitTreeEncoder(6);
			}
		}

		private void SetWriteEndMarkerMode(bool writeEndMarker)
		{
			_writeEndMark = writeEndMarker;
		}

		private void Init()
		{
			BaseInit();
			_rangeEncoder.Init();
			for (uint num = 0u; num < 12; num++)
			{
				for (uint num2 = 0u; num2 <= _posStateMask; num2++)
				{
					uint num3 = (num << 4) + num2;
					_isMatch[num3].Init();
					_isRep0Long[num3].Init();
				}
				_isRep[num].Init();
				_isRepG0[num].Init();
				_isRepG1[num].Init();
				_isRepG2[num].Init();
			}
			_literalEncoder.Init();
			for (uint num = 0u; num < 4; num++)
			{
				_posSlotEncoder[num].Init();
			}
			for (uint num = 0u; num < 114; num++)
			{
				_posEncoders[num].Init();
			}
			_lenEncoder.Init((uint)(1 << _posStateBits));
			_repMatchLenEncoder.Init((uint)(1 << _posStateBits));
			_posAlignEncoder.Init();
			_longestMatchWasFound = false;
			_optimumEndIndex = 0u;
			_optimumCurrentIndex = 0u;
			_additionalOffset = 0u;
		}

		private void ReadMatchDistances(out uint lenRes, out uint numDistancePairs)
		{
			lenRes = 0u;
			numDistancePairs = _matchFinder.GetMatches(_matchDistances);
			if (numDistancePairs != 0)
			{
				lenRes = _matchDistances[numDistancePairs - 2];
				if (lenRes == _numFastBytes)
				{
					lenRes += _matchFinder.GetMatchLen((int)(lenRes - 1), _matchDistances[numDistancePairs - 1], 273 - lenRes);
				}
			}
			_additionalOffset++;
		}

		private void MovePos(uint num)
		{
			if (num != 0)
			{
				_matchFinder.Skip(num);
				_additionalOffset += num;
			}
		}

		private uint GetRepLen1Price(Base.State state, uint posState)
		{
			return _isRepG0[state.Index].GetPrice0() + _isRep0Long[(state.Index << 4) + posState].GetPrice0();
		}

		private uint GetPureRepPrice(uint repIndex, Base.State state, uint posState)
		{
			uint price;
			if (repIndex == 0)
			{
				price = _isRepG0[state.Index].GetPrice0();
				return price + _isRep0Long[(state.Index << 4) + posState].GetPrice1();
			}
			price = _isRepG0[state.Index].GetPrice1();
			if (repIndex == 1)
			{
				return price + _isRepG1[state.Index].GetPrice0();
			}
			price += _isRepG1[state.Index].GetPrice1();
			return price + _isRepG2[state.Index].GetPrice(repIndex - 2);
		}

		private uint GetRepPrice(uint repIndex, uint len, Base.State state, uint posState)
		{
			return _repMatchLenEncoder.GetPrice(len - 2, posState) + GetPureRepPrice(repIndex, state, posState);
		}

		private uint GetPosLenPrice(uint pos, uint len, uint posState)
		{
			uint lenToPosState = Base.GetLenToPosState(len);
			uint num = ((pos >= 128) ? (_posSlotPrices[(lenToPosState << 6) + GetPosSlot2(pos)] + _alignPrices[pos & 0xF]) : _distancesPrices[lenToPosState * 128 + pos]);
			return num + _lenEncoder.GetPrice(len - 2, posState);
		}

		private uint Backward(out uint backRes, uint cur)
		{
			_optimumEndIndex = cur;
			uint posPrev = _optimum[cur].PosPrev;
			uint backPrev = _optimum[cur].BackPrev;
			do
			{
				if (_optimum[cur].Prev1IsChar)
				{
					_optimum[posPrev].MakeAsChar();
					_optimum[posPrev].PosPrev = posPrev - 1;
					if (_optimum[cur].Prev2)
					{
						_optimum[posPrev - 1].Prev1IsChar = false;
						_optimum[posPrev - 1].PosPrev = _optimum[cur].PosPrev2;
						_optimum[posPrev - 1].BackPrev = _optimum[cur].BackPrev2;
					}
				}
				uint num = posPrev;
				uint backPrev2 = backPrev;
				backPrev = _optimum[num].BackPrev;
				posPrev = _optimum[num].PosPrev;
				_optimum[num].BackPrev = backPrev2;
				_optimum[num].PosPrev = cur;
				cur = num;
			}
			while (cur != 0);
			backRes = _optimum[0].BackPrev;
			_optimumCurrentIndex = _optimum[0].PosPrev;
			return _optimumCurrentIndex;
		}

		private uint GetOptimum(uint position, out uint backRes)
		{
			if (_optimumEndIndex != _optimumCurrentIndex)
			{
				uint result = _optimum[_optimumCurrentIndex].PosPrev - _optimumCurrentIndex;
				backRes = _optimum[_optimumCurrentIndex].BackPrev;
				_optimumCurrentIndex = _optimum[_optimumCurrentIndex].PosPrev;
				return result;
			}
			_optimumCurrentIndex = (_optimumEndIndex = 0u);
			uint lenRes;
			uint numDistancePairs;
			if (!_longestMatchWasFound)
			{
				ReadMatchDistances(out lenRes, out numDistancePairs);
			}
			else
			{
				lenRes = _longestMatchLength;
				numDistancePairs = _numDistancePairs;
				_longestMatchWasFound = false;
			}
			uint num = _matchFinder.GetNumAvailableBytes() + 1;
			if (num < 2)
			{
				backRes = uint.MaxValue;
				return 1u;
			}
			if (num > 273)
			{
				num = 273u;
			}
			uint num2 = 0u;
			for (uint num3 = 0u; num3 < 4; num3++)
			{
				reps[num3] = _repDistances[num3];
				repLens[num3] = _matchFinder.GetMatchLen(-1, reps[num3], 273u);
				if (repLens[num3] > repLens[num2])
				{
					num2 = num3;
				}
			}
			if (repLens[num2] >= _numFastBytes)
			{
				backRes = num2;
				uint num4 = repLens[num2];
				MovePos(num4 - 1);
				return num4;
			}
			if (lenRes >= _numFastBytes)
			{
				backRes = _matchDistances[numDistancePairs - 1] + 4;
				MovePos(lenRes - 1);
				return lenRes;
			}
			byte indexByte = _matchFinder.GetIndexByte(-1);
			byte indexByte2 = _matchFinder.GetIndexByte((int)(0 - _repDistances[0] - 1 - 1));
			if (lenRes < 2 && indexByte != indexByte2 && repLens[num2] < 2)
			{
				backRes = uint.MaxValue;
				return 1u;
			}
			_optimum[0].State = _state;
			uint num5 = position & _posStateMask;
			_optimum[1].Price = _isMatch[(_state.Index << 4) + num5].GetPrice0() + _literalEncoder.GetSubCoder(position, _previousByte).GetPrice(!_state.IsCharState(), indexByte2, indexByte);
			_optimum[1].MakeAsChar();
			uint price = _isMatch[(_state.Index << 4) + num5].GetPrice1();
			uint num6 = price + _isRep[_state.Index].GetPrice1();
			if (indexByte2 == indexByte)
			{
				uint num7 = num6 + GetRepLen1Price(_state, num5);
				if (num7 < _optimum[1].Price)
				{
					_optimum[1].Price = num7;
					_optimum[1].MakeAsShortRep();
				}
			}
			uint num8 = ((lenRes >= repLens[num2]) ? lenRes : repLens[num2]);
			if (num8 < 2)
			{
				backRes = _optimum[1].BackPrev;
				return 1u;
			}
			_optimum[1].PosPrev = 0u;
			_optimum[0].Backs0 = reps[0];
			_optimum[0].Backs1 = reps[1];
			_optimum[0].Backs2 = reps[2];
			_optimum[0].Backs3 = reps[3];
			uint num9 = num8;
			do
			{
				_optimum[num9--].Price = 268435455u;
			}
			while (num9 >= 2);
			for (uint num3 = 0u; num3 < 4; num3++)
			{
				uint num10 = repLens[num3];
				if (num10 < 2)
				{
					continue;
				}
				uint num11 = num6 + GetPureRepPrice(num3, _state, num5);
				do
				{
					uint num12 = num11 + _repMatchLenEncoder.GetPrice(num10 - 2, num5);
					Optimal optimal = _optimum[num10];
					if (num12 < optimal.Price)
					{
						optimal.Price = num12;
						optimal.PosPrev = 0u;
						optimal.BackPrev = num3;
						optimal.Prev1IsChar = false;
					}
				}
				while (--num10 >= 2);
			}
			uint num13 = price + _isRep[_state.Index].GetPrice0();
			num9 = ((repLens[0] >= 2) ? (repLens[0] + 1) : 2u);
			if (num9 <= lenRes)
			{
				uint num14;
				for (num14 = 0u; num9 > _matchDistances[num14]; num14 += 2)
				{
				}
				while (true)
				{
					uint num15 = _matchDistances[num14 + 1];
					uint num16 = num13 + GetPosLenPrice(num15, num9, num5);
					Optimal optimal2 = _optimum[num9];
					if (num16 < optimal2.Price)
					{
						optimal2.Price = num16;
						optimal2.PosPrev = 0u;
						optimal2.BackPrev = num15 + 4;
						optimal2.Prev1IsChar = false;
					}
					if (num9 == _matchDistances[num14])
					{
						num14 += 2;
						if (num14 == numDistancePairs)
						{
							break;
						}
					}
					num9++;
				}
			}
			uint num17 = 0u;
			uint lenRes2;
			while (true)
			{
				num17++;
				if (num17 == num8)
				{
					return Backward(out backRes, num17);
				}
				ReadMatchDistances(out lenRes2, out numDistancePairs);
				if (lenRes2 >= _numFastBytes)
				{
					break;
				}
				position++;
				uint num18 = _optimum[num17].PosPrev;
				Base.State state;
				if (_optimum[num17].Prev1IsChar)
				{
					num18--;
					if (_optimum[num17].Prev2)
					{
						state = _optimum[_optimum[num17].PosPrev2].State;
						if (_optimum[num17].BackPrev2 < 4)
						{
							state.UpdateRep();
						}
						else
						{
							state.UpdateMatch();
						}
					}
					else
					{
						state = _optimum[num18].State;
					}
					state.UpdateChar();
				}
				else
				{
					state = _optimum[num18].State;
				}
				if (num18 == num17 - 1)
				{
					if (_optimum[num17].IsShortRep())
					{
						state.UpdateShortRep();
					}
					else
					{
						state.UpdateChar();
					}
				}
				else
				{
					uint num19;
					if (_optimum[num17].Prev1IsChar && _optimum[num17].Prev2)
					{
						num18 = _optimum[num17].PosPrev2;
						num19 = _optimum[num17].BackPrev2;
						state.UpdateRep();
					}
					else
					{
						num19 = _optimum[num17].BackPrev;
						if (num19 < 4)
						{
							state.UpdateRep();
						}
						else
						{
							state.UpdateMatch();
						}
					}
					Optimal optimal3 = _optimum[num18];
					switch (num19)
					{
					case 0u:
						reps[0] = optimal3.Backs0;
						reps[1] = optimal3.Backs1;
						reps[2] = optimal3.Backs2;
						reps[3] = optimal3.Backs3;
						break;
					case 1u:
						reps[0] = optimal3.Backs1;
						reps[1] = optimal3.Backs0;
						reps[2] = optimal3.Backs2;
						reps[3] = optimal3.Backs3;
						break;
					case 2u:
						reps[0] = optimal3.Backs2;
						reps[1] = optimal3.Backs0;
						reps[2] = optimal3.Backs1;
						reps[3] = optimal3.Backs3;
						break;
					case 3u:
						reps[0] = optimal3.Backs3;
						reps[1] = optimal3.Backs0;
						reps[2] = optimal3.Backs1;
						reps[3] = optimal3.Backs2;
						break;
					default:
						reps[0] = num19 - 4;
						reps[1] = optimal3.Backs0;
						reps[2] = optimal3.Backs1;
						reps[3] = optimal3.Backs2;
						break;
					}
				}
				_optimum[num17].State = state;
				_optimum[num17].Backs0 = reps[0];
				_optimum[num17].Backs1 = reps[1];
				_optimum[num17].Backs2 = reps[2];
				_optimum[num17].Backs3 = reps[3];
				uint price2 = _optimum[num17].Price;
				indexByte = _matchFinder.GetIndexByte(-1);
				indexByte2 = _matchFinder.GetIndexByte((int)(0 - reps[0] - 1 - 1));
				num5 = position & _posStateMask;
				uint num20 = price2 + _isMatch[(state.Index << 4) + num5].GetPrice0() + _literalEncoder.GetSubCoder(position, _matchFinder.GetIndexByte(-2)).GetPrice(!state.IsCharState(), indexByte2, indexByte);
				Optimal optimal4 = _optimum[num17 + 1];
				bool flag = false;
				if (num20 < optimal4.Price)
				{
					optimal4.Price = num20;
					optimal4.PosPrev = num17;
					optimal4.MakeAsChar();
					flag = true;
				}
				price = price2 + _isMatch[(state.Index << 4) + num5].GetPrice1();
				num6 = price + _isRep[state.Index].GetPrice1();
				if (indexByte2 == indexByte && (optimal4.PosPrev >= num17 || optimal4.BackPrev != 0))
				{
					uint num21 = num6 + GetRepLen1Price(state, num5);
					if (num21 <= optimal4.Price)
					{
						optimal4.Price = num21;
						optimal4.PosPrev = num17;
						optimal4.MakeAsShortRep();
						flag = true;
					}
				}
				uint val = _matchFinder.GetNumAvailableBytes() + 1;
				val = Math.Min(4095 - num17, val);
				num = val;
				if (num < 2)
				{
					continue;
				}
				if (num > _numFastBytes)
				{
					num = _numFastBytes;
				}
				if (!flag && indexByte2 != indexByte)
				{
					uint limit = Math.Min(val - 1, _numFastBytes);
					uint matchLen = _matchFinder.GetMatchLen(0, reps[0], limit);
					if (matchLen >= 2)
					{
						Base.State state2 = state;
						state2.UpdateChar();
						uint num22 = (position + 1) & _posStateMask;
						uint num23 = num20 + _isMatch[(state2.Index << 4) + num22].GetPrice1() + _isRep[state2.Index].GetPrice1();
						uint num24 = num17 + 1 + matchLen;
						while (num8 < num24)
						{
							_optimum[++num8].Price = 268435455u;
						}
						uint num25 = num23 + GetRepPrice(0u, matchLen, state2, num22);
						Optimal optimal5 = _optimum[num24];
						if (num25 < optimal5.Price)
						{
							optimal5.Price = num25;
							optimal5.PosPrev = num17 + 1;
							optimal5.BackPrev = 0u;
							optimal5.Prev1IsChar = true;
							optimal5.Prev2 = false;
						}
					}
				}
				uint num26 = 2u;
				for (uint num27 = 0u; num27 < 4; num27++)
				{
					uint num28 = _matchFinder.GetMatchLen(-1, reps[num27], num);
					if (num28 < 2)
					{
						continue;
					}
					uint num29 = num28;
					while (true)
					{
						if (num8 < num17 + num28)
						{
							_optimum[++num8].Price = 268435455u;
							continue;
						}
						uint num30 = num6 + GetRepPrice(num27, num28, state, num5);
						Optimal optimal6 = _optimum[num17 + num28];
						if (num30 < optimal6.Price)
						{
							optimal6.Price = num30;
							optimal6.PosPrev = num17;
							optimal6.BackPrev = num27;
							optimal6.Prev1IsChar = false;
						}
						if (--num28 < 2)
						{
							break;
						}
					}
					num28 = num29;
					if (num27 == 0)
					{
						num26 = num28 + 1;
					}
					if (num28 >= val)
					{
						continue;
					}
					uint limit2 = Math.Min(val - 1 - num28, _numFastBytes);
					uint matchLen2 = _matchFinder.GetMatchLen((int)num28, reps[num27], limit2);
					if (matchLen2 >= 2)
					{
						Base.State state3 = state;
						state3.UpdateRep();
						uint num31 = (position + num28) & _posStateMask;
						uint num32 = num6 + GetRepPrice(num27, num28, state, num5) + _isMatch[(state3.Index << 4) + num31].GetPrice0() + _literalEncoder.GetSubCoder(position + num28, _matchFinder.GetIndexByte((int)(num28 - 1 - 1))).GetPrice(matchMode: true, _matchFinder.GetIndexByte((int)(num28 - 1 - (reps[num27] + 1))), _matchFinder.GetIndexByte((int)(num28 - 1)));
						state3.UpdateChar();
						num31 = (position + num28 + 1) & _posStateMask;
						uint num33 = num32 + _isMatch[(state3.Index << 4) + num31].GetPrice1() + _isRep[state3.Index].GetPrice1();
						uint num34 = num28 + 1 + matchLen2;
						while (num8 < num17 + num34)
						{
							_optimum[++num8].Price = 268435455u;
						}
						uint num35 = num33 + GetRepPrice(0u, matchLen2, state3, num31);
						Optimal optimal7 = _optimum[num17 + num34];
						if (num35 < optimal7.Price)
						{
							optimal7.Price = num35;
							optimal7.PosPrev = num17 + num28 + 1;
							optimal7.BackPrev = 0u;
							optimal7.Prev1IsChar = true;
							optimal7.Prev2 = true;
							optimal7.PosPrev2 = num17;
							optimal7.BackPrev2 = num27;
						}
					}
				}
				if (lenRes2 > num)
				{
					lenRes2 = num;
					for (numDistancePairs = 0u; lenRes2 > _matchDistances[numDistancePairs]; numDistancePairs += 2)
					{
					}
					_matchDistances[numDistancePairs] = lenRes2;
					numDistancePairs += 2;
				}
				if (lenRes2 < num26)
				{
					continue;
				}
				num13 = price + _isRep[state.Index].GetPrice0();
				while (num8 < num17 + lenRes2)
				{
					_optimum[++num8].Price = 268435455u;
				}
				uint num36;
				for (num36 = 0u; num26 > _matchDistances[num36]; num36 += 2)
				{
				}
				uint num37 = num26;
				while (true)
				{
					uint num38 = _matchDistances[num36 + 1];
					uint num39 = num13 + GetPosLenPrice(num38, num37, num5);
					Optimal optimal8 = _optimum[num17 + num37];
					if (num39 < optimal8.Price)
					{
						optimal8.Price = num39;
						optimal8.PosPrev = num17;
						optimal8.BackPrev = num38 + 4;
						optimal8.Prev1IsChar = false;
					}
					if (num37 == _matchDistances[num36])
					{
						if (num37 < val)
						{
							uint limit3 = Math.Min(val - 1 - num37, _numFastBytes);
							uint matchLen3 = _matchFinder.GetMatchLen((int)num37, num38, limit3);
							if (matchLen3 >= 2)
							{
								Base.State state4 = state;
								state4.UpdateMatch();
								uint num40 = (position + num37) & _posStateMask;
								uint num41 = num39 + _isMatch[(state4.Index << 4) + num40].GetPrice0() + _literalEncoder.GetSubCoder(position + num37, _matchFinder.GetIndexByte((int)(num37 - 1 - 1))).GetPrice(matchMode: true, _matchFinder.GetIndexByte((int)(num37 - (num38 + 1) - 1)), _matchFinder.GetIndexByte((int)(num37 - 1)));
								state4.UpdateChar();
								num40 = (position + num37 + 1) & _posStateMask;
								uint num42 = num41 + _isMatch[(state4.Index << 4) + num40].GetPrice1() + _isRep[state4.Index].GetPrice1();
								uint num43 = num37 + 1 + matchLen3;
								while (num8 < num17 + num43)
								{
									_optimum[++num8].Price = 268435455u;
								}
								num39 = num42 + GetRepPrice(0u, matchLen3, state4, num40);
								optimal8 = _optimum[num17 + num43];
								if (num39 < optimal8.Price)
								{
									optimal8.Price = num39;
									optimal8.PosPrev = num17 + num37 + 1;
									optimal8.BackPrev = 0u;
									optimal8.Prev1IsChar = true;
									optimal8.Prev2 = true;
									optimal8.PosPrev2 = num17;
									optimal8.BackPrev2 = num38 + 4;
								}
							}
						}
						num36 += 2;
						if (num36 == numDistancePairs)
						{
							break;
						}
					}
					num37++;
				}
			}
			_numDistancePairs = numDistancePairs;
			_longestMatchLength = lenRes2;
			_longestMatchWasFound = true;
			return Backward(out backRes, num17);
		}

		private bool ChangePair(uint smallDist, uint bigDist)
		{
			if (smallDist < 33554432)
			{
				return bigDist >= smallDist << 7;
			}
			return false;
		}

		private void WriteEndMarker(uint posState)
		{
			if (_writeEndMark)
			{
				_isMatch[(_state.Index << 4) + posState].Encode(_rangeEncoder, 1u);
				_isRep[_state.Index].Encode(_rangeEncoder, 0u);
				_state.UpdateMatch();
				uint num = 2u;
				_lenEncoder.Encode(_rangeEncoder, num - 2, posState);
				uint symbol = 63u;
				uint lenToPosState = Base.GetLenToPosState(num);
				_posSlotEncoder[lenToPosState].Encode(_rangeEncoder, symbol);
				int num2 = 30;
				uint num3 = (uint)((1 << num2) - 1);
				_rangeEncoder.EncodeDirectBits(num3 >> 4, num2 - 4);
				_posAlignEncoder.ReverseEncode(_rangeEncoder, num3 & 0xFu);
			}
		}

		private void Flush(uint nowPos)
		{
			ReleaseMFStream();
			WriteEndMarker(nowPos & _posStateMask);
			_rangeEncoder.FlushData();
			_rangeEncoder.FlushStream();
		}

		public void CodeOneBlock(out long inSize, out long outSize, out bool finished)
		{
			inSize = 0L;
			outSize = 0L;
			finished = true;
			if (_inStream != null)
			{
				_matchFinder.SetStream(_inStream);
				_matchFinder.Init();
				_needReleaseMFStream = true;
				_inStream = null;
				if (_trainSize != 0)
				{
					_matchFinder.Skip(_trainSize);
				}
			}
			if (_finished)
			{
				return;
			}
			_finished = true;
			long num = nowPos64;
			if (nowPos64 == 0L)
			{
				if (_matchFinder.GetNumAvailableBytes() == 0)
				{
					Flush((uint)nowPos64);
					return;
				}
				ReadMatchDistances(out var _, out var _);
				uint num2 = (uint)(int)nowPos64 & _posStateMask;
				_isMatch[(_state.Index << 4) + num2].Encode(_rangeEncoder, 0u);
				_state.UpdateChar();
				byte indexByte = _matchFinder.GetIndexByte((int)(0 - _additionalOffset));
				_literalEncoder.GetSubCoder((uint)nowPos64, _previousByte).Encode(_rangeEncoder, indexByte);
				_previousByte = indexByte;
				_additionalOffset--;
				nowPos64++;
			}
			if (_matchFinder.GetNumAvailableBytes() == 0)
			{
				Flush((uint)nowPos64);
				return;
			}
			while (true)
			{
				uint backRes;
				uint optimum = GetOptimum((uint)nowPos64, out backRes);
				uint num3 = (uint)(int)nowPos64 & _posStateMask;
				uint num4 = (_state.Index << 4) + num3;
				if (optimum == 1 && backRes == uint.MaxValue)
				{
					_isMatch[num4].Encode(_rangeEncoder, 0u);
					byte indexByte2 = _matchFinder.GetIndexByte((int)(0 - _additionalOffset));
					LiteralEncoder.Encoder2 subCoder = _literalEncoder.GetSubCoder((uint)nowPos64, _previousByte);
					if (!_state.IsCharState())
					{
						byte indexByte3 = _matchFinder.GetIndexByte((int)(0 - _repDistances[0] - 1 - _additionalOffset));
						subCoder.EncodeMatched(_rangeEncoder, indexByte3, indexByte2);
					}
					else
					{
						subCoder.Encode(_rangeEncoder, indexByte2);
					}
					_previousByte = indexByte2;
					_state.UpdateChar();
				}
				else
				{
					_isMatch[num4].Encode(_rangeEncoder, 1u);
					if (backRes < 4)
					{
						_isRep[_state.Index].Encode(_rangeEncoder, 1u);
						if (backRes == 0)
						{
							_isRepG0[_state.Index].Encode(_rangeEncoder, 0u);
							if (optimum == 1)
							{
								_isRep0Long[num4].Encode(_rangeEncoder, 0u);
							}
							else
							{
								_isRep0Long[num4].Encode(_rangeEncoder, 1u);
							}
						}
						else
						{
							_isRepG0[_state.Index].Encode(_rangeEncoder, 1u);
							if (backRes == 1)
							{
								_isRepG1[_state.Index].Encode(_rangeEncoder, 0u);
							}
							else
							{
								_isRepG1[_state.Index].Encode(_rangeEncoder, 1u);
								_isRepG2[_state.Index].Encode(_rangeEncoder, backRes - 2);
							}
						}
						if (optimum == 1)
						{
							_state.UpdateShortRep();
						}
						else
						{
							_repMatchLenEncoder.Encode(_rangeEncoder, optimum - 2, num3);
							_state.UpdateRep();
						}
						uint num5 = _repDistances[backRes];
						if (backRes != 0)
						{
							for (uint num6 = backRes; num6 >= 1; num6--)
							{
								_repDistances[num6] = _repDistances[num6 - 1];
							}
							_repDistances[0] = num5;
						}
					}
					else
					{
						_isRep[_state.Index].Encode(_rangeEncoder, 0u);
						_state.UpdateMatch();
						_lenEncoder.Encode(_rangeEncoder, optimum - 2, num3);
						backRes -= 4;
						uint posSlot = GetPosSlot(backRes);
						uint lenToPosState = Base.GetLenToPosState(optimum);
						_posSlotEncoder[lenToPosState].Encode(_rangeEncoder, posSlot);
						if (posSlot >= 4)
						{
							int num7 = (int)((posSlot >> 1) - 1);
							uint num8 = (2 | (posSlot & 1)) << num7;
							uint num9 = backRes - num8;
							if (posSlot < 14)
							{
								BitTreeEncoder.ReverseEncode(_posEncoders, num8 - posSlot - 1, _rangeEncoder, num7, num9);
							}
							else
							{
								_rangeEncoder.EncodeDirectBits(num9 >> 4, num7 - 4);
								_posAlignEncoder.ReverseEncode(_rangeEncoder, num9 & 0xFu);
								_alignPriceCount++;
							}
						}
						uint num10 = backRes;
						for (uint num11 = 3u; num11 >= 1; num11--)
						{
							_repDistances[num11] = _repDistances[num11 - 1];
						}
						_repDistances[0] = num10;
						_matchPriceCount++;
					}
					_previousByte = _matchFinder.GetIndexByte((int)(optimum - 1 - _additionalOffset));
				}
				_additionalOffset -= optimum;
				nowPos64 += optimum;
				if (_additionalOffset == 0)
				{
					if (_matchPriceCount >= 128)
					{
						FillDistancesPrices();
					}
					if (_alignPriceCount >= 16)
					{
						FillAlignPrices();
					}
					inSize = nowPos64;
					outSize = _rangeEncoder.GetProcessedSizeAdd();
					if (_matchFinder.GetNumAvailableBytes() == 0)
					{
						Flush((uint)nowPos64);
						return;
					}
					if (nowPos64 - num >= 4096)
					{
						break;
					}
				}
			}
			_finished = false;
			finished = false;
		}

		private void ReleaseMFStream()
		{
			if (_matchFinder != null && _needReleaseMFStream)
			{
				_matchFinder.ReleaseStream();
				_needReleaseMFStream = false;
			}
		}

		private void SetOutStream(Stream outStream)
		{
			_rangeEncoder.SetStream(outStream);
		}

		private void ReleaseOutStream()
		{
			_rangeEncoder.ReleaseStream();
		}

		private void ReleaseStreams()
		{
			ReleaseMFStream();
			ReleaseOutStream();
		}

		private void SetStreams(Stream inStream, Stream outStream, long inSize, long outSize)
		{
			_inStream = inStream;
			_finished = false;
			Create();
			SetOutStream(outStream);
			Init();
			FillDistancesPrices();
			FillAlignPrices();
			_lenEncoder.SetTableSize(_numFastBytes + 1 - 2);
			_lenEncoder.UpdateTables((uint)(1 << _posStateBits));
			_repMatchLenEncoder.SetTableSize(_numFastBytes + 1 - 2);
			_repMatchLenEncoder.UpdateTables((uint)(1 << _posStateBits));
			nowPos64 = 0L;
		}

		public void Code(Stream inStream, Stream outStream, long inSize, long outSize, ICodeProgress progress)
		{
			_needReleaseMFStream = false;
			try
			{
				SetStreams(inStream, outStream, inSize, outSize);
				while (true)
				{
					CodeOneBlock(out var inSize2, out var outSize2, out var finished);
					if (finished)
					{
						break;
					}
					progress?.SetProgress(inSize2, outSize2);
				}
			}
			finally
			{
				ReleaseStreams();
			}
		}

		public void WriteCoderProperties(Stream outStream)
		{
			properties[0] = (byte)((_posStateBits * 5 + _numLiteralPosStateBits) * 9 + _numLiteralContextBits);
			for (int i = 0; i < 4; i++)
			{
				properties[1 + i] = (byte)((_dictionarySize >> 8 * i) & 0xFFu);
			}
			outStream.Write(properties, 0, 5);
		}

		private void FillDistancesPrices()
		{
			for (uint num = 4u; num < 128; num++)
			{
				uint posSlot = GetPosSlot(num);
				int num2 = (int)((posSlot >> 1) - 1);
				uint num3 = (2 | (posSlot & 1)) << num2;
				tempPrices[num] = BitTreeEncoder.ReverseGetPrice(_posEncoders, num3 - posSlot - 1, num2, num - num3);
			}
			for (uint num4 = 0u; num4 < 4; num4++)
			{
				BitTreeEncoder bitTreeEncoder = _posSlotEncoder[num4];
				uint num5 = num4 << 6;
				for (uint num6 = 0u; num6 < _distTableSize; num6++)
				{
					_posSlotPrices[num5 + num6] = bitTreeEncoder.GetPrice(num6);
				}
				for (uint num6 = 14u; num6 < _distTableSize; num6++)
				{
					_posSlotPrices[num5 + num6] += (num6 >> 1) - 1 - 4 << 6;
				}
				uint num7 = num4 * 128;
				uint num8;
				for (num8 = 0u; num8 < 4; num8++)
				{
					_distancesPrices[num7 + num8] = _posSlotPrices[num5 + num8];
				}
				for (; num8 < 128; num8++)
				{
					_distancesPrices[num7 + num8] = _posSlotPrices[num5 + GetPosSlot(num8)] + tempPrices[num8];
				}
			}
			_matchPriceCount = 0u;
		}

		private void FillAlignPrices()
		{
			for (uint num = 0u; num < 16; num++)
			{
				_alignPrices[num] = _posAlignEncoder.ReverseGetPrice(num);
			}
			_alignPriceCount = 0u;
		}

		private static int FindMatchFinder(string s)
		{
			for (int i = 0; i < kMatchFinderIDs.Length; i++)
			{
				if (s == kMatchFinderIDs[i])
				{
					return i;
				}
			}
			return -1;
		}

		public void SetCoderProperties(CoderPropID[] propIDs, object[] properties)
		{
			for (uint num = 0u; num < properties.Length; num++)
			{
				object obj = properties[num];
				switch (propIDs[num])
				{
				case CoderPropID.NumFastBytes:
					if (!(obj is int num2))
					{
						throw new InvalidParamException();
					}
					if (num2 < 5 || (long)num2 > 273L)
					{
						throw new InvalidParamException();
					}
					_numFastBytes = (uint)num2;
					break;
				case CoderPropID.MatchFinder:
				{
					if (!(obj is string))
					{
						throw new InvalidParamException();
					}
					EMatchFinderType matchFinderType = _matchFinderType;
					int num6 = FindMatchFinder(((string)obj).ToUpper());
					if (num6 < 0)
					{
						throw new InvalidParamException();
					}
					_matchFinderType = (EMatchFinderType)num6;
					if (_matchFinder != null && matchFinderType != _matchFinderType)
					{
						_dictionarySizePrev = uint.MaxValue;
						_matchFinder = null;
					}
					break;
				}
				case CoderPropID.DictionarySize:
				{
					if (!(obj is int num7))
					{
						throw new InvalidParamException();
					}
					if ((long)num7 < 1L || (long)num7 > 1073741824L)
					{
						throw new InvalidParamException();
					}
					_dictionarySize = (uint)num7;
					int i;
					for (i = 0; (long)i < 30L && num7 > (uint)(1 << i); i++)
					{
					}
					_distTableSize = (uint)(i * 2);
					break;
				}
				case CoderPropID.PosStateBits:
					if (!(obj is int num3))
					{
						throw new InvalidParamException();
					}
					if (num3 < 0 || (long)num3 > 4L)
					{
						throw new InvalidParamException();
					}
					_posStateBits = num3;
					_posStateMask = (uint)((1 << _posStateBits) - 1);
					break;
				case CoderPropID.LitPosBits:
					if (!(obj is int num5))
					{
						throw new InvalidParamException();
					}
					if (num5 < 0 || (long)num5 > 4L)
					{
						throw new InvalidParamException();
					}
					_numLiteralPosStateBits = num5;
					break;
				case CoderPropID.LitContextBits:
					if (!(obj is int num4))
					{
						throw new InvalidParamException();
					}
					if (num4 < 0 || (long)num4 > 8L)
					{
						throw new InvalidParamException();
					}
					_numLiteralContextBits = num4;
					break;
				case CoderPropID.EndMarker:
					if (!(obj is bool))
					{
						throw new InvalidParamException();
					}
					SetWriteEndMarkerMode((bool)obj);
					break;
				default:
					throw new InvalidParamException();
				case CoderPropID.Algorithm:
					break;
				}
			}
		}

		public void SetTrainSize(uint trainSize)
		{
			_trainSize = trainSize;
		}
	}
	public static class SevenZipHelper
	{
		private static CoderPropID[] propIDs = new CoderPropID[8]
		{
			CoderPropID.DictionarySize,
			CoderPropID.PosStateBits,
			CoderPropID.LitContextBits,
			CoderPropID.LitPosBits,
			CoderPropID.Algorithm,
			CoderPropID.NumFastBytes,
			CoderPropID.MatchFinder,
			CoderPropID.EndMarker
		};

		private static object[] properties = new object[8] { 2097152, 2, 3, 0, 2, 32, "bt4", false };

		public static byte[] Compress(byte[] inputBytes, ICodeProgress progress = null)
		{
			MemoryStream inStream = new MemoryStream(inputBytes);
			MemoryStream memoryStream = new MemoryStream();
			Compress(inStream, memoryStream, progress);
			return memoryStream.ToArray();
		}

		public static void Compress(Stream inStream, Stream outStream, ICodeProgress progress = null)
		{
			Encoder encoder = new Encoder();
			encoder.SetCoderProperties(propIDs, properties);
			encoder.WriteCoderProperties(outStream);
			encoder.Code(inStream, outStream, -1L, -1L, progress);
		}

		public static byte[] Decompress(byte[] inputBytes)
		{
			MemoryStream memoryStream = new MemoryStream(inputBytes);
			Decoder decoder = new Decoder();
			memoryStream.Seek(0L, SeekOrigin.Begin);
			MemoryStream memoryStream2 = new MemoryStream();
			byte[] array = new byte[5];
			if (memoryStream.Read(array, 0, 5) != 5)
			{
				throw new Exception("input .lzma is too short");
			}
			long num = 0L;
			for (int i = 0; i < 8; i++)
			{
				int num2 = memoryStream.ReadByte();
				if (num2 < 0)
				{
					throw new Exception("Can't Read 1");
				}
				num |= (long)((ulong)(byte)num2 << 8 * i);
			}
			decoder.SetDecoderProperties(array);
			long inSize = memoryStream.Length - memoryStream.Position;
			decoder.Code(memoryStream, memoryStream2, inSize, num, null);
			return memoryStream2.ToArray();
		}

		public static MemoryStream StreamDecompress(MemoryStream newInStream)
		{
			Decoder decoder = new Decoder();
			newInStream.Seek(0L, SeekOrigin.Begin);
			MemoryStream memoryStream = new MemoryStream();
			byte[] array = new byte[5];
			if (newInStream.Read(array, 0, 5) != 5)
			{
				throw new Exception("input .lzma is too short");
			}
			long num = 0L;
			for (int i = 0; i < 8; i++)
			{
				int num2 = newInStream.ReadByte();
				if (num2 < 0)
				{
					throw new Exception("Can't Read 1");
				}
				num |= (long)((ulong)(byte)num2 << 8 * i);
			}
			decoder.SetDecoderProperties(array);
			long inSize = newInStream.Length - newInStream.Position;
			decoder.Code(newInStream, memoryStream, inSize, num, null);
			memoryStream.Position = 0L;
			return memoryStream;
		}

		public static MemoryStream StreamDecompress(MemoryStream newInStream, long outSize)
		{
			Decoder decoder = new Decoder();
			newInStream.Seek(0L, SeekOrigin.Begin);
			MemoryStream memoryStream = new MemoryStream();
			byte[] array = new byte[5];
			if (newInStream.Read(array, 0, 5) != 5)
			{
				throw new Exception("input .lzma is too short");
			}
			decoder.SetDecoderProperties(array);
			long inSize = newInStream.Length - newInStream.Position;
			decoder.Code(newInStream, memoryStream, inSize, outSize, null);
			memoryStream.Position = 0L;
			return memoryStream;
		}

		public static void StreamDecompress(Stream compressedStream, Stream decompressedStream, long compressedSize, long decompressedSize)
		{
			long position = compressedStream.Position;
			Decoder decoder = new Decoder();
			byte[] array = new byte[5];
			if (compressedStream.Read(array, 0, 5) != 5)
			{
				throw new Exception("input .lzma is too short");
			}
			decoder.SetDecoderProperties(array);
			decoder.Code(compressedStream, decompressedStream, compressedSize - 5, decompressedSize, null);
			compressedStream.Position = position + compressedSize;
		}
	}
}
namespace SevenZip.Buffer
{
	public class InBuffer
	{
		private byte[] m_Buffer;

		private uint m_Pos;

		private uint m_Limit;

		private uint m_BufferSize;

		private Stream m_Stream;

		private bool m_StreamWasExhausted;

		private ulong m_ProcessedSize;

		public InBuffer(uint bufferSize)
		{
			m_Buffer = new byte[bufferSize];
			m_BufferSize = bufferSize;
		}

		public void Init(Stream stream)
		{
			m_Stream = stream;
			m_ProcessedSize = 0uL;
			m_Limit = 0u;
			m_Pos = 0u;
			m_StreamWasExhausted = false;
		}

		public bool ReadBlock()
		{
			if (m_StreamWasExhausted)
			{
				return false;
			}
			m_ProcessedSize += m_Pos;
			int num = m_Stream.Read(m_Buffer, 0, (int)m_BufferSize);
			m_Pos = 0u;
			m_Limit = (uint)num;
			m_StreamWasExhausted = num == 0;
			return !m_StreamWasExhausted;
		}

		public void ReleaseStream()
		{
			m_Stream = null;
		}

		public bool ReadByte(byte b)
		{
			if (m_Pos >= m_Limit && !ReadBlock())
			{
				return false;
			}
			b = m_Buffer[m_Pos++];
			return true;
		}

		public byte ReadByte()
		{
			if (m_Pos >= m_Limit && !ReadBlock())
			{
				return byte.MaxValue;
			}
			return m_Buffer[m_Pos++];
		}

		public ulong GetProcessedSize()
		{
			return m_ProcessedSize + m_Pos;
		}
	}
	public class OutBuffer
	{
		private byte[] m_Buffer;

		private uint m_Pos;

		private uint m_BufferSize;

		private Stream m_Stream;

		private ulong m_ProcessedSize;

		public OutBuffer(uint bufferSize)
		{
			m_Buffer = new byte[bufferSize];
			m_BufferSize = bufferSize;
		}

		public void SetStream(Stream stream)
		{
			m_Stream = stream;
		}

		public void FlushStream()
		{
			m_Stream.Flush();
		}

		public void CloseStream()
		{
			m_Stream.Close();
		}

		public void ReleaseStream()
		{
			m_Stream = null;
		}

		public void Init()
		{
			m_ProcessedSize = 0uL;
			m_Pos = 0u;
		}

		public void WriteByte(byte b)
		{
			m_Buffer[m_Pos++] = b;
			if (m_Pos >= m_BufferSize)
			{
				FlushData();
			}
		}

		public void FlushData()
		{
			if (m_Pos != 0)
			{
				m_Stream.Write(m_Buffer, 0, (int)m_Pos);
				m_Pos = 0u;
			}
		}

		public ulong GetProcessedSize()
		{
			return m_ProcessedSize + m_Pos;
		}
	}
}
namespace SevenZip.CommandLineParser
{
	public enum SwitchType
	{
		Simple,
		PostMinus,
		LimitedPostString,
		UnLimitedPostString,
		PostChar
	}
	public class SwitchForm
	{
		public string IDString;

		public SwitchType Type;

		public bool Multi;

		public int MinLen;

		public int MaxLen;

		public string PostCharSet;

		public SwitchForm(string idString, SwitchType type, bool multi, int minLen, int maxLen, string postCharSet)
		{
			IDString = idString;
			Type = type;
			Multi = multi;
			MinLen = minLen;
			MaxLen = maxLen;
			PostCharSet = postCharSet;
		}

		public SwitchForm(string idString, SwitchType type, bool multi, int minLen)
			: this(idString, type, multi, minLen, 0, "")
		{
		}

		public SwitchForm(string idString, SwitchType type, bool multi)
			: this(idString, type, multi, 0)
		{
		}
	}
	public class SwitchResult
	{
		public bool ThereIs;

		public bool WithMinus;

		public ArrayList PostStrings = new ArrayList();

		public int PostCharIndex;

		public SwitchResult()
		{
			ThereIs = false;
		}
	}
	public class Parser
	{
		public ArrayList NonSwitchStrings = new ArrayList();

		private SwitchResult[] _switches;

		private const char kSwitchID1 = '-';

		private const char kSwitchID2 = '/';

		private const char kSwitchMinus = '-';

		private const string kStopSwitchParsing = "--";

		public SwitchResult this[int index] => _switches[index];

		public Parser(int numSwitches)
		{
			_switches = new SwitchResult[numSwitches];
			for (int i = 0; i < numSwitches; i++)
			{
				_switches[i] = new SwitchResult();
			}
		}

		private bool ParseString(string srcString, SwitchForm[] switchForms)
		{
			int length = srcString.Length;
			if (length == 0)
			{
				return false;
			}
			int num = 0;
			if (!IsItSwitchChar(srcString[num]))
			{
				return false;
			}
			while (num < length)
			{
				if (IsItSwitchChar(srcString[num]))
				{
					num++;
				}
				int num2 = 0;
				int num3 = -1;
				for (int i = 0; i < _switches.Length; i++)
				{
					int length2 = switchForms[i].IDString.Length;
					if (length2 > num3 && num + length2 <= length && string.Compare(switchForms[i].IDString, 0, srcString, num, length2, ignoreCase: true) == 0)
					{
						num2 = i;
						num3 = length2;
					}
				}
				if (num3 == -1)
				{
					throw new Exception("maxLen == kNoLen");
				}
				SwitchResult switchResult = _switches[num2];
				SwitchForm switchForm = switchForms[num2];
				if (!switchForm.Multi && switchResult.ThereIs)
				{
					throw new Exception("switch must be single");
				}
				switchResult.ThereIs = true;
				num += num3;
				int num4 = length - num;
				SwitchType type = switchForm.Type;
				switch (type)
				{
				case SwitchType.PostMinus:
					if (num4 == 0)
					{
						switchResult.WithMinus = false;
						break;
					}
					switchResult.WithMinus = srcString[num] == '-';
					if (switchResult.WithMinus)
					{
						num++;
					}
					break;
				case SwitchType.PostChar:
				{
					if (num4 < switchForm.MinLen)
					{
						throw new Exception("switch is not full");
					}
					string postCharSet = switchForm.PostCharSet;
					if (num4 == 0)
					{
						switchResult.PostCharIndex = -1;
						break;
					}
					int num6 = postCharSet.IndexOf(srcString[num]);
					if (num6 < 0)
					{
						switchResult.PostCharIndex = -1;
						break;
					}
					switchResult.PostCharIndex = num6;
					num++;
					break;
				}
				case SwitchType.LimitedPostString:
				case SwitchType.UnLimitedPostString:
				{
					int minLen = switchForm.MinLen;
					if (num4 < minLen)
					{
						throw new Exception("switch is not full");
					}
					if (type == SwitchType.UnLimitedPostString)
					{
						switchResult.PostStrings.Add(srcString.Substring(num));
						return true;
					}
					string text = srcString.Substring(num, minLen);
					num += minLen;
					int num5 = minLen;
					while (num5 < switchForm.MaxLen && num < length)
					{
						char c = srcString[num];
						if (IsItSwitchChar(c))
						{
							break;
						}
						text += c;
						num5++;
						num++;
					}
					switchResult.PostStrings.Add(text);
					break;
				}
				}
			}
			return true;
		}

		public void ParseStrings(SwitchForm[] switchForms, string[] commandStrings)
		{
			int num = commandStrings.Length;
			bool flag = false;
			for (int i = 0; i < num; i++)
			{
				string text = commandStrings[i];
				if (flag)
				{
					NonSwitchStrings.Add(text);
				}
				else if (text == "--")
				{
					flag = true;
				}
				else if (!ParseString(text, switchForms))
				{
					NonSwitchStrings.Add(text);
				}
			}
		}

		public static int ParseCommand(CommandForm[] commandForms, string commandString, out string postString)
		{
			for (int i = 0; i < commandForms.Length; i++)
			{
				string iDString = commandForms[i].IDString;
				if (commandForms[i].PostStringMode)
				{
					if (commandString.IndexOf(iDString) == 0)
					{
						postString = commandString.Substring(iDString.Length);
						return i;
					}
				}
				else if (commandString == iDString)
				{
					postString = "";
					return i;
				}
			}
			postString = "";
			return -1;
		}

		private static bool ParseSubCharsCommand(int numForms, CommandSubCharsSet[] forms, string commandString, ArrayList indices)
		{
			indices.Clear();
			int num = 0;
			for (int i = 0; i < numForms; i++)
			{
				CommandSubCharsSet commandSubCharsSet = forms[i];
				int num2 = -1;
				int length = commandSubCharsSet.Chars.Length;
				for (int j = 0; j < length; j++)
				{
					char value = commandSubCharsSet.Chars[j];
					int num3 = commandString.IndexOf(value);
					if (num3 >= 0)
					{
						if (num2 >= 0)
						{
							return false;
						}
						if (commandString.IndexOf(value, num3 + 1) >= 0)
						{
							return false;
						}
						num2 = j;
						num++;
					}
				}
				if (num2 == -1 && !commandSubCharsSet.EmptyAllowed)
				{
					return false;
				}
				indices.Add(num2);
			}
			return num == commandString.Length;
		}

		private static bool IsItSwitchChar(char c)
		{
			if (c != '-')
			{
				return c == '/';
			}
			return true;
		}
	}
	public class CommandForm
	{
		public string IDString = "";

		public bool PostStringMode;

		public CommandForm(string idString, bool postStringMode)
		{
			IDString = idString;
			PostStringMode = postStringMode;
		}
	}
	internal class CommandSubCharsSet
	{
		public string Chars = "";

		public bool EmptyAllowed;
	}
}
namespace LZ4ps
{
	public static class LZ4Codec
	{
		private class LZ4HC_Data_Structure
		{
			public byte[] src;

			public int src_base;

			public int src_end;

			public int src_LASTLITERALS;

			public byte[] dst;

			public int dst_base;

			public int dst_len;

			public int dst_end;

			public int[] hashTable;

			public ushort[] chainTable;

			public int nextToUpdate;
		}

		private const int MEMORY_USAGE = 14;

		private const int NOTCOMPRESSIBLE_DETECTIONLEVEL = 6;

		private const int BLOCK_COPY_LIMIT = 16;

		private const int MINMATCH = 4;

		private const int SKIPSTRENGTH = 6;

		private const int COPYLENGTH = 8;

		private const int LASTLITERALS = 5;

		private const int MFLIMIT = 12;

		private const int MINLENGTH = 13;

		private const int MAXD_LOG = 16;

		private const int MAXD = 65536;

		private const int MAXD_MASK = 65535;

		private const int MAX_DISTANCE = 65535;

		private const int ML_BITS = 4;

		private const int ML_MASK = 15;

		private const int RUN_BITS = 4;

		private const int RUN_MASK = 15;

		private const int STEPSIZE_64 = 8;

		private const int STEPSIZE_32 = 4;

		private const int LZ4_64KLIMIT = 65547;

		private const int HASH_LOG = 12;

		private const int HASH_TABLESIZE = 4096;

		private const int HASH_ADJUST = 20;

		private const int HASH64K_LOG = 13;

		private const int HASH64K_TABLESIZE = 8192;

		private const int HASH64K_ADJUST = 19;

		private const int HASHHC_LOG = 15;

		private const int HASHHC_TABLESIZE = 32768;

		private const int HASHHC_ADJUST = 17;

		private static readonly int[] DECODER_TABLE_32 = new int[8] { 0, 3, 2, 3, 0, 0, 0, 0 };

		private static readonly int[] DECODER_TABLE_64 = new int[8] { 0, 0, 0, -1, 0, 1, 2, 3 };

		private static readonly int[] DEBRUIJN_TABLE_32 = new int[32]
		{
			0, 0, 3, 0, 3, 1, 3, 0, 3, 2,
			2, 1, 3, 2, 0, 1, 3, 3, 1, 2,
			2, 2, 2, 0, 3, 1, 2, 0, 1, 0,
			1, 1
		};

		private static readonly int[] DEBRUIJN_TABLE_64 = new int[64]
		{
			0, 0, 0, 0, 0, 1, 1, 2, 0, 3,
			1, 3, 1, 4, 2, 7, 0, 2, 3, 6,
			1, 5, 3, 5, 1, 3, 4, 4, 2, 5,
			6, 7, 7, 0, 1, 2, 3, 3, 4, 6,
			2, 6, 5, 5, 3, 4, 5, 6, 7, 1,
			2, 4, 6, 4, 4, 5, 7, 2, 6, 5,
			7, 6, 7, 7
		};

		private const int MAX_NB_ATTEMPTS = 256;

		private const int OPTIMAL_ML = 18;

		public static int MaximumOutputLength(int inputLength)
		{
			return inputLength + inputLength / 255 + 16;
		}

		internal static void CheckArguments(byte[] input, int inputOffset, ref int inputLength, byte[] output, int outputOffset, ref int outputLength)
		{
			if (inputLength < 0)
			{
				inputLength = input.Length - inputOffset;
			}
			if (inputLength == 0)
			{
				outputLength = 0;
				return;
			}
			if (input == null)
			{
				throw new ArgumentNullException("input");
			}
			if (inputOffset < 0 || inputOffset + inputLength > input.Length)
			{
				throw new ArgumentException("inputOffset and inputLength are invalid for given input");
			}
			if (outputLength < 0)
			{
				outputLength = output.Length - outputOffset;
			}
			if (output == null)
			{
				throw new ArgumentNullException("output");
			}
			if (outputOffset >= 0 && outputOffset + outputLength <= output.Length)
			{
				return;
			}
			throw new ArgumentException("outputOffset and outputLength are invalid for given output");
		}

		[Conditional("DEBUG")]
		private static void Assert(bool condition, string errorMessage)
		{
			if (!condition)
			{
				throw new ArgumentException(errorMessage);
			}
		}

		internal static void Poke2(byte[] buffer, int offset, ushort value)
		{
			buffer[offset] = (byte)value;
			buffer[offset + 1] = (byte)(value >> 8);
		}

		internal static ushort Peek2(byte[] buffer, int offset)
		{
			return (ushort)(buffer[offset] | (buffer[offset + 1] << 8));
		}

		internal static uint Peek4(byte[] buffer, int offset)
		{
			return (uint)(buffer[offset] | (buffer[offset + 1] << 8) | (buffer[offset + 2] << 16) | (buffer[offset + 3] << 24));
		}

		private static uint Xor4(byte[] buffer, int offset1, int offset2)
		{
			int num = buffer[offset1] | (buffer[offset1 + 1] << 8) | (buffer[offset1 + 2] << 16) | (buffer[offset1 + 3] << 24);
			uint num2 = (uint)(buffer[offset2] | (buffer[offset2 + 1] << 8) | (buffer[offset2 + 2] << 16) | (buffer[offset2 + 3] << 24));
			return (uint)num ^ num2;
		}

		private static ulong Xor8(byte[] buffer, int offset1, int offset2)
		{
			ulong num = buffer[offset1] | ((ulong)buffer[offset1 + 1] << 8) | ((ulong)buffer[offset1 + 2] << 16) | ((ulong)buffer[offset1 + 3] << 24) | ((ulong)buffer[offset1 + 4] << 32) | ((ulong)buffer[offset1 + 5] << 40) | ((ulong)buffer[offset1 + 6] << 48) | ((ulong)buffer[offset1 + 7] << 56);
			ulong num2 = buffer[offset2] | ((ulong)buffer[offset2 + 1] << 8) | ((ulong)buffer[offset2 + 2] << 16) | ((ulong)buffer[offset2 + 3] << 24) | ((ulong)buffer[offset2 + 4] << 32) | ((ulong)buffer[offset2 + 5] << 40) | ((ulong)buffer[offset2 + 6] << 48) | ((ulong)buffer[offset2 + 7] << 56);
			return num ^ num2;
		}

		private static bool Equal2(byte[] buffer, int offset1, int offset2)
		{
			if (buffer[offset1] != buffer[offset2])
			{
				return false;
			}
			return buffer[offset1 + 1] == buffer[offset2 + 1];
		}

		private static bool Equal4(byte[] buffer, int offset1, int offset2)
		{
			if (buffer[offset1] != buffer[offset2])
			{
				return false;
			}
			if (buffer[offset1 + 1] != buffer[offset2 + 1])
			{
				return false;
			}
			if (buffer[offset1 + 2] != buffer[offset2 + 2])
			{
				return false;
			}
			return buffer[offset1 + 3] == buffer[offset2 + 3];
		}

		private static void Copy4(byte[] buf, int src, int dst)
		{
			buf[dst + 3] = buf[src + 3];
			buf[dst + 2] = buf[src + 2];
			buf[dst + 1] = buf[src + 1];
			buf[dst] = buf[src];
		}

		private static void Copy8(byte[] buf, int src, int dst)
		{
			buf[dst + 7] = buf[src + 7];
			buf[dst + 6] = buf[src + 6];
			buf[dst + 5] = buf[src + 5];
			buf[dst + 4] = buf[src + 4];
			buf[dst + 3] = buf[src + 3];
			buf[dst + 2] = buf[src + 2];
			buf[dst + 1] = buf[src + 1];
			buf[dst] = buf[src];
		}

		private static void BlockCopy(byte[] src, int src_0, byte[] dst, int dst_0, int len)
		{
			if (len >= 16)
			{
				Buffer.BlockCopy(src, src_0, dst, dst_0, len);
				return;
			}
			while (len >= 8)
			{
				dst[dst_0] = src[src_0];
				dst[dst_0 + 1] = src[src_0 + 1];
				dst[dst_0 + 2] = src[src_0 + 2];
				dst[dst_0 + 3] = src[src_0 + 3];
				dst[dst_0 + 4] = src[src_0 + 4];
				dst[dst_0 + 5] = src[src_0 + 5];
				dst[dst_0 + 6] = src[src_0 + 6];
				dst[dst_0 + 7] = src[src_0 + 7];
				len -= 8;
				src_0 += 8;
				dst_0 += 8;
			}
			while (len >= 4)
			{
				dst[dst_0] = src[src_0];
				dst[dst_0 + 1] = src[src_0 + 1];
				dst[dst_0 + 2] = src[src_0 + 2];
				dst[dst_0 + 3] = src[src_0 + 3];
				len -= 4;
				src_0 += 4;
				dst_0 += 4;
			}
			while (len-- > 0)
			{
				dst[dst_0++] = src[src_0++];
			}
		}

		private static int WildCopy(byte[] src, int src_0, byte[] dst, int dst_0, int dst_end)
		{
			int num = dst_end - dst_0;
			if (num >= 16)
			{
				Buffer.BlockCopy(src, src_0, dst, dst_0, num);
			}
			else
			{
				while (num >= 4)
				{
					dst[dst_0] = src[src_0];
					dst[dst_0 + 1] = src[src_0 + 1];
					dst[dst_0 + 2] = src[src_0 + 2];
					dst[dst_0 + 3] = src[src_0 + 3];
					num -= 4;
					src_0 += 4;
					dst_0 += 4;
				}
				while (num-- > 0)
				{
					dst[dst_0++] = src[src_0++];
				}
			}
			return num;
		}

		private static int SecureCopy(byte[] buffer, int src, int dst, int dst_end)
		{
			int num = dst - src;
			int num2 = dst_end - dst;
			int num3 = num2;
			if (num >= 16)
			{
				if (num >= num2)
				{
					Buffer.BlockCopy(buffer, src, buffer, dst, num2);
					return num2;
				}
				do
				{
					Buffer.BlockCopy(buffer, src, buffer, dst, num);
					src += num;
					dst += num;
					num3 -= num;
				}
				while (num3 >= num);
			}
			while (num3 >= 4)
			{
				buffer[dst] = buffer[src];
				buffer[dst + 1] = buffer[src + 1];
				buffer[dst + 2] = buffer[src + 2];
				buffer[dst + 3] = buffer[src + 3];
				dst += 4;
				src += 4;
				num3 -= 4;
			}
			while (num3-- > 0)
			{
				buffer[dst++] = buffer[src++];
			}
			return num2;
		}

		public static int Encode32(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int outputLength)
		{
			CheckArguments(input, inputOffset, ref inputLength, output, outputOffset, ref outputLength);
			if (outputLength == 0)
			{
				return 0;
			}
			if (inputLength < 65547)
			{
				return LZ4_compress64kCtx_safe32(new ushort[8192], input, output, inputOffset, outputOffset, inputLength, outputLength);
			}
			return LZ4_compressCtx_safe32(new int[4096], input, output, inputOffset, outputOffset, inputLength, outputLength);
		}

		public static byte[] Encode32(byte[] input, int inputOffset, int inputLength)
		{
			if (inputLength < 0)
			{
				inputLength = input.Length - inputOffset;
			}
			if (input == null)
			{
				throw new ArgumentNullException("input");
			}
			if (inputOffset < 0 || inputOffset + inputLength > input.Length)
			{
				throw new ArgumentException("inputOffset and inputLength are invalid for given input");
			}
			byte[] array = new byte[MaximumOutputLength(inputLength)];
			int num = Encode32(input, inputOffset, inputLength, array, 0, array.Length);
			if (num != array.Length)
			{
				if (num < 0)
				{
					throw new InvalidOperationException("Compression has been corrupted");
				}
				byte[] array2 = new byte[num];
				Buffer.BlockCopy(array, 0, array2, 0, num);
				return array2;
			}
			return array;
		}

		public static int Encode64(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int outputLength)
		{
			CheckArguments(input, inputOffset, ref inputLength, output, outputOffset, ref outputLength);
			if (outputLength == 0)
			{
				return 0;
			}
			if (inputLength < 65547)
			{
				return LZ4_compress64kCtx_safe64(new ushort[8192], input, output, inputOffset, outputOffset, inputLength, outputLength);
			}
			return LZ4_compressCtx_safe64(new int[4096], input, output, inputOffset, outputOffset, inputLength, outputLength);
		}

		public static byte[] Encode64(byte[] input, int inputOffset, int inputLength)
		{
			if (inputLength < 0)
			{
				inputLength = input.Length - inputOffset;
			}
			if (input == null)
			{
				throw new ArgumentNullException("input");
			}
			if (inputOffset < 0 || inputOffset + inputLength > input.Length)
			{
				throw new ArgumentException("inputOffset and inputLength are invalid for given input");
			}
			byte[] array = new byte[MaximumOutputLength(inputLength)];
			int num = Encode64(input, inputOffset, inputLength, array, 0, array.Length);
			if (num != array.Length)
			{
				if (num < 0)
				{
					throw new InvalidOperationException("Compression has been corrupted");
				}
				byte[] array2 = new byte[num];
				Buffer.BlockCopy(array, 0, array2, 0, num);
				return array2;
			}
			return array;
		}

		public static int Decode32(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int outputLength, bool knownOutputLength)
		{
			CheckArguments(input, inputOffset, ref inputLength, output, outputOffset, ref outputLength);
			if (outputLength == 0)
			{
				return 0;
			}
			if (knownOutputLength)
			{
				if (LZ4_uncompress_safe32(input, output, inputOffset, 

BepInEx-BepInEx_MLLoader/BepInEx.MelonLoader.Loader/BepInEx.MelonLoader.Loader.UnityMono.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using MelonLoader;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("BepInEx.MelonLoader.Loader.UnityMono")]
[assembly: AssemblyConfiguration("BepInEx5")]
[assembly: AssemblyDescription("MelonLoader loader for UnityMono games")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0")]
[assembly: AssemblyProduct("BepInEx.MelonLoader.Loader.UnityMono")]
[assembly: AssemblyTitle("BepInEx.MelonLoader.Loader.UnityMono")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.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 BepInEx.MelonLoader.Loader.UnityMono
{
	[BepInPlugin("BepInEx.MelonLoader.Loader.UnityMono", "BepInEx.MelonLoader.Loader.UnityMono", "2.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			AppDomain.CurrentDomain.AssemblyResolve += (object sender, ResolveEventArgs args) => args.Name.Contains("MelonLoader") ? typeof(Core).Assembly : null;
			Core.Initialize(((BaseUnityPlugin)this).Config, false);
			Core.PreStart();
			Core.Start();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BepInEx.MelonLoader.Loader.UnityMono";

		public const string PLUGIN_NAME = "BepInEx.MelonLoader.Loader.UnityMono";

		public const string PLUGIN_VERSION = "2.1.0";
	}
}

BepInEx-BepInEx_MLLoader/BepInEx.MelonLoader.Loader/bHapticsLib.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Timers;
using WebSocketDotNet;
using WebSocketDotNet.Messages;
using bHapticsLib.Internal;
using bHapticsLib.Internal.Models.Connection;
using bHapticsLib.Internal.SimpleJSON;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("bHapticsLib")]
[assembly: AssemblyCompany("Lava Gang")]
[assembly: AssemblyProduct("bHapticsLib")]
[assembly: AssemblyCopyright("Created by Herp Derpinstine")]
[assembly: AssemblyTrademark("Lava Gang")]
[assembly: Guid("C55CC59C-138B-48DF-95CC-FA956D064600")]
[assembly: AssemblyFileVersion("1.0.6")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("1.0.6.0")]
namespace bHapticsLib
{
	public class bHapticsConnection : ThreadedTask
	{
		private static readonly Type intType = typeof(int);

		private static readonly Type byteType = typeof(byte);

		private static readonly Type dotPointType = typeof(DotPoint);

		private List<RegisterRequest> RegisterCache = new List<RegisterRequest>();

		private ThreadSafeQueue<RegisterRequest> RegisterQueue = new ThreadSafeQueue<RegisterRequest>();

		private ThreadSafeQueue<SubmitRequest> SubmitQueue = new ThreadSafeQueue<SubmitRequest>();

		internal static int Port = 15881;

		internal static string Endpoint = "v2/feedbacks";

		private IPAddress _ipaddress = IPAddress.Loopback;

		private string _id;

		private string _name;

		public bool TryToReconnect;

		private int _maxRetries = 5;

		internal WebSocketConnection Socket;

		private PlayerPacket Packet = new PlayerPacket();

		private bool ShouldRun = true;

		public IPAddress IPAddress
		{
			get
			{
				return _ipaddress;
			}
			set
			{
				if (value == null)
				{
					RestartAndRunAction(delegate
					{
						_ipaddress = IPAddress.Loopback;
					});
				}
				else
				{
					RestartAndRunAction(delegate
					{
						_ipaddress = value;
					});
				}
			}
		}

		public string ID
		{
			get
			{
				return _id;
			}
			set
			{
				if (string.IsNullOrEmpty(value))
				{
					throw new ArgumentNullException("value");
				}
				RestartAndRunAction(delegate
				{
					_id = value.Replace(" ", "_");
				});
			}
		}

		public string Name
		{
			get
			{
				return _name;
			}
			set
			{
				if (string.IsNullOrEmpty(value))
				{
					throw new ArgumentNullException("value");
				}
				RestartAndRunAction(delegate
				{
					_name = value.Replace(" ", "_");
				});
			}
		}

		public int MaxRetries
		{
			get
			{
				return _maxRetries;
			}
			set
			{
				_maxRetries = value.Clamp(0, int.MaxValue);
			}
		}

		public bHapticsStatus Status
		{
			get
			{
				if (IsAlive())
				{
					if (IsConnected())
					{
						return bHapticsStatus.Connected;
					}
					return bHapticsStatus.Connecting;
				}
				return bHapticsStatus.Disconnected;
			}
		}

		internal bHapticsConnection()
		{
		}

		public bHapticsConnection(string id, string name, bool tryToReconnect = true, int maxRetries = 5)
			: this(null, id, name, tryToReconnect, maxRetries)
		{
		}

		public bHapticsConnection(IPAddress ipaddress, string id, string name, bool tryToReconnect = true, int maxRetries = 5)
		{
			Setup(ipaddress, id, name, tryToReconnect, maxRetries);
		}

		internal void Setup(IPAddress ipaddress, string id, string name, bool tryToReconnect, int maxRetries)
		{
			if (string.IsNullOrEmpty(id))
			{
				throw new ArgumentNullException("id");
			}
			if (string.IsNullOrEmpty(name))
			{
				throw new ArgumentNullException("name");
			}
			ID = id;
			Name = name;
			TryToReconnect = tryToReconnect;
			MaxRetries = maxRetries;
			IPAddress = ipaddress;
		}

		internal override bool BeginInitInternal()
		{
			if (Socket != null)
			{
				EndInit();
			}
			Socket = new WebSocketConnection(this);
			ShouldRun = true;
			return true;
		}

		internal override bool EndInitInternal()
		{
			if (Socket == null)
			{
				return false;
			}
			ShouldRun = false;
			while (IsAlive())
			{
				Thread.Sleep(1);
			}
			RegisterCache.Clear();
			Socket.Dispose();
			Socket = null;
			return true;
		}

		internal override void WithinThread()
		{
			while (ShouldRun)
			{
				if (Socket.FirstTry)
				{
					Socket.FirstTry = false;
					Socket.TryConnect();
				}
				if (IsConnected())
				{
					RegisterRequest aItem;
					while ((aItem = RegisterQueue.Dequeue()) != null)
					{
						Packet.Register.Add(aItem);
					}
					SubmitRequest aItem2;
					while ((aItem2 = SubmitQueue.Dequeue()) != null)
					{
						Packet.Submit.Add(aItem2);
					}
					if (!Packet.IsEmpty())
					{
						Socket.Send(Packet);
						Packet.Clear();
					}
				}
				if (ShouldRun)
				{
					Thread.Sleep(1);
				}
			}
		}

		internal void QueueRegisterCache()
		{
			int count = RegisterCache.Count;
			if (count <= 0)
			{
				return;
			}
			for (int i = 0; i < count; i++)
			{
				RegisterRequest registerRequest = RegisterCache[i];
				if (!(registerRequest == null) && !registerRequest.IsNull)
				{
					RegisterQueue.Enqueue(registerRequest);
				}
			}
		}

		private void RestartAndRunAction(Action whileDisconnected)
		{
			bool num = Socket != null;
			if (num)
			{
				EndInit();
			}
			whileDisconnected();
			if (num)
			{
				BeginInit();
			}
		}

		internal bool IsConnected()
		{
			return Socket?.IsConnected() ?? false;
		}

		public int GetConnectedDeviceCount()
		{
			return (Socket?.LastResponse?.ConnectedDeviceCount).GetValueOrDefault();
		}

		public bool IsDeviceConnected(PositionID type)
		{
			if (type == PositionID.VestFront || type == PositionID.VestBack)
			{
				type = PositionID.Vest;
			}
			return (Socket?.LastResponse?.ConnectedPositions?.ContainsValue(type.ToPacketString())).GetValueOrDefault();
		}

		public int[] GetDeviceStatus(PositionID type)
		{
			if (Socket == null || Socket.LastResponse == null)
			{
				return null;
			}
			JSONNode status = Socket.LastResponse.Status;
			if (type == PositionID.Vest)
			{
				JSONNode jSONNode = status[PositionID.VestFront.ToPacketString()];
				JSONNode jSONNode2 = status[PositionID.VestBack.ToPacketString()];
				int num = jSONNode.Count + jSONNode2.Count;
				int[] array = new int[num];
				for (int i = 0; i < num; i++)
				{
					if (i < jSONNode.Count)
					{
						array[i] = jSONNode[i].AsInt;
					}
					else
					{
						array[i] = jSONNode2[i - jSONNode.Count].AsInt;
					}
				}
				return array;
			}
			JSONNode jSONNode3 = status[type.ToPacketString()];
			int count = jSONNode3.Count;
			int[] array2 = new int[count];
			for (int j = 0; j < count; j++)
			{
				array2[j] = jSONNode3[j].AsInt;
			}
			return array2;
		}

		public bool IsPlaying(string key)
		{
			return (Socket?.LastResponse?.ActiveKeys?.ContainsValue(key)).GetValueOrDefault();
		}

		public bool IsPlayingAny()
		{
			WebSocketConnection socket = Socket;
			if (socket == null)
			{
				return false;
			}
			return socket.LastResponse?.ActiveKeys?.Count > 0;
		}

		public void StopPlaying(string key)
		{
			if (IsAlive() && IsConnected())
			{
				SubmitQueue.Enqueue(new SubmitRequest
				{
					key = key,
					type = "turnOff"
				});
			}
		}

		public void StopPlayingAll()
		{
			if (IsAlive() && IsConnected())
			{
				SubmitQueue.Enqueue(new SubmitRequest
				{
					type = "turnOffAll"
				});
			}
		}

		public bool IsPatternRegistered(string key)
		{
			return (Socket?.LastResponse?.RegisteredKeys?.ContainsValue(key)).GetValueOrDefault();
		}

		public void RegisterPatternFromFile(string key, string tactFilePath)
		{
			if (File.Exists(tactFilePath))
			{
				RegisterPatternFromJson(key, File.ReadAllText(tactFilePath));
			}
		}

		public void RegisterPatternFromJson(string key, string tactFileJson)
		{
			if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(tactFileJson))
			{
				return;
			}
			JSONNode jSONNode = JSON.Parse(tactFileJson);
			if (!jSONNode.HasKey("project"))
			{
				return;
			}
			JSONNode jSONNode2 = jSONNode["project"];
			if (!(jSONNode2 == null) && !jSONNode2.IsNull && jSONNode2.IsObject)
			{
				RegisterRequest registerRequest = new RegisterRequest();
				registerRequest.key = key;
				registerRequest.project = jSONNode2.AsObject;
				RegisterCache.Add(registerRequest);
				if (IsConnected())
				{
					RegisterQueue.Enqueue(registerRequest);
				}
			}
		}

		public void RegisterPatternSwappedFromFile(string key, string tactFilePath)
		{
			if (File.Exists(tactFilePath))
			{
				RegisterPatternSwappedFromJson(key, File.ReadAllText(tactFilePath));
			}
		}

		public void RegisterPatternSwappedFromJson(string key, string tactFileJson)
		{
			if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(tactFileJson))
			{
				return;
			}
			JSONNode jSONNode = JSON.Parse(tactFileJson);
			if (!jSONNode.HasKey("project"))
			{
				return;
			}
			JSONNode jSONNode2 = jSONNode["project"];
			if (!(jSONNode2 == null) && !jSONNode2.IsNull && jSONNode2.IsObject)
			{
				RegisterRequest registerRequest = new RegisterRequest();
				registerRequest.key = key;
				JSONObject asObject = jSONNode2.AsObject;
				JSONArray asArray = asObject["tracks"].AsArray;
				LoopTracks(asArray, delegate(JSONObject effect)
				{
					JSONNode jSONNode3 = effect["modes"];
					JSONNode value = jSONNode3[0];
					JSONNode value2 = jSONNode3[1];
					jSONNode3[0] = value2;
					jSONNode3[1] = value;
					effect["modes"] = jSONNode3;
				});
				asObject["tracks"] = asArray;
				registerRequest.project = asObject;
				RegisterCache.Add(registerRequest);
				if (IsConnected())
				{
					RegisterQueue.Enqueue(registerRequest);
				}
			}
		}

		private static void LoopTracks(JSONArray tracks, Action<JSONObject> act)
		{
			for (int i = 0; i < tracks.Count; i++)
			{
				JSONObject asObject = tracks[i].AsObject;
				JSONArray asArray = asObject["effects"].AsArray;
				for (int j = 0; j < asArray.Count; j++)
				{
					JSONObject asObject2 = asArray[j].AsObject;
					act(asObject2);
					asArray[j] = asObject2;
				}
				asObject["effects"] = asArray;
				tracks[i] = asObject;
			}
		}

		public void Play<A, B>(string key, int durationMillis, PositionID position, A dotPoints, B pathPoints, MirrorDirection dotMirrorDirection = MirrorDirection.None) where A : IList, ICollection where B : IList<PathPoint>, ICollection<PathPoint>
		{
			if (!IsAlive())
			{
				return;
			}
			if (position == PositionID.Vest)
			{
				Play(key + "Front", durationMillis, PositionID.VestFront, dotPoints, pathPoints, dotMirrorDirection);
				Play(key + "Back", durationMillis, PositionID.VestBack, dotPoints, pathPoints, dotMirrorDirection);
				return;
			}
			SubmitRequest submitRequest = new SubmitRequest
			{
				key = key,
				type = "frame"
			};
			submitRequest.Frame.durationMillis = durationMillis;
			submitRequest.Frame.position = position.ToPacketString();
			if (dotPoints != null && dotPoints.Count > 0)
			{
				object[] dotPoints2 = null;
				if (dotMirrorDirection != 0)
				{
					dotPoints2 = new object[dotPoints.Count];
					for (int i = 0; i < dotPoints.Count; i++)
					{
						dotPoints2[i] = dotPoints[i];
					}
					switch (dotMirrorDirection)
					{
					case MirrorDirection.Horizontal:
						MirrorHorizontal(ref dotPoints2, position);
						break;
					case MirrorDirection.Vertical:
						MirrorVertical(ref dotPoints2, position);
						break;
					case MirrorDirection.Both:
						MirrorHorizontal(ref dotPoints2, position);
						MirrorVertical(ref dotPoints2, position);
						break;
					}
				}
				Type type = null;
				for (int j = 0; j < ((dotPoints2 == null) ? dotPoints.Count : dotPoints2.Length); j++)
				{
					object obj = ((dotPoints2 == null) ? dotPoints[j] : dotPoints2[j]);
					if (obj == null)
					{
						continue;
					}
					if ((object)type == null)
					{
						type = obj.GetType();
					}
					if ((object)type == intType || (object)type == byteType)
					{
						JSONObject jSONObject = new JSONObject();
						jSONObject["index"] = j.Clamp(0, 20);
						if ((object)type == intType)
						{
							jSONObject["intensity"] = Extensions.Clamp<int>((int)obj, 0, 500);
						}
						else if ((object)type == byteType)
						{
							jSONObject["intensity"] = Extensions.Clamp((byte)obj, (byte)0, (byte)200);
						}
						submitRequest.Frame.dotPoints.Add(jSONObject);
					}
					else if ((object)type == dotPointType)
					{
						submitRequest.Frame.dotPoints.Add((obj as DotPoint).node);
					}
				}
			}
			SubmitQueue.Enqueue(submitRequest);
		}

		public void PlayRegistered(string key, string altKey = null, ScaleOption scaleOption = null, RotationOption rotationOption = null)
		{
			if (IsAlive())
			{
				SubmitRequest submitRequest = new SubmitRequest
				{
					key = key,
					type = "key"
				};
				if (!string.IsNullOrEmpty(altKey))
				{
					submitRequest.Parameters["altKey"] = altKey;
				}
				if (scaleOption != null)
				{
					submitRequest.Parameters["scaleOption"] = scaleOption.node;
				}
				if (rotationOption != null)
				{
					submitRequest.Parameters["rotationOption"] = rotationOption.node;
				}
				SubmitQueue.Enqueue(submitRequest);
			}
		}

		public void PlayRegisteredMillis(string key, int startTimeMillis = 0)
		{
			if (IsAlive())
			{
				SubmitRequest submitRequest = new SubmitRequest
				{
					key = key,
					type = "key"
				};
				submitRequest.Parameters["startTimeMillis"] = startTimeMillis;
				SubmitQueue.Enqueue(submitRequest);
			}
		}

		private static void MirrorHorizontal<A>(ref A dotPoints, PositionID position) where A : IList, ICollection
		{
			int count = dotPoints.Count;
			int num = count / 2;
			if (count != 20)
			{
				dotPoints.Reverse(0, count);
				return;
			}
			switch (position)
			{
			case PositionID.Head:
				dotPoints.Reverse(0, count);
				break;
			case PositionID.VestFront:
			case PositionID.VestBack:
				dotPoints.Reverse(0, 4);
				dotPoints.Reverse(4, 4);
				dotPoints.Reverse(8, 4);
				dotPoints.Reverse(12, 4);
				dotPoints.Reverse(16, 4);
				break;
			case PositionID.FootLeft:
			case PositionID.FootRight:
			case PositionID.ArmLeft:
			case PositionID.ArmRight:
				dotPoints.Reverse(0, num);
				dotPoints.Reverse(num + 1, count);
				break;
			}
		}

		private static void MirrorVertical<A>(ref A dotPoints, PositionID position) where A : IList, ICollection
		{
			int count = dotPoints.Count;
			if (count != 20)
			{
				dotPoints.Reverse(0, count);
				return;
			}
			switch (position)
			{
			case PositionID.VestFront:
			case PositionID.VestBack:
				dotPoints.Swap(0, 16);
				dotPoints.Swap(1, 17);
				dotPoints.Swap(2, 18);
				dotPoints.Swap(3, 19);
				dotPoints.Swap(4, 12);
				dotPoints.Swap(5, 13);
				dotPoints.Swap(6, 14);
				dotPoints.Swap(7, 15);
				break;
			case PositionID.ArmLeft:
			case PositionID.ArmRight:
				dotPoints.Swap(0, 3);
				dotPoints.Swap(1, 4);
				dotPoints.Swap(2, 5);
				break;
			case PositionID.HandLeft:
			case PositionID.HandRight:
				dotPoints.Reverse(0, count);
				break;
			}
		}
	}
	public static class bHapticsManager
	{
		public const int MaxIntensityInInt = 500;

		public const byte MaxIntensityInByte = 200;

		public const int MaxMotorsPerDotPoint = 20;

		public const int MaxMotorsPerPathPoint = 3;

		private static bHapticsConnection Connection = new bHapticsConnection();

		public static bHapticsStatus Status => Connection.Status;

		public static bool Connect(string id, string name, bool tryToReconnect = true, int maxRetries = 5)
		{
			Connection.Setup(null, id, name, tryToReconnect, maxRetries);
			if (Status == bHapticsStatus.Disconnected)
			{
				return Connection.BeginInit();
			}
			return true;
		}

		public static bool Disconnect()
		{
			if (Status == bHapticsStatus.Disconnected)
			{
				return true;
			}
			StopPlayingAll();
			return Connection.EndInit();
		}

		public static int GetConnectedDeviceCount()
		{
			return Connection.GetConnectedDeviceCount();
		}

		public static bool IsAnyDevicesConnected()
		{
			return GetConnectedDeviceCount() > 0;
		}

		public static bool IsDeviceConnected(PositionID type)
		{
			return Connection.IsDeviceConnected(type);
		}

		public static int[] GetDeviceStatus(PositionID type)
		{
			return Connection.GetDeviceStatus(type);
		}

		public static bool IsAnyMotorActive(PositionID type)
		{
			return GetDeviceStatus(type)?.ContainsValueMoreThan(0) ?? false;
		}

		public static bool IsPlaying(string key)
		{
			return Connection.IsPlaying(key);
		}

		public static bool IsPlayingAny()
		{
			return Connection.IsPlayingAny();
		}

		public static void StopPlaying(string key)
		{
			Connection.StopPlaying(key);
		}

		public static void StopPlayingAll()
		{
			Connection.StopPlayingAll();
		}

		public static bool IsPatternRegistered(string key)
		{
			return Connection.IsPatternRegistered(key);
		}

		public static void RegisterPatternFromJson(string key, string tactFileJson)
		{
			Connection.RegisterPatternFromJson(key, tactFileJson);
		}

		public static void RegisterPatternFromFile(string key, string tactFilePath)
		{
			Connection.RegisterPatternFromFile(key, tactFilePath);
		}

		public static void RegisterPatternSwappedFromJson(string key, string tactFileJson)
		{
			Connection.RegisterPatternSwappedFromJson(key, tactFileJson);
		}

		public static void RegisterPatternSwappedFromFile(string key, string tactFilePath)
		{
			Connection.RegisterPatternSwappedFromFile(key, tactFilePath);
		}

		public static void Play(string key, int durationMillis, PositionID position, int[] dotPoints)
		{
			Connection.Play<int[], PathPoint[]>(key, durationMillis, position, dotPoints, null);
		}

		public static void Play(string key, int durationMillis, PositionID position, List<int> dotPoints)
		{
			Connection.Play<List<int>, PathPoint[]>(key, durationMillis, position, dotPoints, null);
		}

		public static void Play(string key, int durationMillis, PositionID position, byte[] dotPoints)
		{
			Connection.Play<byte[], PathPoint[]>(key, durationMillis, position, dotPoints, null);
		}

		public static void Play(string key, int durationMillis, PositionID position, List<byte> dotPoints)
		{
			Connection.Play<List<byte>, PathPoint[]>(key, durationMillis, position, dotPoints, null);
		}

		public static void Play(string key, int durationMillis, PositionID position, DotPoint[] dotPoints)
		{
			Connection.Play<DotPoint[], PathPoint[]>(key, durationMillis, position, dotPoints, null);
		}

		public static void Play(string key, int durationMillis, PositionID position, List<DotPoint> dotPoints)
		{
			Connection.Play<List<DotPoint>, PathPoint[]>(key, durationMillis, position, dotPoints, null);
		}

		public static void Play<A>(string key, int durationMillis, PositionID position, A pathPoints) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play<DotPoint[], A>(key, durationMillis, position, null, pathPoints);
		}

		public static void Play<A>(string key, int durationMillis, PositionID position, int[] dotPoints, A pathPoints) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints);
		}

		public static void Play<A>(string key, int durationMillis, PositionID position, List<int> dotPoints, A pathPoints) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints);
		}

		public static void Play<A>(string key, int durationMillis, PositionID position, byte[] dotPoints, A pathPoints) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints);
		}

		public static void Play<A>(string key, int durationMillis, PositionID position, List<byte> dotPoints, A pathPoints) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints);
		}

		public static void Play<A>(string key, int durationMillis, PositionID position, DotPoint[] dotPoints, A pathPoints) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints);
		}

		public static void Play<A>(string key, int durationMillis, PositionID position, List<DotPoint> dotPoints, A pathPoints) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints);
		}

		public static void PlayMirrored(string key, int durationMillis, PositionID position, int[] dotPoints, MirrorDirection mirrorDirection)
		{
			Connection.Play<int[], PathPoint[]>(key, durationMillis, position, dotPoints, null, mirrorDirection);
		}

		public static void PlayMirrored(string key, int durationMillis, PositionID position, List<int> dotPoints, MirrorDirection mirrorDirection)
		{
			Connection.Play<List<int>, PathPoint[]>(key, durationMillis, position, dotPoints, null, mirrorDirection);
		}

		public static void PlayMirrored(string key, int durationMillis, PositionID position, byte[] dotPoints, MirrorDirection mirrorDirection)
		{
			Connection.Play<byte[], PathPoint[]>(key, durationMillis, position, dotPoints, null, mirrorDirection);
		}

		public static void PlayMirrored(string key, int durationMillis, PositionID position, List<byte> dotPoints, MirrorDirection mirrorDirection)
		{
			Connection.Play<List<byte>, PathPoint[]>(key, durationMillis, position, dotPoints, null, mirrorDirection);
		}

		public static void PlayMirrored(string key, int durationMillis, PositionID position, DotPoint[] dotPoints, MirrorDirection mirrorDirection)
		{
			Connection.Play<DotPoint[], PathPoint[]>(key, durationMillis, position, dotPoints, null, mirrorDirection);
		}

		public static void PlayMirrored(string key, int durationMillis, PositionID position, List<DotPoint> dotPoints, MirrorDirection mirrorDirection)
		{
			Connection.Play<List<DotPoint>, PathPoint[]>(key, durationMillis, position, dotPoints, null, mirrorDirection);
		}

		public static void PlayMirrored<A>(string key, int durationMillis, PositionID position, int[] dotPoints, A pathPoints, MirrorDirection dotMirrorDirection) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints, dotMirrorDirection);
		}

		public static void PlayMirrored<A>(string key, int durationMillis, PositionID position, List<int> dotPoints, A pathPoints, MirrorDirection dotMirrorDirection) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints, dotMirrorDirection);
		}

		public static void PlayMirrored<A>(string key, int durationMillis, PositionID position, byte[] dotPoints, A pathPoints, MirrorDirection dotMirrorDirection) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints, dotMirrorDirection);
		}

		public static void PlayMirrored<A>(string key, int durationMillis, PositionID position, List<byte> dotPoints, A pathPoints, MirrorDirection dotMirrorDirection) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints, dotMirrorDirection);
		}

		public static void PlayMirrored<A>(string key, int durationMillis, PositionID position, DotPoint[] dotPoints, A pathPoints, MirrorDirection dotMirrorDirection) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints, dotMirrorDirection);
		}

		public static void PlayMirrored<A>(string key, int durationMillis, PositionID position, List<DotPoint> dotPoints, A pathPoints, MirrorDirection dotMirrorDirection) where A : IList<PathPoint>, ICollection<PathPoint>
		{
			Connection.Play(key, durationMillis, position, dotPoints, pathPoints, dotMirrorDirection);
		}

		public static void PlayRegistered(string key)
		{
			Connection.PlayRegistered(key);
		}

		public static void PlayRegistered(string key, int startTimeMillis)
		{
			Connection.PlayRegisteredMillis(key, startTimeMillis);
		}

		public static void PlayRegistered(string key, ScaleOption option)
		{
			Connection.PlayRegistered(key, null, option);
		}

		public static void PlayRegistered(string key, RotationOption option)
		{
			Connection.PlayRegistered(key, null, null, option);
		}

		public static void PlayRegistered(string key, ScaleOption scaleOption, RotationOption rotationOption)
		{
			Connection.PlayRegistered(key, null, scaleOption, rotationOption);
		}

		public static void PlayRegistered(string key, string altKey)
		{
			Connection.PlayRegistered(key, altKey);
		}

		public static void PlayRegistered(string key, string altKey, ScaleOption option)
		{
			Connection.PlayRegistered(key, altKey, option);
		}

		public static void PlayRegistered(string key, string altKey, RotationOption option)
		{
			Connection.PlayRegistered(key, altKey, null, option);
		}

		public static void PlayRegistered(string key, string altKey, ScaleOption scaleOption, RotationOption rotationOption)
		{
			Connection.PlayRegistered(key, altKey, scaleOption, rotationOption);
		}
	}
	public enum bHapticsStatus
	{
		Disconnected,
		Connecting,
		Connected
	}
	public class DotPoint
	{
		internal JSONObject node = new JSONObject();

		public int Index
		{
			get
			{
				return node["index"].AsInt;
			}
			set
			{
				node["index"] = value.Clamp(0, 20);
			}
		}

		public int Intensity
		{
			get
			{
				return node["intensity"].AsInt;
			}
			set
			{
				node["intensity"] = value.Clamp(0, 500);
			}
		}

		public DotPoint(int index = 0, int intensity = 50)
		{
			Index = index;
			Intensity = intensity;
		}

		public override string ToString()
		{
			return string.Format("{0} ( {1}: {2}, {3}: {4} )", "DotPoint", "Index", Index, "Intensity", Intensity);
		}
	}
	public static class Extensions
	{
		private static string OscAddressHeader = "/bhaptics";

		public static string ToOscAddress(this PositionID value)
		{
			return value switch
			{
				PositionID.Head => OscAddressHeader + "/head", 
				PositionID.Vest => OscAddressHeader + "/vest", 
				PositionID.VestFront => OscAddressHeader + "/vest/front", 
				PositionID.VestBack => OscAddressHeader + "/vest/back", 
				PositionID.ArmLeft => OscAddressHeader + "/arm/left", 
				PositionID.ArmRight => OscAddressHeader + "/arm/right", 
				PositionID.HandLeft => OscAddressHeader + "/hand/left", 
				PositionID.HandRight => OscAddressHeader + "/hand/right", 
				PositionID.GloveLeft => OscAddressHeader + "/glove/left", 
				PositionID.GloveRight => OscAddressHeader + "/glove/right", 
				PositionID.FootLeft => OscAddressHeader + "/foot/left", 
				PositionID.FootRight => OscAddressHeader + "/foot/right", 
				_ => null, 
			};
		}

		internal static string ToPacketString(this PositionID value)
		{
			return value switch
			{
				PositionID.ArmLeft => "ForearmL", 
				PositionID.ArmRight => "ForearmR", 
				PositionID.HandLeft => "HandL", 
				PositionID.HandRight => "HandR", 
				PositionID.GloveLeft => "GloveL", 
				PositionID.GloveRight => "GloveR", 
				PositionID.FootLeft => "FootL", 
				PositionID.FootRight => "FootR", 
				_ => value.ToString(), 
			};
		}

		internal static T Clamp<T>(T value, T min, T max) where T : IComparable<T>
		{
			if (value.CompareTo(min) < 0)
			{
				return min;
			}
			if (value.CompareTo(max) > 0)
			{
				return max;
			}
			return value;
		}

		internal static short Clamp(this short value, short min, short max)
		{
			return Extensions.Clamp<short>(value, min, max);
		}

		internal static ushort Clamp(this ushort value, ushort min, ushort max)
		{
			return Extensions.Clamp<ushort>(value, min, max);
		}

		internal static int Clamp(this int value, int min, int max)
		{
			return Extensions.Clamp<int>(value, min, max);
		}

		internal static uint Clamp(this uint value, uint min, uint max)
		{
			return Extensions.Clamp<uint>(value, min, max);
		}

		internal static double Clamp(this double value, double min, double max)
		{
			return Extensions.Clamp<double>(value, min, max);
		}

		internal static float Clamp(this float value, float min, float max)
		{
			return Extensions.Clamp<float>(value, min, max);
		}

		internal static void AddRange<T, Z>(this T arr, List<Z> value) where T : JSONNode where Z : JSONNode
		{
			if (value == null || arr.IsNull)
			{
				return;
			}
			int count = value.Count;
			if (count <= 0)
			{
				return;
			}
			for (int i = 0; i < count; i++)
			{
				Z val = value[i];
				if (!((JSONNode)val == (object)null) && !val.IsNull)
				{
					arr.Add(value[i]);
				}
			}
		}

		internal static void AddRange<T, Z>(this T arr, Z[] value) where T : JSONNode where Z : JSONNode
		{
			if (value == null || arr.IsNull)
			{
				return;
			}
			int num = value.Length;
			if (num <= 0)
			{
				return;
			}
			for (int i = 0; i < num; i++)
			{
				Z val = value[i];
				if (!((JSONNode)val == (object)null) && !val.IsNull)
				{
					arr.Add(value[i]);
				}
			}
		}

		internal static bool ContainsValue<T, Z>(this T arr, Z value) where T : JSONNode where Z : JSONNode
		{
			if (arr.IsNull || (JSONNode)value == (object)null || value.IsNull)
			{
				return false;
			}
			int count = arr.Count;
			if (count <= 0)
			{
				return false;
			}
			for (int i = 0; i < count; i++)
			{
				JSONNode jSONNode = arr[i];
				if (!(jSONNode == null) && !jSONNode.IsNull)
				{
					if (value.IsObject && jSONNode.IsObject && jSONNode.AsObject == value)
					{
						return true;
					}
					if (value.IsArray && jSONNode.IsArray && jSONNode.AsArray == value)
					{
						return true;
					}
				}
			}
			return false;
		}

		internal static bool ContainsValue<T>(this T arr, bool value) where T : JSONNode
		{
			if (arr.IsNull)
			{
				return false;
			}
			int count = arr.Count;
			if (count <= 0)
			{
				return false;
			}
			for (int i = 0; i < count; i++)
			{
				JSONNode jSONNode = arr[i];
				if (!(jSONNode == null) && !jSONNode.IsNull && jSONNode.IsBoolean && jSONNode.AsBool == value)
				{
					return true;
				}
			}
			return false;
		}

		internal static bool ContainsValue<T>(this T arr, string value) where T : JSONNode
		{
			if (arr.IsNull || string.IsNullOrEmpty(value))
			{
				return false;
			}
			int count = arr.Count;
			if (count <= 0)
			{
				return false;
			}
			for (int i = 0; i < count; i++)
			{
				JSONNode jSONNode = arr[i];
				if (!(jSONNode == null) && !jSONNode.IsNull && jSONNode.IsString && !string.IsNullOrEmpty(jSONNode.Value) && jSONNode.Value.Equals(value))
				{
					return true;
				}
			}
			return false;
		}

		internal static bool ContainsValueMoreThan<T>(this T[] arr, T value) where T : IComparable<T>
		{
			int num = arr.Length;
			if (num <= 0)
			{
				return false;
			}
			for (int i = 0; i < num; i++)
			{
				if (arr[i].CompareTo(value) > 0)
				{
					return true;
				}
			}
			return false;
		}

		internal static void ReverseAll<A>(this A arr) where A : IList, ICollection
		{
			arr.Reverse(0, arr.Count);
		}

		internal static void Reverse<A>(this A arr, int index, int length) where A : IList, ICollection
		{
			int num = index;
			int num2 = index + length - 1;
			while (num < num2)
			{
				arr.Swap(num2, num);
				num++;
				num2--;
			}
		}

		internal static void ReverseAll(this JSONNode node)
		{
			node.Reverse(0, node.Count);
		}

		internal static void Reverse(this JSONNode node, int index, int length)
		{
			int num = index;
			int num2 = index + length - 1;
			while (num < num2)
			{
				JSONNode value = node[num2];
				JSONNode value2 = node[num];
				node[num2] = value2;
				node[num] = value;
				num++;
				num2--;
			}
		}

		internal static void Swap<A>(this A dotPoints, int indexA, int indexB) where A : IList, ICollection
		{
			int count = dotPoints.Count;
			if (count <= 1 || indexA < 0 || indexA > count - 1 || indexB < 0 || indexB > count - 1)
			{
				return;
			}
			object obj = dotPoints[indexA];
			object obj2 = dotPoints[indexB];
			if ((object)obj.GetType() == typeof(DotPoint))
			{
				if (obj != null)
				{
					(obj as DotPoint).Index = indexB;
				}
				if (obj2 != null)
				{
					(obj2 as DotPoint).Index = indexA;
				}
			}
			dotPoints[indexB] = obj;
			dotPoints[indexA] = obj2;
		}
	}
	public class HapticPattern
	{
		public string Key { get; private set; }

		public static HapticPattern LoadFromJson(string key, string tactFileJson)
		{
			bHapticsManager.RegisterPatternFromJson(key, tactFileJson);
			return new HapticPattern
			{
				Key = key
			};
		}

		public static HapticPattern LoadFromFile(string key, string tactFilePath)
		{
			bHapticsManager.RegisterPatternFromFile(key, tactFilePath);
			return new HapticPattern
			{
				Key = key
			};
		}

		public static HapticPattern LoadSwappedFromJson(string key, string tactFileJson)
		{
			bHapticsManager.RegisterPatternSwappedFromJson(key, tactFileJson);
			return new HapticPattern
			{
				Key = key
			};
		}

		public static HapticPattern LoadSwappedFromFile(string key, string tactFilePath)
		{
			bHapticsManager.RegisterPatternSwappedFromFile(key, tactFilePath);
			return new HapticPattern
			{
				Key = key
			};
		}

		public bool IsRegistered()
		{
			return bHapticsManager.IsPatternRegistered(Key);
		}

		public bool IsPlaying()
		{
			return bHapticsManager.IsPlaying(Key);
		}

		public void Stop()
		{
			bHapticsManager.StopPlaying(Key);
		}

		public void Play()
		{
			bHapticsManager.PlayRegistered(Key);
		}

		public void Play(ScaleOption option)
		{
			bHapticsManager.PlayRegistered(Key, option);
		}

		public void Play(RotationOption option)
		{
			bHapticsManager.PlayRegistered(Key, option);
		}

		public void Play(ScaleOption scaleOption, RotationOption rotationOption)
		{
			bHapticsManager.PlayRegistered(Key, scaleOption, rotationOption);
		}
	}
	public enum MirrorDirection
	{
		None,
		Horizontal,
		Vertical,
		Both
	}
	public class PathPoint
	{
		internal JSONObject node = new JSONObject();

		public float X
		{
			get
			{
				return node["x"].AsFloat;
			}
			set
			{
				node["x"] = value;
			}
		}

		public float Y
		{
			get
			{
				return node["y"].AsFloat;
			}
			set
			{
				node["y"] = value;
			}
		}

		public int Intensity
		{
			get
			{
				return node["intensity"].AsInt;
			}
			set
			{
				node["intensity"] = value.Clamp(0, 500);
			}
		}

		public int MotorCount
		{
			get
			{
				return node["motorCount"].AsInt;
			}
			set
			{
				node["motorCount"] = value.Clamp(0, 3);
			}
		}

		public PathPoint(float x = 0f, float y = 0f, int intensity = 50, int motorCount = 3)
		{
			X = x;
			Y = y;
			Intensity = intensity;
			MotorCount = motorCount;
		}

		public override string ToString()
		{
			return string.Format("{0} ( {1}: {2}, {3}: {4}, {5}: {6}, {7}: {8} )", "PathPoint", "X", X, "Y", Y, "MotorCount", MotorCount, "Intensity", Intensity);
		}
	}
	public enum PositionID
	{
		Vest = 3,
		Head = 4,
		HandLeft = 6,
		HandRight = 7,
		FootLeft = 8,
		FootRight = 9,
		ArmLeft = 10,
		ArmRight = 11,
		VestFront = 201,
		VestBack = 202,
		GloveLeft = 203,
		GloveRight = 204
	}
	public class RotationOption
	{
		internal JSONObject node = new JSONObject();

		public float OffsetAngleX
		{
			get
			{
				return node["offsetAngleX"].AsFloat;
			}
			set
			{
				node["offsetAngleX"] = value;
			}
		}

		public float OffsetY
		{
			get
			{
				return node["offsetY"].AsFloat;
			}
			set
			{
				node["offsetY"] = value;
			}
		}

		public RotationOption(float offsetAngleX = 0f, float offsetY = 0f)
		{
			OffsetAngleX = offsetAngleX;
			OffsetY = offsetY;
		}

		public override string ToString()
		{
			return string.Format("{0} ( {1}: {2}, {3}: {4} )", "RotationOption", "OffsetAngleX", OffsetAngleX, "OffsetY", OffsetY);
		}
	}
	public class ScaleOption
	{
		internal JSONObject node = new JSONObject();

		public float Intensity
		{
			get
			{
				return node["intensity"].AsFloat;
			}
			set
			{
				node["intensity"] = value;
			}
		}

		public float Duration
		{
			get
			{
				return node["duration"].AsFloat;
			}
			set
			{
				node["duration"] = value;
			}
		}

		public ScaleOption(float intensity = 1f, float duration = 1f)
		{
			Intensity = intensity;
			Duration = duration;
		}

		public override string ToString()
		{
			return string.Format("{0} ( {1}: {2}, {3}: {4} )", "ScaleOption", "Intensity", Intensity, "Duration", Duration);
		}
	}
}
namespace bHapticsLib.Properties
{
	internal static class BuildInfo
	{
		public const string Name = "bHapticsLib";

		public const string Author = "Herp Derpinstine";

		public const string Company = "Lava Gang";

		public const string Version = "1.0.6";

		public const string DownloadLink = "https://github.com/HerpDerpinstine/bHapticsLib";
	}
}
namespace bHapticsLib.Internal
{
	public abstract class ThreadedTask
	{
		private Thread thread;

		internal bool IsAlive()
		{
			return thread?.IsAlive ?? false;
		}

		public bool BeginInit()
		{
			if (!BeginInitInternal())
			{
				return false;
			}
			RunThread();
			return true;
		}

		internal abstract bool BeginInitInternal();

		public bool EndInit()
		{
			if (!EndInitInternal())
			{
				return false;
			}
			KillThread();
			return true;
		}

		internal abstract bool EndInitInternal();

		internal abstract void WithinThread();

		private void RunThread()
		{
			if (IsAlive())
			{
				KillThread();
			}
			thread = new Thread(WithinThread);
			thread.Start();
		}

		private void KillThread()
		{
			if (IsAlive())
			{
				thread.Abort();
				thread = null;
			}
		}
	}
	internal class ThreadSafeQueue<T> : IEnumerable<T>, IEnumerable, ICollection
	{
		private Queue<T> queue = new Queue<T>();

		public int Count => queue.Count;

		public object SyncRoot => ((ICollection)queue).SyncRoot;

		public bool IsSynchronized => true;

		public void Enqueue(T item)
		{
			lock (SyncRoot)
			{
				queue.Enqueue(item);
			}
		}

		public T Dequeue()
		{
			if (Count <= 0)
			{
				return default(T);
			}
			lock (SyncRoot)
			{
				return queue.Dequeue();
			}
		}

		public void Clear()
		{
			lock (SyncRoot)
			{
				queue.Clear();
			}
		}

		public void CopyTo(Array array, int index)
		{
			lock (SyncRoot)
			{
				((ICollection)queue).CopyTo(array, index);
			}
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		public IEnumerator<T> GetEnumerator()
		{
			lock (SyncRoot)
			{
				foreach (T item in queue)
				{
					yield return item;
				}
			}
		}
	}
	internal class WebSocketConnection : IDisposable
	{
		private bHapticsConnection Parent;

		internal bool FirstTry;

		private bool isConnected;

		private int RetryCount;

		private int RetryDelay = 3;

		private System.Timers.Timer RetryTimer;

		internal WebSocket Socket;

		internal PlayerResponse LastResponse;

		internal WebSocketConnection(bHapticsConnection parent)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			Parent = parent;
			string text = $"ws://{parent.IPAddress}:{bHapticsConnection.Port}/{bHapticsConnection.Endpoint}?app_id={parent.ID}&app_name={parent.Name}";
			WebSocketConfiguration val = default(WebSocketConfiguration);
			((WebSocketConfiguration)(ref val))..ctor();
			((WebSocketConfiguration)(ref val)).AutoConnect = false;
			((WebSocketConfiguration)(ref val)).UseAutomaticReceiveThread = true;
			Socket = new WebSocket(text, val);
			Socket.TextReceived += delegate(string txt)
			{
				try
				{
					if (LastResponse == null)
					{
						LastResponse = new PlayerResponse();
					}
					JSONNode jSONNode = JSON.Parse(txt);
					if (!(jSONNode == null) && !jSONNode.IsNull && jSONNode.IsObject)
					{
						LastResponse.m_Dict = jSONNode.AsObject.m_Dict;
					}
				}
				catch
				{
				}
			};
			Socket.Opened += delegate
			{
				isConnected = true;
				RetryCount = 0;
				Parent.QueueRegisterCache();
			};
			Socket.Closed += delegate
			{
				isConnected = false;
				LastResponse = null;
			};
			if (parent.TryToReconnect)
			{
				RetryTimer = new System.Timers.Timer(RetryDelay * 1000);
				RetryTimer.AutoReset = true;
				RetryTimer.Elapsed += delegate
				{
					RetryCheck();
				};
				RetryTimer.Start();
			}
			FirstTry = true;
		}

		public void Dispose()
		{
			try
			{
				Socket.SendClose((WebSocketCloseCode)1000, (string)null);
				isConnected = false;
				if (Parent.TryToReconnect)
				{
					RetryTimer.Stop();
					RetryTimer.Dispose();
				}
			}
			catch
			{
			}
		}

		internal void TryConnect()
		{
			try
			{
				Socket.Connect();
			}
			catch
			{
			}
		}

		private void RetryCheck()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			if (IsConnected() || !Parent.TryToReconnect || (int)Socket.State == 0 || (int)Socket.State == 2)
			{
				return;
			}
			if (Parent.MaxRetries > 0)
			{
				if (RetryCount >= Parent.MaxRetries)
				{
					Parent.EndInit();
					return;
				}
				RetryCount++;
			}
			TryConnect();
		}

		internal bool IsConnected()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			if (isConnected)
			{
				return (int)Socket.State == 1;
			}
			return false;
		}

		internal void Send(JSONObject jsonNode)
		{
			Send(jsonNode.ToString());
		}

		internal void Send(string msg)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (!IsConnected())
			{
				return;
			}
			try
			{
				Socket.Send((WebSocketMessage)new WebSocketTextMessage(msg));
			}
			catch
			{
			}
		}
	}
}
namespace bHapticsLib.Internal.SimpleJSON
{
	internal enum JSONNodeType
	{
		Array = 1,
		Object = 2,
		String = 3,
		Number = 4,
		NullValue = 5,
		Boolean = 6,
		None = 7,
		Custom = 255
	}
	internal enum JSONTextMode
	{
		Compact,
		Indent
	}
	internal abstract class JSONNode
	{
		internal struct Enumerator
		{
			private enum Type
			{
				None,
				Array,
				Object
			}

			private Type type;

			private Dictionary<string, JSONNode>.Enumerator m_Object;

			private List<JSONNode>.Enumerator m_Array;

			internal bool IsValid => type != Type.None;

			internal KeyValuePair<string, JSONNode> Current
			{
				get
				{
					if (type == Type.Array)
					{
						return new KeyValuePair<string, JSONNode>(string.Empty, m_Array.Current);
					}
					if (type == Type.Object)
					{
						return m_Object.Current;
					}
					return new KeyValuePair<string, JSONNode>(string.Empty, null);
				}
			}

			internal Enumerator(List<JSONNode>.Enumerator aArrayEnum)
			{
				type = Type.Array;
				m_Object = default(Dictionary<string, JSONNode>.Enumerator);
				m_Array = aArrayEnum;
			}

			internal Enumerator(Dictionary<string, JSONNode>.Enumerator aDictEnum)
			{
				type = Type.Object;
				m_Object = aDictEnum;
				m_Array = default(List<JSONNode>.Enumerator);
			}

			internal bool MoveNext()
			{
				if (type == Type.Array)
				{
					return m_Array.MoveNext();
				}
				if (type == Type.Object)
				{
					return m_Object.MoveNext();
				}
				return false;
			}
		}

		internal struct ValueEnumerator
		{
			private Enumerator m_Enumerator;

			internal JSONNode Current => m_Enumerator.Current.Value;

			internal ValueEnumerator(List<JSONNode>.Enumerator aArrayEnum)
				: this(new Enumerator(aArrayEnum))
			{
			}

			internal ValueEnumerator(Dictionary<string, JSONNode>.Enumerator aDictEnum)
				: this(new Enumerator(aDictEnum))
			{
			}

			internal ValueEnumerator(Enumerator aEnumerator)
			{
				m_Enumerator = aEnumerator;
			}

			internal bool MoveNext()
			{
				return m_Enumerator.MoveNext();
			}

			internal ValueEnumerator GetEnumerator()
			{
				return this;
			}
		}

		internal struct KeyEnumerator
		{
			private Enumerator m_Enumerator;

			internal string Current => m_Enumerator.Current.Key;

			internal KeyEnumerator(List<JSONNode>.Enumerator aArrayEnum)
				: this(new Enumerator(aArrayEnum))
			{
			}

			internal KeyEnumerator(Dictionary<string, JSONNode>.Enumerator aDictEnum)
				: this(new Enumerator(aDictEnum))
			{
			}

			internal KeyEnumerator(Enumerator aEnumerator)
			{
				m_Enumerator = aEnumerator;
			}

			internal bool MoveNext()
			{
				return m_Enumerator.MoveNext();
			}

			internal KeyEnumerator GetEnumerator()
			{
				return this;
			}
		}

		public class LinqEnumerator : IEnumerator<KeyValuePair<string, JSONNode>>, IDisposable, IEnumerator, IEnumerable<KeyValuePair<string, JSONNode>>, IEnumerable
		{
			private JSONNode m_Node;

			private Enumerator m_Enumerator;

			public KeyValuePair<string, JSONNode> Current => m_Enumerator.Current;

			object IEnumerator.Current => m_Enumerator.Current;

			internal LinqEnumerator(JSONNode aNode)
			{
				m_Node = aNode;
				if (m_Node != null)
				{
					m_Enumerator = m_Node.GetEnumerator();
				}
			}

			public bool MoveNext()
			{
				return m_Enumerator.MoveNext();
			}

			public void Dispose()
			{
				m_Node = null;
				m_Enumerator = default(Enumerator);
			}

			public IEnumerator<KeyValuePair<string, JSONNode>> GetEnumerator()
			{
				return new LinqEnumerator(m_Node);
			}

			public void Reset()
			{
				if (m_Node != null)
				{
					m_Enumerator = m_Node.GetEnumerator();
				}
			}

			IEnumerator IEnumerable.GetEnumerator()
			{
				return new LinqEnumerator(m_Node);
			}
		}

		internal static bool forceASCII = false;

		internal static bool longAsString = false;

		internal static bool allowLineComments = true;

		[ThreadStatic]
		private static StringBuilder m_EscapeBuilder;

		internal abstract JSONNodeType Tag { get; }

		internal virtual JSONNode this[int aIndex]
		{
			get
			{
				return null;
			}
			set
			{
			}
		}

		internal virtual JSONNode this[string aKey]
		{
			get
			{
				return null;
			}
			set
			{
			}
		}

		internal virtual string Value
		{
			get
			{
				return "";
			}
			set
			{
			}
		}

		internal virtual int Count => 0;

		internal virtual bool IsNumber => false;

		internal virtual bool IsString => false;

		internal virtual bool IsBoolean => false;

		internal virtual bool IsNull => false;

		internal virtual bool IsArray => false;

		internal virtual bool IsObject => false;

		internal virtual bool Inline
		{
			get
			{
				return false;
			}
			set
			{
			}
		}

		internal virtual IEnumerable<JSONNode> Children
		{
			get
			{
				yield break;
			}
		}

		internal IEnumerable<JSONNode> DeepChildren
		{
			get
			{
				foreach (JSONNode child in Children)
				{
					foreach (JSONNode deepChild in child.DeepChildren)
					{
						yield return deepChild;
					}
				}
			}
		}

		internal IEnumerable<KeyValuePair<string, JSONNode>> Linq => new LinqEnumerator(this);

		internal KeyEnumerator Keys => new KeyEnumerator(GetEnumerator());

		internal ValueEnumerator Values => new ValueEnumerator(GetEnumerator());

		internal virtual double AsDouble
		{
			get
			{
				double result = 0.0;
				if (double.TryParse(Value, NumberStyles.Float, CultureInfo.InvariantCulture, out result))
				{
					return result;
				}
				return 0.0;
			}
			set
			{
				Value = value.ToString(CultureInfo.InvariantCulture);
			}
		}

		internal virtual int AsInt
		{
			get
			{
				return (int)AsDouble;
			}
			set
			{
				AsDouble = value;
			}
		}

		internal virtual float AsFloat
		{
			get
			{
				return (float)AsDouble;
			}
			set
			{
				AsDouble = value;
			}
		}

		internal virtual bool AsBool
		{
			get
			{
				bool result = false;
				if (bool.TryParse(Value, out result))
				{
					return result;
				}
				return !string.IsNullOrEmpty(Value);
			}
			set
			{
				Value = (value ? "true" : "false");
			}
		}

		internal virtual long AsLong
		{
			get
			{
				long result = 0L;
				if (long.TryParse(Value, out result))
				{
					return result;
				}
				return 0L;
			}
			set
			{
				Value = value.ToString();
			}
		}

		internal virtual JSONArray AsArray => this as JSONArray;

		internal virtual JSONObject AsObject => this as JSONObject;

		internal static StringBuilder EscapeBuilder
		{
			get
			{
				if (m_EscapeBuilder == null)
				{
					m_EscapeBuilder = new StringBuilder();
				}
				return m_EscapeBuilder;
			}
		}

		internal virtual void Add(string aKey, JSONNode aItem)
		{
		}

		internal virtual void Add(JSONNode aItem)
		{
			Add("", aItem);
		}

		internal virtual JSONNode Remove(string aKey)
		{
			return null;
		}

		internal virtual JSONNode Remove(int aIndex)
		{
			return null;
		}

		internal virtual JSONNode Remove(JSONNode aNode)
		{
			return aNode;
		}

		internal virtual bool HasKey(string aKey)
		{
			return false;
		}

		internal virtual JSONNode GetValueOrDefault(string aKey, JSONNode aDefault)
		{
			return aDefault;
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			WriteToStringBuilder(stringBuilder, 0, 0, JSONTextMode.Compact);
			return stringBuilder.ToString();
		}

		internal virtual string ToString(int aIndent)
		{
			StringBuilder stringBuilder = new StringBuilder();
			WriteToStringBuilder(stringBuilder, 0, aIndent, JSONTextMode.Indent);
			return stringBuilder.ToString();
		}

		internal abstract void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode);

		internal abstract Enumerator GetEnumerator();

		public static implicit operator JSONNode(string s)
		{
			return new JSONString(s);
		}

		public static implicit operator string(JSONNode d)
		{
			if (!(d == null))
			{
				return d.Value;
			}
			return null;
		}

		public static implicit operator JSONNode(double n)
		{
			return new JSONNumber(n);
		}

		public static implicit operator double(JSONNode d)
		{
			if (!(d == null))
			{
				return d.AsDouble;
			}
			return 0.0;
		}

		public static implicit operator JSONNode(float n)
		{
			return new JSONNumber(n);
		}

		public static implicit operator float(JSONNode d)
		{
			if (!(d == null))
			{
				return d.AsFloat;
			}
			return 0f;
		}

		public static implicit operator JSONNode(int n)
		{
			return new JSONNumber(n);
		}

		public static implicit operator int(JSONNode d)
		{
			if (!(d == null))
			{
				return d.AsInt;
			}
			return 0;
		}

		public static implicit operator JSONNode(long n)
		{
			if (longAsString)
			{
				return new JSONString(n.ToString());
			}
			return new JSONNumber(n);
		}

		public static implicit operator long(JSONNode d)
		{
			if (!(d == null))
			{
				return d.AsLong;
			}
			return 0L;
		}

		public static implicit operator JSONNode(bool b)
		{
			return new JSONBool(b);
		}

		public static implicit operator bool(JSONNode d)
		{
			if (!(d == null))
			{
				return d.AsBool;
			}
			return false;
		}

		public static implicit operator JSONNode(KeyValuePair<string, JSONNode> aKeyValue)
		{
			return aKeyValue.Value;
		}

		public static bool operator ==(JSONNode a, object b)
		{
			if ((object)a == b)
			{
				return true;
			}
			bool flag = a is JSONNull || (object)a == null || a is JSONLazyCreator;
			bool flag2 = b is JSONNull || b == null || b is JSONLazyCreator;
			if (flag && flag2)
			{
				return true;
			}
			if (!flag)
			{
				return a.Equals(b);
			}
			return false;
		}

		public static bool operator !=(JSONNode a, object b)
		{
			return !(a == b);
		}

		public override bool Equals(object obj)
		{
			return (object)this == obj;
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		internal static string Escape(string aText)
		{
			StringBuilder escapeBuilder = EscapeBuilder;
			escapeBuilder.Length = 0;
			if (escapeBuilder.Capacity < aText.Length + aText.Length / 10)
			{
				escapeBuilder.Capacity = aText.Length + aText.Length / 10;
			}
			foreach (char c in aText)
			{
				switch (c)
				{
				case '\\':
					escapeBuilder.Append("\\\\");
					continue;
				case '"':
					escapeBuilder.Append("\\\"");
					continue;
				case '\n':
					escapeBuilder.Append("\\n");
					continue;
				case '\r':
					escapeBuilder.Append("\\r");
					continue;
				case '\t':
					escapeBuilder.Append("\\t");
					continue;
				case '\b':
					escapeBuilder.Append("\\b");
					continue;
				case '\f':
					escapeBuilder.Append("\\f");
					continue;
				}
				if (c < ' ' || (forceASCII && c > '\u007f'))
				{
					ushort num = c;
					escapeBuilder.Append("\\u").Append(num.ToString("X4"));
				}
				else
				{
					escapeBuilder.Append(c);
				}
			}
			string result = escapeBuilder.ToString();
			escapeBuilder.Length = 0;
			return result;
		}

		private static JSONNode ParseElement(string token, bool quoted)
		{
			if (quoted)
			{
				return token;
			}
			string text = token.ToLower();
			switch (text)
			{
			case "false":
			case "true":
				return text == "true";
			case "null":
				return JSONNull.CreateOrGet();
			default:
			{
				if (double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
				{
					return result;
				}
				return token;
			}
			}
		}

		internal static JSONNode Parse(string aJSON)
		{
			Stack<JSONNode> stack = new Stack<JSONNode>();
			JSONNode jSONNode = null;
			int i = 0;
			StringBuilder stringBuilder = new StringBuilder();
			string aKey = "";
			bool flag = false;
			bool flag2 = false;
			for (; i < aJSON.Length; i++)
			{
				switch (aJSON[i])
				{
				case '{':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
						break;
					}
					stack.Push(new JSONObject());
					if (jSONNode != null)
					{
						jSONNode.Add(aKey, stack.Peek());
					}
					aKey = "";
					stringBuilder.Length = 0;
					jSONNode = stack.Peek();
					break;
				case '[':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
						break;
					}
					stack.Push(new JSONArray());
					if (jSONNode != null)
					{
						jSONNode.Add(aKey, stack.Peek());
					}
					aKey = "";
					stringBuilder.Length = 0;
					jSONNode = stack.Peek();
					break;
				case ']':
				case '}':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
						break;
					}
					if (stack.Count == 0)
					{
						throw new Exception("JSON Parse: Too many closing brackets");
					}
					stack.Pop();
					if (stringBuilder.Length > 0 || flag2)
					{
						jSONNode.Add(aKey, ParseElement(stringBuilder.ToString(), flag2));
					}
					flag2 = false;
					aKey = "";
					stringBuilder.Length = 0;
					if (stack.Count > 0)
					{
						jSONNode = stack.Peek();
					}
					break;
				case ':':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
						break;
					}
					aKey = stringBuilder.ToString();
					stringBuilder.Length = 0;
					flag2 = false;
					break;
				case '"':
					flag = !flag;
					flag2 = flag2 || flag;
					break;
				case ',':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
						break;
					}
					if (stringBuilder.Length > 0 || flag2)
					{
						jSONNode.Add(aKey, ParseElement(stringBuilder.ToString(), flag2));
					}
					flag2 = false;
					aKey = "";
					stringBuilder.Length = 0;
					flag2 = false;
					break;
				case '\t':
				case ' ':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
					}
					break;
				case '\\':
					i++;
					if (flag)
					{
						char c = aJSON[i];
						switch (c)
						{
						case 't':
							stringBuilder.Append('\t');
							break;
						case 'r':
							stringBuilder.Append('\r');
							break;
						case 'n':
							stringBuilder.Append('\n');
							break;
						case 'b':
							stringBuilder.Append('\b');
							break;
						case 'f':
							stringBuilder.Append('\f');
							break;
						case 'u':
						{
							string s = aJSON.Substring(i + 1, 4);
							stringBuilder.Append((char)int.Parse(s, NumberStyles.AllowHexSpecifier));
							i += 4;
							break;
						}
						default:
							stringBuilder.Append(c);
							break;
						}
					}
					break;
				case '/':
					if (allowLineComments && !flag && i + 1 < aJSON.Length && aJSON[i + 1] == '/')
					{
						while (++i < aJSON.Length && aJSON[i] != '\n' && aJSON[i] != '\r')
						{
						}
					}
					else
					{
						stringBuilder.Append(aJSON[i]);
					}
					break;
				default:
					stringBuilder.Append(aJSON[i]);
					break;
				case '\n':
				case '\r':
				case '\ufeff':
					break;
				}
			}
			if (flag)
			{
				throw new Exception("JSON Parse: Quotation marks seems to be messed up.");
			}
			if (jSONNode == null)
			{
				return ParseElement(stringBuilder.ToString(), flag2);
			}
			return jSONNode;
		}
	}
	internal class JSONArray : JSONNode
	{
		private List<JSONNode> m_List = new List<JSONNode>();

		private bool inline;

		internal override bool Inline
		{
			get
			{
				return inline;
			}
			set
			{
				inline = value;
			}
		}

		internal override JSONNodeType Tag => JSONNodeType.Array;

		internal override bool IsArray => true;

		internal override JSONNode this[int aIndex]
		{
			get
			{
				if (aIndex < 0 || aIndex >= m_List.Count)
				{
					return new JSONLazyCreator(this);
				}
				return m_List[aIndex];
			}
			set
			{
				if (value == null)
				{
					value = JSONNull.CreateOrGet();
				}
				if (aIndex < 0 || aIndex >= m_List.Count)
				{
					m_List.Add(value);
				}
				else
				{
					m_List[aIndex] = value;
				}
			}
		}

		internal override JSONNode this[string aKey]
		{
			get
			{
				return new JSONLazyCreator(this);
			}
			set
			{
				if (value == null)
				{
					value = JSONNull.CreateOrGet();
				}
				m_List.Add(value);
			}
		}

		internal override int Count => m_List.Count;

		internal override IEnumerable<JSONNode> Children
		{
			get
			{
				foreach (JSONNode item in m_List)
				{
					yield return item;
				}
			}
		}

		internal override Enumerator GetEnumerator()
		{
			return new Enumerator(m_List.GetEnumerator());
		}

		internal override void Add(string aKey, JSONNode aItem)
		{
			if (aItem == null)
			{
				aItem = JSONNull.CreateOrGet();
			}
			m_List.Add(aItem);
		}

		internal override JSONNode Remove(int aIndex)
		{
			if (aIndex < 0 || aIndex >= m_List.Count)
			{
				return null;
			}
			JSONNode result = m_List[aIndex];
			m_List.RemoveAt(aIndex);
			return result;
		}

		internal override JSONNode Remove(JSONNode aNode)
		{
			m_List.Remove(aNode);
			return aNode;
		}

		internal void Clear()
		{
			m_List.Clear();
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append('[');
			int count = m_List.Count;
			if (inline)
			{
				aMode = JSONTextMode.Compact;
			}
			for (int i = 0; i < count; i++)
			{
				if (i > 0)
				{
					aSB.Append(',');
				}
				if (aMode == JSONTextMode.Indent)
				{
					aSB.AppendLine();
				}
				if (aMode == JSONTextMode.Indent)
				{
					aSB.Append(' ', aIndent + aIndentInc);
				}
				m_List[i].WriteToStringBuilder(aSB, aIndent + aIndentInc, aIndentInc, aMode);
			}
			if (aMode == JSONTextMode.Indent)
			{
				aSB.AppendLine().Append(' ', aIndent);
			}
			aSB.Append(']');
		}
	}
	internal class JSONObject : JSONNode
	{
		internal Dictionary<string, JSONNode> m_Dict = new Dictionary<string, JSONNode>();

		private bool inline;

		internal override bool Inline
		{
			get
			{
				return inline;
			}
			set
			{
				inline = value;
			}
		}

		internal override JSONNodeType Tag => JSONNodeType.Object;

		internal override bool IsObject => true;

		internal override JSONNode this[string aKey]
		{
			get
			{
				if (m_Dict.ContainsKey(aKey))
				{
					return m_Dict[aKey];
				}
				return new JSONLazyCreator(this, aKey);
			}
			set
			{
				if (value == null)
				{
					value = JSONNull.CreateOrGet();
				}
				if (m_Dict.ContainsKey(aKey))
				{
					m_Dict[aKey] = value;
				}
				else
				{
					m_Dict.Add(aKey, value);
				}
			}
		}

		internal override JSONNode this[int aIndex]
		{
			get
			{
				if (aIndex < 0 || aIndex >= m_Dict.Count)
				{
					return null;
				}
				return m_Dict.ElementAt(aIndex).Value;
			}
			set
			{
				if (value == null)
				{
					value = JSONNull.CreateOrGet();
				}
				if (aIndex >= 0 && aIndex < m_Dict.Count)
				{
					string key = m_Dict.ElementAt(aIndex).Key;
					m_Dict[key] = value;
				}
			}
		}

		internal override int Count => m_Dict.Count;

		internal override IEnumerable<JSONNode> Children
		{
			get
			{
				foreach (KeyValuePair<string, JSONNode> item in m_Dict)
				{
					yield return item.Value;
				}
			}
		}

		internal override Enumerator GetEnumerator()
		{
			return new Enumerator(m_Dict.GetEnumerator());
		}

		internal override void Add(string aKey, JSONNode aItem)
		{
			if (aItem == null)
			{
				aItem = JSONNull.CreateOrGet();
			}
			if (aKey != null)
			{
				if (m_Dict.ContainsKey(aKey))
				{
					m_Dict[aKey] = aItem;
				}
				else
				{
					m_Dict.Add(aKey, aItem);
				}
			}
			else
			{
				m_Dict.Add(Guid.NewGuid().ToString(), aItem);
			}
		}

		internal override JSONNode Remove(string aKey)
		{
			if (!m_Dict.ContainsKey(aKey))
			{
				return null;
			}
			JSONNode result = m_Dict[aKey];
			m_Dict.Remove(aKey);
			return result;
		}

		internal override JSONNode Remove(int aIndex)
		{
			if (aIndex < 0 || aIndex >= m_Dict.Count)
			{
				return null;
			}
			KeyValuePair<string, JSONNode> keyValuePair = m_Dict.ElementAt(aIndex);
			m_Dict.Remove(keyValuePair.Key);
			return keyValuePair.Value;
		}

		internal override JSONNode Remove(JSONNode aNode)
		{
			try
			{
				KeyValuePair<string, JSONNode> keyValuePair = m_Dict.Where((KeyValuePair<string, JSONNode> k) => k.Value == aNode).First();
				m_Dict.Remove(keyValuePair.Key);
				return aNode;
			}
			catch
			{
				return null;
			}
		}

		internal override bool HasKey(string aKey)
		{
			return m_Dict.ContainsKey(aKey);
		}

		internal override JSONNode GetValueOrDefault(string aKey, JSONNode aDefault)
		{
			if (m_Dict.TryGetValue(aKey, out var value))
			{
				return value;
			}
			return aDefault;
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append('{');
			bool flag = true;
			if (inline)
			{
				aMode = JSONTextMode.Compact;
			}
			foreach (KeyValuePair<string, JSONNode> item in m_Dict)
			{
				if (!flag)
				{
					aSB.Append(',');
				}
				flag = false;
				if (aMode == JSONTextMode.Indent)
				{
					aSB.AppendLine();
				}
				if (aMode == JSONTextMode.Indent)
				{
					aSB.Append(' ', aIndent + aIndentInc);
				}
				aSB.Append('"').Append(JSONNode.Escape(item.Key)).Append('"');
				if (aMode == JSONTextMode.Compact)
				{
					aSB.Append(':');
				}
				else
				{
					aSB.Append(" : ");
				}
				item.Value.WriteToStringBuilder(aSB, aIndent + aIndentInc, aIndentInc, aMode);
			}
			if (aMode == JSONTextMode.Indent)
			{
				aSB.AppendLine().Append(' ', aIndent);
			}
			aSB.Append('}');
		}
	}
	internal class JSONString : JSONNode
	{
		private string m_Data;

		internal override JSONNodeType Tag => JSONNodeType.String;

		internal override bool IsString => true;

		internal override string Value
		{
			get
			{
				return m_Data;
			}
			set
			{
				m_Data = value;
			}
		}

		internal override Enumerator GetEnumerator()
		{
			return default(Enumerator);
		}

		internal JSONString(string aData)
		{
			m_Data = aData;
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append('"').Append(JSONNode.Escape(m_Data)).Append('"');
		}

		public override bool Equals(object obj)
		{
			if (base.Equals(obj))
			{
				return true;
			}
			if (obj is string text)
			{
				return m_Data == text;
			}
			JSONString jSONString = obj as JSONString;
			if (jSONString != null)
			{
				return m_Data == jSONString.m_Data;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return m_Data.GetHashCode();
		}
	}
	internal class JSONNumber : JSONNode
	{
		private double m_Data;

		internal override JSONNodeType Tag => JSONNodeType.Number;

		internal override bool IsNumber => true;

		internal override string Value
		{
			get
			{
				return m_Data.ToString(CultureInfo.InvariantCulture);
			}
			set
			{
				if (double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
				{
					m_Data = result;
				}
			}
		}

		internal override double AsDouble
		{
			get
			{
				return m_Data;
			}
			set
			{
				m_Data = value;
			}
		}

		internal override long AsLong
		{
			get
			{
				return (long)m_Data;
			}
			set
			{
				m_Data = value;
			}
		}

		internal override Enumerator GetEnumerator()
		{
			return default(Enumerator);
		}

		internal JSONNumber(double aData)
		{
			m_Data = aData;
		}

		internal JSONNumber(string aData)
		{
			Value = aData;
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append(Value);
		}

		private static bool IsNumeric(object value)
		{
			if (!(value is int) && !(value is uint) && !(value is float) && !(value is double) && !(value is decimal) && !(value is long) && !(value is ulong) && !(value is short) && !(value is ushort) && !(value is sbyte))
			{
				return value is byte;
			}
			return true;
		}

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return false;
			}
			if (base.Equals(obj))
			{
				return true;
			}
			JSONNumber jSONNumber = obj as JSONNumber;
			if (jSONNumber != null)
			{
				return m_Data == jSONNumber.m_Data;
			}
			if (IsNumeric(obj))
			{
				return Convert.ToDouble(obj) == m_Data;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return m_Data.GetHashCode();
		}
	}
	internal class JSONBool : JSONNode
	{
		private bool m_Data;

		internal override JSONNodeType Tag => JSONNodeType.Boolean;

		internal override bool IsBoolean => true;

		internal override string Value
		{
			get
			{
				return m_Data.ToString();
			}
			set
			{
				if (bool.TryParse(value, out var result))
				{
					m_Data = result;
				}
			}
		}

		internal override bool AsBool
		{
			get
			{
				return m_Data;
			}
			set
			{
				m_Data = value;
			}
		}

		internal override Enumerator GetEnumerator()
		{
			return default(Enumerator);
		}

		internal JSONBool(bool aData)
		{
			m_Data = aData;
		}

		internal JSONBool(string aData)
		{
			Value = aData;
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append(m_Data ? "true" : "false");
		}

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return false;
			}
			if (obj is bool)
			{
				return m_Data == (bool)obj;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return m_Data.GetHashCode();
		}
	}
	internal class JSONNull : JSONNode
	{
		private static JSONNull m_StaticInstance = new JSONNull();

		internal static bool reuseSameInstance = true;

		internal override JSONNodeType Tag => JSONNodeType.NullValue;

		internal override bool IsNull => true;

		internal override string Value
		{
			get
			{
				return "null";
			}
			set
			{
			}
		}

		internal override bool AsBool
		{
			get
			{
				return false;
			}
			set
			{
			}
		}

		internal static JSONNull CreateOrGet()
		{
			if (reuseSameInstance)
			{
				return m_StaticInstance;
			}
			return new JSONNull();
		}

		private JSONNull()
		{
		}

		internal override Enumerator GetEnumerator()
		{
			return default(Enumerator);
		}

		public override bool Equals(object obj)
		{
			if ((object)this == obj)
			{
				return true;
			}
			return obj is JSONNull;
		}

		public override int GetHashCode()
		{
			return 0;
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append("null");
		}
	}
	internal class JSONLazyCreator : JSONNode
	{
		private JSONNode m_Node;

		private string m_Key;

		internal override JSONNodeType Tag => JSONNodeType.None;

		internal override JSONNode this[int aIndex]
		{
			get
			{
				return new JSONLazyCreator(this);
			}
			set
			{
				Set(new JSONArray()).Add(value);
			}
		}

		internal override JSONNode this[string aKey]
		{
			get
			{
				return new JSONLazyCreator(this, aKey);
			}
			set
			{
				Set(new JSONObject()).Add(aKey, value);
			}
		}

		internal override int AsInt
		{
			get
			{
				Set(new JSONNumber(0.0));
				return 0;
			}
			set
			{
				Set(new JSONNumber(value));
			}
		}

		internal override float AsFloat
		{
			get
			{
				Set(new JSONNumber(0.0));
				return 0f;
			}
			set
			{
				Set(new JSONNumber(value));
			}
		}

		internal override double AsDouble
		{
			get
			{
				Set(new JSONNumber(0.0));
				return 0.0;
			}
			set
			{
				Set(new JSONNumber(value));
			}
		}

		internal override long AsLong
		{
			get
			{
				if (JSONNode.longAsString)
				{
					Set(new JSONString("0"));
				}
				else
				{
					Set(new JSONNumber(0.0));
				}
				return 0L;
			}
			set
			{
				if (JSONNode.longAsString)
				{
					Set(new JSONString(value.ToString()));
				}
				else
				{
					Set(new JSONNumber(value));
				}
			}
		}

		internal override bool AsBool
		{
			get
			{
				Set(new JSONBool(aData: false));
				return false;
			}
			set
			{
				Set(new JSONBool(value));
			}
		}

		internal override JSONArray AsArray => Set(new JSONArray());

		internal override JSONObject AsObject => Set(new JSONObject());

		internal override Enumerator GetEnumerator()
		{
			return default(Enumerator);
		}

		internal JSONLazyCreator(JSONNode aNode)
		{
			m_Node = aNode;
			m_Key = null;
		}

		internal JSONLazyCreator(JSONNode aNode, string aKey)
		{
			m_Node = aNode;
			m_Key = aKey;
		}

		private T Set<T>(T aVal) where T : JSONNode
		{
			if (m_Key == null)
			{
				m_Node.Add(aVal);
			}
			else
			{
				m_Node.Add(m_Key, aVal);
			}
			m_Node = null;
			return aVal;
		}

		internal override void Add(JSONNode aItem)
		{
			Set(new JSONArray()).Add(aItem);
		}

		internal override void Add(string aKey, JSONNode aItem)
		{
			Set(new JSONObject()).Add(aKey, aItem);
		}

		public static bool operator ==(JSONLazyCreator a, object b)
		{
			if (b == null)
			{
				return true;
			}
			return (object)a == b;
		}

		public static bool operator !=(JSONLazyCreator a, object b)
		{
			return !(a == b);
		}

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return true;
			}
			return (object)this == obj;
		}

		public override int GetHashCode()
		{
			return 0;
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append("null");
		}
	}
	internal static class JSON
	{
		internal static JSONNode Parse(string aJSON)
		{
			return JSONNode.Parse(aJSON);
		}
	}
}
namespace bHapticsLib.Internal.Models.Connection
{
	internal class PlayerPacket : JSONObject
	{
		internal JSONArray Register
		{
			get
			{
				string aKey = "Register";
				if (this[aKey] == null)
				{
					this[aKey] = new JSONArray();
				}
				return this[aKey].AsArray;
			}
		}

		internal JSONArray Submit
		{
			get
			{
				string aKey = "Submit";
				if (this[aKey] == null)
				{
					this[aKey] = new JSONArray();
				}
				return this[aKey].AsArray;
			}
		}

		internal void Clear()
		{
			Register.Clear();
			Submit.Clear();
		}

		internal bool IsEmpty()
		{
			if (Register.Count <= 0)
			{
				return Submit.Count <= 0;
			}
			return false;
		}
	}
	internal class PlayerResponse : JSONObject
	{
		internal int ConnectedDeviceCount => this["ConnectedDeviceCount"].AsInt;

		internal JSONArray ActiveKeys
		{
			get
			{
				string aKey = "ActiveKeys";
				if (this[aKey] == null)
				{
					this[aKey] = new JSONArray();
				}
				return this[aKey].AsArray;
			}
		}

		internal JSONArray ConnectedPositions
		{
			get
			{
				string aKey = "ConnectedPositions";
				if (this[aKey] == null)
				{
					this[aKey] = new JSONArray();
				}
				return this[aKey].AsArray;
			}
		}

		internal JSONArray RegisteredKeys
		{
			get
			{
				string aKey = "RegisteredKeys";
				if (this[aKey] == null)
				{
					this[aKey] = new JSONArray();
				}
				return this[aKey].AsArray;
			}
		}

		internal JSONObject Status
		{
			get
			{
				string aKey = "Status";
				if (this[aKey] == null)
				{
					this[aKey] = new JSONObject();
				}
				return this[aKey].AsObject;
			}
		}
	}
	internal class RegisterRequest : JSONObject
	{
		internal string key
		{
			get
			{
				return this["key"];
			}
			set
			{
				this["key"] = value;
			}
		}

		internal JSONObject project
		{
			get
			{
				string aKey = "project";
				if (this[aKey] == null)
				{
					this[aKey] = new JSONObject();
				}
				return this[aKey].AsObject;
			}
			set
			{
				this["project"] = value;
			}
		}
	}
	internal class SubmitRequest : JSONObject
	{
		internal string type
		{
			get
			{
				return this["type"];
			}
			set
			{
				this["type"] = value;
			}
		}

		internal string key
		{
			get
			{
				return this["key"];
			}
			set
			{
				this["key"] = value;
			}
		}

		internal JSONObject Parameters
		{
			get
			{
				string aKey = "Parameters";
				if (this[aKey] == null)
				{
					this[aKey] = new JSONObject();
				}
				return this[aKey].AsObject;
			}
		}

		internal SubmitRequestFrame Frame
		{
			get
			{
				string aKey = "Frame";
				if (this[aKey] == null)
				{
					this[aKey] = new SubmitRequestFrame();
				}
				return this[aKey].AsObject as SubmitRequestFrame;
			}
		}
	}
	internal class SubmitRequestFrame : JSONObject
	{
		internal int durationMillis
		{
			get
			{
				return this["durationMillis"].AsInt;
			}
			set
			{
				this["durationMillis"] = value;
			}
		}

		internal string position
		{
			get
			{
				return this["position"];
			}
			set
			{
				this["position"] = value.ToString();
			}
		}

		internal JSONArray dotPoints
		{
			get
			{
				string aKey = "dotPoints";
				if (this[aKey] == null)
				{
					this[aKey] = new JSONArray();
				}
				return this[aKey].AsArray;
			}
		}

		internal JSONArray pathPoints
		{
			get
			{
				string aKey = "pathPoints";
				if (this[aKey] == null)
				{
					this[aKey] = new JSONArray();
				}
				return this[aKey].AsArray;
			}
		}
	}
}

BepInEx-BepInEx_MLLoader/BepInEx.MelonLoader.Loader/MelonLoader.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Security;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using AssetRipper.VersionUtilities;
using AssetsTools.NET;
using AssetsTools.NET.Extra;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Harmony;
using HarmonyLib;
using HarmonyLib.Public.Patching;
using HarmonyLib.Tools;
using MelonLoader;
using MelonLoader.Assertions;
using MelonLoader.Fixes;
using MelonLoader.ICSharpCode.SharpZipLib.BZip2;
using MelonLoader.ICSharpCode.SharpZipLib.Checksum;
using MelonLoader.ICSharpCode.SharpZipLib.Core;
using MelonLoader.ICSharpCode.SharpZipLib.Encryption;
using MelonLoader.ICSharpCode.SharpZipLib.Zip;
using MelonLoader.ICSharpCode.SharpZipLib.Zip.Compression;
using MelonLoader.ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using MelonLoader.InternalUtils;
using MelonLoader.Lemons.Cryptography;
using MelonLoader.Modules;
using MelonLoader.MonoInternals;
using MelonLoader.MonoInternals.ResolveInternals;
using MelonLoader.Preferences;
using MelonLoader.Preferences.IO;
using MelonLoader.TinyJSON;
using Microsoft.Cci;
using Microsoft.CodeAnalysis;
using Microsoft.Win32;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Cecil.Mdb;
using Mono.Cecil.Pdb;
using Mono.Cecil.Rocks;
using Mono.Collections.Generic;
using Mono.CompilerServices.SymbolWriter;
using MonoMod.Cil;
using MonoMod.ModInterop;
using MonoMod.RuntimeDetour;
using MonoMod.RuntimeDetour.HookGen;
using MonoMod.RuntimeDetour.Platforms;
using MonoMod.Utils;
using MonoMod.Utils.Cil;
using Semver;
using Tomlet;
using Tomlet.Attributes;
using Tomlet.Exceptions;
using Tomlet.Models;
using bHapticsLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MelonLoader")]
[assembly: AssemblyDescription("MelonLoader")]
[assembly: AssemblyCompany("discord.gg/2Wn3N2P")]
[assembly: AssemblyProduct("MelonLoader")]
[assembly: AssemblyCopyright("Created by Lava Gang")]
[assembly: AssemblyTrademark("discord.gg/2Wn3N2P")]
[assembly: Guid("A662769A-B294-434F-83B5-176FC4795334")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: PatchShield]
[assembly: InternalsVisibleTo("BepInEx.MelonLoader.Loader.UnityMono")]
[assembly: InternalsVisibleTo("BepInEx.MelonLoader.Loader.IL2CPP")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.7.0")]
[assembly: TypeForwardedTo(typeof(AccessTools))]
[assembly: TypeForwardedTo(typeof(ArgumentType))]
[assembly: TypeForwardedTo(typeof(CodeInstruction))]
[assembly: TypeForwardedTo(typeof(CodeInstructionExtensions))]
[assembly: TypeForwardedTo(typeof(CodeMatch))]
[assembly: TypeForwardedTo(typeof(CodeMatcher))]
[assembly: TypeForwardedTo(typeof(CollectionExtensions))]
[assembly: TypeForwardedTo(typeof(DelegateTypeFactory))]
[assembly: TypeForwardedTo(typeof(ExceptionBlock))]
[assembly: TypeForwardedTo(typeof(ExceptionBlockType))]
[assembly: TypeForwardedTo(typeof(FastAccess))]
[assembly: TypeForwardedTo(typeof(FastInvokeHandler))]
[assembly: TypeForwardedTo(typeof(FileLog))]
[assembly: TypeForwardedTo(typeof(GeneralExtensions))]
[assembly: TypeForwardedTo(typeof(GetterHandler<, >))]
[assembly: TypeForwardedTo(typeof(Harmony))]
[assembly: TypeForwardedTo(typeof(HarmonyAfter))]
[assembly: TypeForwardedTo(typeof(HarmonyArgument))]
[assembly: TypeForwardedTo(typeof(HarmonyAttribute))]
[assembly: TypeForwardedTo(typeof(HarmonyBefore))]
[assembly: TypeForwardedTo(typeof(HarmonyCleanup))]
[assembly: TypeForwardedTo(typeof(HarmonyDebug))]
[assembly: TypeForwardedTo(typeof(HarmonyDelegate))]
[assembly: TypeForwardedTo(typeof(HarmonyEmitIL))]
[assembly: TypeForwardedTo(typeof(HarmonyException))]
[assembly: TypeForwardedTo(typeof(HarmonyFinalizer))]
[assembly: TypeForwardedTo(typeof(HarmonyGlobalSettings))]
[assembly: TypeForwardedTo(typeof(HarmonyILManipulator))]
[assembly: TypeForwardedTo(typeof(HarmonyMethod))]
[assembly: TypeForwardedTo(typeof(HarmonyMethodExtensions))]
[assembly: TypeForwardedTo(typeof(HarmonyPatch))]
[assembly: TypeForwardedTo(typeof(HarmonyPatchAll))]
[assembly: TypeForwardedTo(typeof(HarmonyPatchType))]
[assembly: TypeForwardedTo(typeof(HarmonyPostfix))]
[assembly: TypeForwardedTo(typeof(HarmonyPrefix))]
[assembly: TypeForwardedTo(typeof(HarmonyPrepare))]
[assembly: TypeForwardedTo(typeof(HarmonyPriority))]
[assembly: TypeForwardedTo(typeof(HarmonyReversePatch))]
[assembly: TypeForwardedTo(typeof(HarmonyReversePatchType))]
[assembly: TypeForwardedTo(typeof(HarmonyTargetMethod))]
[assembly: TypeForwardedTo(typeof(HarmonyTargetMethods))]
[assembly: TypeForwardedTo(typeof(HarmonyTranspiler))]
[assembly: TypeForwardedTo(typeof(HarmonyWrapSafe))]
[assembly: TypeForwardedTo(typeof(InlineSignature))]
[assembly: TypeForwardedTo(typeof(InstantiationHandler<>))]
[assembly: TypeForwardedTo(typeof(InvalidHarmonyPatchArgumentException))]
[assembly: TypeForwardedTo(typeof(MemberNotFoundException))]
[assembly: TypeForwardedTo(typeof(MethodBaseExtensions))]
[assembly: TypeForwardedTo(typeof(MethodDispatchType))]
[assembly: TypeForwardedTo(typeof(MethodInvoker))]
[assembly: TypeForwardedTo(typeof(MethodType))]
[assembly: TypeForwardedTo(typeof(Patch))]
[assembly: TypeForwardedTo(typeof(PatchClassProcessor))]
[assembly: TypeForwardedTo(typeof(Patches))]
[assembly: TypeForwardedTo(typeof(PatchInfo))]
[assembly: TypeForwardedTo(typeof(PatchProcessor))]
[assembly: TypeForwardedTo(typeof(Priority))]
[assembly: TypeForwardedTo(typeof(HarmonyManipulator))]
[assembly: TypeForwardedTo(typeof(ManagedMethodPatcher))]
[assembly: TypeForwardedTo(typeof(MethodPatcher))]
[assembly: TypeForwardedTo(typeof(NativeDetourMethodPatcher))]
[assembly: TypeForwardedTo(typeof(PatchManager))]
[assembly: TypeForwardedTo(typeof(ReversePatcher))]
[assembly: TypeForwardedTo(typeof(SetterHandler<, >))]
[assembly: TypeForwardedTo(typeof(SymbolExtensions))]
[assembly: TypeForwardedTo(typeof(HarmonyFileLog))]
[assembly: TypeForwardedTo(typeof(Logger))]
[assembly: TypeForwardedTo(typeof(Transpilers))]
[assembly: TypeForwardedTo(typeof(Traverse))]
[assembly: TypeForwardedTo(typeof(Traverse<>))]
[assembly: TypeForwardedTo(typeof(ILocalScope))]
[assembly: TypeForwardedTo(typeof(IName))]
[assembly: TypeForwardedTo(typeof(INamespaceScope))]
[assembly: TypeForwardedTo(typeof(IUsedNamespace))]
[assembly: TypeForwardedTo(typeof(ArrayDimension))]
[assembly: TypeForwardedTo(typeof(ArrayMarshalInfo))]
[assembly: TypeForwardedTo(typeof(ArrayType))]
[assembly: TypeForwardedTo(typeof(AssemblyAttributes))]
[assembly: TypeForwardedTo(typeof(AssemblyDefinition))]
[assembly: TypeForwardedTo(typeof(AssemblyHashAlgorithm))]
[assembly: TypeForwardedTo(typeof(AssemblyLinkedResource))]
[assembly: TypeForwardedTo(typeof(AssemblyNameDefinition))]
[assembly: TypeForwardedTo(typeof(AssemblyNameReference))]
[assembly: TypeForwardedTo(typeof(AssemblyResolutionException))]
[assembly: TypeForwardedTo(typeof(AssemblyResolveEventArgs))]
[assembly: TypeForwardedTo(typeof(AssemblyResolveEventHandler))]
[assembly: TypeForwardedTo(typeof(BaseAssemblyResolver))]
[assembly: TypeForwardedTo(typeof(ByReferenceType))]
[assembly: TypeForwardedTo(typeof(CallSite))]
[assembly: TypeForwardedTo(typeof(AsyncMethodBodyDebugInformation))]
[assembly: TypeForwardedTo(typeof(BinaryCustomDebugInformation))]
[assembly: TypeForwardedTo(typeof(Code))]
[assembly: TypeForwardedTo(typeof(ConstantDebugInformation))]
[assembly: TypeForwardedTo(typeof(CustomDebugInformation))]
[assembly: TypeForwardedTo(typeof(CustomDebugInformationKind))]
[assembly: TypeForwardedTo(typeof(DebugInformation))]
[assembly: TypeForwardedTo(typeof(DefaultSymbolReaderProvider))]
[assembly: TypeForwardedTo(typeof(DefaultSymbolWriterProvider))]
[assembly: TypeForwardedTo(typeof(Document))]
[assembly: TypeForwardedTo(typeof(DocumentHashAlgorithm))]
[assembly: TypeForwardedTo(typeof(DocumentLanguage))]
[assembly: TypeForwardedTo(typeof(DocumentLanguageVendor))]
[assembly: TypeForwardedTo(typeof(DocumentType))]
[assembly: TypeForwardedTo(typeof(EmbeddedPortablePdbReader))]
[assembly: TypeForwardedTo(typeof(EmbeddedPortablePdbReaderProvider))]
[assembly: TypeForwardedTo(typeof(EmbeddedPortablePdbWriter))]
[assembly: TypeForwardedTo(typeof(EmbeddedPortablePdbWriterProvider))]
[assembly: TypeForwardedTo(typeof(EmbeddedSourceDebugInformation))]
[assembly: TypeForwardedTo(typeof(ExceptionHandler))]
[assembly: TypeForwardedTo(typeof(ExceptionHandlerType))]
[assembly: TypeForwardedTo(typeof(FlowControl))]
[assembly: TypeForwardedTo(typeof(ICustomDebugInformationProvider))]
[assembly: TypeForwardedTo(typeof(ILProcessor))]
[assembly: TypeForwardedTo(typeof(ImageDebugDirectory))]
[assembly: TypeForwardedTo(typeof(ImageDebugHeader))]
[assembly: TypeForwardedTo(typeof(ImageDebugHeaderEntry))]
[assembly: TypeForwardedTo(typeof(ImageDebugType))]
[assembly: TypeForwardedTo(typeof(ImportDebugInformation))]
[assembly: TypeForwardedTo(typeof(ImportTarget))]
[assembly: TypeForwardedTo(typeof(ImportTargetKind))]
[assembly: TypeForwardedTo(typeof(Instruction))]
[assembly: TypeForwardedTo(typeof(InstructionOffset))]
[assembly: TypeForwardedTo(typeof(ISymbolReader))]
[assembly: TypeForwardedTo(typeof(ISymbolReaderProvider))]
[assembly: TypeForwardedTo(typeof(ISymbolWriter))]
[assembly: TypeForwardedTo(typeof(ISymbolWriterProvider))]
[assembly: TypeForwardedTo(typeof(MethodBody))]
[assembly: TypeForwardedTo(typeof(MethodDebugInformation))]
[assembly: TypeForwardedTo(typeof(OpCode))]
[assembly: TypeForwardedTo(typeof(OpCodes))]
[assembly: TypeForwardedTo(typeof(OpCodeType))]
[assembly: TypeForwardedTo(typeof(OperandType))]
[assembly: TypeForwardedTo(typeof(PortablePdbReader))]
[assembly: TypeForwardedTo(typeof(PortablePdbReaderProvider))]
[assembly: TypeForwardedTo(typeof(PortablePdbWriter))]
[assembly: TypeForwardedTo(typeof(PortablePdbWriterProvider))]
[assembly: TypeForwardedTo(typeof(ScopeDebugInformation))]
[assembly: TypeForwardedTo(typeof(SequencePoint))]
[assembly: TypeForwardedTo(typeof(SourceLinkDebugInformation))]
[assembly: TypeForwardedTo(typeof(StackBehaviour))]
[assembly: TypeForwardedTo(typeof(StateMachineScope))]
[assembly: TypeForwardedTo(typeof(StateMachineScopeDebugInformation))]
[assembly: TypeForwardedTo(typeof(SymbolsNotFoundException))]
[assembly: TypeForwardedTo(typeof(SymbolsNotMatchingException))]
[assembly: TypeForwardedTo(typeof(VariableAttributes))]
[assembly: TypeForwardedTo(typeof(VariableDebugInformation))]
[assembly: TypeForwardedTo(typeof(VariableDefinition))]
[assembly: TypeForwardedTo(typeof(VariableIndex))]
[assembly: TypeForwardedTo(typeof(VariableReference))]
[assembly: TypeForwardedTo(typeof(CustomAttribute))]
[assembly: TypeForwardedTo(typeof(CustomAttributeArgument))]
[assembly: TypeForwardedTo(typeof(CustomAttributeNamedArgument))]
[assembly: TypeForwardedTo(typeof(CustomMarshalInfo))]
[assembly: TypeForwardedTo(typeof(DefaultAssemblyResolver))]
[assembly: TypeForwardedTo(typeof(DefaultMetadataImporter))]
[assembly: TypeForwardedTo(typeof(DefaultReflectionImporter))]
[assembly: TypeForwardedTo(typeof(EmbeddedResource))]
[assembly: TypeForwardedTo(typeof(EventAttributes))]
[assembly: TypeForwardedTo(typeof(EventDefinition))]
[assembly: TypeForwardedTo(typeof(EventReference))]
[assembly: TypeForwardedTo(typeof(ExportedType))]
[assembly: TypeForwardedTo(typeof(FieldAttributes))]
[assembly: TypeForwardedTo(typeof(FieldDefinition))]
[assembly: TypeForwardedTo(typeof(FieldReference))]
[assembly: TypeForwardedTo(typeof(FixedArrayMarshalInfo))]
[assembly: TypeForwardedTo(typeof(FixedSysStringMarshalInfo))]
[assembly: TypeForwardedTo(typeof(FunctionPointerType))]
[assembly: TypeForwardedTo(typeof(GenericInstanceMethod))]
[assembly: TypeForwardedTo(typeof(GenericInstanceType))]
[assembly: TypeForwardedTo(typeof(GenericParameter))]
[assembly: TypeForwardedTo(typeof(GenericParameterAttributes))]
[assembly: TypeForwardedTo(typeof(GenericParameterType))]
[assembly: TypeForwardedTo(typeof(IAssemblyResolver))]
[assembly: TypeForwardedTo(typeof(IConstantProvider))]
[assembly: TypeForwardedTo(typeof(ICustomAttribute))]
[assembly: TypeForwardedTo(typeof(ICustomAttributeProvider))]
[assembly: TypeForwardedTo(typeof(IGenericInstance))]
[assembly: TypeForwardedTo(typeof(IGenericParameterProvider))]
[assembly: TypeForwardedTo(typeof(IMarshalInfoProvider))]
[assembly: TypeForwardedTo(typeof(IMemberDefinition))]
[assembly: TypeForwardedTo(typeof(IMetadataImporter))]
[assembly: TypeForwardedTo(typeof(IMetadataImporterProvider))]
[assembly: TypeForwardedTo(typeof(IMetadataResolver))]
[assembly: TypeForwardedTo(typeof(IMetadataScope))]
[assembly: TypeForwardedTo(typeof(IMetadataTokenProvider))]
[assembly: TypeForwardedTo(typeof(IMethodSignature))]
[assembly: TypeForwardedTo(typeof(IModifierType))]
[assembly: TypeForwardedTo(typeof(InterfaceImplementation))]
[assembly: TypeForwardedTo(typeof(IReflectionImporter))]
[assembly: TypeForwardedTo(typeof(IReflectionImporterProvider))]
[assembly: TypeForwardedTo(typeof(ISecurityDeclarationProvider))]
[assembly: TypeForwardedTo(typeof(LinkedResource))]
[assembly: TypeForwardedTo(typeof(ManifestResourceAttributes))]
[assembly: TypeForwardedTo(typeof(MarshalInfo))]
[assembly: TypeForwardedTo(typeof(MdbReader))]
[assembly: TypeForwardedTo(typeof(MdbReaderProvider))]
[assembly: TypeForwardedTo(typeof(MdbWriter))]
[assembly: TypeForwardedTo(typeof(MdbWriterProvider))]
[assembly: TypeForwardedTo(typeof(MemberReference))]
[assembly: TypeForwardedTo(typeof(MetadataKind))]
[assembly: TypeForwardedTo(typeof(MetadataResolver))]
[assembly: TypeForwardedTo(typeof(MetadataScopeType))]
[assembly: TypeForwardedTo(typeof(MetadataToken))]
[assembly: TypeForwardedTo(typeof(MetadataType))]
[assembly: TypeForwardedTo(typeof(MethodAttributes))]
[assembly: TypeForwardedTo(typeof(MethodCallingConvention))]
[assembly: TypeForwardedTo(typeof(MethodDefinition))]
[assembly: TypeForwardedTo(typeof(MethodImplAttributes))]
[assembly: TypeForwardedTo(typeof(MethodReference))]
[assembly: TypeForwardedTo(typeof(MethodReturnType))]
[assembly: TypeForwardedTo(typeof(MethodSemanticsAttributes))]
[assembly: TypeForwardedTo(typeof(MethodSpecification))]
[assembly: TypeForwardedTo(typeof(ModuleAttributes))]
[assembly: TypeForwardedTo(typeof(ModuleCharacteristics))]
[assembly: TypeForwardedTo(typeof(ModuleDefinition))]
[assembly: TypeForwardedTo(typeof(ModuleKind))]
[assembly: TypeForwardedTo(typeof(ModuleParameters))]
[assembly: TypeForwardedTo(typeof(ModuleReference))]
[assembly: TypeForwardedTo(typeof(NativeType))]
[assembly: TypeForwardedTo(typeof(OptionalModifierType))]
[assembly: TypeForwardedTo(typeof(ParameterAttributes))]
[assembly: TypeForwardedTo(typeof(ParameterDefinition))]
[assembly: TypeForwardedTo(typeof(ParameterReference))]
[assembly: TypeForwardedTo(typeof(NativePdbReader))]
[assembly: TypeForwardedTo(typeof(NativePdbReaderProvider))]
[assembly: TypeForwardedTo(typeof(NativePdbWriter))]
[assembly: TypeForwardedTo(typeof(NativePdbWriterProvider))]
[assembly: TypeForwardedTo(typeof(PdbReaderProvider))]
[assembly: TypeForwardedTo(typeof(PdbWriterProvider))]
[assembly: TypeForwardedTo(typeof(PinnedType))]
[assembly: TypeForwardedTo(typeof(PInvokeAttributes))]
[assembly: TypeForwardedTo(typeof(PInvokeInfo))]
[assembly: TypeForwardedTo(typeof(PointerType))]
[assembly: TypeForwardedTo(typeof(PropertyAttributes))]
[assembly: TypeForwardedTo(typeof(PropertyDefinition))]
[assembly: TypeForwardedTo(typeof(PropertyReference))]
[assembly: TypeForwardedTo(typeof(ReaderParameters))]
[assembly: TypeForwardedTo(typeof(ReadingMode))]
[assembly: TypeForwardedTo(typeof(RequiredModifierType))]
[assembly: TypeForwardedTo(typeof(ResolutionException))]
[assembly: TypeForwardedTo(typeof(Resource))]
[assembly: TypeForwardedTo(typeof(ResourceType))]
[assembly: TypeForwardedTo(typeof(DocCommentId))]
[assembly: TypeForwardedTo(typeof(IILVisitor))]
[assembly: TypeForwardedTo(typeof(ILParser))]
[assembly: TypeForwardedTo(typeof(MethodBodyRocks))]
[assembly: TypeForwardedTo(typeof(MethodDefinitionRocks))]
[assembly: TypeForwardedTo(typeof(ModuleDefinitionRocks))]
[assembly: TypeForwardedTo(typeof(ParameterReferenceRocks))]
[assembly: TypeForwardedTo(typeof(SecurityDeclarationRocks))]
[assembly: TypeForwardedTo(typeof(TypeDefinitionRocks))]
[assembly: TypeForwardedTo(typeof(TypeReferenceRocks))]
[assembly: TypeForwardedTo(typeof(SafeArrayMarshalInfo))]
[assembly: TypeForwardedTo(typeof(SecurityAction))]
[assembly: TypeForwardedTo(typeof(SecurityAttribute))]
[assembly: TypeForwardedTo(typeof(SecurityDeclaration))]
[assembly: TypeForwardedTo(typeof(SentinelType))]
[assembly: TypeForwardedTo(typeof(TargetArchitecture))]
[assembly: TypeForwardedTo(typeof(TargetRuntime))]
[assembly: TypeForwardedTo(typeof(TokenType))]
[assembly: TypeForwardedTo(typeof(TypeAttributes))]
[assembly: TypeForwardedTo(typeof(TypeDefinition))]
[assembly: TypeForwardedTo(typeof(TypeReference))]
[assembly: TypeForwardedTo(typeof(TypeSpecification))]
[assembly: TypeForwardedTo(typeof(TypeSystem))]
[assembly: TypeForwardedTo(typeof(VariantType))]
[assembly: TypeForwardedTo(typeof(WriterParameters))]
[assembly: TypeForwardedTo(typeof(Collection<>))]
[assembly: TypeForwardedTo(typeof(ReadOnlyCollection<>))]
[assembly: TypeForwardedTo(typeof(AnonymousScopeEntry))]
[assembly: TypeForwardedTo(typeof(CapturedScope))]
[assembly: TypeForwardedTo(typeof(CapturedVariable))]
[assembly: TypeForwardedTo(typeof(CodeBlockEntry))]
[assembly: TypeForwardedTo(typeof(CompileUnitEntry))]
[assembly: TypeForwardedTo(typeof(ICompileUnit))]
[assembly: TypeForwardedTo(typeof(IMethodDef))]
[assembly: TypeForwardedTo(typeof(ISourceFile))]
[assembly: TypeForwardedTo(typeof(LineNumberEntry))]
[assembly: TypeForwardedTo(typeof(LineNumberTable))]
[assembly: TypeForwardedTo(typeof(LocalVariableEntry))]
[assembly: TypeForwardedTo(typeof(MethodEntry))]
[assembly: TypeForwardedTo(typeof(MonoSymbolFile))]
[assembly: TypeForwardedTo(typeof(MonoSymbolFileException))]
[assembly: TypeForwardedTo(typeof(MonoSymbolWriter))]
[assembly: TypeForwardedTo(typeof(NamespaceEntry))]
[assembly: TypeForwardedTo(typeof(OffsetTable))]
[assembly: TypeForwardedTo(typeof(ScopeVariable))]
[assembly: TypeForwardedTo(typeof(SourceFileEntry))]
[assembly: TypeForwardedTo(typeof(SourceMethodBuilder))]
[assembly: TypeForwardedTo(typeof(SymbolWriterImpl))]
[assembly: TypeForwardedTo(typeof(IILReferenceBag))]
[assembly: TypeForwardedTo(typeof(ILContext))]
[assembly: TypeForwardedTo(typeof(ILCursor))]
[assembly: TypeForwardedTo(typeof(ILLabel))]
[assembly: TypeForwardedTo(typeof(ILPatternMatchingExt))]
[assembly: TypeForwardedTo(typeof(MoveType))]
[assembly: TypeForwardedTo(typeof(NopILReferenceBag))]
[assembly: TypeForwardedTo(typeof(RuntimeILReferenceBag))]
[assembly: TypeForwardedTo(typeof(SearchTarget))]
[assembly: TypeForwardedTo(typeof(ModExportNameAttribute))]
[assembly: TypeForwardedTo(typeof(ModImportNameAttribute))]
[assembly: TypeForwardedTo(typeof(ModInteropManager))]
[assembly: TypeForwardedTo(typeof(Detour))]
[assembly: TypeForwardedTo(typeof(Detour<>))]
[assembly: TypeForwardedTo(typeof(DetourConfig))]
[assembly: TypeForwardedTo(typeof(DetourContext))]
[assembly: TypeForwardedTo(typeof(DetourHelper))]
[assembly: TypeForwardedTo(typeof(DetourModManager))]
[assembly: TypeForwardedTo(typeof(HarmonyDetourBridge))]
[assembly: TypeForwardedTo(typeof(Hook))]
[assembly: TypeForwardedTo(typeof(Hook<>))]
[assembly: TypeForwardedTo(typeof(Hook<, >))]
[assembly: TypeForwardedTo(typeof(HookConfig))]
[assembly: TypeForwardedTo(typeof(HookEndpointManager))]
[assembly: TypeForwardedTo(typeof(IDetour))]
[assembly: TypeForwardedTo(typeof(IDetourNativePlatform))]
[assembly: TypeForwardedTo(typeof(IDetourRuntimePlatform))]
[assembly: TypeForwardedTo(typeof(ILHook))]
[assembly: TypeForwardedTo(typeof(ILHookConfig))]
[assembly: TypeForwardedTo(typeof(ISortableDetour))]
[assembly: TypeForwardedTo(typeof(NativeDetour))]
[assembly: TypeForwardedTo(typeof(NativeDetourConfig))]
[assembly: TypeForwardedTo(typeof(NativeDetourData))]
[assembly: TypeForwardedTo(typeof(OnMethodCompiledEvent))]
[assembly: TypeForwardedTo(typeof(DetourNativeARMPlatform))]
[assembly: TypeForwardedTo(typeof(DetourNativeLibcPlatform))]
[assembly: TypeForwardedTo(typeof(DetourNativeMonoPlatform))]
[assembly: TypeForwardedTo(typeof(DetourNativeMonoPosixPlatform))]
[assembly: TypeForwardedTo(typeof(DetourNativeWindowsPlatform))]
[assembly: TypeForwardedTo(typeof(DetourNativeX86Platform))]
[assembly: TypeForwardedTo(typeof(DetourRuntimeILPlatform))]
[assembly: TypeForwardedTo(typeof(DetourRuntimeMonoPlatform))]
[assembly: TypeForwardedTo(typeof(DetourRuntimeNET50Platform))]
[assembly: TypeForwardedTo(typeof(DetourRuntimeNET60Platform))]
[assembly: TypeForwardedTo(typeof(DetourRuntimeNETCore30Platform))]
[assembly: TypeForwardedTo(typeof(DetourRuntimeNETCorePlatform))]
[assembly: TypeForwardedTo(typeof(DetourRuntimeNETPlatform))]
[assembly: TypeForwardedTo(typeof(CecilILGenerator))]
[assembly: TypeForwardedTo(typeof(ILGeneratorShim))]
[assembly: TypeForwardedTo(typeof(ILGeneratorShimExt))]
[assembly: TypeForwardedTo(typeof(DMDCecilGenerator))]
[assembly: TypeForwardedTo(typeof(DMDEmitDynamicMethodGenerator))]
[assembly: TypeForwardedTo(typeof(DMDEmitMethodBuilderGenerator))]
[assembly: TypeForwardedTo(typeof(DMDGenerator<>))]
[assembly: TypeForwardedTo(typeof(DynamicMethodDefinition))]
[assembly: TypeForwardedTo(typeof(DynamicMethodHelper))]
[assembly: TypeForwardedTo(typeof(DynamicMethodReference))]
[assembly: TypeForwardedTo(typeof(DynData<>))]
[assembly: TypeForwardedTo(typeof(DynDll))]
[assembly: TypeForwardedTo(typeof(DynDllImportAttribute))]
[assembly: TypeForwardedTo(typeof(DynDllMapping))]
[assembly: TypeForwardedTo(typeof(Extensions))]
[assembly: TypeForwardedTo(typeof(FastReflectionDelegate))]
[assembly: TypeForwardedTo(typeof(FastReflectionHelper))]
[assembly: TypeForwardedTo(typeof(GCListener))]
[assembly: TypeForwardedTo(typeof(GenericMethodInstantiationComparer))]
[assembly: TypeForwardedTo(typeof(GenericTypeInstantiationComparer))]
[assembly: TypeForwardedTo(typeof(ICallSiteGenerator))]
[assembly: TypeForwardedTo(typeof(LazyDisposable))]
[assembly: TypeForwardedTo(typeof(LazyDisposable<>))]
[assembly: TypeForwardedTo(typeof(MMReflectionImporter))]
[assembly: TypeForwardedTo(typeof(Platform))]
[assembly: TypeForwardedTo(typeof(PlatformHelper))]
[assembly: TypeForwardedTo(typeof(ReflectionHelper))]
[assembly: TypeForwardedTo(typeof(Relinker))]
[assembly: TypeForwardedTo(typeof(RelinkFailedException))]
[assembly: TypeForwardedTo(typeof(RelinkTargetNotFoundException))]
[assembly: TypeForwardedTo(typeof(WeakReferenceComparer))]
[assembly: TypeForwardedTo(typeof(IgnoresAccessChecksToAttribute))]
[assembly: TypeForwardedTo(typeof(TomlDoNotInlineObjectAttribute))]
[assembly: TypeForwardedTo(typeof(TomlInlineCommentAttribute))]
[assembly: TypeForwardedTo(typeof(TomlPrecedingCommentAttribute))]
[assembly: TypeForwardedTo(typeof(TomlPropertyAttribute))]
[assembly: TypeForwardedTo(typeof(InvalidTomlDateTimeException))]
[assembly: TypeForwardedTo(typeof(InvalidTomlEscapeException))]
[assembly: TypeForwardedTo(typeof(InvalidTomlInlineTableException))]
[assembly: TypeForwardedTo(typeof(InvalidTomlKeyException))]
[assembly: TypeForwardedTo(typeof(InvalidTomlNumberException))]
[assembly: TypeForwardedTo(typeof(MissingIntermediateInTomlTableArraySpecException))]
[assembly: TypeForwardedTo(typeof(NewLineInTomlInlineTableException))]
[assembly: TypeForwardedTo(typeof(NoTomlKeyException))]
[assembly: TypeForwardedTo(typeof(TimeOffsetOnTomlDateOrTimeException))]
[assembly: TypeForwardedTo(typeof(TomlArraySyntaxException))]
[assembly: TypeForwardedTo(typeof(TomlContainsDottedKeyNonTableException))]
[assembly: TypeForwardedTo(typeof(TomlDateTimeMissingSeparatorException))]
[assembly: TypeForwardedTo(typeof(TomlDateTimeUnnecessarySeparatorException))]
[assembly: TypeForwardedTo(typeof(TomlDottedKeyException))]
[assembly: TypeForwardedTo(typeof(TomlDottedKeyParserException))]
[assembly: TypeForwardedTo(typeof(TomlDoubleDottedKeyException))]
[assembly: TypeForwardedTo(typeof(TomlEndOfFileException))]
[assembly: TypeForwardedTo(typeof(TomlEnumParseException))]
[assembly: TypeForwardedTo(typeof(TomlException))]
[assembly: TypeForwardedTo(typeof(TomlExceptionWithLine))]
[assembly: TypeForwardedTo(typeof(TomlFieldTypeMismatchException))]
[assembly: TypeForwardedTo(typeof(TomlInlineTableSeparatorException))]
[assembly: TypeForwardedTo(typeof(TomlInstantiationException))]
[assembly: TypeForwardedTo(typeof(TomlInternalException))]
[assembly: TypeForwardedTo(typeof(TomlInvalidValueException))]
[assembly: TypeForwardedTo(typeof(TomlKeyRedefinitionException))]
[assembly: TypeForwardedTo(typeof(TomlMissingEqualsException))]
[assembly: TypeForwardedTo(typeof(TomlMissingNewlineException))]
[assembly: TypeForwardedTo(typeof(TomlNewlineInInlineCommentException))]
[assembly: TypeForwardedTo(typeof(TomlNonTableArrayUsedAsTableArrayException))]
[assembly: TypeForwardedTo(typeof(TomlNoSuchValueException))]
[assembly: TypeForwardedTo(typeof(TomlPrimitiveToDocumentException))]
[assembly: TypeForwardedTo(typeof(TomlStringException))]
[assembly: TypeForwardedTo(typeof(TomlTableArrayAlreadyExistsAsNonArrayException))]
[assembly: TypeForwardedTo(typeof(TomlTableLockedException))]
[assembly: TypeForwardedTo(typeof(TomlTableRedefinitionException))]
[assembly: TypeForwardedTo(typeof(TomlTripleQuotedKeyException))]
[assembly: TypeForwardedTo(typeof(TomlTypeMismatchException))]
[assembly: TypeForwardedTo(typeof(TomlUnescapedUnicodeControlCharException))]
[assembly: TypeForwardedTo(typeof(TomlWhitespaceInKeyException))]
[assembly: TypeForwardedTo(typeof(TripleQuoteInTomlMultilineLiteralException))]
[assembly: TypeForwardedTo(typeof(TripleQuoteInTomlMultilineSimpleStringException))]
[assembly: TypeForwardedTo(typeof(UnterminatedTomlKeyException))]
[assembly: TypeForwardedTo(typeof(UnterminatedTomlStringException))]
[assembly: TypeForwardedTo(typeof(UnterminatedTomlTableArrayException))]
[assembly: TypeForwardedTo(typeof(UnterminatedTomlTableNameException))]
[assembly: TypeForwardedTo(typeof(ITomlValueWithDateTime))]
[assembly: TypeForwardedTo(typeof(TomlArray))]
[assembly: TypeForwardedTo(typeof(TomlBoolean))]
[assembly: TypeForwardedTo(typeof(TomlCommentData))]
[assembly: TypeForwardedTo(typeof(TomlDocument))]
[assembly: TypeForwardedTo(typeof(TomlDouble))]
[assembly: TypeForwardedTo(typeof(TomlLocalDate))]
[assembly: TypeForwardedTo(typeof(TomlLocalDateTime))]
[assembly: TypeForwardedTo(typeof(TomlLocalTime))]
[assembly: TypeForwardedTo(typeof(TomlLong))]
[assembly: TypeForwardedTo(typeof(TomlOffsetDateTime))]
[assembly: TypeForwardedTo(typeof(TomlString))]
[assembly: TypeForwardedTo(typeof(TomlTable))]
[assembly: TypeForwardedTo(typeof(TomlValue))]
[assembly: TypeForwardedTo(typeof(TomletMain))]
[assembly: TypeForwardedTo(typeof(TomletStringReader))]
[assembly: TypeForwardedTo(typeof(TomlNumberUtils))]
[assembly: TypeForwardedTo(typeof(TomlParser))]
[assembly: TypeForwardedTo(typeof(TomlSerializationMethods))]
[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 Semver
{
	internal static class IntExtensions
	{
		public static int Digits(this int n)
		{
			if (n < 10)
			{
				return 1;
			}
			if (n < 100)
			{
				return 2;
			}
			if (n < 1000)
			{
				return 3;
			}
			if (n < 10000)
			{
				return 4;
			}
			if (n < 100000)
			{
				return 5;
			}
			if (n < 1000000)
			{
				return 6;
			}
			if (n < 10000000)
			{
				return 7;
			}
			if (n < 100000000)
			{
				return 8;
			}
			if (n < 1000000000)
			{
				return 9;
			}
			return 10;
		}
	}
	[Serializable]
	public sealed class SemVersion : IComparable<SemVersion>, IComparable, ISerializable
	{
		private static readonly Regex ParseEx = new Regex("^(?<major>\\d+)(?>\\.(?<minor>\\d+))?(?>\\.(?<patch>\\d+))?(?>\\-(?<pre>[0-9A-Za-z\\-\\.]+))?(?>\\+(?<build>[0-9A-Za-z\\-\\.]+))?$", RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant);

		public int Major { get; }

		public int Minor { get; }

		public int Patch { get; }

		public string Prerelease { get; }

		public string Build { get; }

		private SemVersion(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			SemVersion semVersion = Parse(info.GetString("SemVersion"));
			Major = semVersion.Major;
			Minor = semVersion.Minor;
			Patch = semVersion.Patch;
			Prerelease = semVersion.Prerelease;
			Build = semVersion.Build;
		}

		public SemVersion(int major, int minor = 0, int patch = 0, string prerelease = "", string build = "")
		{
			Major = major;
			Minor = minor;
			Patch = patch;
			Prerelease = prerelease ?? "";
			Build = build ?? "";
		}

		public SemVersion(Version version)
		{
			if (version == null)
			{
				throw new ArgumentNullException("version");
			}
			Major = version.Major;
			Minor = version.Minor;
			if (version.Revision >= 0)
			{
				Patch = version.Revision;
			}
			Prerelease = "";
			Build = ((version.Build > 0) ? version.Build.ToString(CultureInfo.InvariantCulture) : "");
		}

		public static SemVersion Parse(string version, bool strict = false)
		{
			Match match = ParseEx.Match(version);
			if (!match.Success)
			{
				throw new ArgumentException("Invalid version '" + version + "'.", "version");
			}
			int major = int.Parse(match.Groups["major"].Value, CultureInfo.InvariantCulture);
			Group group = match.Groups["minor"];
			int minor = 0;
			if (group.Success)
			{
				minor = int.Parse(group.Value, CultureInfo.InvariantCulture);
			}
			else if (strict)
			{
				throw new InvalidOperationException("Invalid version (no minor version given in strict mode)");
			}
			Group group2 = match.Groups["patch"];
			int patch = 0;
			if (group2.Success)
			{
				patch = int.Parse(group2.Value, CultureInfo.InvariantCulture);
			}
			else if (strict)
			{
				throw new InvalidOperationException("Invalid version (no patch version given in strict mode)");
			}
			string value = match.Groups["pre"].Value;
			string value2 = match.Groups["build"].Value;
			return new SemVersion(major, minor, patch, value, value2);
		}

		public static bool TryParse(string version, out SemVersion semver, bool strict = false)
		{
			semver = null;
			if (version == null)
			{
				return false;
			}
			Match match = ParseEx.Match(version);
			if (!match.Success)
			{
				return false;
			}
			if (!int.TryParse(match.Groups["major"].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
			{
				return false;
			}
			Group group = match.Groups["minor"];
			int result2 = 0;
			if (group.Success)
			{
				if (!int.TryParse(group.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result2))
				{
					return false;
				}
			}
			else if (strict)
			{
				return false;
			}
			Group group2 = match.Groups["patch"];
			int result3 = 0;
			if (group2.Success)
			{
				if (!int.TryParse(group2.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result3))
				{
					return false;
				}
			}
			else if (strict)
			{
				return false;
			}
			string value = match.Groups["pre"].Value;
			string value2 = match.Groups["build"].Value;
			semver = new SemVersion(result, result2, result3, value, value2);
			return true;
		}

		public static bool Equals(SemVersion versionA, SemVersion versionB)
		{
			if ((object)versionA == versionB)
			{
				return true;
			}
			if ((object)versionA == null || (object)versionB == null)
			{
				return false;
			}
			return versionA.Equals(versionB);
		}

		public static int Compare(SemVersion versionA, SemVersion versionB)
		{
			if ((object)versionA == versionB)
			{
				return 0;
			}
			if ((object)versionA == null)
			{
				return -1;
			}
			if ((object)versionB == null)
			{
				return 1;
			}
			return versionA.CompareTo(versionB);
		}

		public SemVersion Change(int? major = null, int? minor = null, int? patch = null, string prerelease = null, string build = null)
		{
			return new SemVersion(major ?? Major, minor ?? Minor, patch ?? Patch, prerelease ?? Prerelease, build ?? Build);
		}

		public override string ToString()
		{
			int capacity = 4 + Major.Digits() + Minor.Digits() + Patch.Digits() + Prerelease.Length + Build.Length;
			StringBuilder stringBuilder = new StringBuilder(capacity);
			stringBuilder.Append(Major);
			stringBuilder.Append('.');
			stringBuilder.Append(Minor);
			stringBuilder.Append('.');
			stringBuilder.Append(Patch);
			if (Prerelease.Length > 0)
			{
				stringBuilder.Append('-');
				stringBuilder.Append(Prerelease);
			}
			if (Build.Length > 0)
			{
				stringBuilder.Append('+');
				stringBuilder.Append(Build);
			}
			return stringBuilder.ToString();
		}

		public int CompareTo(object obj)
		{
			return CompareTo((SemVersion)obj);
		}

		public int CompareTo(SemVersion other)
		{
			int num = CompareByPrecedence(other);
			if (num != 0)
			{
				return num;
			}
			return CompareComponent(Build, other.Build);
		}

		public bool PrecedenceMatches(SemVersion other)
		{
			return CompareByPrecedence(other) == 0;
		}

		public int CompareByPrecedence(SemVersion other)
		{
			if ((object)other == null)
			{
				return 1;
			}
			int num = Major.CompareTo(other.Major);
			if (num != 0)
			{
				return num;
			}
			num = Minor.CompareTo(other.Minor);
			if (num != 0)
			{
				return num;
			}
			num = Patch.CompareTo(other.Patch);
			if (num != 0)
			{
				return num;
			}
			return CompareComponent(Prerelease, other.Prerelease, nonemptyIsLower: true);
		}

		private static int CompareComponent(string a, string b, bool nonemptyIsLower = false)
		{
			bool flag = string.IsNullOrEmpty(a);
			bool flag2 = string.IsNullOrEmpty(b);
			if (flag && flag2)
			{
				return 0;
			}
			if (flag)
			{
				return nonemptyIsLower ? 1 : (-1);
			}
			if (flag2)
			{
				return (!nonemptyIsLower) ? 1 : (-1);
			}
			string[] array = a.Split(new char[1] { '.' });
			string[] array2 = b.Split(new char[1] { '.' });
			int num = Math.Min(array.Length, array2.Length);
			for (int i = 0; i < num; i++)
			{
				string text = array[i];
				string text2 = array2[i];
				int result;
				bool flag3 = int.TryParse(text, out result);
				int result2;
				bool flag4 = int.TryParse(text2, out result2);
				int num2;
				if (flag3 && flag4)
				{
					num2 = result.CompareTo(result2);
					if (num2 != 0)
					{
						return num2;
					}
					continue;
				}
				if (flag3)
				{
					return -1;
				}
				if (flag4)
				{
					return 1;
				}
				num2 = string.CompareOrdinal(text, text2);
				if (num2 != 0)
				{
					return num2;
				}
			}
			return array.Length.CompareTo(array2.Length);
		}

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return false;
			}
			if (this == obj)
			{
				return true;
			}
			SemVersion semVersion = (SemVersion)obj;
			return Major == semVersion.Major && Minor == semVersion.Minor && Patch == semVersion.Patch && string.Equals(Prerelease, semVersion.Prerelease, StringComparison.Ordinal) && string.Equals(Build, semVersion.Build, StringComparison.Ordinal);
		}

		public override int GetHashCode()
		{
			int hashCode = Major.GetHashCode();
			hashCode = hashCode * 31 + Minor.GetHashCode();
			hashCode = hashCode * 31 + Patch.GetHashCode();
			hashCode = hashCode * 31 + Prerelease.GetHashCode();
			return hashCode * 31 + Build.GetHashCode();
		}

		[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
		public void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			if (info == null)
			{
				throw new ArgumentNullException("info");
			}
			info.AddValue("SemVersion", ToString());
		}

		public static implicit operator SemVersion(string version)
		{
			return Parse(version);
		}

		public static bool operator ==(SemVersion left, SemVersion right)
		{
			return Equals(left, right);
		}

		public static bool operator !=(SemVersion left, SemVersion right)
		{
			return !Equals(left, right);
		}

		public static bool operator >(SemVersion left, SemVersion right)
		{
			return Compare(left, right) > 0;
		}

		public static bool operator >=(SemVersion left, SemVersion right)
		{
			return Equals(left, right) || Compare(left, right) > 0;
		}

		public static bool operator <(SemVersion left, SemVersion right)
		{
			return Compare(left, right) < 0;
		}

		public static bool operator <=(SemVersion left, SemVersion right)
		{
			return Equals(left, right) || Compare(left, right) < 0;
		}
	}
}
namespace Harmony
{
	[Obsolete("Harmony.MethodType is Only Here for Compatibility Reasons. Please use HarmonyLib.MethodType instead.")]
	public enum MethodType
	{
		Normal,
		Getter,
		Setter,
		Constructor,
		StaticConstructor
	}
	[Obsolete("Harmony.PropertyMethod is Only Here for Compatibility Reasons. Please use HarmonyLib.MethodType instead.")]
	public enum PropertyMethod
	{
		Getter = 1,
		Setter
	}
	[Obsolete("Harmony.ArgumentType is Only Here for Compatibility Reasons. Please use HarmonyLib.ArgumentType instead.")]
	public enum ArgumentType
	{
		Normal,
		Ref,
		Out,
		Pointer
	}
	[Obsolete("Harmony.HarmonyPatchType is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatchType instead.")]
	public enum HarmonyPatchType
	{
		All,
		Prefix,
		Postfix,
		Transpiler
	}
	[Obsolete("Harmony.HarmonyAttribute is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyAttribute instead.")]
	public class HarmonyAttribute : HarmonyAttribute
	{
	}
	[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Delegate, AllowMultiple = true)]
	public class HarmonyPatch : HarmonyPatch
	{
		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch()
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type declaringType)
			: base(declaringType)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type declaringType, Type[] argumentTypes)
			: base(declaringType, argumentTypes)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type declaringType, string methodName)
			: base(declaringType, methodName)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type declaringType, string methodName, params Type[] argumentTypes)
			: base(declaringType, methodName, argumentTypes)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type declaringType, string methodName, Type[] argumentTypes, ArgumentType[] argumentVariations)
			: base(declaringType, methodName, argumentTypes, Array.ConvertAll(argumentVariations, (ArgumentType x) => (ArgumentType)x))
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type declaringType, MethodType methodType)
			: base(declaringType, (MethodType)methodType)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type declaringType, MethodType methodType, params Type[] argumentTypes)
			: base(declaringType, (MethodType)methodType, argumentTypes)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type declaringType, MethodType methodType, Type[] argumentTypes, ArgumentType[] argumentVariations)
			: base(declaringType, (MethodType)methodType, argumentTypes, Array.ConvertAll(argumentVariations, (ArgumentType x) => (ArgumentType)x))
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type declaringType, string propertyName, MethodType methodType)
			: base(declaringType, propertyName, (MethodType)methodType)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(string methodName)
			: base(methodName)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(string methodName, params Type[] argumentTypes)
			: base(methodName, argumentTypes)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(string methodName, Type[] argumentTypes, ArgumentType[] argumentVariations)
			: base(methodName, argumentTypes, Array.ConvertAll(argumentVariations, (ArgumentType x) => (ArgumentType)x))
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(string propertyName, MethodType methodType)
			: base(propertyName, (MethodType)methodType)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(MethodType methodType)
			: base((MethodType)methodType)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(MethodType methodType, params Type[] argumentTypes)
			: base((MethodType)methodType, argumentTypes)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(MethodType methodType, Type[] argumentTypes, ArgumentType[] argumentVariations)
			: base((MethodType)methodType, argumentTypes, Array.ConvertAll(argumentVariations, (ArgumentType x) => (ArgumentType)x))
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type[] argumentTypes)
			: base(argumentTypes)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(Type[] argumentTypes, ArgumentType[] argumentVariations)
			: base(argumentTypes, Array.ConvertAll(argumentVariations, (ArgumentType x) => (ArgumentType)x))
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(string propertyName, PropertyMethod type)
			: base(propertyName, (MethodType)type)
		{
		}

		[Obsolete("Harmony.HarmonyPatch is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatch instead.")]
		public HarmonyPatch(string assemblyQualifiedDeclaringType, string methodName, MethodType methodType, Type[] argumentTypes = null, ArgumentType[] argumentVariations = null)
			: base(assemblyQualifiedDeclaringType, methodName, (MethodType)methodType, argumentTypes, Array.ConvertAll(argumentVariations, (ArgumentType x) => (ArgumentType)x))
		{
		}
	}
	[Obsolete("Harmony.HarmonyPatchAll is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPatchAll instead.")]
	[AttributeUsage(AttributeTargets.Class)]
	public class HarmonyPatchAll : HarmonyPatchAll
	{
	}
	[Obsolete("Harmony.HarmonyPriority is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPriority instead.")]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
	public class HarmonyPriority : HarmonyPriority
	{
		[Obsolete("Harmony.HarmonyPriority is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPriority instead.")]
		public HarmonyPriority(int prioritiy)
			: base(prioritiy)
		{
		}
	}
	[Obsolete("Harmony.HarmonyBefore is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyBefore instead.")]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
	public class HarmonyBefore : HarmonyBefore
	{
		[Obsolete("Harmony.HarmonyBefore is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyBefore instead.")]
		public HarmonyBefore(params string[] before)
			: base(before)
		{
		}
	}
	[Obsolete("Harmony.HarmonyAfter is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyAfter instead.")]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
	public class HarmonyAfter : HarmonyAfter
	{
		[Obsolete("Harmony.HarmonyAfter is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyAfter instead.")]
		public HarmonyAfter(params string[] after)
			: base(after)
		{
		}
	}
	[Obsolete("Harmony.HarmonyPrepare is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPrepare instead.")]
	[AttributeUsage(AttributeTargets.Method)]
	public class HarmonyPrepare : HarmonyPrepare
	{
	}
	[Obsolete("Harmony.HarmonyCleanup is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyCleanup instead.")]
	[AttributeUsage(AttributeTargets.Method)]
	public class HarmonyCleanup : HarmonyCleanup
	{
	}
	[Obsolete("Harmony.HarmonyTargetMethod is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyTargetMethod instead.")]
	[AttributeUsage(AttributeTargets.Method)]
	public class HarmonyTargetMethod : HarmonyTargetMethod
	{
	}
	[Obsolete("Harmony.HarmonyTargetMethods is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyTargetMethods instead.")]
	[AttributeUsage(AttributeTargets.Method)]
	public class HarmonyTargetMethods : HarmonyTargetMethods
	{
	}
	[Obsolete("Harmony.HarmonyPrefix is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPrefix instead.")]
	[AttributeUsage(AttributeTargets.Method)]
	public class HarmonyPrefix : HarmonyPrefix
	{
	}
	[Obsolete("Harmony.HarmonyPostfix is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyPostfix instead.")]
	[AttributeUsage(AttributeTargets.Method)]
	public class HarmonyPostfix : HarmonyPostfix
	{
	}
	[Obsolete("Harmony.HarmonyTranspiler is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyTranspiler instead.")]
	[AttributeUsage(AttributeTargets.Method)]
	public class HarmonyTranspiler : HarmonyTranspiler
	{
	}
	[Obsolete("Harmony.HarmonyArgument is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyArgument instead.")]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter, AllowMultiple = true)]
	public class HarmonyArgument : HarmonyArgument
	{
		[Obsolete("Harmony.HarmonyArgument is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyArgument instead.")]
		public HarmonyArgument(string originalName)
			: base(originalName, (string)null)
		{
		}

		[Obsolete("Harmony.HarmonyArgument is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyArgument instead.")]
		public HarmonyArgument(int index)
			: base(index, (string)null)
		{
		}

		[Obsolete("Harmony.HarmonyArgument is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyArgument instead.")]
		public HarmonyArgument(string originalName, string newName)
			: base(originalName, newName)
		{
		}

		[Obsolete("Harmony.HarmonyArgument is Only Here for Compatibility Reasons. Please use HarmonyLib.HarmonyArgument instead.")]
		public HarmonyArgument(int index, string name)
			: base(index, name)
		{
		}
	}
	public class DelegateTypeFactory : DelegateTypeFactory
	{
	}
	public delegate object GetterHandler(object source);
	public delegate void SetterHandler(object source, object value);
	public delegate object InstantiationHandler();
	public class FastAccess
	{
		[Obsolete("Use AccessTools.MethodDelegate<Func<T, S>>(PropertyInfo.GetGetMethod(true))")]
		public static InstantiationHandler CreateInstantiationHandler(Type type)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			ConstructorInfo constructor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[0], null);
			if ((object)constructor == null)
			{
				throw new ApplicationException($"The type {type} must declare an empty constructor (the constructor may be private, internal, protected, protected internal, or public).");
			}
			DynamicMethodDefinition val = new DynamicMethodDefinition("InstantiateObject_" + type.Name, type, (Type[])null);
			ILGenerator iLGenerator = val.GetILGenerator();
			iLGenerator.Emit(OpCodes.Newobj, constructor);
			iLGenerator.Emit(OpCodes.Ret);
			return (InstantiationHandler)Extensions.CreateDelegate((MethodBase)val.Generate(), typeof(InstantiationHandler));
		}

		[Obsolete("Use AccessTools.MethodDelegate<Func<T, S>>(PropertyInfo.GetGetMethod(true))")]
		public static GetterHandler CreateGetterHandler(PropertyInfo propertyInfo)
		{
			MethodInfo getMethod = propertyInfo.GetGetMethod(nonPublic: true);
			DynamicMethodDefinition val = CreateGetDynamicMethod(propertyInfo.DeclaringType);
			ILGenerator iLGenerator = val.GetILGenerator();
			iLGenerator.Emit(OpCodes.Ldarg_0);
			iLGenerator.Emit(OpCodes.Call, getMethod);
			iLGenerator.Emit(OpCodes.Ret);
			return (GetterHandler)Extensions.CreateDelegate((MethodBase)val.Generate(), typeof(GetterHandler));
		}

		[Obsolete("Use AccessTools.FieldRefAccess<T, S>(fieldInfo)")]
		public static GetterHandler CreateGetterHandler(FieldInfo fieldInfo)
		{
			DynamicMethodDefinition val = CreateGetDynamicMethod(fieldInfo.DeclaringType);
			ILGenerator iLGenerator = val.GetILGenerator();
			iLGenerator.Emit(OpCodes.Ldarg_0);
			iLGenerator.Emit(OpCodes.Ldfld, fieldInfo);
			iLGenerator.Emit(OpCodes.Ret);
			return (GetterHandler)Extensions.CreateDelegate((MethodBase)val.Generate(), typeof(GetterHandler));
		}

		[Obsolete("Use AccessTools.FieldRefAccess<T, S>(name) for fields and AccessTools.MethodDelegate<Func<T, S>>(AccessTools.PropertyGetter(typeof(T), name)) for properties")]
		public static GetterHandler CreateFieldGetter(Type type, params string[] names)
		{
			foreach (string name in names)
			{
				FieldInfo field = type.GetField(name, AccessTools.all);
				if ((object)field != null)
				{
					return CreateGetterHandler(field);
				}
				PropertyInfo property = type.GetProperty(name, AccessTools.all);
				if ((object)property != null)
				{
					return CreateGetterHandler(property);
				}
			}
			return null;
		}

		[Obsolete("Use AccessTools.MethodDelegate<Action<T, S>>(PropertyInfo.GetSetMethod(true))")]
		public static SetterHandler CreateSetterHandler(PropertyInfo propertyInfo)
		{
			MethodInfo setMethod = propertyInfo.GetSetMethod(nonPublic: true);
			DynamicMethodDefinition val = CreateSetDynamicMethod(propertyInfo.DeclaringType);
			ILGenerator iLGenerator = val.GetILGenerator();
			iLGenerator.Emit(OpCodes.Ldarg_0);
			iLGenerator.Emit(OpCodes.Ldarg_1);
			iLGenerator.Emit(OpCodes.Call, setMethod);
			iLGenerator.Emit(OpCodes.Ret);
			return (SetterHandler)Extensions.CreateDelegate((MethodBase)val.Generate(), typeof(SetterHandler));
		}

		[Obsolete("Use AccessTools.FieldRefAccess<T, S>(fieldInfo)")]
		public static SetterHandler CreateSetterHandler(FieldInfo fieldInfo)
		{
			DynamicMethodDefinition val = CreateSetDynamicMethod(fieldInfo.DeclaringType);
			ILGenerator iLGenerator = val.GetILGenerator();
			iLGenerator.Emit(OpCodes.Ldarg_0);
			iLGenerator.Emit(OpCodes.Ldarg_1);
			iLGenerator.Emit(OpCodes.Stfld, fieldInfo);
			iLGenerator.Emit(OpCodes.Ret);
			return (SetterHandler)Extensions.CreateDelegate((MethodBase)val.Generate(), typeof(SetterHandler));
		}

		private static DynamicMethodDefinition CreateGetDynamicMethod(Type type)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			return new DynamicMethodDefinition("DynamicGet_" + type.Name, typeof(object), new Type[1] { typeof(object) });
		}

		private static DynamicMethodDefinition CreateSetDynamicMethod(Type type)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			return new DynamicMethodDefinition("DynamicSet_" + type.Name, typeof(void), new Type[2]
			{
				typeof(object),
				typeof(object)
			});
		}
	}
	public delegate object FastInvokeHandler(object target, object[] paramters);
	public class MethodInvoker
	{
		public static FastInvokeHandler GetHandler(DynamicMethod methodInfo, Module module)
		{
			return ConvertFastInvokeHandler(MethodInvoker.GetHandler((MethodInfo)methodInfo, false));
		}

		public static FastInvokeHandler GetHandler(MethodInfo methodInfo)
		{
			return ConvertFastInvokeHandler(MethodInvoker.GetHandler(methodInfo, false));
		}

		private static FastInvokeHandler ConvertFastInvokeHandler(FastInvokeHandler sourceDelegate)
		{
			return (FastInvokeHandler)Delegate.CreateDelegate(typeof(FastInvokeHandler), ((Delegate)(object)sourceDelegate).Target, ((Delegate)(object)sourceDelegate).Method);
		}
	}
	public class HarmonyInstance : Harmony
	{
		[Obsolete("Harmony.HarmonyInstance is obsolete. Please use HarmonyLib.Harmony instead.")]
		public HarmonyInstance(string id)
			: base(id)
		{
		}

		[Obsolete("Harmony.HarmonyInstance.Create is obsolete. Please use the HarmonyLib.Harmony Constructor instead.")]
		public static HarmonyInstance Create(string id)
		{
			if (id == null)
			{
				throw new Exception("id cannot be null");
			}
			return new HarmonyInstance(id);
		}

		[Obsolete("Harmony.HarmonyInstance.Patch is obsolete. Please use HarmonyLib.Harmony.Patch instead.")]
		public DynamicMethod Patch(MethodBase original, HarmonyMethod prefix = null, HarmonyMethod postfix = null, HarmonyMethod transpiler = null)
		{
			((Harmony)this).Patch(original, (HarmonyMethod)(object)prefix, (HarmonyMethod)(object)postfix, (HarmonyMethod)(object)transpiler, (HarmonyMethod)null, (HarmonyMethod)null);
			return null;
		}

		public void Unpatch(MethodBase original, HarmonyPatchType type, string harmonyID = null)
		{
			((Harmony)this).Unpatch(original, (HarmonyPatchType)type, harmonyID);
		}
	}
	[Obsolete("Harmony.HarmonyMethod is obsolete. Please use HarmonyLib.HarmonyMethod instead.")]
	public class HarmonyMethod : HarmonyMethod
	{
		[Obsolete("Harmony.HarmonyMethod.prioritiy is obsolete. Please use HarmonyLib.HarmonyMethod.priority instead.")]
		public int prioritiy = -1;

		[Obsolete("Harmony.HarmonyMethod is obsolete. Please use HarmonyLib.HarmonyMethod instead.")]
		public HarmonyMethod()
		{
		}

		[Obsolete("Harmony.HarmonyMethod is obsolete. Please use HarmonyLib.HarmonyMethod instead.")]
		public HarmonyMethod(MethodInfo method)
			: base(method)
		{
		}

		[Obsolete("Harmony.HarmonyMethod is obsolete. Please use HarmonyLib.HarmonyMethod instead.")]
		public HarmonyMethod(Type type, string name, Type[] parameters = null)
			: base(type, name, parameters)
		{
		}

		[Obsolete("Harmony.HarmonyMethod.Merge is obsolete. Please use HarmonyLib.HarmonyMethod.Merge instead.")]
		public static HarmonyMethod Merge(List<HarmonyMethod> attributes)
		{
			return (HarmonyMethod)(object)HarmonyMethod.Merge(Array.ConvertAll(attributes.ToArray(), (HarmonyMethod x) => (HarmonyMethod)(object)x).ToList());
		}

		public override string ToString()
		{
			return ((HarmonyMethod)this).ToString();
		}
	}
	[Obsolete("Harmony.HarmonyMethodExtensions is obsolete. Please use HarmonyLib.HarmonyMethodExtensions instead.")]
	public static class HarmonyMethodExtensions
	{
		[Obsolete("Harmony.HarmonyMethodExtensions.CopyTo is obsolete. Please use HarmonyLib.HarmonyMethodExtensions.CopyTo instead.")]
		public static void CopyTo(this HarmonyMethod from, HarmonyMethod to)
		{
			HarmonyMethodExtensions.CopyTo((HarmonyMethod)(object)from, (HarmonyMethod)(object)to);
		}

		[Obsolete("Harmony.HarmonyMethodExtensions.Clone is obsolete. Please use HarmonyLib.HarmonyMethodExtensions.Clone instead.")]
		public static HarmonyMethod Clone(this HarmonyMethod original)
		{
			return (HarmonyMethod)(object)HarmonyMethodExtensions.Clone((HarmonyMethod)(object)original);
		}

		[Obsolete("Harmony.HarmonyMethodExtensions.Merge is obsolete. Please use HarmonyLib.HarmonyMethodExtensions.Merge instead.")]
		public static HarmonyMethod Merge(this HarmonyMethod master, HarmonyMethod detail)
		{
			return (HarmonyMethod)(object)HarmonyMethodExtensions.Merge((HarmonyMethod)(object)master, (HarmonyMethod)(object)detail);
		}

		[Obsolete("Harmony.HarmonyMethodExtensions.GetHarmonyMethods(Type) is obsolete. Please use HarmonyLib.HarmonyMethodExtensions.GetFromType instead.")]
		public static List<HarmonyMethod> GetHarmonyMethods(this Type type)
		{
			return Array.ConvertAll(HarmonyMethodExtensions.GetFromType(type).ToArray(), (HarmonyMethod x) => (HarmonyMethod)(object)x).ToList();
		}

		[Obsolete("Harmony.HarmonyMethodExtensions.GetHarmonyMethods(MethodBase) is obsolete. Please use HarmonyLib.HarmonyMethodExtensions.GetFromMethod instead.")]
		public static List<HarmonyMethod> GetHarmonyMethods(this MethodBase method)
		{
			return Array.ConvertAll(HarmonyMethodExtensions.GetFromMethod(method).ToArray(), (HarmonyMethod x) => (HarmonyMethod)(object)x).ToList();
		}
	}
	[Obsolete("Harmony.PatchInfoSerialization is Only Here for Compatibility Reasons. Please use HarmonyLib.PatchInfoSerialization instead.")]
	public static class PatchInfoSerialization
	{
		private delegate PatchInfo HarmonyLib_PatchInfoSerialization_Deserialize_Delegate(byte[] bytes);

		private delegate int HarmonyLib_PatchInfoSerialization_PriorityComparer_Delegate(object obj, int index, int priority);

		private static HarmonyLib_PatchInfoSerialization_Deserialize_Delegate HarmonyLib_PatchInfoSerialization_Deserialize = Extensions.CreateDelegate<HarmonyLib_PatchInfoSerialization_Deserialize_Delegate>((MethodBase)AccessTools.Method("HarmonyLib.PatchInfoSerialization:Deserialize", (Type[])null, (Type[])null));

		private static HarmonyLib_PatchInfoSerialization_PriorityComparer_Delegate HarmonyLib_PatchInfoSerialization_PriorityComparer = Extensions.CreateDelegate<HarmonyLib_PatchInfoSerialization_PriorityComparer_Delegate>((MethodBase)AccessTools.Method("HarmonyLib.PatchInfoSerialization:PriorityComparer", (Type[])null, (Type[])null));

		[Obsolete("Harmony.PatchInfoSerialization.Deserialize is Only Here for Compatibility Reasons. Please use HarmonyLib.PatchInfoSerialization.Deserialize instead.")]
		public static PatchInfo Deserialize(byte[] bytes)
		{
			return (PatchInfo)(object)HarmonyLib_PatchInfoSerialization_Deserialize(bytes);
		}

		[Obsolete("Harmony.PatchInfoSerialization.PriorityComparer is Only Here for Compatibility Reasons. Please use HarmonyLib.PatchInfoSerialization.PriorityComparer instead.")]
		public static int PriorityComparer(object obj, int index, int priority, string[] before, string[] after)
		{
			return HarmonyLib_PatchInfoSerialization_PriorityComparer(obj, index, priority);
		}
	}
	[Serializable]
	[Obsolete("Harmony.PatchInfo is Only Here for Compatibility Reasons. Please use HarmonyLib.PatchInfo instead.")]
	public class PatchInfo : PatchInfo
	{
	}
	[Serializable]
	[Obsolete("Harmony.Patch is Only Here for Compatibility Reasons. Please use HarmonyLib.Patch instead.")]
	public class Patch : IComparable
	{
		public readonly MethodInfo patch;

		private Patch patchWrapper;

		[Obsolete("Harmony.Patch is Only Here for Compatibility Reasons. Please use HarmonyLib.Patch instead.")]
		public Patch(MethodInfo patch, int index, string owner, int priority, string[] before, string[] after)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			this.patch = patch;
			patchWrapper = new Patch(patch, index, owner, priority, before, after, false);
		}

		public MethodInfo GetMethod(MethodBase original)
		{
			return patchWrapper.GetMethod(original);
		}

		public override bool Equals(object obj)
		{
			return ((object)patchWrapper).Equals(obj);
		}

		public int CompareTo(object obj)
		{
			return patchWrapper.CompareTo(obj);
		}

		public override int GetHashCode()
		{
			return ((object)patchWrapper).GetHashCode();
		}
	}
	[Obsolete("Harmony.Priority is Only Here for Compatibility Reasons. Please use HarmonyLib.Priority instead.")]
	public static class Priority
	{
		[Obsolete("Harmony.Priority.Last is Only Here for Compatibility Reasons. Please use HarmonyLib.Priority.Last instead.")]
		public const int Last = 0;

		[Obsolete("Harmony.Priority.VeryLow is Only Here for Compatibility Reasons. Please use HarmonyLib.Priority.VeryLow instead.")]
		public const int VeryLow = 100;

		[Obsolete("Harmony.Priority.Low is Only Here for Compatibility Reasons. Please use HarmonyLib.Priority.Low instead.")]
		public const int Low = 200;

		[Obsolete("Harmony.Priority.LowerThanNormal is Only Here for Compatibility Reasons. Please use HarmonyLib.Priority.LowerThanNormal instead.")]
		public const int LowerThanNormal = 300;

		[Obsolete("Harmony.Priority.Normal is Only Here for Compatibility Reasons. Please use HarmonyLib.Priority.Normal instead.")]
		public const int Normal = 400;

		[Obsolete("Harmony.Priority.HigherThanNormal is Only Here for Compatibility Reasons. Please use HarmonyLib.Priority.HigherThanNormal instead.")]
		public const int HigherThanNormal = 500;

		[Obsolete("Harmony.Priority.High is Only Here for Compatibility Reasons. Please use HarmonyLib.Priority.High instead.")]
		public const int High = 600;

		[Obsolete("Harmony.Priority.VeryHigh is Only Here for Compatibility Reasons. Please use HarmonyLib.Priority.VeryHigh instead.")]
		public const int VeryHigh = 700;

		[Obsolete("Harmony.Priority.First is Only Here for Compatibility Reasons. Please use HarmonyLib.Priority.First instead.")]
		public const int First = 800;
	}
	[Obsolete("Harmony.AccessTools is Only Here for Compatibility Reasons. Please use HarmonyLib.AccessTools instead.")]
	public static class AccessTools
	{
		public delegate ref U FieldRef<T, U>(T obj);

		public static BindingFlags all = AccessTools.all;

		public static Type TypeByName(string name)
		{
			return AccessTools.TypeByName(name);
		}

		public static T FindIncludingBaseTypes<T>(Type type, Func<Type, T> action) where T : class
		{
			return AccessTools.FindIncludingBaseTypes<T>(type, action);
		}

		public static T FindIncludingInnerTypes<T>(Type type, Func<Type, T> action) where T : class
		{
			return AccessTools.FindIncludingInnerTypes<T>(type, action);
		}

		public static FieldInfo Field(Type type, string name)
		{
			return AccessTools.Field(type, name);
		}

		public static FieldInfo Field(Type type, int idx)
		{
			return AccessTools.DeclaredField(type, idx);
		}

		public static PropertyInfo DeclaredProperty(Type type, string name)
		{
			return AccessTools.DeclaredProperty(type, name);
		}

		public static PropertyInfo Property(Type type, string name)
		{
			return AccessTools.Property(type, name);
		}

		public static MethodInfo DeclaredMethod(Type type, string name, Type[] parameters = null, Type[] generics = null)
		{
			return AccessTools.DeclaredMethod(type, name, parameters, generics);
		}

		public static MethodInfo Method(Type type, string name, Type[] parameters = null, Type[] generics = null)
		{
			return AccessTools.Method(type, name, parameters, generics);
		}

		public static MethodInfo Method(string typeColonMethodname, Type[] parameters = null, Type[] generics = null)
		{
			return AccessTools.Method(typeColonMethodname, parameters, generics);
		}

		public static List<string> GetMethodNames(Type type)
		{
			return AccessTools.GetMethodNames(type);
		}

		public static List<string> GetMethodNames(object instance)
		{
			return AccessTools.GetMethodNames(instance);
		}

		public static ConstructorInfo DeclaredConstructor(Type type, Type[] parameters = null)
		{
			return AccessTools.DeclaredConstructor(type, parameters, false);
		}

		public static ConstructorInfo Constructor(Type type, Type[] parameters = null)
		{
			return AccessTools.Constructor(type, parameters, false);
		}

		public static List<ConstructorInfo> GetDeclaredConstructors(Type type)
		{
			return AccessTools.GetDeclaredConstructors(type, (bool?)null);
		}

		public static List<MethodInfo> GetDeclaredMethods(Type type)
		{
			return AccessTools.GetDeclaredMethods(type);
		}

		public static List<PropertyInfo> GetDeclaredProperties(Type type)
		{
			return AccessTools.GetDeclaredProperties(type);
		}

		public static List<FieldInfo> GetDeclaredFields(Type type)
		{
			return AccessTools.GetDeclaredFields(type);
		}

		public static Type GetReturnedType(MethodBase method)
		{
			return AccessTools.GetReturnedType(method);
		}

		public static Type Inner(Type type, string name)
		{
			return AccessTools.Inner(type, name);
		}

		public static Type FirstInner(Type type, Func<Type, bool> predicate)
		{
			return AccessTools.FirstInner(type, predicate);
		}

		public static MethodInfo FirstMethod(Type type, Func<MethodInfo, bool> predicate)
		{
			return AccessTools.FirstMethod(type, predicate);
		}

		public static ConstructorInfo FirstConstructor(Type type, Func<ConstructorInfo, bool> predicate)
		{
			return AccessTools.FirstConstructor(type, predicate);
		}

		public static PropertyInfo FirstProperty(Type type, Func<PropertyInfo, bool> predicate)
		{
			return AccessTools.FirstProperty(type, predicate);
		}

		public static Type[] GetTypes(object[] parameters)
		{
			return AccessTools.GetTypes(parameters);
		}

		public static List<string> GetFieldNames(Type type)
		{
			return AccessTools.GetFieldNames(type);
		}

		public static List<string> GetFieldNames(object instance)
		{
			return AccessTools.GetFieldNames(instance);
		}

		public static List<string> GetPropertyNames(Type type)
		{
			return AccessTools.GetPropertyNames(type);
		}

		public static List<string> GetPropertyNames(object instance)
		{
			return AccessTools.GetPropertyNames(instance);
		}

		public static FieldRef<T, U> FieldRefAccess<T, U>(string fieldName)
		{
			return ConvertFieldRef<T, U>(AccessTools.FieldRefAccess<T, U>(fieldName));
		}

		public static ref U FieldRefAccess<T, U>(T instance, string fieldName)
		{
			return ref FieldRefAccess<T, U>(fieldName)(instance);
		}

		private static FieldRef<T, U> ConvertFieldRef<T, U>(FieldRef<T, U> sourceDelegate)
		{
			return (FieldRef<T, U>)Delegate.CreateDelegate(typeof(FieldRef<T, U>), ((Delegate)(object)sourceDelegate).Target, ((Delegate)(object)sourceDelegate).Method);
		}

		public static void ThrowMissingMemberException(Type type, params string[] names)
		{
			AccessTools.ThrowMissingMemberException(type, names);
		}

		public static object GetDefaultValue(Type type)
		{
			return AccessTools.GetDefaultValue(type);
		}

		public static object CreateInstance(Type type)
		{
			return AccessTools.CreateInstance(type);
		}

		public static bool IsStruct(Type type)
		{
			return AccessTools.IsStruct(type);
		}

		public static bool IsClass(Type type)
		{
			return AccessTools.IsClass(type);
		}

		public static bool IsValue(Type type)
		{
			return AccessTools.IsValue(type);
		}

		public static bool IsVoid(Type type)
		{
			return AccessTools.IsVoid(type);
		}
	}
	[Obsolete("Harmony.GeneralExtensions is Only Here for Compatibility Reasons. Please use HarmonyLib.GeneralExtensions instead.")]
	public static class GeneralExtensions
	{
		[Obsolete("Harmony.GeneralExtensions.Join is Only Here for Compatibility Reasons. Please use HarmonyLib.GeneralExtensions.Join instead.")]
		public static string Join<T>(this IEnumerable<T> enumeration, Func<T, string> converter = null, string delimiter = ", ")
		{
			return GeneralExtensions.Join<T>(enumeration, converter, delimiter);
		}

		[Obsolete("Harmony.GeneralExtensions.Description is Only Here for Compatibility Reasons. Please use HarmonyLib.GeneralExtensions.Description instead.")]
		public static string Description(this Type[] parameters)
		{
			return GeneralExtensions.Description(parameters);
		}

		[Obsolete("Harmony.GeneralExtensions.FullDescription is Only Here for Compatibility Reasons. Please use HarmonyLib.GeneralExtensions.FullDescription instead.")]
		public static string FullDescription(this MethodBase method)
		{
			return GeneralExtensions.FullDescription(method);
		}

		[Obsolete("Harmony.GeneralExtensions.Types is Only Here for Compatibility Reasons. Please use HarmonyLib.GeneralExtensions.Types instead.")]
		public static Type[] Types(this ParameterInfo[] pinfo)
		{
			return GeneralExtensions.Types(pinfo);
		}

		[Obsolete("Harmony.GeneralExtensions.GetValueSafe is Only Here for Compatibility Reasons. Please use HarmonyLib.GeneralExtensions.GetValueSafe instead.")]
		public static T GetValueSafe<S, T>(this Dictionary<S, T> dictionary, S key)
		{
			return GeneralExtensions.GetValueSafe<S, T>(dictionary, key);
		}

		[Obsolete("Harmony.GeneralExtensions.GetTypedValue is Only Here for Compatibility Reasons. Please use HarmonyLib.GeneralExtensions.GetTypedValue instead.")]
		public static T GetTypedValue<T>(this Dictionary<string, object> dictionary, string key)
		{
			return GeneralExtensions.GetTypedValue<T>(dictionary, key);
		}
	}
	[Obsolete("Harmony.CollectionExtensions is Only Here for Compatibility Reasons. Please use HarmonyLib.CollectionExtensions instead.")]
	public static class CollectionExtensions
	{
		[Obsolete("Harmony.CollectionExtensions.Do is Only Here for Compatibility Reasons. Please use HarmonyLib.CollectionExtensions.Do instead.")]
		public static void Do<T>(this IEnumerable<T> sequence, Action<T> action)
		{
			CollectionExtensions.Do<T>(sequence, action);
		}

		[Obsolete("Harmony.CollectionExtensions.DoIf is Only Here for Compatibility Reasons. Please use HarmonyLib.CollectionExtensions.DoIf instead.")]
		public static void DoIf<T>(this IEnumerable<T> sequence, Func<T, bool> condition, Action<T> action)
		{
			CollectionExtensions.DoIf<T>(sequence, condition, action);
		}

		[Obsolete("Harmony.CollectionExtensions.Add is Only Here for Compatibility Reasons. Please use HarmonyLib.CollectionExtensions.Add instead.")]
		public static IEnumerable<T> Add<T>(this IEnumerable<T> sequence, T item)
		{
			return CollectionExtensions.AddItem<T>(sequence, item);
		}

		[Obsolete("Harmony.CollectionExtensions.AddRangeToArray is Only Here for Compatibility Reasons. Please use HarmonyLib.CollectionExtensions.AddRangeToArray instead.")]
		public static T[] AddRangeToArray<T>(this T[] sequence, T[] items)
		{
			return CollectionExtensions.AddRangeToArray<T>(sequence, items);
		}

		[Obsolete("Harmony.CollectionExtensions.AddToArray is Only Here for Compatibility Reasons. Please use HarmonyLib.CollectionExtensions.AddToArray instead.")]
		public static T[] AddToArray<T>(this T[] sequence, T item)
		{
			return CollectionExtensions.AddToArray<T>(sequence, item);
		}
	}
	[Obsolete("Harmony.SymbolExtensions is Only Here for Compatibility Reasons. Please use HarmonyLib.SymbolExtensions instead.")]
	public static class SymbolExtensions
	{
		[Obsolete("Harmony.SymbolExtensions.GetMethodInfo is Only Here for Compatibility Reasons. Please use HarmonyLib.SymbolExtensions.GetMethodInfo instead.")]
		public static MethodInfo GetMethodInfo(Expression<Action> expression)
		{
			return SymbolExtensions.GetMethodInfo(expression);
		}

		[Obsolete("Harmony.SymbolExtensions.GetMethodInfo is Only Here for Compatibility Reasons. Please use HarmonyLib.SymbolExtensions.GetMethodInfo instead.")]
		public static MethodInfo GetMethodInfo<T>(Expression<Action<T>> expression)
		{
			return GetMethodInfo((LambdaExpression)expression);
		}

		[Obsolete("Harmony.SymbolExtensions.GetMethodInfo is Only Here for Compatibility Reasons. Please use HarmonyLib.SymbolExtensions.GetMethodInfo instead.")]
		public static MethodInfo GetMethodInfo<T, TResult>(Expression<Func<T, TResult>> expression)
		{
			return GetMethodInfo((LambdaExpression)expression);
		}

		[Obsolete("Harmony.SymbolExtensions.GetMethodInfo is Only Here for Compatibility Reasons. Please use HarmonyLib.SymbolExtensions.GetMethodInfo instead.")]
		public static MethodInfo GetMethodInfo(LambdaExpression expression)
		{
			return SymbolExtensions.GetMethodInfo(expression);
		}
	}
	[Obsolete("Harmony.HarmonyShield is Only Here for Compatibility Reasons. Please use MelonLoader.PatchShield instead.")]
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method)]
	public class HarmonyShield : PatchShield
	{
	}
}
namespace MelonLoader
{
	[AttributeUsage(AttributeTargets.Assembly)]
	public class HarmonyDontPatchAllAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class MelonAdditionalDependenciesAttribute : Attribute
	{
		public string[] AssemblyNames { get; internal set; }

		public MelonAdditionalDependenciesAttribute(params string[] assemblyNames)
		{
			AssemblyNames = assemblyNames;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class MelonAuthorColorAttribute : Attribute
	{
		public ConsoleColor Color { get; internal set; }

		public MelonAuthorColorAttribute()
		{
			Color = MelonLogger.DefaultTextColor;
		}

		public MelonAuthorColorAttribute(ConsoleColor color)
		{
			Color = ((color == ConsoleColor.Black) ? MelonLogger.DefaultMelonColor : color);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class MelonColorAttribute : Attribute
	{
		public ConsoleColor Color { get; internal set; }

		public MelonColorAttribute()
		{
			Color = MelonLogger.DefaultMelonColor;
		}

		public MelonColorAttribute(ConsoleColor color)
		{
			Color = ((color == ConsoleColor.Black) ? MelonLogger.DefaultMelonColor : color);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	public class MelonGameAttribute : Attribute
	{
		public string Developer { get; internal set; }

		public string Name { get; internal set; }

		public bool Universal => string.IsNullOrEmpty(Developer) || Developer.Equals("UNKNOWN") || string.IsNullOrEmpty(Name) || Name.Equals("UNKNOWN");

		public MelonGameAttribute(string developer = null, string name = null)
		{
			Developer = developer;
			Name = name;
		}

		public bool IsCompatible(string developer, string gameName)
		{
			return Universal || (!string.IsNullOrEmpty(developer) && Developer.Equals(developer) && !string.IsNullOrEmpty(gameName) && Name.Equals(gameName));
		}

		public bool IsCompatible(MelonGameAttribute att)
		{
			return IsCompatibleBecauseUniversal(att) || (att.Developer.Equals(Developer) && att.Name.Equals(Name));
		}

		public bool IsCompatibleBecauseUniversal(MelonGameAttribute att)
		{
			return att == null || Universal || att.Universal;
		}

		[Obsolete("IsCompatible(MelonModGameAttribute) is obsolete. Please use IsCompatible(MelonGameAttribute) instead.")]
		public bool IsCompatible(MelonModGameAttribute att)
		{
			return att == null || IsCompatibleBecauseUniversal(att) || (att.Developer.Equals(Developer) && att.GameName.Equals(Name));
		}

		[Obsolete("IsCompatible(MelonPluginGameAttribute) is obsolete. Please use IsCompatible(MelonGameAttribute) instead.")]
		public bool IsCompatible(MelonPluginGameAttribute att)
		{
			return att == null || IsCompatibleBecauseUniversal(att) || (att.Developer.Equals(Developer) && att.GameName.Equals(Name));
		}

		[Obsolete("IsCompatibleBecauseUniversal(MelonModGameAttribute) is obsolete. Please use IsCompatible(MelonGameAttribute) instead.")]
		public bool IsCompatibleBecauseUniversal(MelonModGameAttribute att)
		{
			return att == null || Universal || string.IsNullOrEmpty(att.Developer) || string.IsNullOrEmpty(att.GameName);
		}

		[Obsolete("IsCompatibleBecauseUniversal(MelonPluginGameAttribute) is obsolete. Please use IsCompatible(MelonGameAttribute) instead.")]
		public bool IsCompatibleBecauseUniversal(MelonPluginGameAttribute att)
		{
			return att == null || Universal || string.IsNullOrEmpty(att.Developer) || string.IsNullOrEmpty(att.GameName);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	public class MelonGameVersionAttribute : Attribute
	{
		public string Version { get; internal set; }

		public bool Universal => string.IsNullOrEmpty(Version);

		public MelonGameVersionAttribute(string version = null)
		{
			Version = version;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class MelonIDAttribute : Attribute
	{
		public string ID { get; internal set; }

		public MelonIDAttribute(string id)
		{
			ID = id;
		}

		public MelonIDAttribute(int id)
		{
			ID = id.ToString();
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class MelonIncompatibleAssembliesAttribute : Attribute
	{
		public string[] AssemblyNames { get; internal set; }

		public MelonIncompatibleAssembliesAttribute(params string[] assemblyNames)
		{
			AssemblyNames = assemblyNames;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class MelonInfoAttribute : Attribute
	{
		public Type SystemType { get; internal set; }

		public string Name { get; internal set; }

		public string Version { get; internal set; }

		public SemVersion SemanticVersion { get; internal set; }

		public string Author { get; internal set; }

		public string DownloadLink { get; internal set; }

		public MelonInfoAttribute(Type type, string name, string version, string author, string downloadLink = null)
		{
			if ((object)type == null)
			{
				throw new ArgumentNullException("type");
			}
			SystemType = type;
			Name = name ?? "UNKNOWN";
			Author = author ?? "UNKNOWN";
			DownloadLink = downloadLink;
			if (string.IsNullOrEmpty(version))
			{
				Version = "1.0.0";
			}
			else
			{
				Version = version;
			}
			if (SemVersion.TryParse(Version, out var semver))
			{
				SemanticVersion = semver;
			}
		}

		public MelonInfoAttribute(Type type, string name, int versionMajor, int versionMinor, int versionRevision, string versionIdentifier, string author, string downloadLink = null)
			: this(type, name, string.Format("{0}.{1}.{2}{3}", versionMajor, versionMinor, versionRevision, string.IsNullOrEmpty(versionIdentifier) ? "" : versionIdentifier), author, downloadLink)
		{
		}

		public MelonInfoAttribute(Type type, string name, int versionMajor, int versionMinor, int versionRevision, string author, string downloadLink = null)
			: this(type, name, versionMajor, versionMinor, versionRevision, null, author, downloadLink)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class MelonOptionalDependenciesAttribute : Attribute
	{
		public string[] AssemblyNames { get; internal set; }

		public MelonOptionalDependenciesAttribute(params string[] assemblyNames)
		{
			AssemblyNames = assemblyNames;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class MelonPlatformAttribute : Attribute
	{
		public enum CompatiblePlatforms
		{
			UNIVERSAL,
			WINDOWS_X86,
			WINDOWS_X64
		}

		public CompatiblePlatforms[] Platforms { get; internal set; }

		public MelonPlatformAttribute(params CompatiblePlatforms[] platforms)
		{
			Platforms = platforms;
		}

		public bool IsCompatible(CompatiblePlatforms platform)
		{
			return Platforms == null || Platforms.Length == 0 || Platforms.Contains(platform);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class MelonPlatformDomainAttribute : Attribute
	{
		public enum CompatibleDomains
		{
			UNIVERSAL,
			MONO,
			IL2CPP
		}

		public CompatibleDomains Domain { get; internal set; }

		public MelonPlatformDomainAttribute(CompatibleDomains domain = CompatibleDomains.UNIVERSAL)
		{
			Domain = domain;
		}

		public bool IsCompatible(CompatibleDomains domain)
		{
			return Domain == CompatibleDomains.UNIVERSAL || domain == CompatibleDomains.UNIVERSAL || Domain == domain;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class MelonPriorityAttribute : Attribute
	{
		public int Priority;

		public MelonPriorityAttribute(int priority = 0)
		{
			Priority = priority;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	public class MelonProcessAttribute : Attribute
	{
		public string EXE_Name { get; internal set; }

		public bool Universal => string.IsNullOrEmpty(EXE_Name);

		public MelonProcessAttribute(string exe_name = null)
		{
			EXE_Name = RemoveExtension(exe_name);
		}

		public bool IsCompatible(string processName)
		{
			return Universal || string.IsNullOrEmpty(processName) || RemoveExtension(processName) == EXE_Name;
		}

		private string RemoveExtension(string name)
		{
			return (name == null) ? null : (name.EndsWith(".exe") ? name.Remove(name.Length - 4) : name);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method)]
	public class PatchShield : Attribute
	{
		private static FieldRef<object, MethodBase> PatchProcessor_OriginalRef;

		private static void LogException(Exception ex)
		{
			MelonLogger.Warning($"Patch Shield Exception: {ex}");
		}

		private static bool MethodCheck(MethodBase method)
		{
			return (object)method != null && method.DeclaringType.Assembly.GetCustomAttributes(typeof(PatchShield), inherit: false).Length == 0 && method.DeclaringType.GetCustomAttributes(typeof(PatchShield), inherit: false).Length == 0 && method.GetCustomAttributes(typeof(PatchShield), inherit: false).Length == 0;
		}

		internal static void Install()
		{
			Type typeFromHandle = typeof(PatchProcessor);
			Type typeFromHandle2 = typeof(PatchShield);
			PatchProcessor_OriginalRef = AccessTools.FieldRefAccess<MethodBase>(typeFromHandle, "original");
			try
			{
				Core.HarmonyInstance.Patch((MethodBase)AccessTools.Method("HarmonyLib.PatchFunctions:ReversePatch", (Type[])null, (Type[])null), AccessTools.Method(typeFromHandle2, "PatchMethod_PatchFunctions_ReversePatch", (Type[])null, (Type[])null).ToNewHarmonyMethod(), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			catch (Exception ex)
			{
				LogException(ex);
			}
			try
			{
				HarmonyMethod val = AccessTools.Method(typeFromHandle2, "PatchMethod_PatchProcessor_Unpatch", (Type[])null, (Type[])null).ToNewHarmonyMethod();
				foreach (MethodInfo item in from x in typeFromHandle.GetMethods(BindingFlags.Instance | BindingFlags.Public)
					where x.Name.Equals("Unpatch")
					select x)
				{
					Core.HarmonyInstance.Patch((MethodBase)item, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
			catch (Exception ex2)
			{
				LogException(ex2);
			}
			try
			{
				Core.HarmonyInstance.Patch((MethodBase)AccessTools.Method(typeFromHandle, "Patch", (Type[])null, (Type[])null), AccessTools.Method(typeFromHandle2, "PatchMethod_PatchProcessor_Patch", (Type[])null, (Type[])null).ToNewHarmonyMethod(), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			catch (Exception ex3)
			{
				LogException(ex3);
			}
			Hook.OnDetour = (Func<Hook, MethodBase, MethodBase, object, bool>)Delegate.Combine(Hook.OnDetour, (Func<Hook, MethodBase, MethodBase, object, bool>)((Hook detour, MethodBase originalMethod, MethodBase patchMethod, object delegateTarget) => MethodCheck(originalMethod)));
			ILHook.OnDetour = (Func<ILHook, MethodBase, Manipulator, bool>)Delegate.Combine(ILHook.OnDetour, (Func<ILHook, MethodBase, Manipulator, bool>)((ILHook detour, MethodBase originalMethod, Manipulator ilmanipulator) => MethodCheck(originalMethod)));
			Detour.OnDetour = (Func<Detour, MethodBase, MethodBase, bool>)Delegate.Combine(Detour.OnDetour, (Func<Detour, MethodBase, MethodBase, bool>)((Detour detour, MethodBase originalMethod, MethodBase patchMethod) => MethodCheck(originalMethod)));
		}

		private static bool PatchMethod_PatchFunctions_ReversePatch(MethodBase __1)
		{
			return MethodCheck(__1);
		}

		private static bool PatchMethod_PatchProcessor_Patch(PatchProcessor __instance)
		{
			return MethodCheck(PatchProcessor_OriginalRef.Invoke((object)__instance));
		}

		private static bool PatchMethod_PatchProcessor_Unpatch(PatchProcessor __instance)
		{
			return MethodCheck(PatchProcessor_OriginalRef.Invoke((object)__instance));
		}
	}
	[AttributeUsage(AttributeTargets.Class)]
	public class RegisterTypeInIl2Cpp : Attribute
	{
		internal static List<Assembly> registrationQueue = new List<Assembly>();

		internal static bool ready;

		internal bool LogSuccess = true;

		public RegisterTypeInIl2Cpp()
		{
		}

		public RegisterTypeInIl2Cpp(bool logSuccess)
		{
			LogSuccess = logSuccess;
		}

		public static void RegisterAssembly(Assembly asm)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return;
			}
			if (!ready)
			{
				registrationQueue.Add(asm);
				return;
			}
			IEnumerable<Type> validTypes = asm.GetValidTypes();
			if (validTypes == null || validTypes.Count() <= 0)
			{
				return;
			}
			foreach (Type item in validTypes)
			{
				object[] customAttributes = item.GetCustomAttributes(typeof(RegisterTypeInIl2Cpp), inherit: false);
				if (customAttributes != null && customAttributes.Length != 0)
				{
					RegisterTypeInIl2Cpp registerTypeInIl2Cpp = (RegisterTypeInIl2Cpp)customAttributes[0];
					if (registerTypeInIl2Cpp != null)
					{
						UnhollowerSupport.RegisterTypeInIl2CppDomain(item, registerTypeInIl2Cpp.LogSuccess);
					}
				}
			}
		}

		internal static void SetReady()
		{
			ready = true;
			if (registrationQueue == null)
			{
				return;
			}
			foreach (Assembly item in registrationQueue)
			{
				RegisterAssembly(item);
			}
			registrationQueue = null;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class VerifyLoaderBuildAttribute : Attribute
	{
		public string HashCode { get; internal set; }

		public VerifyLoaderBuildAttribute(string hashcode)
		{
			HashCode = hashcode;
		}

		public bool IsCompatible(string hashCode)
		{
			return string.IsNullOrEmpty(HashCode) || string.IsNullOrEmpty(hashCode) || HashCode == hashCode;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly)]
	public class VerifyLoaderVersionAttribute : Attribute
	{
		public SemVersion SemVer { get; private set; }

		public int Major { get; }

		public int Minor { get; }

		public int Patch { get; }

		public bool IsMinimum { get; private set; }

		public VerifyLoaderVersionAttribute(int major, int minor, int patch)
			: this(new SemVersion(major, minor, patch), is_minimum: false)
		{
		}

		public VerifyLoaderVersionAttribute(int major, int minor, int patch, bool is_minimum)
			: this(new SemVersion(major, minor, patch), is_minimum)
		{
		}

		public VerifyLoaderVersionAttribute(string version)
			: this(version, is_minimum: false)
		{
		}

		public VerifyLoaderVersionAttribute(string version, bool is_minimum)
			: this(SemVersion.Parse(version), is_minimum)
		{
		}

		public VerifyLoaderVersionAttribute(SemVersion semver, bool is_minimum)
		{
			SemVer = semver;
			IsMinimum = is_minimum;
		}

		public bool IsCompatible(SemVersion version)
		{
			return SemVer == null || version == null || (IsMinimum ? (SemVer <= version) : (SemVer == version));
		}

		public bool IsCompatible(string version)
		{
			SemVersion semver;
			return !SemVersion.TryParse(version, out semver) || IsCompatible(semver);
		}
	}
	public static class bHaptics
	{
		[Obsolete("MelonLoader.bHaptics.DeviceType is Only Here for Compatibility Reasons.")]
		public enum DeviceType
		{
			None,
			Tactal,
			TactSuit,
			Tactosy_arms,
			Tactosy_hands,
			Tactosy_feet
		}

		[Obsolete("MelonLoader.bHaptics.PositionType is Only Here for Compatibility Reasons. Please use bHapticsLib.PositionID instead.")]
		public enum PositionType
		{
			All = 0,
			Left = 1,
			Right = 2,
			Vest = 3,
			Head = 4,
			Racket = 5,
			HandL = 6,
			HandR = 7,
			FootL = 8,
			FootR = 9,
			ForearmL = 10,
			ForearmR = 11,
			VestFront = 201,
			VestBack = 202,
			GloveLeft = 203,
			GloveRight = 204,
			Custom1 = 251,
			Custom2 = 252,
			Custom3 = 253,
			Custom4 = 254
		}

		[Obsolete("MelonLoader.bHaptics.RotationOption is Only Here for Compatibility Reasons. Please use bHapticsLib.RotationOption instead.")]
		public class RotationOption
		{
			public float OffsetX;

			public float OffsetY;

			public RotationOption(float offsetX, float offsetY)
			{
				OffsetX = offsetX;
				OffsetY = offsetY;
			}

			public override string ToString()
			{
				return "RotationOption { OffsetX=" + OffsetX + ", OffsetY=" + OffsetY + " }";
			}
		}

		[Obsolete("MelonLoader.bHaptics.ScaleOption is Only Here for Compatibility Reasons. Please use bHapticsLib.ScaleOption instead.")]
		public class ScaleOption
		{
			public float Intensity;

			public float Duration;

			public ScaleOption(float intensity = 1f, float duration = 1f)
			{
				Intensity = intensity;
				Duration = duration;
			}

			public override string ToString()
			{
				return "ScaleOption { Intensity=" + Intensity + ", Duration=" + Duration + " }";
			}
		}

		[Obsolete("MelonLoader.bHaptics.DotPoint is Only Here for Compatibility Reasons. Please use bHapticsLib.DotPoint instead.")]
		public class DotPoint
		{
			public int Index;

			public int Intensity;

			public DotPoint(int index, int intensity = 50)
			{
				if (index < 0 || index > 19)
				{
					throw new Exception("Invalid argument index : " + index);
				}
				Intensity = MelonUtils.Clamp(intensity, 0, 100);
				Index = index;
			}

			public override string ToString()
			{
				return "DotPoint { Index=" + Index + ", Intensity=" + Intensity + " }";
			}
		}

		[Obsolete("MelonLoader.bHaptics.PathPoint is Only Here for Compatibility Reasons. Please use bHapticsLib.PathPoint instead.")]
		public struct PathPoint
		{
			public float X;

			public float Y;

			public int Intensity;

			public int MotorCount;

			public PathPoint(float x, float y, int intensity = 50, int motorCount = 3)
			{
				X = MelonUtils.Clamp(x, 0f, 1f);
				Y = MelonUtils.Clamp(y, 0f, 1f);
				Intensity = MelonUtils.Clamp(intensity, 0, 100);
				MotorCount = MelonUtils.Clamp(motorCount, 0, 3);
			}

			public override string ToString()
			{
				return "PathPoint { X=" + X + ", Y=" + Y + ", MotorCount=" + MotorCount + ", Intensity=" + Intensity + " }";
			}
		}

		[Obsolete("MelonLoader.bHaptics.FeedbackStatus is Only Here for Compatibility Reasons.")]
		public struct FeedbackStatus
		{
			[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
			public int[] values;
		}

		private static Converter<DotPoint, DotPoint> DotPointConverter = (DotPoint x) => new DotPoint(0, 50)
		{
			Index = x.Index,
			Intensity = x.Intensity
		};

		private static Converter<PathPoint, PathPoint> PathPointConverter = (PathPoint x) => new PathPoint(0f, 0f, 50, 3)
		{
			X = x.X,
			Y = x.Y,
			Intensity = x.Intensity,
			MotorCount = x.MotorCount
		};

		public static bool WasError => false;

		[Obsolete("MelonLoader.bHaptics.IsPlaying is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.IsPlayingAny instead.")]
		public static bool IsPlaying()
		{
			return bHapticsManager.IsPlayingAny();
		}

		[Obsolete("MelonLoader.bHaptics.IsPlaying(string) is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.IsPlaying instead.")]
		public static bool IsPlaying(string key)
		{
			return bHapticsManager.IsPlaying(key);
		}

		[Obsolete("MelonLoader.bHaptics.IsDeviceConnected(DeviceType, bool) is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.IsDeviceConnected instead.")]
		public static bool IsDeviceConnected(DeviceType type, bool isLeft = true)
		{
			return IsDeviceConnected(DeviceTypeToPositionType(type, isLeft));
		}

		[Obsolete("MelonLoader.bHaptics.IsDeviceConnected(PositionType) is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.IsDeviceConnected instead.")]
		public static bool IsDeviceConnected(PositionType type)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return bHapticsManager.IsDeviceConnected(PositionTypeToPositionID(type));
		}

		[Obsolete("MelonLoader.bHaptics.IsFeedbackRegistered is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.IsPatternRegistered instead.")]
		public static bool IsFeedbackRegistered(string key)
		{
			return bHapticsManager.IsPatternRegistered(key);
		}

		[Obsolete("MelonLoader.bHaptics.RegisterFeedback is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.RegisterPatternFromJson instead.")]
		public static void RegisterFeedback(string key, string tactFileStr)
		{
			ProxyArray proxyArray = new ProxyArray();
			proxyArray["project"] = MelonLoader.TinyJSON.Decoder.Decode(tactFileStr);
			bHapticsManager.RegisterPatternFromJson(key, MelonLoader.TinyJSON.Encoder.Encode(proxyArray));
		}

		[Obsolete("MelonLoader.bHaptics.RegisterFeedbackFromTactFile is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.RegisterPatternFromJson instead.")]
		public static void RegisterFeedbackFromTactFile(string key, string tactFileStr)
		{
			bHapticsManager.RegisterPatternFromJson(key, tactFileStr);
		}

		[Obsolete("MelonLoader.bHaptics.RegisterFeedbackFromTactFileReflected is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.RegisterPatternSwappedFromJson instead.")]
		public static void RegisterFeedbackFromTactFileReflected(string key, string tactFileStr)
		{
			bHapticsManager.RegisterPatternSwappedFromJson(key, tactFileStr);
		}

		[Obsolete("MelonLoader.bHaptics.SubmitRegistered is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.PlayRegistered instead.")]
		public static void SubmitRegistered(string key)
		{
			bHapticsManager.PlayRegistered(key);
		}

		[Obsolete("MelonLoader.bHaptics.SubmitRegistered is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.PlayRegistered instead.")]
		public static void SubmitRegistered(string key, int startTimeMillis)
		{
			bHapticsManager.PlayRegistered(key, startTimeMillis);
		}

		[Obsolete("MelonLoader.bHaptics.SubmitRegistered is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.PlayRegistered instead.")]
		public static void SubmitRegistered(string key, string altKey, ScaleOption option)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			bHapticsManager.PlayRegistered(key, altKey, new ScaleOption(1f, 1f)
			{
				Duration = option.Duration,
				Intensity = option.Intensity
			});
		}

		[Obsolete("MelonLoader.bHaptics.SubmitRegistered is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.PlayRegistered instead.")]
		public static void SubmitRegistered(string key, string altKey, ScaleOption sOption, RotationOption rOption)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_0059: Expected O, but got Unknown
			bHapticsManager.PlayRegistered(key, altKey, new ScaleOption(1f, 1f)
			{
				Duration = sOption.Duration,
				Intensity = sOption.Intensity
			}, new RotationOption(0f, 0f)
			{
				OffsetAngleX = rOption.OffsetX,
				OffsetY = rOption.OffsetY
			});
		}

		[Obsolete("MelonLoader.bHaptics.TurnOff is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.StopPlayingAll instead.")]
		public static void TurnOff()
		{
			bHapticsManager.StopPlayingAll();
		}

		[Obsolete("MelonLoader.bHaptics.TurnOff(string) is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.StopPlaying instead.")]
		public static void TurnOff(string key)
		{
			bHapticsManager.StopPlaying(key);
		}

		[Obsolete("MelonLoader.bHaptics.Submit is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.Play instead.")]
		public static void Submit(string key, DeviceType type, bool isLeft, byte[] bytes, int durationMillis)
		{
			Submit(key, DeviceTypeToPositionType(type, isLeft), bytes, durationMillis);
		}

		[Obsolete("MelonLoader.bHaptics.Submit is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.Play instead.")]
		public static void Submit(string key, PositionType position, byte[] bytes, int durationMillis)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			bHapticsManager.Play(key, durationMillis, PositionTypeToPositionID(position), bytes);
		}

		[Obsolete("MelonLoader.bHaptics.Submit is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.Play instead.")]
		public static void Submit(string key, DeviceType type, bool isLeft, List<DotPoint> points, int durationMillis)
		{
			Submit(key, DeviceTypeToPositionType(type, isLeft), points, durationMillis);
		}

		[Obsolete("MelonLoader.bHaptics.Submit is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.Play instead.")]
		public static void Submit(string key, PositionType position, List<DotPoint> points, int durationMillis)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			bHapticsManager.Play(key, durationMillis, PositionTypeToPositionID(position), points.ConvertAll(DotPointConverter));
		}

		[Obsolete("MelonLoader.bHaptics.Submit is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.Play instead.")]
		public static void Submit(string key, DeviceType type, bool isLeft, List<PathPoint> points, int durationMillis)
		{
			Submit(key, DeviceTypeToPositionType(type, isLeft), points, durationMillis);
		}

		[Obsolete("MelonLoader.bHaptics.Submit is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.Play instead.")]
		public static void Submit(string key, PositionType position, List<PathPoint> points, int durationMillis)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			bHapticsManager.Play<List<PathPoint>>(key, durationMillis, PositionTypeToPositionID(position), (DotPoint[])null, points.ConvertAll(PathPointConverter));
		}

		[Obsolete("MelonLoader.bHaptics.GetCurrentFeedbackStatus is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.GetDeviceStatus instead.")]
		public static FeedbackStatus GetCurrentFeedbackStatus(DeviceType type, bool isLeft = true)
		{
			return GetCurrentFeedbackStatus(DeviceTypeToPositionType(type, isLeft));
		}

		[Obsolete("MelonLoader.bHaptics.GetCurrentFeedbackStatus is Only Here for Compatibility Reasons. Please use bHapticsLib.bHapticsManager.GetDeviceStatus instead.")]
		public static FeedbackStatus GetCurrentFeedbackStatus(PositionType pos)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			FeedbackStatus result = default(FeedbackStatus);
			result.values = bHapticsManager.GetDeviceStatus(PositionTypeToPositionID(pos));
			return result;
		}

		[Obsolete("MelonLoader.bHaptics.DeviceTypeToPositionType is Only Here for Compatibility Reasons.")]
		public static PositionType DeviceTypeToPositionType(DeviceType pos, bool isLeft = true)
		{
			if (1 == 0)
			{
			}
			PositionType result = pos switch
			{
				DeviceType.Tactal => PositionType.Head, 
				DeviceType.TactSuit => PositionType.Vest, 
				DeviceType.Tactosy_arms => isLeft ? PositionType.ForearmL : PositionType.ForearmR, 
				DeviceType.Tactosy_feet => isLeft ? PositionType.FootL : PositionType.FootR, 
				DeviceType.Tactosy_hands => isLeft ? PositionType.HandL : PositionType.HandR, 
				_ => PositionType.Head, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private static PositionID PositionTypeToPositionID(PositionType pos)
		{
			//IL_0051: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to inval

BepInEx-BepInEx_MLLoader/BepInEx.MelonLoader.Loader/Tomlet.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using Microsoft.CodeAnalysis;
using Tomlet.Attributes;
using Tomlet.Exceptions;
using Tomlet.Models;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("N/A")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("\n            Tomlet allows consumption and creation of TOML files (often used as configuration files) in .NET applications.\n            It supports serialization and deserialization of objects to and from TOML, and is compliant with version 1.0.0 of the TOML specification.\n        ")]
[assembly: AssemblyFileVersion("5.0.0.0")]
[assembly: AssemblyInformationalVersion("5.0.0+6c956664aa89c34c3d8ec0c0342ccd675646589d")]
[assembly: AssemblyProduct("Tomlet")]
[assembly: AssemblyTitle("Tomlet")]
[assembly: AssemblyVersion("5.0.0.0")]
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;
		}
	}
}
namespace Tomlet
{
	internal static class Extensions
	{
		private static readonly HashSet<int> IllegalChars = new HashSet<int>
		{
			0, 1, 2, 3, 4, 5, 6, 7, 8, 11,
			14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
			24, 25, 26, 27, 28, 29, 30, 31, 127
		};

		internal static bool IsWhitespace(this int val)
		{
			if (!val.IsNewline())
			{
				return char.IsWhiteSpace((char)val);
			}
			return false;
		}

		internal static bool IsEquals(this int val)
		{
			return val == 61;
		}

		internal static bool IsSingleQuote(this int val)
		{
			return val == 39;
		}

		internal static bool IsDoubleQuote(this int val)
		{
			return val == 34;
		}

		internal static bool IsHashSign(this int val)
		{
			return val == 35;
		}

		internal static bool IsNewline(this int val)
		{
			if (val != 13)
			{
				return val == 10;
			}
			return true;
		}

		internal static bool IsDigit(this int val)
		{
			return char.IsDigit((char)val);
		}

		internal static bool IsComma(this int val)
		{
			return val == 44;
		}

		internal static bool IsPeriod(this int val)
		{
			return val == 46;
		}

		internal static bool IsEndOfArrayChar(this int val)
		{
			return val == 93;
		}

		internal static bool IsEndOfInlineObjectChar(this int val)
		{
			return val == 125;
		}

		internal static bool IsHexDigit(this char c)
		{
			if (IsDigit(c))
			{
				return true;
			}
			char c2 = char.ToUpperInvariant(c);
			if (c2 >= 'A')
			{
				return c2 <= 'F';
			}
			return false;
		}

		internal static bool TryPeek(this TomletStringReader reader, out int nextChar)
		{
			nextChar = reader.Peek();
			return nextChar != -1;
		}

		internal static int SkipWhitespace(this TomletStringReader reader)
		{
			return reader.ReadWhile((int c) => c.IsWhitespace()).Length;
		}

		internal static void SkipPotentialCarriageReturn(this TomletStringReader reader)
		{
			if (reader.TryPeek(out var nextChar) && nextChar == 13)
			{
				reader.Read();
			}
		}

		internal static void SkipAnyComment(this TomletStringReader reader)
		{
			if (reader.TryPeek(out var nextChar) && nextChar.IsHashSign())
			{
				reader.ReadWhile((int commentChar) => !commentChar.IsNewline());
			}
		}

		internal static int SkipAnyNewlineOrWhitespace(this TomletStringReader reader)
		{
			return reader.ReadWhile((int c) => c.IsNewline() || c.IsWhitespace()).Count((char c) => c == '\n');
		}

		internal static int SkipAnyCommentNewlineWhitespaceEtc(this TomletStringReader reader)
		{
			int num = 0;
			int nextChar;
			while (reader.TryPeek(out nextChar) && (nextChar.IsHashSign() || nextChar.IsNewline() || nextChar.IsWhitespace()))
			{
				if (nextChar.IsHashSign())
				{
					reader.SkipAnyComment();
				}
				num += reader.SkipAnyNewlineOrWhitespace();
			}
			return num;
		}

		internal static int SkipAnyNewline(this TomletStringReader reader)
		{
			return reader.ReadWhile((int c) => c.IsNewline()).Count((char c) => c == '\n');
		}

		internal static char[] ReadChars(this TomletStringReader reader, int count)
		{
			char[] array = new char[count];
			reader.ReadBlock(array, 0, count);
			return array;
		}

		internal static string ReadWhile(this TomletStringReader reader, Predicate<int> predicate)
		{
			StringBuilder stringBuilder = new StringBuilder();
			int nextChar;
			while (reader.TryPeek(out nextChar) && predicate(nextChar))
			{
				stringBuilder.Append((char)reader.Read());
			}
			return stringBuilder.ToString();
		}

		internal static bool ExpectAndConsume(this TomletStringReader reader, char expectWhat)
		{
			if (!reader.TryPeek(out var nextChar))
			{
				return false;
			}
			if (nextChar == expectWhat)
			{
				reader.Read();
				return true;
			}
			return false;
		}

		public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> pair, out TKey one, out TValue two)
		{
			one = pair.Key;
			two = pair.Value;
		}

		public static bool IsNullOrWhiteSpace(this string s)
		{
			if (!string.IsNullOrEmpty(s))
			{
				return string.IsNullOrEmpty(s.Trim());
			}
			return true;
		}

		internal static T? GetCustomAttribute<T>(this MemberInfo info) where T : Attribute
		{
			return (from a in info.GetCustomAttributes(inherit: false)
				where a is T
				select a).Cast<T>().FirstOrDefault();
		}

		internal static void EnsureLegalChar(this int c, int currentLineNum)
		{
			if (IllegalChars.Contains(c))
			{
				throw new TomlUnescapedUnicodeControlCharException(currentLineNum, c);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool RuntimeCorrectContains(this string original, char c)
		{
			return original.Contains(c.ToString());
		}
	}
	internal static class TomlCompositeDeserializer
	{
		public static TomlSerializationMethods.Deserialize<object> For(Type type)
		{
			Type type2 = type;
			TomlSerializationMethods.Deserialize<object> deserialize;
			if (type2.IsEnum)
			{
				TomlSerializationMethods.Deserialize<object> stringDeserializer = TomlSerializationMethods.GetDeserializer(typeof(string));
				deserialize = delegate(TomlValue value)
				{
					string text = (string)stringDeserializer(value);
					try
					{
						return Enum.Parse(type2, text, ignoreCase: true);
					}
					catch (Exception)
					{
						throw new TomlEnumParseException(text, type2);
					}
				};
			}
			else
			{
				FieldInfo[] fields = type2.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				fields = fields.Where((FieldInfo f) => !f.IsNotSerialized && f.GetCustomAttribute<CompilerGeneratedAttribute>() == null).ToArray();
				PropertyInfo[] properties = type2.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				Dictionary<PropertyInfo, TomlPropertyAttribute> propsDict = (from p in properties
					where (object)p.GetSetMethod(nonPublic: true) != null
					select new KeyValuePair<PropertyInfo, TomlPropertyAttribute>(p, p.GetCustomAttribute<TomlPropertyAttribute>())).ToDictionary((KeyValuePair<PropertyInfo, TomlPropertyAttribute> tuple) => tuple.Key, (KeyValuePair<PropertyInfo, TomlPropertyAttribute> tuple) => tuple.Value);
				if (fields.Length + propsDict.Count == 0)
				{
					return delegate
					{
						try
						{
							return Activator.CreateInstance(type2);
						}
						catch (MissingMethodException)
						{
							throw new TomlInstantiationException(type2);
						}
					};
				}
				deserialize = delegate(TomlValue value)
				{
					if (!(value is TomlTable tomlTable))
					{
						throw new TomlTypeMismatchException(typeof(TomlTable), value.GetType(), type2);
					}
					object obj;
					try
					{
						obj = Activator.CreateInstance(type2);
					}
					catch (MissingMethodException)
					{
						throw new TomlInstantiationException(type2);
					}
					FieldInfo[] array = fields;
					foreach (FieldInfo fieldInfo in array)
					{
						if (tomlTable.TryGetValue(fieldInfo.Name, out TomlValue value2))
						{
							object value3;
							try
							{
								value3 = TomlSerializationMethods.GetDeserializer(fieldInfo.FieldType)(value2);
							}
							catch (TomlTypeMismatchException cause)
							{
								throw new TomlFieldTypeMismatchException(type2, fieldInfo, cause);
							}
							fieldInfo.SetValue(obj, value3);
						}
					}
					foreach (KeyValuePair<PropertyInfo, TomlPropertyAttribute> item in propsDict)
					{
						Extensions.Deconstruct(item, out var one, out var two);
						PropertyInfo propertyInfo = one;
						string key = two?.GetMappedString() ?? propertyInfo.Name;
						if (tomlTable.TryGetValue(key, out TomlValue value4))
						{
							object value5;
							try
							{
								value5 = TomlSerializationMethods.GetDeserializer(propertyInfo.PropertyType)(value4);
							}
							catch (TomlTypeMismatchException cause2)
							{
								throw new TomlPropertyTypeMismatchException(type2, propertyInfo, cause2);
							}
							propertyInfo.SetValue(obj, value5, null);
						}
					}
					return obj;
				};
			}
			TomlSerializationMethods.Register(type2, null, deserialize);
			return deserialize;
		}
	}
	internal static class TomlCompositeSerializer
	{
		public static TomlSerializationMethods.Serialize<object> For(Type type)
		{
			Type type2 = type;
			TomlSerializationMethods.Serialize<object> serialize;
			if (type2.IsEnum)
			{
				TomlSerializationMethods.Serialize<object> stringSerializer = TomlSerializationMethods.GetSerializer(typeof(string));
				serialize = (object? o) => stringSerializer(Enum.GetName(type2, o) ?? throw new ArgumentException($"Tomlet: Cannot serialize {o} as an enum of type {type2} because the enum type does not declare a name for that value"));
			}
			else
			{
				FieldInfo[] fields = type2.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				var fieldAttribs = fields.ToDictionary((FieldInfo f) => f, (FieldInfo f) => new
				{
					inline = f.GetCustomAttribute<TomlInlineCommentAttribute>(),
					preceding = f.GetCustomAttribute<TomlPrecedingCommentAttribute>()
				});
				PropertyInfo[] props = type2.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).ToArray();
				var propAttribs = props.ToDictionary((PropertyInfo p) => p, (PropertyInfo p) => new
				{
					inline = p.GetCustomAttribute<TomlInlineCommentAttribute>(),
					preceding = p.GetCustomAttribute<TomlPrecedingCommentAttribute>(),
					prop = p.GetCustomAttribute<TomlPropertyAttribute>()
				});
				bool isForcedNoInline = type2.GetCustomAttribute<TomlDoNotInlineObjectAttribute>() != null;
				fields = fields.Where((FieldInfo f) => !f.IsNotSerialized && f.GetCustomAttribute<CompilerGeneratedAttribute>() == null && !Enumerable.Contains(f.Name, '<')).ToArray();
				if (fields.Length + props.Length == 0)
				{
					return (object? _) => new TomlTable();
				}
				serialize = delegate(object? instance)
				{
					if (instance == null)
					{
						throw new ArgumentNullException("instance", "Object being serialized is null. TOML does not support null values.");
					}
					TomlTable tomlTable = new TomlTable
					{
						ForceNoInline = isForcedNoInline
					};
					FieldInfo[] array = fields;
					foreach (FieldInfo fieldInfo in array)
					{
						object value = fieldInfo.GetValue(instance);
						if (value != null)
						{
							TomlValue tomlValue = TomlSerializationMethods.GetSerializer(fieldInfo.FieldType)(value);
							if (tomlValue != null)
							{
								var anon = fieldAttribs[fieldInfo];
								if (!tomlTable.ContainsKey(fieldInfo.Name))
								{
									tomlValue.Comments.InlineComment = anon.inline?.Comment;
									tomlValue.Comments.PrecedingComment = anon.preceding?.Comment;
									tomlTable.PutValue(fieldInfo.Name, tomlValue);
								}
							}
						}
					}
					PropertyInfo[] array2 = props;
					foreach (PropertyInfo propertyInfo in array2)
					{
						if ((object)propertyInfo.GetGetMethod(nonPublic: true) != null && !(propertyInfo.Name == "EqualityContract"))
						{
							object value2 = propertyInfo.GetValue(instance, null);
							if (value2 != null)
							{
								TomlValue tomlValue2 = TomlSerializationMethods.GetSerializer(propertyInfo.PropertyType)(value2);
								if (tomlValue2 != null)
								{
									var anon2 = propAttribs[propertyInfo];
									tomlValue2.Comments.InlineComment = anon2.inline?.Comment;
									tomlValue2.Comments.PrecedingComment = anon2.preceding?.Comment;
									tomlTable.PutValue(anon2.prop?.GetMappedString() ?? propertyInfo.Name, tomlValue2);
								}
							}
						}
					}
					return tomlTable;
				};
			}
			TomlSerializationMethods.Register(type2, serialize, null);
			return serialize;
		}
	}
	internal static class TomlDateTimeUtils
	{
		private static readonly Regex DateTimeRegex = new Regex("^(?:(\\d+)-(0[1-9]|1[012])-(0[1-9]|[12]\\d|3[01]))?([\\sTt])?(?:([01]\\d|2[0-3]):([0-5]\\d):([0-5]\\d|60)(\\.\\d+)?((?:[Zz])|(?:[\\+|\\-](?:[01]\\d|2[0-3])(?::[0-6][0-9])?(?::[0-6][0-9])?))?)?$", RegexOptions.Compiled);

		internal static TomlValue? ParseDateString(string input, int lineNumber)
		{
			Match match = DateTimeRegex.Match(input);
			bool flag = !match.Groups[1].Value.IsNullOrWhiteSpace();
			bool flag2 = !string.IsNullOrEmpty(match.Groups[4].Value);
			bool flag3 = !match.Groups[5].Value.IsNullOrWhiteSpace();
			bool flag4 = !match.Groups[9].Value.IsNullOrWhiteSpace();
			if (flag && flag3 && !flag2)
			{
				throw new TomlDateTimeMissingSeparatorException(lineNumber);
			}
			if (flag2 && (!flag3 || !flag))
			{
				throw new TomlDateTimeUnnecessarySeparatorException(lineNumber);
			}
			if (flag4 && (!flag3 || !flag))
			{
				throw new TimeOffsetOnTomlDateOrTimeException(lineNumber, match.Groups[9].Value);
			}
			if (!flag)
			{
				return TomlLocalTime.Parse(input);
			}
			if (!flag3)
			{
				return TomlLocalDate.Parse(input);
			}
			if (!flag4)
			{
				return TomlLocalDateTime.Parse(input);
			}
			return TomlOffsetDateTime.Parse(input);
		}
	}
	public static class TomletMain
	{
		[NoCoverage]
		public static void RegisterMapper<T>(TomlSerializationMethods.Serialize<T>? serializer, TomlSerializationMethods.Deserialize<T>? deserializer)
		{
			TomlSerializationMethods.Register(serializer, deserializer);
		}

		public static T To<T>(string tomlString)
		{
			return To<T>(new TomlParser().Parse(tomlString));
		}

		public static T To<T>(TomlValue value)
		{
			return (T)To(typeof(T), value);
		}

		public static object To(Type what, TomlValue value)
		{
			return TomlSerializationMethods.GetDeserializer(what)(value);
		}

		public static TomlValue? ValueFrom<T>(T t)
		{
			if (t == null)
			{
				throw new ArgumentNullException("t");
			}
			return ValueFrom(t.GetType(), t);
		}

		public static TomlValue? ValueFrom(Type type, object t)
		{
			return TomlSerializationMethods.GetSerializer(type)(t);
		}

		public static TomlDocument DocumentFrom<T>(T t)
		{
			if (t == null)
			{
				throw new ArgumentNullException("t");
			}
			return DocumentFrom(t.GetType(), t);
		}

		public static TomlDocument DocumentFrom(Type type, object t)
		{
			TomlValue tomlValue = ValueFrom(type, t);
			if (!(tomlValue is TomlDocument result))
			{
				if (tomlValue is TomlTable from)
				{
					return new TomlDocument(from);
				}
				throw new TomlPrimitiveToDocumentException(type);
			}
			return result;
		}

		public static string TomlStringFrom<T>(T t)
		{
			return DocumentFrom(t).SerializedValue;
		}

		public static string TomlStringFrom(Type type, object t)
		{
			return DocumentFrom(type, t).SerializedValue;
		}
	}
	public class TomletStringReader : IDisposable
	{
		private string? _s;

		private int _pos;

		private int _length;

		public TomletStringReader(string s)
		{
			_s = s;
			_length = s.Length;
		}

		public void Backtrack(int amount)
		{
			if (_pos < amount)
			{
				throw new Exception("Cannot backtrack past the beginning of the string");
			}
			_pos -= amount;
		}

		public void Dispose()
		{
			_s = null;
			_pos = 0;
			_length = 0;
		}

		public int Peek()
		{
			if (_pos != _length)
			{
				return _s[_pos];
			}
			return -1;
		}

		public int Read()
		{
			if (_pos != _length)
			{
				return _s[_pos++];
			}
			return -1;
		}

		public int Read(char[] buffer, int index, int count)
		{
			int num = _length - _pos;
			if (num <= 0)
			{
				return num;
			}
			if (num > count)
			{
				num = count;
			}
			_s.CopyTo(_pos, buffer, index, num);
			_pos += num;
			return num;
		}

		public int ReadBlock(char[] buffer, int index, int count)
		{
			int num = 0;
			int num2;
			do
			{
				num += (num2 = Read(buffer, index + num, count - num));
			}
			while (num2 > 0 && num < count);
			return num;
		}
	}
	internal static class TomlKeyUtils
	{
		internal static void GetTopLevelAndSubKeys(string key, out string ourKeyName, out string restOfKey)
		{
			bool flag = (key.StartsWith("\"") && key.EndsWith("\"")) || (key.StartsWith("'") && key.EndsWith("'"));
			bool flag2 = !flag && (key.StartsWith("\"") || key.StartsWith("'"));
			if (!key.Contains(".") || flag)
			{
				ourKeyName = key;
				restOfKey = "";
				return;
			}
			if (!flag2)
			{
				string[] array = key.Split(new char[1] { '.' });
				ourKeyName = array[0];
			}
			else
			{
				ourKeyName = key;
				string text = ourKeyName.Substring(1);
				if (ourKeyName.Contains("\""))
				{
					ourKeyName = ourKeyName.Substring(0, 2 + text.IndexOf("\"", StringComparison.Ordinal));
				}
				else
				{
					ourKeyName = ourKeyName.Substring(0, 2 + text.IndexOf("'", StringComparison.Ordinal));
				}
			}
			restOfKey = key.Substring(ourKeyName.Length + 1);
			ourKeyName = ourKeyName.Trim();
		}
	}
	internal static class TomlNumberStyle
	{
		internal static NumberStyles FloatingPoint = NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands | NumberStyles.AllowExponent;

		internal static NumberStyles Integer = NumberStyles.AllowLeadingSign | NumberStyles.AllowThousands;
	}
	public static class TomlNumberUtils
	{
		public static long? GetLongValue(string input)
		{
			bool flag = input.StartsWith("0o");
			bool flag2 = input.StartsWith("0x");
			bool flag3 = input.StartsWith("0b");
			if (flag3 || flag2 || flag)
			{
				input = input.Substring(2);
			}
			if (input.Contains("__") || input.Any((char c) => c != '_' && c != '-' && c != '+' && !char.IsDigit(c) && (c < 'a' || c > 'f')))
			{
				return null;
			}
			if (input.First() == '_')
			{
				return null;
			}
			if (input.Last() == '_')
			{
				return null;
			}
			input = input.Replace("_", "");
			try
			{
				if (flag3)
				{
					return Convert.ToInt64(input, 2);
				}
				if (flag)
				{
					return Convert.ToInt64(input, 8);
				}
				if (flag2)
				{
					return Convert.ToInt64(input, 16);
				}
				return Convert.ToInt64(input, 10);
			}
			catch (Exception)
			{
				return null;
			}
		}

		public static double? GetDoubleValue(string input)
		{
			string text = input.Substring(1);
			if (input == "nan" || input == "inf" || text == "nan" || text == "inf")
			{
				if (input == "nan" || text == "nan")
				{
					return double.NaN;
				}
				if (input == "inf")
				{
					return double.PositiveInfinity;
				}
				if (text == "inf")
				{
					return input.StartsWith("-") ? double.NegativeInfinity : double.PositiveInfinity;
				}
			}
			if (input.Contains("__") || input.Any((char c) => c != '_' && c != '-' && c != '+' && c != 'e' && c != '.' && !char.IsDigit(c)))
			{
				return null;
			}
			if (input.First() == '_')
			{
				return null;
			}
			if (input.Last() == '_')
			{
				return null;
			}
			input = input.Replace("_", "");
			if (input.Contains("e"))
			{
				string[] array = input.Split(new char[1] { 'e' });
				if (array.Length != 2)
				{
					return null;
				}
				if (array[0].EndsWith("."))
				{
					return null;
				}
			}
			if (double.TryParse(input, TomlNumberStyle.FloatingPoint, CultureInfo.InvariantCulture, out var result))
			{
				return result;
			}
			return null;
		}
	}
	public class TomlParser
	{
		private static readonly char[] TrueChars = new char[4] { 't', 'r', 'u', 'e' };

		private static readonly char[] FalseChars = new char[5] { 'f', 'a', 'l', 's', 'e' };

		private int _lineNumber = 1;

		private string[] _tableNames = new string[0];

		private TomlTable? _currentTable;

		[NoCoverage]
		public static TomlDocument ParseFile(string filePath)
		{
			string input = File.ReadAllText(filePath);
			return new TomlParser().Parse(input);
		}

		public TomlDocument Parse(string input)
		{
			try
			{
				TomlDocument tomlDocument = new TomlDocument();
				using TomletStringReader tomletStringReader = new TomletStringReader(input);
				string text = null;
				int nextChar;
				while (tomletStringReader.TryPeek(out nextChar))
				{
					_lineNumber += tomletStringReader.SkipAnyNewlineOrWhitespace();
					text = ReadAnyPotentialMultilineComment(tomletStringReader);
					if (!tomletStringReader.TryPeek(out var nextChar2))
					{
						break;
					}
					if (nextChar2 == 91)
					{
						tomletStringReader.Read();
						if (!tomletStringReader.TryPeek(out var nextChar3))
						{
							throw new TomlEndOfFileException(_lineNumber);
						}
						TomlValue tomlValue = ((nextChar3 == 91) ? ((TomlValue)ReadTableArrayStatement(tomletStringReader, tomlDocument)) : ((TomlValue)ReadTableStatement(tomletStringReader, tomlDocument)));
						tomlValue.Comments.PrecedingComment = text;
						continue;
					}
					ReadKeyValuePair(tomletStringReader, out string key, out TomlValue value);
					value.Comments.PrecedingComment = text;
					text = null;
					if (_currentTable != null)
					{
						_currentTable.ParserPutValue(key, value, _lineNumber);
					}
					else
					{
						tomlDocument.ParserPutValue(key, value, _lineNumber);
					}
					tomletStringReader.SkipWhitespace();
					tomletStringReader.SkipPotentialCarriageReturn();
					if (!tomletStringReader.ExpectAndConsume('\n') && tomletStringReader.TryPeek(out var nextChar4))
					{
						throw new TomlMissingNewlineException(_lineNumber, (char)nextChar4);
					}
					_lineNumber++;
				}
				tomlDocument.TrailingComment = text;
				return tomlDocument;
			}
			catch (Exception ex) when (!(ex is TomlException))
			{
				throw new TomlInternalException(_lineNumber, ex);
			}
		}

		private void ReadKeyValuePair(TomletStringReader reader, out string key, out TomlValue value)
		{
			key = ReadKey(reader);
			reader.SkipWhitespace();
			if (!reader.ExpectAndConsume('='))
			{
				if (reader.TryPeek(out var nextChar))
				{
					throw new TomlMissingEqualsException(_lineNumber, (char)nextChar);
				}
				throw new TomlEndOfFileException(_lineNumber);
			}
			reader.SkipWhitespace();
			value = ReadValue(reader);
		}

		private string ReadKey(TomletStringReader reader)
		{
			reader.SkipWhitespace();
			if (!reader.TryPeek(out var nextChar))
			{
				return "";
			}
			if (nextChar.IsEquals())
			{
				throw new NoTomlKeyException(_lineNumber);
			}
			reader.SkipWhitespace();
			string text;
			if (nextChar.IsDoubleQuote())
			{
				reader.Read();
				if (reader.TryPeek(out var nextChar2) && nextChar2.IsDoubleQuote())
				{
					reader.Read();
					if (reader.TryPeek(out var nextChar3) && nextChar3.IsDoubleQuote())
					{
						throw new TomlTripleQuotedKeyException(_lineNumber);
					}
					return string.Empty;
				}
				text = "\"" + ReadSingleLineBasicString(reader, consumeClosingQuote: false).StringValue + "\"";
				if (!reader.ExpectAndConsume('"'))
				{
					throw new UnterminatedTomlKeyException(_lineNumber);
				}
			}
			else if (nextChar.IsSingleQuote())
			{
				reader.Read();
				text = "'" + ReadSingleLineLiteralString(reader, consumeClosingQuote: false).StringValue + "'";
				if (!reader.ExpectAndConsume('\''))
				{
					throw new UnterminatedTomlKeyException(_lineNumber);
				}
			}
			else
			{
				text = ReadKeyInternal(reader, (int keyChar) => keyChar.IsEquals() || keyChar.IsHashSign());
			}
			return text.Replace("\\n", "\n").Replace("\\t", "\t");
		}

		private string ReadKeyInternal(TomletStringReader reader, Func<int, bool> charSignalsEndOfKey)
		{
			List<string> list = new List<string>();
			int nextChar;
			while (reader.TryPeek(out nextChar))
			{
				if (charSignalsEndOfKey(nextChar))
				{
					return string.Join(".", list.ToArray());
				}
				if (nextChar.IsPeriod())
				{
					throw new TomlDoubleDottedKeyException(_lineNumber);
				}
				StringBuilder stringBuilder = new StringBuilder();
				while (reader.TryPeek(out nextChar))
				{
					nextChar.EnsureLegalChar(_lineNumber);
					int num = reader.SkipWhitespace();
					reader.TryPeek(out var nextChar2);
					if (nextChar2.IsPeriod())
					{
						list.Add(stringBuilder.ToString());
						reader.ExpectAndConsume('.');
						reader.SkipWhitespace();
						break;
					}
					if (num > 0 && charSignalsEndOfKey(nextChar2))
					{
						list.Add(stringBuilder.ToString());
						break;
					}
					reader.Backtrack(num);
					if (charSignalsEndOfKey(nextChar))
					{
						list.Add(stringBuilder.ToString());
						break;
					}
					if (num > 0)
					{
						throw new TomlWhitespaceInKeyException(_lineNumber);
					}
					stringBuilder.Append((char)reader.Read());
				}
			}
			throw new TomlEndOfFileException(_lineNumber);
		}

		private TomlValue ReadValue(TomletStringReader reader)
		{
			if (!reader.TryPeek(out var nextChar))
			{
				throw new TomlEndOfFileException(_lineNumber);
			}
			TomlValue tomlValue;
			switch (nextChar)
			{
			case 91:
				tomlValue = ReadArray(reader);
				break;
			case 123:
				tomlValue = ReadInlineTable(reader);
				break;
			case 34:
			case 39:
			{
				int num = reader.Read();
				if (reader.Peek() != num)
				{
					tomlValue = (num.IsSingleQuote() ? ReadSingleLineLiteralString(reader) : ReadSingleLineBasicString(reader));
					break;
				}
				reader.Read();
				int num2 = reader.Peek();
				if (num2 == num)
				{
					reader.Read();
					tomlValue = (num.IsSingleQuote() ? ReadMultiLineLiteralString(reader) : ReadMultiLineBasicString(reader));
					break;
				}
				if (num2.IsWhitespace() || num2.IsNewline() || num2.IsHashSign() || num2.IsComma() || num2.IsEndOfArrayChar() || num2 == -1)
				{
					tomlValue = TomlString.Empty;
					break;
				}
				throw new TomlStringException(_lineNumber);
			}
			case 43:
			case 45:
			case 48:
			case 49:
			case 50:
			case 51:
			case 52:
			case 53:
			case 54:
			case 55:
			case 56:
			case 57:
			case 105:
			case 110:
			{
				string text = reader.ReadWhile((int valueChar) => !valueChar.IsEquals() && !valueChar.IsNewline() && !valueChar.IsHashSign() && !valueChar.IsComma() && !valueChar.IsEndOfArrayChar() && !valueChar.IsEndOfInlineObjectChar()).ToLowerInvariant().Trim();
				tomlValue = ((!Enumerable.Contains(text, ':') && !Enumerable.Contains(text, 't') && !Enumerable.Contains(text, ' ') && !Enumerable.Contains(text, 'z')) ? ((!Enumerable.Contains(text, '.') && (!Enumerable.Contains(text, 'e') || text.StartsWith("0x")) && !Enumerable.Contains(text, 'n') && !Enumerable.Contains(text, 'i')) ? (TomlLong.Parse(text) ?? TomlDateTimeUtils.ParseDateString(text, _lineNumber) ?? throw new InvalidTomlNumberException(_lineNumber, text)) : (TomlDouble.Parse(text) ?? TomlDateTimeUtils.ParseDateString(text, _lineNumber) ?? throw new InvalidTomlNumberException(_lineNumber, text))) : (TomlDateTimeUtils.ParseDateString(text, _lineNumber) ?? throw new InvalidTomlDateTimeException(_lineNumber, text)));
				break;
			}
			case 116:
			{
				char[] second2 = reader.ReadChars(4);
				if (!TrueChars.SequenceEqual(second2))
				{
					throw new TomlInvalidValueException(_lineNumber, (char)nextChar);
				}
				tomlValue = TomlBoolean.True;
				break;
			}
			case 102:
			{
				char[] second = reader.ReadChars(5);
				if (!FalseChars.SequenceEqual(second))
				{
					throw new TomlInvalidValueException(_lineNumber, (char)nextChar);
				}
				tomlValue = TomlBoolean.False;
				break;
			}
			default:
				throw new TomlInvalidValueException(_lineNumber, (char)nextChar);
			}
			reader.SkipWhitespace();
			tomlValue.Comments.InlineComment = ReadAnyPotentialInlineComment(reader);
			return tomlValue;
		}

		private TomlValue ReadSingleLineBasicString(TomletStringReader reader, bool consumeClosingQuote = true)
		{
			StringBuilder stringBuilder = new StringBuilder();
			bool flag = false;
			bool fourDigitUnicodeMode = false;
			bool eightDigitUnicodeMode = false;
			StringBuilder stringBuilder2 = new StringBuilder();
			int nextChar;
			while (reader.TryPeek(out nextChar))
			{
				nextChar.EnsureLegalChar(_lineNumber);
				if (nextChar == 34 && !flag)
				{
					break;
				}
				reader.Read();
				if (nextChar == 92 && !flag)
				{
					flag = true;
				}
				else if (flag)
				{
					flag = false;
					char? c = HandleEscapedChar(nextChar, out fourDigitUnicodeMode, out eightDigitUnicodeMode);
					if (c.HasValue)
					{
						stringBuilder.Append(c.Value);
					}
				}
				else if (fourDigitUnicodeMode || eightDigitUnicodeMode)
				{
					stringBuilder2.Append((char)nextChar);
					if ((fourDigitUnicodeMode && stringBuilder2.Length == 4) || (eightDigitUnicodeMode && stringBuilder2.Length == 8))
					{
						string unicodeString = stringBuilder2.ToString();
						stringBuilder.Append(DecipherUnicodeEscapeSequence(unicodeString, fourDigitUnicodeMode));
						fourDigitUnicodeMode = false;
						eightDigitUnicodeMode = false;
						stringBuilder2 = new StringBuilder();
					}
				}
				else
				{
					if (nextChar.IsNewline())
					{
						throw new UnterminatedTomlStringException(_lineNumber);
					}
					stringBuilder.Append((char)nextChar);
				}
			}
			if (consumeClosingQuote && !reader.ExpectAndConsume('"'))
			{
				throw new UnterminatedTomlStringException(_lineNumber);
			}
			return new TomlString(stringBuilder.ToString());
		}

		private string DecipherUnicodeEscapeSequence(string unicodeString, bool fourDigitMode)
		{
			if (unicodeString.Any((char c) => !c.IsHexDigit()))
			{
				throw new InvalidTomlEscapeException(_lineNumber, $"\\{(fourDigitMode ? 'u' : 'U')}{unicodeString}");
			}
			if (fourDigitMode)
			{
				return ((char)short.Parse(unicodeString, NumberStyles.HexNumber)).ToString();
			}
			return char.ConvertFromUtf32(int.Parse(unicodeString, NumberStyles.HexNumber));
		}

		private char? HandleEscapedChar(int escapedChar, out bool fourDigitUnicodeMode, out bool eightDigitUnicodeMode, bool allowNewline = false)
		{
			eightDigitUnicodeMode = false;
			fourDigitUnicodeMode = false;
			char value;
			switch (escapedChar)
			{
			case 98:
				value = '\b';
				break;
			case 116:
				value = '\t';
				break;
			case 110:
				value = '\n';
				break;
			case 102:
				value = '\f';
				break;
			case 114:
				value = '\r';
				break;
			case 34:
				value = '"';
				break;
			case 92:
				value = '\\';
				break;
			case 117:
				fourDigitUnicodeMode = true;
				return null;
			case 85:
				eightDigitUnicodeMode = true;
				return null;
			default:
				if (allowNewline && escapedChar.IsNewline())
				{
					return null;
				}
				throw new InvalidTomlEscapeException(_lineNumber, $"\\{escapedChar}");
			}
			return value;
		}

		private TomlValue ReadSingleLineLiteralString(TomletStringReader reader, bool consumeClosingQuote = true)
		{
			string text = reader.ReadWhile((int valueChar) => !valueChar.IsSingleQuote() && !valueChar.IsNewline());
			foreach (int item in ((IEnumerable<char>)text).Select((Func<char, int>)((char c) => c)))
			{
				item.EnsureLegalChar(_lineNumber);
			}
			if (!reader.TryPeek(out var nextChar))
			{
				throw new TomlEndOfFileException(_lineNumber);
			}
			if (!nextChar.IsSingleQuote())
			{
				throw new UnterminatedTomlStringException(_lineNumber);
			}
			if (consumeClosingQuote)
			{
				reader.Read();
			}
			return new TomlString(text);
		}

		private TomlValue ReadMultiLineLiteralString(TomletStringReader reader)
		{
			StringBuilder stringBuilder = new StringBuilder();
			_lineNumber += reader.SkipAnyNewline();
			int nextChar;
			while (reader.TryPeek(out nextChar))
			{
				int num = reader.Read();
				num.EnsureLegalChar(_lineNumber);
				if (!num.IsSingleQuote())
				{
					stringBuilder.Append((char)num);
					if (num == 10)
					{
						_lineNumber++;
					}
					continue;
				}
				if (!reader.TryPeek(out var nextChar2) || !nextChar2.IsSingleQuote())
				{
					stringBuilder.Append('\'');
					continue;
				}
				reader.Read();
				if (!reader.TryPeek(out var nextChar3) || !nextChar3.IsSingleQuote())
				{
					stringBuilder.Append('\'');
					stringBuilder.Append('\'');
					continue;
				}
				reader.Read();
				if (!reader.TryPeek(out var nextChar4) || !nextChar4.IsSingleQuote())
				{
					break;
				}
				reader.Read();
				stringBuilder.Append('\'');
				if (!reader.TryPeek(out var nextChar5) || !nextChar5.IsSingleQuote())
				{
					break;
				}
				reader.Read();
				stringBuilder.Append('\'');
				if (!reader.TryPeek(out var nextChar6) || !nextChar6.IsSingleQuote())
				{
					break;
				}
				throw new TripleQuoteInTomlMultilineLiteralException(_lineNumber);
			}
			return new TomlString(stringBuilder.ToString());
		}

		private TomlValue ReadMultiLineBasicString(TomletStringReader reader)
		{
			StringBuilder stringBuilder = new StringBuilder();
			bool flag = false;
			bool fourDigitUnicodeMode = false;
			bool eightDigitUnicodeMode = false;
			StringBuilder stringBuilder2 = new StringBuilder();
			_lineNumber += reader.SkipAnyNewline();
			int nextChar;
			while (reader.TryPeek(out nextChar))
			{
				int num = reader.Read();
				num.EnsureLegalChar(_lineNumber);
				if (num == 92 && !flag)
				{
					flag = true;
					continue;
				}
				if (flag)
				{
					flag = false;
					char? c = HandleEscapedChar(num, out fourDigitUnicodeMode, out eightDigitUnicodeMode, allowNewline: true);
					if (c.HasValue)
					{
						stringBuilder.Append(c.Value);
					}
					else if (num.IsNewline())
					{
						if (num == 13 && !reader.ExpectAndConsume('\n'))
						{
							throw new Exception($"Found a CR without an LF on line {_lineNumber}");
						}
						_lineNumber++;
						reader.SkipAnyNewlineOrWhitespace();
					}
					continue;
				}
				if (fourDigitUnicodeMode || eightDigitUnicodeMode)
				{
					stringBuilder2.Append((char)num);
					if ((fourDigitUnicodeMode && stringBuilder2.Length == 4) || (eightDigitUnicodeMode && stringBuilder2.Length == 8))
					{
						string unicodeString = stringBuilder2.ToString();
						stringBuilder.Append(DecipherUnicodeEscapeSequence(unicodeString, fourDigitUnicodeMode));
						fourDigitUnicodeMode = false;
						eightDigitUnicodeMode = false;
						stringBuilder2 = new StringBuilder();
					}
					continue;
				}
				if (!num.IsDoubleQuote())
				{
					if (num == 10)
					{
						_lineNumber++;
					}
					stringBuilder.Append((char)num);
					continue;
				}
				if (!reader.TryPeek(out var nextChar2) || !nextChar2.IsDoubleQuote())
				{
					stringBuilder.Append('"');
					continue;
				}
				reader.Read();
				if (!reader.TryPeek(out var nextChar3) || !nextChar3.IsDoubleQuote())
				{
					stringBuilder.Append('"');
					stringBuilder.Append('"');
					continue;
				}
				reader.Read();
				if (!reader.TryPeek(out var nextChar4) || !nextChar4.IsDoubleQuote())
				{
					break;
				}
				reader.Read();
				stringBuilder.Append('"');
				if (!reader.TryPeek(out var nextChar5) || !nextChar5.IsDoubleQuote())
				{
					break;
				}
				reader.Read();
				stringBuilder.Append('"');
				if (!reader.TryPeek(out var nextChar6) || !nextChar6.IsDoubleQuote())
				{
					break;
				}
				throw new TripleQuoteInTomlMultilineSimpleStringException(_lineNumber);
			}
			return new TomlString(stringBuilder.ToString());
		}

		private TomlArray ReadArray(TomletStringReader reader)
		{
			if (!reader.ExpectAndConsume('['))
			{
				throw new ArgumentException("Internal Tomlet Bug: ReadArray called and first char is not a [");
			}
			_lineNumber += reader.SkipAnyCommentNewlineWhitespaceEtc();
			TomlArray tomlArray = new TomlArray();
			int nextChar;
			while (reader.TryPeek(out nextChar))
			{
				_lineNumber += reader.SkipAnyCommentNewlineWhitespaceEtc();
				if (!reader.TryPeek(out var nextChar2))
				{
					throw new TomlEndOfFileException(_lineNumber);
				}
				if (nextChar2.IsEndOfArrayChar())
				{
					break;
				}
				tomlArray.ArrayValues.Add(ReadValue(reader));
				_lineNumber += reader.SkipAnyNewlineOrWhitespace();
				if (!reader.TryPeek(out var nextChar3))
				{
					throw new TomlEndOfFileException(_lineNumber);
				}
				if (nextChar3.IsEndOfArrayChar())
				{
					break;
				}
				if (!nextChar3.IsComma())
				{
					throw new TomlArraySyntaxException(_lineNumber, (char)nextChar3);
				}
				reader.ExpectAndConsume(',');
			}
			reader.ExpectAndConsume(']');
			return tomlArray;
		}

		private TomlTable ReadInlineTable(TomletStringReader reader)
		{
			if (!reader.ExpectAndConsume('{'))
			{
				throw new ArgumentException("Internal Tomlet Bug: ReadInlineTable called and first char is not a {");
			}
			_lineNumber += reader.SkipAnyCommentNewlineWhitespaceEtc();
			TomlTable tomlTable = new TomlTable
			{
				Defined = true
			};
			int nextChar;
			while (reader.TryPeek(out nextChar))
			{
				reader.SkipWhitespace();
				if (!reader.TryPeek(out var nextChar2))
				{
					throw new TomlEndOfFileException(_lineNumber);
				}
				if (nextChar2.IsEndOfInlineObjectChar())
				{
					break;
				}
				if (nextChar2.IsNewline())
				{
					throw new NewLineInTomlInlineTableException(_lineNumber);
				}
				try
				{
					ReadKeyValuePair(reader, out string key, out TomlValue value);
					tomlTable.ParserPutValue(key, value, _lineNumber);
				}
				catch (TomlException ex) when (ex is TomlMissingEqualsException || ex is NoTomlKeyException || ex is TomlWhitespaceInKeyException)
				{
					throw new InvalidTomlInlineTableException(_lineNumber, ex);
				}
				if (!reader.TryPeek(out var nextChar3))
				{
					throw new TomlEndOfFileException(_lineNumber);
				}
				if (!reader.ExpectAndConsume(','))
				{
					reader.SkipWhitespace();
					if (!reader.TryPeek(out nextChar3))
					{
						throw new TomlEndOfFileException(_lineNumber);
					}
					if (nextChar3.IsEndOfInlineObjectChar())
					{
						break;
					}
					throw new TomlInlineTableSeparatorException(_lineNumber, (char)nextChar3);
				}
			}
			reader.ExpectAndConsume('}');
			tomlTable.Locked = true;
			return tomlTable;
		}

		private TomlTable ReadTableStatement(TomletStringReader reader, TomlDocument document)
		{
			string text = reader.ReadWhile((int c) => !c.IsEndOfArrayChar() && !c.IsNewline());
			TomlTable parent = document;
			string relativeName = text;
			FindParentAndRelativeKey(ref parent, ref relativeName);
			TomlTable tomlTable;
			try
			{
				if (parent.ContainsKey(relativeName))
				{
					try
					{
						tomlTable = (TomlTable)parent.GetValue(relativeName);
						if (tomlTable.Defined)
						{
							throw new TomlTableRedefinitionException(_lineNumber, text);
						}
					}
					catch (InvalidCastException)
					{
						throw new TomlKeyRedefinitionException(_lineNumber, text);
					}
				}
				else
				{
					tomlTable = new TomlTable
					{
						Defined = true
					};
					parent.ParserPutValue(relativeName, tomlTable, _lineNumber);
				}
			}
			catch (TomlContainsDottedKeyNonTableException ex2)
			{
				throw new TomlDottedKeyParserException(_lineNumber, ex2.Key);
			}
			if (!reader.TryPeek(out var _))
			{
				throw new TomlEndOfFileException(_lineNumber);
			}
			if (!reader.ExpectAndConsume(']'))
			{
				throw new UnterminatedTomlTableNameException(_lineNumber);
			}
			reader.SkipWhitespace();
			tomlTable.Comments.InlineComment = ReadAnyPotentialInlineComment(reader);
			reader.SkipPotentialCarriageReturn();
			if (!reader.TryPeek(out var nextChar2))
			{
				throw new TomlEndOfFileException(_lineNumber);
			}
			if (!nextChar2.IsNewline())
			{
				throw new TomlMissingNewlineException(_lineNumber, (char)nextChar2);
			}
			_currentTable = tomlTable;
			_tableNames = text.Split(new char[1] { '.' });
			return tomlTable;
		}

		private TomlArray ReadTableArrayStatement(TomletStringReader reader, TomlDocument document)
		{
			if (!reader.ExpectAndConsume('['))
			{
				throw new ArgumentException("Internal Tomlet Bug: ReadTableArrayStatement called and first char is not a [");
			}
			string text = reader.ReadWhile((int c) => !c.IsEndOfArrayChar() && !c.IsNewline());
			if (!reader.ExpectAndConsume(']') || !reader.ExpectAndConsume(']'))
			{
				throw new UnterminatedTomlTableArrayException(_lineNumber);
			}
			TomlTable parent = document;
			string relativeName = text;
			FindParentAndRelativeKey(ref parent, ref relativeName);
			if (parent == document && Enumerable.Contains(relativeName, '.'))
			{
				throw new MissingIntermediateInTomlTableArraySpecException(_lineNumber, relativeName);
			}
			TomlArray tomlArray2;
			if (parent.ContainsKey(relativeName))
			{
				if (!(parent.GetValue(relativeName) is TomlArray tomlArray))
				{
					throw new TomlTableArrayAlreadyExistsAsNonArrayException(_lineNumber, text);
				}
				tomlArray2 = tomlArray;
				if (!tomlArray2.IsLockedToBeTableArray)
				{
					throw new TomlNonTableArrayUsedAsTableArrayException(_lineNumber, text);
				}
			}
			else
			{
				tomlArray2 = new TomlArray
				{
					IsLockedToBeTableArray = true
				};
				parent.ParserPutValue(relativeName, tomlArray2, _lineNumber);
			}
			_currentTable = new TomlTable
			{
				Defined = true
			};
			tomlArray2.ArrayValues.Add(_currentTable);
			_tableNames = text.Split(new char[1] { '.' });
			return tomlArray2;
		}

		private void FindParentAndRelativeKey(ref TomlTable parent, ref string relativeName)
		{
			for (int i = 0; i < _tableNames.Length; i++)
			{
				string text = _tableNames[i];
				if (!relativeName.StartsWith(text + "."))
				{
					break;
				}
				TomlValue value = parent.GetValue(text);
				if (value is TomlTable tomlTable)
				{
					parent = tomlTable;
				}
				else
				{
					if (!(value is TomlArray source))
					{
						throw new TomlTypeMismatchException(typeof(TomlArray), value.GetType(), typeof(TomlArray));
					}
					parent = (TomlTable)source.Last();
				}
				relativeName = relativeName.Substring(text.Length + 1);
			}
		}

		private string? ReadAnyPotentialInlineComment(TomletStringReader reader)
		{
			if (!reader.ExpectAndConsume('#'))
			{
				return null;
			}
			string text = reader.ReadWhile((int c) => !c.IsNewline()).Trim();
			if (text.Length < 1)
			{
				return null;
			}
			if (text[0] == ' ')
			{
				text = text.Substring(1);
			}
			foreach (int item in ((IEnumerable<char>)text).Select((Func<char, int>)((char c) => c)))
			{
				item.EnsureLegalChar(_lineNumber);
			}
			return text;
		}

		private string? ReadAnyPotentialMultilineComment(TomletStringReader reader)
		{
			StringBuilder stringBuilder = new StringBuilder();
			while (reader.ExpectAndConsume('#'))
			{
				string text = reader.ReadWhile((int c) => !c.IsNewline());
				if (text[0] == ' ')
				{
					text = text.Substring(1);
				}
				foreach (int item in ((IEnumerable<char>)text).Select((Func<char, int>)((char c) => c)))
				{
					item.EnsureLegalChar(_lineNumber);
				}
				stringBuilder.Append(text);
				_lineNumber += reader.SkipAnyNewlineOrWhitespace();
			}
			if (stringBuilder.Length == 0)
			{
				return null;
			}
			return stringBuilder.ToString();
		}
	}
	public static class TomlSerializationMethods
	{
		public delegate T Deserialize<out T>(TomlValue value);

		public delegate TomlValue? Serialize<in T>(T? t);

		private static MethodInfo _stringKeyedDictionaryMethod;

		private static MethodInfo _genericDictionarySerializerMethod;

		private static MethodInfo _genericNullableSerializerMethod;

		private static readonly Dictionary<Type, Delegate> Deserializers;

		private static readonly Dictionary<Type, Delegate> Serializers;

		[NoCoverage]
		static TomlSerializationMethods()
		{
			_stringKeyedDictionaryMethod = typeof(TomlSerializationMethods).GetMethod("StringKeyedDictionaryDeserializerFor", BindingFlags.Static | BindingFlags.NonPublic);
			_genericDictionarySerializerMethod = typeof(TomlSerializationMethods).GetMethod("GenericDictionarySerializer", BindingFlags.Static | BindingFlags.NonPublic);
			_genericNullableSerializerMethod = typeof(TomlSerializationMethods).GetMethod("GenericNullableSerializer", BindingFlags.Static | BindingFlags.NonPublic);
			Deserializers = new Dictionary<Type, Delegate>();
			Serializers = new Dictionary<Type, Delegate>();
			Register((string? s) => new TomlString(s), (TomlValue value) => (value as TomlString)?.Value ?? value.StringValue);
			Register(TomlBoolean.ValueOf, (TomlValue value) => ((value as TomlBoolean) ?? throw new TomlTypeMismatchException(typeof(TomlBoolean), value.GetType(), typeof(bool))).Value);
			Register((byte i) => new TomlLong(i), (TomlValue value) => (byte)((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlLong), value.GetType(), typeof(byte))).Value);
			Register((sbyte i) => new TomlLong(i), (TomlValue value) => (sbyte)((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlLong), value.GetType(), typeof(sbyte))).Value);
			Register((ushort i) => new TomlLong(i), (TomlValue value) => (ushort)((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlLong), value.GetType(), typeof(ushort))).Value);
			Register((short i) => new TomlLong(i), (TomlValue value) => (short)((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlLong), value.GetType(), typeof(short))).Value);
			Register((uint i) => new TomlLong(i), (TomlValue value) => (uint)((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlLong), value.GetType(), typeof(uint))).Value);
			Register((int i) => new TomlLong(i), (TomlValue value) => (int)((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlLong), value.GetType(), typeof(int))).Value);
			Register((ulong l) => new TomlLong((long)l), (TomlValue value) => (ulong)((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlLong), value.GetType(), typeof(ulong))).Value);
			Register((long l) => new TomlLong(l), (TomlValue value) => ((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlLong), value.GetType(), typeof(long))).Value);
			Register((double d) => new TomlDouble(d), (TomlValue value) => (value as TomlDouble)?.Value ?? ((double)((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlDouble), value.GetType(), typeof(double))).Value));
			Register((float f) => new TomlDouble(f), (TomlValue value) => (float)((value as TomlDouble)?.Value ?? ((double)((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlDouble), value.GetType(), typeof(float))).Value)));
			Register((DateTime dt) => (!(dt.TimeOfDay == TimeSpan.Zero)) ? ((TomlValue?)new TomlLocalDateTime(dt)) : ((TomlValue?)new TomlLocalDate(dt)), (TomlValue value) => ((value as ITomlValueWithDateTime) ?? throw new TomlTypeMismatchException(typeof(ITomlValueWithDateTime), value.GetType(), typeof(DateTime))).Value);
			Register((DateTimeOffset odt) => new TomlOffsetDateTime(odt), (TomlValue value) => ((value as TomlOffsetDateTime) ?? throw new TomlTypeMismatchException(typeof(TomlOffsetDateTime), value.GetType(), typeof(DateTimeOffset))).Value);
			Register((TimeSpan lt) => new TomlLocalTime(lt), (TomlValue value) => ((value as TomlLocalTime) ?? throw new TomlTypeMismatchException(typeof(TomlLocalTime), value.GetType(), typeof(TimeSpan))).Value);
		}

		internal static Serialize<object> GetSerializer(Type t)
		{
			if (Serializers.TryGetValue(t, out Delegate value))
			{
				return (Serialize<object>)value;
			}
			if (t.IsArray || (t.Namespace == "System.Collections.Generic" && t.Name == "List`1"))
			{
				Serialize<object> serialize = GenericEnumerableSerializer();
				Serializers[t] = serialize;
				return serialize;
			}
			if (t.IsGenericType)
			{
				Type[] genericArguments = t.GetGenericArguments();
				if (genericArguments != null)
				{
					if ((object)t.GetGenericTypeDefinition() == typeof(Dictionary<, >))
					{
						MethodInfo method = _genericDictionarySerializerMethod.MakeGenericMethod(genericArguments);
						Delegate del2 = Delegate.CreateDelegate(typeof(Serialize<>).MakeGenericType(t), method);
						Serialize<object> serialize2 = (object? dict) => (TomlValue)del2.DynamicInvoke(dict);
						Serializers[t] = serialize2;
						return serialize2;
					}
					if ((object)t.GetGenericTypeDefinition() == typeof(Nullable<>))
					{
						MethodInfo method2 = _genericNullableSerializerMethod.MakeGenericMethod(genericArguments);
						Delegate del = Delegate.CreateDelegate(typeof(Serialize<>).MakeGenericType(t), method2);
						Serialize<object> serialize3 = (object? dict) => (TomlValue)del.DynamicInvoke(dict);
						Serializers[t] = serialize3;
						return serialize3;
					}
				}
			}
			return TomlCompositeSerializer.For(t);
		}

		internal static Deserialize<object> GetDeserializer(Type t)
		{
			if (Deserializers.TryGetValue(t, out Delegate value))
			{
				return (Deserialize<object>)value;
			}
			if (t.IsArray)
			{
				Deserialize<object> deserialize = ArrayDeserializerFor(t.GetElementType());
				Deserializers[t] = deserialize;
				return deserialize;
			}
			if (t.Namespace == "System.Collections.Generic" && t.Name == "List`1")
			{
				Deserialize<object> deserialize2 = ListDeserializerFor(t.GetGenericArguments()[0]);
				Deserializers[t] = deserialize2;
				return deserialize2;
			}
			if (t.IsGenericType && (object)t.GetGenericTypeDefinition() == typeof(Nullable<>))
			{
				Type[] genericArguments = t.GetGenericArguments();
				if (genericArguments != null && genericArguments.Length == 1)
				{
					Deserialize<object> deserialize3 = NullableDeserializerFor(t);
					Deserializers[t] = deserialize3;
					return deserialize3;
				}
			}
			if (t.IsGenericType && (object)t.GetGenericTypeDefinition() == typeof(Dictionary<, >))
			{
				Type[] genericArguments2 = t.GetGenericArguments();
				if (genericArguments2 != null && genericArguments2.Length == 2 && (object)genericArguments2[0] == typeof(string))
				{
					return (Deserialize<object>)_stringKeyedDictionaryMethod.MakeGenericMethod(genericArguments2[1]).Invoke(null, new object[0]);
				}
			}
			return TomlCompositeDeserializer.For(t);
		}

		private static Serialize<object?> GenericEnumerableSerializer()
		{
			return delegate(object? o)
			{
				IEnumerable obj = (o as IEnumerable) ?? throw new Exception("How did ArraySerializer end up getting a non-array?");
				TomlArray tomlArray = new TomlArray();
				foreach (object item in obj)
				{
					tomlArray.Add(item);
				}
				return tomlArray;
			};
		}

		private static Deserialize<object> ArrayDeserializerFor(Type elementType)
		{
			Type elementType2 = elementType;
			return delegate(TomlValue value)
			{
				if (!(value is TomlArray tomlArray))
				{
					throw new TomlTypeMismatchException(typeof(TomlArray), value.GetType(), elementType2.MakeArrayType());
				}
				Array array = Array.CreateInstance(elementType2, tomlArray.Count);
				Deserialize<object> deserializer = GetDeserializer(elementType2);
				for (int i = 0; i < tomlArray.ArrayValues.Count; i++)
				{
					TomlValue value2 = tomlArray.ArrayValues[i];
					array.SetValue(deserializer(value2), i);
				}
				return array;
			};
		}

		private static Deserialize<object> ListDeserializerFor(Type elementType)
		{
			Type elementType2 = elementType;
			Type listType = typeof(List<>).MakeGenericType(elementType2);
			MethodInfo relevantAddMethod = listType.GetMethod("Add");
			return delegate(TomlValue value)
			{
				TomlArray obj = (value as TomlArray) ?? throw new TomlTypeMismatchException(typeof(TomlArray), value.GetType(), listType);
				object obj2 = Activator.CreateInstance(listType);
				Deserialize<object> deserializer = GetDeserializer(elementType2);
				foreach (TomlValue arrayValue in obj.ArrayValues)
				{
					relevantAddMethod.Invoke(obj2, new object[1] { deserializer(arrayValue) });
				}
				return obj2;
			};
		}

		private static Deserialize<object> NullableDeserializerFor(Type nullableType)
		{
			Type nullableType2 = nullableType;
			Type t = nullableType2.GetGenericArguments()[0];
			Deserialize<object> elementDeserializer = GetDeserializer(t);
			return delegate(TomlValue value)
			{
				object obj = elementDeserializer(value);
				return Activator.CreateInstance(nullableType2, obj);
			};
		}

		private static Deserialize<Dictionary<string, T>> StringKeyedDictionaryDeserializerFor<T>()
		{
			Deserialize<object> deserializer = GetDeserializer(typeof(T));
			return (TomlValue value) => ((value as TomlTable) ?? throw new TomlTypeMismatchException(typeof(TomlTable), value.GetType(), typeof(Dictionary<string, T>))).Entries.ToDictionary<KeyValuePair<string, TomlValue>, string, T>((KeyValuePair<string, TomlValue> entry) => entry.Key, (KeyValuePair<string, TomlValue> entry) => (T)deserializer(entry.Value));
		}

		private static TomlValue? GenericNullableSerializer<T>(T? nullable) where T : struct
		{
			Serialize<object> serializer = GetSerializer(typeof(T));
			if (nullable.HasValue)
			{
				return serializer(nullable.Value);
			}
			return null;
		}

		private static TomlValue GenericDictionarySerializer<TKey, TValue>(Dictionary<TKey, TValue> dict) where TKey : notnull
		{
			Serialize<object> serializer = GetSerializer(typeof(TValue));
			TomlTable tomlTable = new TomlTable();
			foreach (KeyValuePair<TKey, TValue> item in dict)
			{
				TKey key = item.Key;
				string text = ((key != null) ? key.ToString() : null);
				if (text != null)
				{
					tomlTable.PutValue(text, serializer(item.Value), quote: true);
				}
			}
			return tomlTable;
		}

		internal static void Register<T>(Serialize<T>? serializer, Deserialize<T>? deserializer)
		{
			if (serializer != null)
			{
				RegisterSerializer(serializer);
				RegisterDictionarySerializer(serializer);
			}
			if (deserializer != null)
			{
				RegisterDeserializer(deserializer);
				RegisterDictionaryDeserializer(deserializer);
			}
		}

		internal static void Register(Type t, Serialize<object>? serializer, Deserialize<object>? deserializer)
		{
			if (serializer != null)
			{
				RegisterSerializer(serializer);
			}
			if (deserializer != null)
			{
				RegisterDeserializer(deserializer);
			}
		}

		private static void RegisterDeserializer<T>(Deserialize<T> deserializer)
		{
			Deserialize<T> deserializer2 = deserializer;
			Deserializers[typeof(T)] = new Deserialize<object>(BoxedDeserializer);
			object BoxedDeserializer(TomlValue value)
			{
				T val = deserializer2(value);
				if (val == null)
				{
					throw new Exception("TOML Deserializer returned null for type T");
				}
				return val;
			}
		}

		private static void RegisterSerializer<T>(Serialize<T> serializer)
		{
			Serialize<T> serializer2 = serializer;
			Serializers[typeof(T)] = new Serialize<object>(ObjectAcceptingSerializer);
			TomlValue? ObjectAcceptingSerializer(object value)
			{
				return serializer2((T)value);
			}
		}

		private static void RegisterDictionarySerializer<T>(Serialize<T> serializer)
		{
			Serialize<T> serializer2 = serializer;
			RegisterSerializer(delegate(Dictionary<string, T>? dict)
			{
				TomlTable tomlTable = new TomlTable();
				if (dict == null)
				{
					return tomlTable;
				}
				List<string> list = dict.Keys.ToList();
				List<TomlValue> list2 = dict.Values.Select(serializer2.Invoke).ToList();
				for (int i = 0; i < list.Count; i++)
				{
					tomlTable.PutValue(list[i], list2[i], quote: true);
				}
				return tomlTable;
			});
		}

		private static void RegisterDictionaryDeserializer<T>(Deserialize<T> deserializer)
		{
			Deserialize<T> deserializer2 = deserializer;
			RegisterDeserializer((TomlValue value) => ((value as TomlTable) ?? throw new TomlTypeMismatchException(typeof(TomlTable), value.GetType(), typeof(Dictionary<string, T>))).Entries.Select<KeyValuePair<string, TomlValue>, KeyValuePair<string, T>>((KeyValuePair<string, TomlValue> kvp) => new KeyValuePair<string, T>(kvp.Key, deserializer2(kvp.Value))).ToDictionary((KeyValuePair<string, T> kvp) => kvp.Key, (KeyValuePair<string, T> kvp) => kvp.Value));
		}
	}
	internal static class TomlUtils
	{
		public static string EscapeStringValue(string key)
		{
			return key.Replace("\\", "\\\\").Replace("\n", "\\n").Replace("\r", "");
		}

		public static string AddCorrectQuotes(string key)
		{
			if (key.Contains("'") && key.Contains("\""))
			{
				throw new InvalidTomlKeyException(key);
			}
			if (key.Contains("\""))
			{
				return "'" + key + "'";
			}
			return "\"" + key + "\"";
		}
	}
}
namespace Tomlet.Models
{
	public class TomlArray : TomlValue, IEnumerable<TomlValue>, IEnumerable
	{
		public readonly List<TomlValue> ArrayValues = new List<TomlValue>();

		internal bool IsLockedToBeTableArray;

		public override string StringValue => $"Toml Array ({ArrayValues.Count} values)";

		public bool IsTableArray
		{
			get
			{
				if (!IsLockedToBeTableArray)
				{
					return ArrayValues.All((TomlValue t) => t is TomlTable);
				}
				return true;
			}
		}

		public bool CanBeSerializedInline
		{
			get
			{
				if (IsTableArray)
				{
					if (ArrayValues.All((TomlValue o) => o is TomlTable tomlTable && tomlTable.ShouldBeSerializedInline))
					{
						return ArrayValues.Count <= 5;
					}
					return false;
				}
				return true;
			}
		}

		public bool IsSimpleArray
		{
			get
			{
				if (!IsLockedToBeTableArray)
				{
					return !ArrayValues.Any((TomlValue o) => o is TomlArray || o is TomlTable || !o.Comments.ThereAreNoComments);
				}
				return false;
			}
		}

		public TomlValue this[int index] => ArrayValues[index];

		public int Count => ArrayValues.Count;

		public override string SerializedValue => SerializeInline(!IsSimpleArray);

		public void Add<T>(T t) where T : new()
		{
			TomlValue tomlValue2 = (((object)t is TomlValue tomlValue) ? tomlValue : TomletMain.ValueFrom(t));
			if (tomlValue2 != null)
			{
				ArrayValues.Add(tomlValue2);
			}
		}

		public string SerializeInline(bool multiline)
		{
			if (!CanBeSerializedInline)
			{
				throw new Exception("Complex Toml Tables cannot be serialized into a TomlArray if the TomlArray is not a Table Array. This means that the TOML array cannot contain anything other than tables. If you are manually accessing SerializedValue on the TomlArray, you should probably be calling SerializeTableArray here. (Check the CanBeSerializedInline property and call that method if it is false)");
			}
			StringBuilder stringBuilder = new StringBuilder("[");
			char value = (multiline ? '\n' : ' ');
			using (IEnumerator<TomlValue> enumerator = GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					TomlValue current = enumerator.Current;
					stringBuilder.Append(value);
					if (current.Comments.PrecedingComment != null)
					{
						stringBuilder.Append(current.Comments.FormatPrecedingComment(1)).Append('\n');
					}
					if (multiline)
					{
						stringBuilder.Append('\t');
					}
					stringBuilder.Append(current.SerializedValue);
					stringBuilder.Append(',');
					if (current.Comments.InlineComment != null)
					{
						stringBuilder.Append(" # ").Append(current.Comments.InlineComment);
					}
				}
			}
			stringBuilder.Append(value);
			stringBuilder.Append(']');
			return stringBuilder.ToString();
		}

		public string SerializeTableArray(string key)
		{
			if (!IsTableArray)
			{
				throw new Exception("Cannot serialize normal arrays using this method. Use the normal TomlValue.SerializedValue property.");
			}
			StringBuilder stringBuilder = new StringBuilder();
			if (base.Comments.InlineComment != null)
			{
				throw new Exception("Sorry, but inline comments aren't supported on table-arrays themselves. See https://github.com/SamboyCoding/Tomlet/blob/master/Docs/InlineCommentsOnTableArrays.md for my rationale on this.");
			}
			bool flag = true;
			using (IEnumerator<TomlValue> enumerator = GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					TomlValue current = enumerator.Current;
					if (!(current is TomlTable tomlTable))
					{
						throw new Exception($"Toml Table-Array contains non-table entry? Value is {current}");
					}
					if (current.Comments.PrecedingComment != null)
					{
						if (flag && base.Comments.PrecedingComment != null)
						{
							stringBuilder.Append('\n');
						}
						stringBuilder.Append(current.Comments.FormatPrecedingComment()).Append('\n');
					}
					flag = false;
					stringBuilder.Append("[[").Append(key).Append("]]");
					if (current.Comments.InlineComment != null)
					{
						stringBuilder.Append(" # ").Append(current.Comments.InlineComment);
					}
					stringBuilder.Append('\n');
					stringBuilder.Append(tomlTable.SerializeNonInlineTable(key, includeHeader: false)).Append('\n');
				}
			}
			return stringBuilder.ToString();
		}

		public IEnumerator<TomlValue> GetEnumerator()
		{
			return ArrayValues.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return ArrayValues.GetEnumerator();
		}
	}
	public class TomlBoolean : TomlValue
	{
		private bool _value;

		public static TomlBoolean True => new TomlBoolean(value: true);

		public static TomlBoolean False => new TomlBoolean(value: false);

		public bool Value => _value;

		public override string StringValue
		{
			get
			{
				if (!Value)
				{
					return bool.FalseString.ToLowerInvariant();
				}
				return bool.TrueString.ToLowerInvariant();
			}
		}

		public override string SerializedValue => StringValue;

		private TomlBoolean(bool value)
		{
			_value = value;
		}

		public static TomlBoolean ValueOf(bool b)
		{
			if (!b)
			{
				return False;
			}
			return True;
		}
	}
	public class TomlCommentData
	{
		private string? _inlineComment;

		public string? PrecedingComment { get; set; }

		public string? InlineComment
		{
			get
			{
				return _inlineComment;
			}
			set
			{
				if (value == null)
				{
					_inlineComment = null;
					return;
				}
				if (value.Contains("\n") || value.Contains("\r"))
				{
					throw new TomlNewlineInInlineCommentException();
				}
				_inlineComment = value;
			}
		}

		public bool ThereAreNoComments
		{
			get
			{
				if (InlineComment == null)
				{
					return PrecedingComment == null;
				}
				return false;
			}
		}

		internal string FormatPrecedingComment(int indentCount = 0)
		{
			if (PrecedingComment == null)
			{
				throw new Exception("Preceding comment is null");
			}
			StringBuilder stringBuilder = new StringBuilder();
			string[] array = PrecedingComment.Split(new char[1] { '\n' });
			bool flag = true;
			string[] array2 = array;
			foreach (string value in array2)
			{
				if (!flag)
				{
					stringBuilder.Append('\n');
				}
				flag = false;
				string value2 = new string('\t', indentCount);
				stringBuilder.Append(value2).Append("# ").Append(value);
			}
			return stringBuilder.ToString();
		}
	}
	public class TomlDocument : TomlTable
	{
		public string? TrailingComment { get; set; }

		public override string SerializedValue => SerializeDocument();

		public override string StringValue => $"Toml root document ({Entries.Count} entries)";

		public static TomlDocument CreateEmpty()
		{
			return new TomlDocument();
		}

		internal TomlDocument()
		{
		}

		internal TomlDocument(TomlTable from)
		{
			foreach (string key in from.Keys)
			{
				PutValue(key, from.GetValue(key));
			}
		}

		private string SerializeDocument()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(SerializeNonInlineTable(null, includeHeader: false));
			if (TrailingComment != null)
			{
				TomlCommentData tomlCommentData = new TomlCommentData
				{
					PrecedingComment = TrailingComment
				};
				stringBuilder.Append('\n');
				stringBuilder.Append(tomlCommentData.FormatPrecedingComment());
			}
			return stringBuilder.ToString();
		}
	}
	public class TomlDouble : TomlValue
	{
		private double _value;

		public bool HasDecimal => Value != (double)(int)Value;

		public double Value => _value;

		public bool IsNaN => double.IsNaN(Value);

		public bool IsInfinity => double.IsInfinity(Value);

		public override string StringValue
		{
			get
			{
				if (this != null)
				{
					if (IsInfinity)
					{
						return double.IsPositiveInfinity(Value) ? "inf" : "-inf";
					}
					if (IsNaN)
					{
						return "nan";
					}
					if (HasDecimal)
					{
						return Value.ToString(CultureInfo.InvariantCulture);
					}
				}
				return $"{Value:F1}";
			}
		}

		public override string SerializedValue => StringValue;

		public TomlDouble(double value)
		{
			_value = value;
		}

		internal static TomlDouble? Parse(string valueInToml)
		{
			double? doubleValue = TomlNumberUtils.GetDoubleValue(valueInToml);
			if (!doubleValue.HasValue)
			{
				return null;
			}
			return new TomlDouble(doubleValue.Value);
		}
	}
	public class TomlLocalDate : TomlValue, ITomlValueWithDateTime
	{
		private readonly DateTime _value;

		public DateTime Value => _value;

		public override string StringValue => XmlConvert.ToString(Value, XmlDateTimeSerializationMode.Unspecified);

		public override string SerializedValue => StringValue;

		public TomlLocalDate(DateTime value)
		{
			_value = value;
		}

		public static TomlLocalDate? Parse(string input)
		{
			if (!DateTime.TryParse(input, out var result))
			{
				return null;
			}
			return new TomlLocalDate(result);
		}
	}
	public class TomlLocalDateTime : TomlValue, ITomlValueWithDateTime
	{
		private readonly DateTime _value;

		public DateTime Value => _value;

		public override string StringValue => XmlConvert.ToString(Value, XmlDateTimeSerializationMode.Unspecified);

		public override string SerializedValue => StringValue;

		public TomlLocalDateTime(DateTime value)
		{
			_value = value;
		}

		public static TomlLocalDateTime? Parse(string input)
		{
			if (!DateTime.TryParse(input, out var result))
			{
				return null;
			}
			return new TomlLocalDateTime(result);
		}
	}
	public class TomlLocalTime : TomlValue
	{
		private readonly TimeSpan _value;

		public TimeSpan Value => _value;

		public override string StringValue => Value.ToString();

		public override string SerializedValue => StringValue;

		public TomlLocalTime(TimeSpan value)
		{
			_value = value;
		}

		public static TomlLocalTime? Parse(string input)
		{
			if (!TimeSpan.TryParse(input, out var result))
			{
				return null;
			}
			return new TomlLocalTime(result);
		}
	}
	public class TomlLong : TomlValue
	{
		private long _value;

		public long Value => _value;

		public override string StringValue => Value.ToString();

		public override string SerializedValue => StringValue;

		public TomlLong(long value)
		{
			_value = value;
		}

		internal static TomlLong? Parse(string valueInToml)
		{
			long? longValue = TomlNumberUtils.GetLongValue(valueInToml);
			if (!longValue.HasValue)
			{
				return null;
			}
			return new TomlLong(longValue.Value);
		}
	}
	public class TomlOffsetDateTime : TomlValue
	{
		private readonly DateTimeOffset _value;

		public DateTimeOffset Value => _value;

		public override string StringValue => Value.ToString("O");

		public override string SerializedValue => StringValue;

		public TomlOffsetDateTime(DateTimeOffset value)
		{
			_value = value;
		}

		public static TomlOffsetDateTime? Parse(string input)
		{
			if (!DateTimeOffset.TryParse(input, out var result))
			{
				return null;
			}
			return new TomlOffsetDateTime(result);
		}
	}
	public class TomlString : TomlValue
	{
		private readonly string _value;

		public static TomlString Empty => new TomlString("");

		public string Value => _value;

		public override string StringValue => Value;

		public override string SerializedValue
		{
			get
			{
				if (!Value.RuntimeCorrectContains('\'') && Value.RuntimeCorrectContains('\\'))
				{
					if (!Value.RuntimeCorrectContains('\n'))
					{
						return LiteralStringSerializedForm;
					}
					return MultiLineLiteralStringSerializedForm;
				}
				if (Value.RuntimeCorrectContains('\'') && !Value.RuntimeCorrectContains('"'))
				{
					return StandardStringSerializedForm;
				}
				if (Value.RuntimeCorrectContains('"') && !Value.RuntimeCorrectContains('\'') && !Value.RuntimeCorrectContains('\n'))
				{
					return LiteralStringSerializedForm;
				}
				if (Value.RuntimeCorrectContains('"') && !Value.RuntimeCorrectContains('\''))
				{
					return MultiLineLiteralStringSerializedForm;
				}
				return StandardStringSerializedForm;
			}
		}

		internal string StandardStringSerializedForm => "\"" + TomlUtils.EscapeStringValue(Value) + "\"";

		internal string LiteralStringSerializedForm => "'" + Value + "'";

		internal string MultiLineLiteralStringSerializedForm => "'''\n" + Value + "'''";

		public TomlString(string? value)
		{
			_value = value ?? throw new ArgumentNullException("value", "TomlString's value cannot be null");
		}
	}
	public class TomlTable : TomlValue
	{
		public readonly Dictionary<string, TomlValue> Entries = new Dictionary<string, TomlValue>();

		internal bool Locked;

		internal bool Defined;

		public bool ForceNoInline { get; set; }

		public override string StringValue => $"Table ({Entries.Count} entries)";

		public HashSet<string> Keys => new HashSet<string>(Entries.Keys);

		public bool ShouldBeSerializedInline
		{
			get
			{
				if (!ForceNoInline && Entries.Count < 4)
				{
					return Entries.All<KeyValuePair<string, TomlValue>>((KeyValuePair<string, TomlValue> e) => !e.Key.Contains(" ") && e.Value.Comments.ThereAreNoComments && ((!(e.Value is TomlArray tomlArray)) ? (!(e.Value is TomlTable)) : tomlArray.IsSimpleArray));
				}
				return false;
			}
		}

		public override string SerializedValue
		{
			get
			{
				if (!ShouldBeSerializedInline)
				{
					throw new Exception("Cannot use SerializeValue to serialize non-inline tables. Use SerializeNonInlineTable(keyName).");
				}
				StringBuilder stringBuilder = new StringBuilder("{ ");
				stringBuilder.Append(string.Join(", ", Entries.Select<KeyValuePair<string, TomlValue>, string>((KeyValuePair<string, TomlValue> o) => o.Key + " = " + o.Value.SerializedValue).ToArray()));
				stringBuilder.Append(" }");
				return stringBuilder.ToString();
			}
		}

		public string SerializeNonInlineTable(string? keyName, bool includeHeader = true)
		{
			StringBuilder stringBuilder = new StringBuilder();
			if (includeHeader)
			{
				stringBuilder.Append('[').Append(keyName).Append("]");
				if (base.Comments.InlineComment != null)
				{
					stringBuilder.Append(" # ").Append(base.Comments.InlineComment);
				}
				stringBuilder.Append('\n');
			}
			string one;
			TomlValue two;
			foreach (KeyValuePair<string, TomlValue> entry in Entries)
			{
				Extensions.Deconstruct(entry, out one, out two);
				string subKey = one;
				TomlValue tomlValue = two;
				if (tomlValue is TomlTable tomlTable)
				{
					if (!tomlTable.ShouldBeSerializedInline)
					{
						goto IL_00a4;
					}
				}
				else if (tomlValue is TomlArray tomlArray && !tomlArray.CanBeSerializedInline)
				{
					goto IL_00a4;
				}
				bool flag = false;
				goto IL_00ac;
				IL_00a4:
				flag = true;
				goto IL_00ac;
				IL_00ac:
				if (!flag)
				{
					WriteValueToStringBuilder(keyName, subKey, stringBuilder);
				}
			}
			foreach (KeyValuePair<string, TomlValue> entry2 in Entries)
			{
				Extensions.Deconstruct(entry2, out one, out two);
				string subKey2 = one;
				if (two is TomlTable tomlTable2 && !tomlTable2.ShouldBeSerializedInline)
				{
					WriteValueToStringBuilder(keyName, subKey2, stringBuilder);
				}
			}
			foreach (KeyValuePair<string, TomlValue> entry3 in Entries)
			{
				Extensions.Deconstruct(entry3, out one, out two);
				string subKey3 = one;
				if (two is TomlArray tomlArray2 && !tomlArray2.CanBeSerializedInline)
				{
					WriteValueToStringBuilder(keyName, subKey3, stringBuilder);
				}
			}
			return stringBuilder.ToString();
		}

		private void WriteValueToStringBuilder(string? keyName, string subKey, StringBuilder builder)
		{
			TomlValue value = GetValue(subKey);
			subKey = EscapeKeyIfNeeded(subKey);
			if (keyName != null)
			{
				keyName = EscapeKeyIfNeeded(keyName);
			}
			string text = ((keyName == null) ? subKey : (keyName + "." + subKey));
			bool flag = builder.Length < 2 || builder[builder.Length - 2] == '\n';
			if (value.Comments.PrecedingComment != null)
			{
				builder.Append(value.Comments.FormatPrecedingComment()).Append('\n');
			}
			if (value is TomlArray tomlArray)
			{
				if (!tomlArray.CanBeSerializedInline)
				{
					if (!flag)
					{
						builder.Append('\n');
					}
					builder.Append(tomlArray.SerializeTableArray(text));
					return;
				}
				TomlArray tomlArray2 = tomlArray;
				builder.Append(subKey).Append(" = ").Append(tomlArray2.SerializedValue);
			}
			else if (value is TomlTable tomlTable)
			{
				if (!tomlTable.ShouldBeSerializedInline)
				{
					TomlTable tomlTable2 = tomlTable;
					builder.Append(tomlTable2.SerializeNonInlineTable(text)).Append('\n');
					return;
				}
				builder.Append(subKey).Append(" = ").Append(tomlTable.SerializedValue);
			}
			else
			{
				builder.Append(subKey).Append(" = ").Append(value.SerializedValue);
			}
			if (value.Comments.InlineComment != null)
			{
				builder.Append(" # ").Append(value.Comments.InlineComment);
			}
			builder.Append('\n');
		}

		private string EscapeKeyIfNeeded(string key)
		{
			bool flag = false;
			if (key.StartsWith("\"") && key.EndsWith("\"") && key.Count((char c) => c == '"') == 2)
			{
				return key;
			}
			if (key.StartsWith("'") && key.EndsWith("'") && key.Count((char c) => c == '\'') == 2)
			{
				return key;
			}
			if (key.Contains("\"") || key.Contains("'"))
			{
				key = TomlUtils.AddCorrectQuotes(key);
				flag = true;
			}
			string text = TomlUtils.EscapeStringValue(key);
			if (text.Contains(" ") || (text.Contains("\\") && !flag))
			{
				text = TomlUtils.AddCorrectQuotes(text);
			}
			return text;
		}

		internal void ParserPutValue(string key, TomlValue value, int lineNumber)
		{
			if (Locked)
			{
				throw new TomlTableLockedException(lineNumber, key);
			}
			InternalPutValue(key, value, lineNumber, callParserForm: true);
		}

		public void PutValue(string key, TomlValue value, bool quote = false)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			if (value == null)
			{
				throw new ArgumentNullException("value");
			}
			if (quote)
			{
				key = TomlUtils.AddCorrectQuotes(key);
			}
			InternalPutValue(key, value, null, callParserForm: false);
		}

		public void Put<T>(string key, T t, bool quote = false)
		{
			TomlValue tomlValue2 = ((!((object)t is TomlValue tomlValue)) ? TomletMain.ValueFrom(t) : tomlValue);
			if (tomlValue2 == null)
			{
				throw new ArgumentException("Value to insert into TOML table serialized to null.", "t");
			}
			PutValue(key, tomlValue2, quote);
		}

		public string DeQuoteKey(string key)
		{
			if ((key.StartsWith("\"") && key.EndsWith("\"")) || (key.StartsWith("'") && key.EndsWith("'")))
			{
				return key.Substring(1, key.Length - 2);
			}
			return key;
		}

		private void InternalPutValue(string key, TomlValue value, int? lineNumber, bool callParserForm)
		{
			key = key.Trim();
			TomlKeyUtils.GetTopLevelAndSubKeys(key, out string ourKeyName, out string restOfKey);
			if (!string.IsNullOrEmpty(restOfKey))
			{
				if (!Entries.TryGetValue(DeQuoteKey(ourKeyName), out TomlValue value2))
				{
					TomlTable tomlTable = new TomlTable();
					if (callParserForm)
					{
						ParserPutValue(ourKeyName, tomlTable, lineNumber.Value);
					}
					else
					{
						PutValue(ourKeyName, tomlTable);
					}
					if (callParserForm)
					{
						tomlTable.ParserPutValue(restOfKey, value, lineNumber.Value);
					}
					else
					{
						tomlTable.PutValue(restOfKey, value);
					}
					return;
				}
				if (!(value2 is TomlTable tomlTable2))
				{
					if (lineNumber.HasValue)
					{
						throw new TomlDottedKeyParserException(lineNumber.Value, ourKeyName);
					}
					throw new TomlDottedKeyException(ourKeyName);
				}
				if (callParserForm)
				{
					tomlTable2.ParserPutValue(restOfKey, value, lineNumber.Value);
				}
				else
				{
					tomlTable2.PutValue(restOfKey, value);
				}
			}
			else
			{
				key = DeQuoteKey(key);
				if (Entries.ContainsKey(key) && lineNumber.HasValue)
				{
					throw new TomlKeyRedefinitionException(lineNumber.Value, key);
				}
				Entries[key] = value;
			}
		}

		public bool ContainsKey(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			TomlKeyUtils.GetTopLevelAndSubKeys(key, out string ourKeyName, out string restOfKey);
			if (string.IsNullOrEmpty(restOfKey))
			{
				return Entries.ContainsKey(DeQuoteKey(key));
			}
			if (!Entries.TryGetValue(ourKeyName, out TomlValue value))
			{
				return false;
			}
			if (value is TomlTable tomlTable)
			{
				return tomlTable.ContainsKey(restOfKey);
			}
			throw new TomlContainsDottedKeyNonTableException(key);
		}

		public bool TryGetValue(string key, out TomlValue? value)
		{
			if (ContainsKey(key))
			{
				return (value = GetValue(key)) != null;
			}
			value = null;
			return false;
		}

		public TomlValue GetValue(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			if (!ContainsKey(key))
			{
				throw new TomlNoSuchValueException(key);
			}
			TomlKeyUtils.GetTopLevelAndSubKeys(key, out string ourKeyName, out string restOfKey);
			if (string.IsNullOrEmpty(restOfKey))
			{
				return Entries[DeQuoteKey(key)];
			}
			if (!Entries.TryGetValue(ourKeyName, out TomlValue value))
			{
				throw new TomlNoSuchValueException(key);
			}
			if (value is TomlTable tomlTable)
			{
				return tomlTable.GetValue(restOfKey);
			}
			throw new Exception("Tomlet Internal bug - existing key is not a table in TomlTable GetValue, but we didn't throw in ContainsKey?");
		}

		public string GetString(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			TomlValue value = GetValue(TomlUtils.AddCorrectQuotes(key));
			return ((value as TomlString) ?? throw new TomlTypeMismatchException(typeof(TomlString), value.GetType(), typeof(string))).Value;
		}

		public int GetInteger(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			TomlValue value = GetValue(TomlUtils.AddCorrectQuotes(key));
			return (int)((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlLong), value.GetType(), typeof(int))).Value;
		}

		public long GetLong(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			TomlValue value = GetValue(TomlUtils.AddCorrectQuotes(key));
			return ((value as TomlLong) ?? throw new TomlTypeMismatchException(typeof(TomlLong), value.GetType(), typeof(int))).Value;
		}

		public float GetFloat(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			TomlValue value = GetValue(TomlUtils.AddCorrectQuotes(key));
			return (float)((value as TomlDouble) ?? throw new TomlTypeMismatchException(typeof(TomlDouble), value.GetType(), typeof(float))).Value;
		}

		public bool GetBoolean(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			TomlValue value = GetValue(TomlUtils.AddCorrectQuotes(key));
			return ((value as TomlBoolean) ?? throw new TomlTypeMismatchException(typeof(TomlBoolean), value.GetType(), typeof(bool))).Value;
		}

		public TomlArray GetArray(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			TomlValue value = GetValue(TomlUtils.AddCorrectQuotes(key));
			return (value as TomlArray) ?? throw new TomlTypeMismatchException(typeof(TomlArray), value.GetType(), typeof(TomlArray));
		}

		public TomlTable GetSubTable(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			TomlValue value = GetValue(TomlUtils.AddCorrectQuotes(key));
			return (value as TomlTable) ?? throw new TomlTypeMismatchException(typeof(TomlTable), value.GetType(), typeof(TomlTable));
		}
	}
	public abstract class TomlValue
	{
		public TomlCommentData Comments { get; } = new TomlCommentData();


		public abstract string StringValue { get; }

		public abstract string SerializedValue { get; }
	}
	public interface ITomlValueWithDateTime
	{
		DateTime Value { get; }
	}
}
namespace Tomlet.Exceptions
{
	public class InvalidTomlDateTimeException : TomlExceptionWithLine
	{
		private readonly string _inputString;

		public override string Message => $"Found an invalid TOML date/time string '{_inputString}' on line {LineNumber}";

		public InvalidTomlDateTimeException(int lineNumber, string inputString)
			: base(lineNumber)
		{
			_inputString = inputString;
		}
	}
	public class InvalidTomlEscapeException : TomlExceptionWithLine
	{
		private readonly string _escapeSequence;

		public override string Message => $"Found an invalid escape sequence '\\{_escapeSequence}' on line {LineNumber}";

		public InvalidTomlEscapeException(int lineNumber, string escapeSequence)
			: base(lineNumber)
		{
			_escapeSequence = escapeSequence;
		}
	}
	public class InvalidTomlInlineTableException : TomlExceptionWithLine
	{
		public override string Message => $"Found an invalid inline TOML table on line {LineNumber}. See further down for cause.";

		public InvalidTomlInlineTableException(int lineNumber, TomlException cause)
			: base(lineNumber, cause)
		{
		}
	}
	public class InvalidTomlKeyException : TomlException
	{
		private readonly string _key;

		public override string Message => "The string |" + _key + "| (between the two bars) contains at least one of both a double quote and a single quote, so it cannot be used for a TOML key.";

		public InvalidTomlKeyException(string key)
		{
			_key = key;
		}
	}
	public class InvalidTomlNumberException : TomlExceptionWithLine
	{
		private readonly string _input;

		public override string Message => $"While reading input line {LineNumber}, found an invalid number literal '{_input}'";

		public InvalidTomlNumberException(int lineNumber, string input)
			: base(lineNumber)
		{
			_input = input;
		}
	}
	public class MissingIntermediateInTomlTableArraySpecException : TomlExceptionWithLine
	{
		private readonly string _missing;

		public override string Message => $"Missing intermediate definition for {_missing} in table-array specification on line {LineNumber}. This is undefined behavior, and I chose to define it as an error.";

		public MissingIntermediateInTomlTableArraySpecException(int lineNumber, string missing)
			: base(lineNumber)
		{
			_missing = missing;
		}
	}
	public class NewLineInTomlInlineTableException : TomlExceptionWithLine
	{
		public override string Message => "Found a new-line character within a TOML inline table. This is not allowed.";

		public NewLineInTomlInlineTableException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class NoTomlKeyException : TomlExceptionWithLine
	{
		public override string Message => $"Expected a TOML key on line {LineNumber}, but found an equals sign ('=').";

		public NoTomlKeyException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class TimeOffsetOnTomlDateOrTimeException : TomlExceptionWithLine
	{
		private readonly string _tzString;

		public override string Message => $"Found a time offset string {_tzString} in a partial datetime on line {LineNumber}. This is not allowed - either specify both the date and the time, or remove the offset specifier.";

		public TimeOffsetOnTomlDateOrTimeException(int lineNumber, string tzString)
			: base(lineNumber)
		{
			_tzString = tzString;
		}
	}
	public class TomlArraySyntaxException : TomlExceptionWithLine
	{
		private readonly char _charFound;

		public override string Message => $"Expecting ',' or ']' after value in array on line {LineNumber}, found '{_charFound}'";

		public TomlArraySyntaxException(int lineNumber, char charFound)
			: base(lineNumber)
		{
			_charFound = charFound;
		}
	}
	public class TomlContainsDottedKeyNonTableException : TomlException
	{
		internal readonly string Key;

		public override string Message => "A call was made on a TOML table which attempted to access a sub-key of " + Key + ", but the value it refers to is not a table";

		public TomlContainsDottedKeyNonTableException(string key)
		{
			Key = key;
		}
	}
	public class TomlDateTimeMissingSeparatorException : TomlExceptionWithLine
	{
		public override string Message => $"Found a date-time on line {LineNumber} which is missing a separator (T, t, or a space) between the date and time.";

		public TomlDateTimeMissingSeparatorException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class TomlDateTimeUnnecessarySeparatorException : TomlExceptionWithLine
	{
		public override string Message => $"Found an unnecessary date-time separator (T, t, or a space) in a date or time on line {LineNumber}";

		public TomlDateTimeUnnecessarySeparatorException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class TomlDottedKeyException : TomlException
	{
		private readonly string _key;

		public override string Message => "Tried to redefine key " + _key + " as a table (by way of a dotted key) when it's already defined as not being a table.";

		public TomlDottedKeyException(string key)
		{
			_key = key;
		}
	}
	public class TomlDottedKeyParserException : TomlExceptionWithLine
	{
		private readonly string _key;

		public override string Message => $"Tried to redefine key {_key} as a table (by way of a dotted key on line {LineNumber}) when it's already defined as not being a table.";

		public TomlDottedKeyParserException(int lineNumber, string key)
			: base(lineNumber)
		{
			_key = key;
		}
	}
	public class TomlDoubleDottedKeyException : TomlExceptionWithLine
	{
		public override string Message => "Found two consecutive dots, or a leading dot, in a key on line " + LineNumber;

		public TomlDoubleDottedKeyException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class TomlEndOfFileException : TomlExceptionWithLine
	{
		public override string Message => $"Found unexpected EOF on line {LineNumber} when parsing TOML file";

		public TomlEndOfFileException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class TomlEnumParseException : TomlException
	{
		private string _valueName;

		private Type _enumType;

		public override string Message => $"Could not find enum value by name \"{_valueName}\" in enum class {_enumType} while deserializing.";

		public TomlEnumParseException(string valueName, Type enumType)
		{
			_valueName = valueName;
			_enumType = enumType;
		}
	}
	public abstract class TomlException : Exception
	{
		protected TomlException()
		{
		}

		protected TomlException(Exception cause)
			: base("", cause)
		{
		}
	}
	public abstract class TomlExceptionWithLine : TomlException
	{
		protected int LineNumber;

		protected TomlExceptionWithLine(int lineNumber)
		{
			LineNumber = lineNumber;
		}

		protected TomlExceptionWithLine(int lineNumber, Exception cause)
			: base(cause)
		{
			LineNumber = lineNumber;
		}
	}
	public class TomlFieldTypeMismatchException : TomlTypeMismatchException
	{
		private readonly Type _typeBeingInstantiated;

		private readonly FieldInfo _fieldBeingDeserialized;

		public override string Message => $"While deserializing an object of type {_typeBeingInstantiated}, found field {_fieldBeingDeserialized.Name} expecting a type of {ExpectedTypeName}, but value in TOML was of type {ActualTypeName}";

		public TomlFieldTypeMismatchException(Type typeBeingInstantiated, FieldInfo fieldBeingDeserialized, TomlTypeMismatchException cause)
			: base(cause.ExpectedType, cause.ActualType, fieldBeingDeserialized.FieldType)
		{
			_typeBeingInstantiated = typeBeingInstantiated;
			_fieldBeingDeserialized = fieldBeingDeserialized;
		}
	}
	public class TomlInlineTableSeparatorException : TomlExceptionWithLine
	{
		private readonly char _found;

		public override string Message => $"Expected '}}' or ',' after key-value pair in TOML inline table, found '{_found}'";

		public TomlInlineTableSeparatorException(int lineNumber, char found)
			: base(lineNumber)
		{
			_found = found;
		}
	}
	public class TomlInstantiationException : TomlException
	{
		private readonly Type _type;

		public override string Message => "Could not find a no-argument constructor for type " + _type.FullName;

		public TomlInstantiationException(Type type)
		{
			_type = type;
		}
	}
	public class TomlInternalException : TomlExceptionWithLine
	{
		public override string Message => $"An internal exception occured while parsing line {LineNumber} of the TOML document";

		public TomlInternalException(int lineNumber, Exception cause)
			: base(lineNumber, cause)
		{
		}
	}
	public class TomlInvalidValueException : TomlExceptionWithLine
	{
		private readonly char _found;

		public override string Message => $"Expected the start of a number, string literal, boolean, array, or table on line {LineNumber}, found '{_found}'";

		public TomlInvalidValueException(int lineNumber, char found)
			: base(lineNumber)
		{
			_found = found;
		}
	}
	public class TomlKeyRedefinitionException : TomlExceptionWithLine
	{
		private readonly string _key;

		public override string Message => $"TOML document attempts to re-define key '{_key}' on line {LineNumber}";

		public TomlKeyRedefinitionException(int lineNumber, string key)
			: base(lineNumber)
		{
			_key = key;
		}
	}
	public class TomlMissingEqualsException : TomlExceptionWithLine
	{
		private readonly char _found;

		public override string Message => $"Expecting an equals sign ('=') on line {LineNumber}, but found '{_found}'";

		public TomlMissingEqualsException(int lineNumber, char found)
			: base(lineNumber)
		{
			_found = found;
		}
	}
	public class TomlMissingNewlineException : TomlExceptionWithLine
	{
		private readonly char _found;

		public override string Message => $"Expecting a newline character at the end of a statement on line {LineNumber}, but found an unexpected '{_found}'";

		public TomlMissingNewlineException(int lineNumber, char found)
			: base(lineNumber)
		{
			_found = found;
		}
	}
	public class TomlNewlineInInlineCommentException : TomlException
	{
		public override string Message => "An attempt was made to set an inline comment which contains a newline. This obviously cannot be done, as inline comments must fit on one line.";
	}
	public class TomlNonTableArrayUsedAsTableArrayException : TomlExceptionWithLine
	{
		private readonly string _arrayName;

		public override string Message => $"{_arrayName} is used as a table-array on line {LineNumber} when it has previously been defined as a static array. This is not allowed.";

		public TomlNonTableArrayUsedAsTableArrayException(int lineNumber, string arrayName)
			: base(lineNumber)
		{
			_arrayName = arrayName;
		}
	}
	public class TomlNoSuchValueException : TomlException
	{
		private readonly string _key;

		public override string Message => "Attempted to get the value for key " + _key + " but no value is associated with that key";

		public TomlNoSuchValueException(string key)
		{
			_key = key;
		}
	}
	public class TomlPrimitiveToDocumentException : TomlException
	{
		private Type primitiveType;

		public override string Message => "Tried to create a TOML document from a primitive value of type " + primitiveType.Name + ". Documents can only be created from objects.";

		public TomlPrimitiveToDocumentException(Type primitiveType)
		{
			this.primitiveType = primitiveType;
		}
	}
	public class TomlPropertyTypeMismatchException : TomlTypeMismatchException
	{
		private readonly Type _typeBeingInstantiated;

		private readonly PropertyInfo _propBeingDeserialized;

		public override string Message => $"While deserializing an object of type {_typeBeingInstantiated}, found property {_propBeingDeserialized.Name} expecting a type of {ExpectedTypeName}, but value in TOML was of type {ActualTypeName}";

		public TomlPropertyTypeMismatchException(Type typeBeingInstantiated, PropertyInfo propBeingDeserialized, TomlTypeMismatchException cause)
			: base(cause.ExpectedType, cause.ActualType, propBeingDeserialized.PropertyType)
		{
			_typeBeingInstantiated = typeBeingInstantiated;
			_propBeingDeserialized = propBeingDeserialized;
		}
	}
	public class TomlStringException : TomlExceptionWithLine
	{
		public override string Message => $"Found an invalid TOML string on line {LineNumber}";

		public TomlStringException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class TomlTableArrayAlreadyExistsAsNonArrayException : TomlExceptionWithLine
	{
		private readonly string _arrayName;

		public override string Message => $"{_arrayName} is defined as a table-array (double-bracketed section) on line {LineNumber} but it has previously been used as a non-array type.";

		public TomlTableArrayAlreadyExistsAsNonArrayException(int lineNumber, string arrayName)
			: base(lineNumber)
		{
			_arrayName = arrayName;
		}
	}
	public class TomlTableLockedException : TomlExceptionWithLine
	{
		private readonly string _key;

		public override string Message => $"TOML table is locked (e.g. defined inline), cannot add or update key {_key} to it on line {LineNumber}";

		public TomlTableLockedException(int lineNumber, string key)
			: base(lineNumber)
		{
			_key = key;
		}
	}
	public class TomlTableRedefinitionException : TomlExceptionWithLine
	{
		private readonly string _key;

		public override string Message => $"TOML document attempts to re-define table '{_key}' on line {LineNumber}";

		public TomlTableRedefinitionException(int lineNumber, string key)
			: base(lineNumber)
		{
			_key = key;
		}
	}
	public class TomlTripleQuotedKeyException : TomlExceptionWithLine
	{
		public override string Message => $"Found a triple-quoted key on line {LineNumber}. This is not allowed.";

		public TomlTripleQuotedKeyException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class TomlTypeMismatchException : TomlException
	{
		protected readonly string ExpectedTypeName;

		protected readonly string ActualTypeName;

		protected internal readonly Type ExpectedType;

		protected internal readonly Type ActualType;

		private readonly Type _context;

		public override string Message => $"While trying to convert to type {_context}, a TOML value of type {ExpectedTypeName} was required but a value of type {ActualTypeName} was found";

		public TomlTypeMismatchException(Type expected, Type actual, Type context)
		{
			ExpectedTypeName = (typeof(TomlValue).IsAssignableFrom(expected) ? expected.Name.Replace("Toml", "") : expected.Name);
			ActualTypeName = (typeof(TomlValue).IsAssignableFrom(actual) ? actual.Name.Replace("Toml", "") : actual.Name);
			ExpectedType = expected;
			ActualType = actual;
			_context = context;
		}
	}
	public class TomlUnescapedUnicodeControlCharException : TomlExceptionWithLine
	{
		private readonly int _theChar;

		public override string Message => $"Found an unescaped unicode control character U+{_theChar:0000} on line {LineNumber}. Control character other than tab (U+0009) are not allowed in TOML unless they are escaped.";

		public TomlUnescapedUnicodeControlCharException(int lineNumber, int theChar)
			: base(lineNumber)
		{
			_theChar = theChar;
		}
	}
	public class TomlWhitespaceInKeyException : TomlExceptionWithLine
	{
		public override string Message => "Found whitespace in an unquoted TOML key at line " + LineNumber;

		public TomlWhitespaceInKeyException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class TripleQuoteInTomlMultilineLiteralException : TomlExceptionWithLine
	{
		public override string Message => $"Found a triple-single-quote (''') inside a multiline string literal on line {LineNumber}. This is not allowed.";

		public TripleQuoteInTomlMultilineLiteralException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class TripleQuoteInTomlMultilineSimpleStringException : TomlExceptionWithLine
	{
		public override string Message => $"Found a triple-double-quote (\"\"\") inside a multiline simple string on line {LineNumber}. This is not allowed.";

		public TripleQuoteInTomlMultilineSimpleStringException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class UnterminatedTomlKeyException : TomlExceptionWithLine
	{
		public override string Message => $"Found an unterminated quoted key on line {LineNumber}";

		public UnterminatedTomlKeyException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class UnterminatedTomlStringException : TomlExceptionWithLine
	{
		public override string Message => $"Found an unterminated TOML string on line {LineNumber}";

		public UnterminatedTomlStringException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class UnterminatedTomlTableArrayException : TomlExceptionWithLine
	{
		public override string Message => $"Found an unterminated table-array (expecting two ]s to close it) on line {LineNumber}";

		public UnterminatedTomlTableArrayException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
	public class UnterminatedTomlTableNameException : TomlExceptionWithLine
	{
		public override string Message => $"Found an unterminated table name on line {LineNumber}";

		public UnterminatedTomlTableNameException(int lineNumber)
			: base(lineNumber)
		{
		}
	}
}
namespace Tomlet.Attributes
{
	internal class NoCoverageAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class)]
	public class TomlDoNotInlineObjectAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
	public class TomlInlineCommentAttribute : Attribute
	{
		internal string Comment { get; }

		public TomlInlineCommentAttribute(string comment)
		{
			Comment = comment;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
	public class TomlPrecedingCommentAttribute : Attribute
	{
		internal string Comment { get; }

		public TomlPrecedingCommentAttribute(string comment)
		{
			Comment = comment;
		}
	}
	[AttributeUsage(AttributeTargets.Property)]
	public class TomlPropertyAttribute : Attribute
	{
		private readonly string _mapFrom;

		public TomlPropertyAttribute(string mapFrom)
		{
			_mapFrom = mapFrom;
		}

		public string GetMappedString()
		{
			return _mapFrom;
		}
	}
}

BepInEx-BepInEx_MLLoader/BepInEx.MelonLoader.Loader/WebSocketDotNet.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using Microsoft.CodeAnalysis;
using WebSocketDotNet.Http;
using WebSocketDotNet.Messages;
using WebSocketDotNet.Protocol;
using WebSocketDotNet.Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("WebSocketDotNet.Tests")]
[assembly: AssemblyCompany("N/A")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("\r\n            WebSocketDotNet is a .NET library for WebSockets. Compared to similar libraries, the main advantage is that it works\r\n            on more versions of .NET, from .NET Framework 3.5 to .NET 6.0.\r\n        ")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e1c3c33f40bfed34fd57b5a048540bcb1e8db26f")]
[assembly: AssemblyProduct("WebSocketDotNet")]
[assembly: AssemblyTitle("WebSocketDotNet")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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;
		}
	}
}
namespace WebSocketDotNet
{
	internal static class AssemblyInfo
	{
		public static readonly string Name = Assembly.GetExecutingAssembly().GetName().Name;

		public static readonly Version Version = Assembly.GetExecutingAssembly().GetName().Version;
	}
	public enum MessageChunkingMode
	{
		AlwaysUseExtendedLength,
		LimitTo16BitExtendedLength,
		NeverUseExtendedLength
	}
	public class WebSocket
	{
		private static readonly Guid WebsocketKeyGuid = new Guid("258EAFA5-E914-47DA-95CA-C5AB0DC85B11");

		private readonly Random _random = new Random();

		private readonly SHA1 _sha1 = SHA1.Create();

		private readonly HttpHandler _httpHandler;

		private readonly List<WebSocketFragment> _currentPartialFragments = new List<WebSocketFragment>();

		private readonly object _sendLock = new object();

		private readonly object _receiveLock = new object();

		private Thread? _receiveThread;

		private WebSocketCloseMessage? _closeMessage;

		private WebSocketConfiguration _configuration;

		public WebSocketState State { get; private set; }

		public event Action Opened = delegate
		{
		};

		public event Action<WebSocketCloseCode, string?> Closing = delegate
		{
		};

		public event Action<WebSocketCloseCode, string?> Closed = delegate
		{
		};

		public event Action<byte[]> PongReceived = delegate
		{
		};

		public event Action<byte[]> BinaryReceived = delegate
		{
		};

		public event Action<string> TextReceived = delegate
		{
		};

		public event Action<WebSocketMessage> MessageReceived = delegate
		{
		};

		[Obsolete("Use the constructor that takes a WebSocketConfiguration instead")]
		public WebSocket(string url, bool autoConnect = true, bool useReceiveThread = true)
			: this(url, new WebSocketConfiguration
			{
				AutoConnect = autoConnect,
				UseAutomaticReceiveThread = useReceiveThread
			})
		{
		}

		public WebSocket(string url, WebSocketConfiguration configuration = default(WebSocketConfiguration))
		{
			_configuration = configuration;
			UriUtils.ValidateUrlScheme(ref url);
			_httpHandler = new HttpHandler(new Uri(url));
			State = WebSocketState.Closed;
			if (configuration.AutoConnect)
			{
				Connect();
			}
		}

		public void Connect()
		{
			if (State != WebSocketState.Closed)
			{
				throw new InvalidOperationException("Cannot connect while in state " + State);
			}
			try
			{
				SendHandshakeRequest();
			}
			catch (Exception e)
			{
				OnException(e);
				throw;
			}
			OnOpen();
		}

		private void SendHandshakeRequest()
		{
			State = WebSocketState.Connecting;
			Dictionary<string, string> dictionary = BuildHandshakeHeaders();
			HttpResponse resp = _httpHandler.SendRequestWithHeaders(dictionary);
			ValidateResponse(resp, dictionary["Sec-WebSocket-Key"]);
		}

		private Dictionary<string, string> BuildHandshakeHeaders()
		{
			byte[] array = new byte[16];
			_random.NextBytes(array);
			string value = Convert.ToBase64String(array);
			return new Dictionary<string, string>
			{
				{ "Upgrade", "websocket" },
				{ "Connection", "Upgrade" },
				{ "Sec-WebSocket-Key", value },
				{ "Sec-WebSocket-Version", "13" }
			};
		}

		private void ValidateResponse(HttpResponse resp, string key)
		{
			string text = Convert.ToBase64String(_sha1.ComputeHash(Encoding.UTF8.GetBytes(key + WebsocketKeyGuid.ToString().ToUpperInvariant())));
			if (resp.StatusCode != HttpStatusCode.SwitchingProtocols)
			{
				throw new WebException($"Expecting HTTP 101/SwitchingProtocols, got {(int)resp.StatusCode}/{resp.StatusCode}");
			}
			if (!resp.Headers.TryGetValue("Upgrade", out string value) || value != "websocket")
			{
				throw new WebException("Expecting Upgrade: websocket, got \"" + value + "\"");
			}
			if (!resp.Headers.TryGetValue("Sec-WebSocket-Accept", out string value2) || value2 != text)
			{
				throw new WebException("Invalid or no Sec-WebSocket-Accept header in response (got \"" + value2 + "\", expected \"" + text + "\")");
			}
		}

		public void Send(WebSocketMessage message)
		{
			WebSocketState state = State;
			if (state != WebSocketState.Open && state != WebSocketState.Closing)
			{
				throw new InvalidOperationException("WebSocket is not open");
			}
			List<WebSocketFragment> list = message.ToFrame().ToFragments(_configuration.MessageChunkingMode);
			Stream orOpenStream = _httpHandler.GetOrOpenStream();
			Monitor.Enter(_sendLock);
			foreach (WebSocketFragment item in list)
			{
				byte[] bytes = item.Serialize();
				Extensions.Write(orOpenStream, bytes);
			}
			Monitor.Exit(_sendLock);
		}

		public void SendClose(WebSocketCloseCode code = WebSocketCloseCode.ClosedOk, string? reason = null)
		{
			if (State == WebSocketState.Closed)
			{
				return;
			}
			if (State == WebSocketState.Closing)
			{
				if (code == WebSocketCloseCode.InternalError)
				{
					this.Closing(code, reason);
				}
				return;
			}
			if (State == WebSocketState.Connecting)
			{
				if (code == WebSocketCloseCode.ProtocolError || code == WebSocketCloseCode.InternalError)
				{
					this.Closing(code, reason);
					_closeMessage = new WebSocketCloseMessage(code, reason);
					OnClose();
					return;
				}
				throw new InvalidOperationException("Cannot send close message while connecting");
			}
			if (code == WebSocketCloseCode.Reserved)
			{
				throw new ArgumentException("Cannot use reserved close codes", "code");
			}
			State = WebSocketState.Closing;
			_closeMessage = new WebSocketCloseMessage(code, reason);
			this.Closing(code, reason);
			try
			{
				Send(_closeMessage);
			}
			catch (Exception e)
			{
				OnException(e);
			}
		}

		public void ReceiveAllAvailable()
		{
			WebSocketState state = State;
			if (state != WebSocketState.Open && state != WebSocketState.Closing)
			{
				return;
			}
			List<WebSocketFragment> list = new List<WebSocketFragment>();
			Monitor.Enter(_receiveLock);
			do
			{
				try
				{
					WebSocketFragment item = ReceiveOneFragment();
					list.Add(item);
				}
				catch (Exception e)
				{
					OnException(e);
				}
			}
			while (_httpHandler.AnyDataAvailable);
			Monitor.Exit(_receiveLock);
			try
			{
				list.ForEach(ProcessFragment);
			}
			catch (Exception e2)
			{
				OnException(e2);
			}
		}

		private void ReceiveLoop()
		{
			while (true)
			{
				WebSocketState state = State;
				if (state == WebSocketState.Open || state == WebSocketState.Closing)
				{
					try
					{
						ReceiveAllAvailable();
					}
					catch (Exception e)
					{
						OnException(e);
					}
					Thread.Sleep(10);
					continue;
				}
				break;
			}
		}

		private WebSocketFragment ReceiveOneFragment()
		{
			WebSocketState state = State;
			if (state != WebSocketState.Open && state != WebSocketState.Closing)
			{
				throw new InvalidOperationException("WebSocket is not open");
			}
			return WebSocketFragment.Read(_httpHandler.GetOrOpenStream());
		}

		private void ProcessFragment(WebSocketFragment fragment)
		{
			if (fragment.Reserved1 || fragment.Reserved2 || fragment.Reserved3)
			{
				throw new WebSocketProtocolException("Reserved bits set in fragment");
			}
			if (fragment.Opcode == WebSocketOpcode.Continuation)
			{
				if (_currentPartialFragments.Count == 0)
				{
					throw new WebSocketProtocolException("Received unexpected continuation fragment with no partial fragments");
				}
				_currentPartialFragments.Add(fragment);
				if (fragment.IsFinal)
				{
					WebSocketFrame frame = WebSocketFrame.FromFragments(_currentPartialFragments);
					_currentPartialFragments.Clear();
					ProcessFrame(frame);
				}
				return;
			}
			if (_currentPartialFragments.Count > 0 && !fragment.Opcode.IsControlOpcode())
			{
				throw new WebSocketProtocolException("Received non-continuation, non-control fragment with incomplete frame in buffer");
			}
			if (fragment.IsFinal)
			{
				ProcessFrame(WebSocketFrame.FromFragment(fragment));
				return;
			}
			if (fragment.Opcode.IsControlOpcode())
			{
				throw new WebSocketProtocolException($"Received fragmented control frame! (opcode: {fragment.Opcode})");
			}
			_currentPartialFragments.Add(fragment);
		}

		private void ProcessFrame(WebSocketFrame frame)
		{
			ProcessMessage(WebSocketMessage.FromFrame(frame));
		}

		private void ProcessMessage(WebSocketMessage message)
		{
			if (!(message is WebSocketPingMessage webSocketPingMessage))
			{
				if (!(message is WebSocketPongMessage webSocketPongMessage))
				{
					if (!(message is WebSocketCloseMessage webSocketCloseMessage))
					{
						if (!(message is WebSocketBinaryMessage webSocketBinaryMessage))
						{
							if (message is WebSocketTextMessage webSocketTextMessage)
							{
								this.TextReceived(webSocketTextMessage.Text);
							}
						}
						else
						{
							this.BinaryReceived(webSocketBinaryMessage.Data);
						}
					}
					else if (State == WebSocketState.Closing)
					{
						_closeMessage = webSocketCloseMessage;
						OnClose();
					}
					else
					{
						WebSocketCloseMessage webSocketCloseMessage2 = webSocketCloseMessage;
						SendClose(webSocketCloseMessage2.CloseReason, webSocketCloseMessage2.CloseReasonText);
					}
				}
				else
				{
					this.PongReceived(webSocketPongMessage.PongPayload);
				}
			}
			else
			{
				Send(new WebSocketPongMessage(webSocketPingMessage.PingPayload));
			}
			this.MessageReceived(message);
		}

		private void OnClose()
		{
			if (State != WebSocketState.Closing || _closeMessage == null)
			{
				_closeMessage = new WebSocketCloseMessage(WebSocketCloseCode.AbnormalClosure, "Unexpected close");
			}
			_httpHandler.CloseAnyExistingStream();
			State = WebSocketState.Closed;
			this.Closed(_closeMessage.CloseReason, _closeMessage.CloseReasonText);
		}

		private void OnOpen()
		{
			_closeMessage = null;
			_currentPartialFragments.Clear();
			this.Opened();
			if (_receiveThread != null)
			{
				if (_receiveThread.IsAlive)
				{
					Console.WriteLine("Warning - receive thread still running!");
				}
				_receiveThread = null;
			}
			State = WebSocketState.Open;
			if (_configuration.UseAutomaticReceiveThread)
			{
				_receiveThread = new Thread(ReceiveLoop)
				{
					Name = "WebSocket Receive Thread",
					IsBackground = true
				};
				_receiveThread.Start();
			}
		}

		private void OnException(Exception e)
		{
			if (e is WebSocketProtocolException ex)
			{
				SendClose(WebSocketCloseCode.ProtocolError, ex.Message);
				return;
			}
			if (e is IOException ex2)
			{
				if (ex2.InnerException is SocketException ex3)
				{
					e = ex3;
				}
				else if (State == WebSocketState.Closing)
				{
					OnClose();
					return;
				}
			}
			if (e is SocketException ex4)
			{
				if (ex4.SocketErrorCode == SocketError.ConnectionReset)
				{
					if (State == WebSocketState.Closing)
					{
						_closeMessage = new WebSocketCloseMessage(WebSocketCloseCode.ClosedOk, "Websocket closed");
						State = WebSocketState.Closing;
						OnClose();
					}
					else
					{
						OnClose();
					}
					return;
				}
				if (ex4.SocketErrorCode == SocketError.ConnectionRefused)
				{
					_closeMessage = new WebSocketCloseMessage(WebSocketCloseCode.ProtocolError, "Connection refused");
					State = WebSocketState.Closing;
					OnClose();
					return;
				}
			}
			SendClose(WebSocketCloseCode.InternalError, e.Message);
		}
	}
	public enum WebSocketCloseCode : ushort
	{
		Unspecified = 0,
		ClosedOk = 1000,
		GoingAway = 1001,
		ProtocolError = 1002,
		UnsupportedData = 1003,
		Reserved = 1004,
		NoStatus = 1005,
		AbnormalClosure = 1006,
		MismatchTypeAndPayload = 1007,
		PolicyViolation = 1008,
		MessageTooBig = 1009,
		MissingMandatoryExtension = 1010,
		InternalError = 1011,
		TlsHandshakeFailure = 1015
	}
	public struct WebSocketConfiguration
	{
		public bool AutoConnect { get; set; }

		public bool UseAutomaticReceiveThread { get; set; }

		public MessageChunkingMode MessageChunkingMode { get; set; }

		public WebSocketConfiguration()
		{
			AutoConnect = true;
			UseAutomaticReceiveThread = true;
			MessageChunkingMode = MessageChunkingMode.LimitTo16BitExtendedLength;
		}
	}
	[NoCoverage]
	public class WebSocketProtocolException : Exception
	{
		public WebSocketProtocolException(string message)
			: base(message)
		{
		}
	}
	public enum WebSocketState
	{
		Connecting,
		Open,
		Closing,
		Closed
	}
}
namespace WebSocketDotNet.Utils
{
	internal static class Extensions
	{
		internal static byte[] ReadToEnd(this Stream s, NetworkStreamProvider provider)
		{
			List<byte> list = new List<byte>();
			byte[] array = new byte[1024];
			int num;
			while (provider.AnythingToRead && (num = s.Read(array, 0, array.Length)) > 0)
			{
				byte[] array2 = new byte[num];
				Array.Copy(array, 0, array2, 0, num);
				list.AddRange(array2);
			}
			return list.ToArray();
		}

		internal static void Write(this Stream s, byte[] bytes)
		{
			s.Write(bytes, 0, bytes.Length);
		}

		internal static bool Bit(this byte b, int bit)
		{
			return (b & (1 << bit)) != 0;
		}

		internal static byte Bits(this byte b, int start, int end)
		{
			int num = 255 >> 8 - (end - start + 1);
			return (byte)((b >> start) & num);
		}

		public static bool IsControlOpcode(this WebSocketOpcode opcode)
		{
			if (opcode != WebSocketOpcode.Close && opcode != WebSocketOpcode.Ping)
			{
				return opcode == WebSocketOpcode.Pong;
			}
			return true;
		}
	}
	internal static class MiscUtils
	{
		public static T[] EmptyArray<T>()
		{
			return new T[0];
		}
	}
	internal class NoCoverageAttribute : Attribute
	{
	}
	internal static class UriUtils
	{
		public static void ValidateUrlScheme(ref string url)
		{
			Uri uri = new Uri(url);
			if (uri.Scheme == "http")
			{
				url = $"ws://{uri.Host}:{uri.Port}{uri.PathAndQuery}";
				return;
			}
			if (uri.Scheme == "https")
			{
				url = $"wss://{uri.Host}:{uri.Port}{uri.PathAndQuery}";
				return;
			}
			string scheme = uri.Scheme;
			if (scheme == "ws" || scheme == "wss")
			{
				return;
			}
			throw new WebException("Invalid url protocol. Must be one of http, https, ws or wss");
		}
	}
}
namespace WebSocketDotNet.Protocol
{
	internal class WebSocketFragment
	{
		private const byte MaxSingleFragmentPayloadSize = 125;

		private const byte ShortLengthExtended16Bit = 126;

		private const byte ShortLengthExtended64Bit = 127;

		private static readonly Random MaskGenerator = new Random();

		public bool IsFinal;

		public bool Reserved1;

		public bool Reserved2;

		public bool Reserved3;

		public WebSocketOpcode Opcode;

		public bool IsMasked;

		private byte _shortPayloadLength;

		private ulong _extendedPayloadLength;

		public byte[] Mask;

		private byte[] _rawPayload;

		public ulong PayloadLength
		{
			get
			{
				if (!UsesExtendedPayloadLength)
				{
					return _shortPayloadLength;
				}
				return _extendedPayloadLength;
			}
		}

		public byte[] Payload => _rawPayload;

		private bool UsesExtendedPayloadLength => _extendedPayloadLength != ulong.MaxValue;

		private WebSocketFragment()
		{
			Mask = new byte[4];
			_rawPayload = MiscUtils.EmptyArray<byte>();
		}

		public WebSocketFragment(bool final, WebSocketOpcode opcode, byte[] payload, bool mask)
			: this()
		{
			IsFinal = final;
			Opcode = opcode;
			_rawPayload = (byte[])payload.Clone();
			ComputeOutgoingLength();
			if (mask)
			{
				MaskPayload();
			}
		}

		private void XorPayloadWithMask()
		{
			for (int i = 0; i < _rawPayload.Length; i++)
			{
				int num = i % 4;
				byte b = Mask[num];
				_rawPayload[i] ^= b;
			}
		}

		private void UnmaskPayload()
		{
			XorPayloadWithMask();
			IsMasked = false;
			Array.Clear(Mask, 0, 4);
		}

		private void MaskPayload()
		{
			MaskGenerator.NextBytes(Mask);
			XorPayloadWithMask();
			IsMasked = true;
		}

		private void ReadLength(byte[] initialHeader, Stream stream)
		{
			byte b = initialHeader[1].Bits(0, 6);
			switch (b)
			{
			case 126:
			{
				if (stream.Read(initialHeader, 0, 2) != 2)
				{
					throw new IOException("Failed to read 2-byte extended length from stream");
				}
				ref byte reference = ref initialHeader[0];
				ref byte reference2 = ref initialHeader[1];
				byte b2 = initialHeader[1];
				byte b3 = initialHeader[0];
				reference = b2;
				reference2 = b3;
				_extendedPayloadLength = BitConverter.ToUInt16(initialHeader, 0);
				break;
			}
			case 127:
				initialHeader = new byte[8];
				if (stream.Read(initialHeader, 0, 8) != 8)
				{
					throw new IOException("Failed to read 8-byte extended length from stream");
				}
				Array.Reverse((Array)initialHeader);
				_extendedPayloadLength = BitConverter.ToUInt64(initialHeader, 0);
				if (_extendedPayloadLength >> 63 != 0L)
				{
					throw new IOException("64-bit extended payload length has most significant bit set, which is not allowed");
				}
				break;
			default:
				_shortPayloadLength = b;
				_extendedPayloadLength = ulong.MaxValue;
				break;
			}
		}

		private void ComputeOutgoingLength()
		{
			if (_rawPayload.Length <= 125)
			{
				_shortPayloadLength = (byte)_rawPayload.Length;
				_extendedPayloadLength = ulong.MaxValue;
				return;
			}
			if (_rawPayload.Length <= 65535)
			{
				_shortPayloadLength = 126;
			}
			else
			{
				_shortPayloadLength = 127;
			}
			_extendedPayloadLength = (ulong)_rawPayload.Length;
		}

		public static WebSocketFragment Read(Stream from)
		{
			byte[] array = new byte[2];
			if (from.Read(array, 0, 2) != 2)
			{
				throw new IOException("Failed to read 2-byte header from stream");
			}
			WebSocketFragment webSocketFragment = ParseTwoByteHeader(array);
			webSocketFragment.ReadLength(array, from);
			if (webSocketFragment.IsMasked && from.Read(webSocketFragment.Mask, 0, 4) != 4)
			{
				throw new IOException("Failed to read 4-byte mask from stream");
			}
			if (webSocketFragment.PayloadLength > int.MaxValue)
			{
				throw new IOException($"Cannot read >2GiB payload (length in header was {webSocketFragment.PayloadLength} bytes)");
			}
			webSocketFragment._rawPayload = new byte[(uint)webSocketFragment.PayloadLength];
			if (from.Read(webSocketFragment._rawPayload, 0, (int)webSocketFragment.PayloadLength) != (int)webSocketFragment.PayloadLength)
			{
				throw new IOException("Failed to read payload from stream");
			}
			if (webSocketFragment.IsMasked)
			{
				webSocketFragment.UnmaskPayload();
			}
			return webSocketFragment;
		}

		private static WebSocketFragment ParseTwoByteHeader(byte[] buf)
		{
			return new WebSocketFragment
			{
				IsFinal = buf[0].Bit(7),
				Reserved1 = buf[0].Bit(6),
				Reserved2 = buf[0].Bit(5),
				Reserved3 = buf[0].Bit(4),
				Opcode = (WebSocketOpcode)buf[0].Bits(0, 3),
				IsMasked = buf[1].Bit(7)
			};
		}

		public byte[] Serialize()
		{
			byte[] array;
			if (!UsesExtendedPayloadLength && !IsMasked)
			{
				array = new byte[2 + _rawPayload.Length];
				WriteTwoByteHeader(array);
				Array.Copy(_rawPayload, 0, array, 2, _rawPayload.Length);
			}
			else if (!UsesExtendedPayloadLength && IsMasked)
			{
				array = new byte[6 + _rawPayload.Length];
				WriteTwoByteHeader(array);
				Array.Copy(Mask, 0, array, 2, 4);
				Array.Copy(_rawPayload, 0, array, 6, _rawPayload.Length);
			}
			else
			{
				int num = ((_shortPayloadLength == 126) ? 2 : 8);
				int num2 = (IsMasked ? 4 : 0);
				array = new byte[2 + num + num2 + _rawPayload.Length];
				WriteTwoByteHeader(array);
				if (num == 2)
				{
					array[2] = (byte)(_extendedPayloadLength >> 8);
					array[3] = (byte)_extendedPayloadLength;
				}
				else
				{
					byte[] bytes = BitConverter.GetBytes(_extendedPayloadLength);
					Array.Reverse((Array)bytes);
					Array.Copy(bytes, 0, array, 2, 8);
				}
				if (IsMasked)
				{
					Array.Copy(Mask, 0, array, 2 + num, 4);
				}
				Array.Copy(_rawPayload, 0, array, 2 + num + num2, _rawPayload.Length);
			}
			return array;
		}

		private void WriteTwoByteHeader(byte[] toWrite)
		{
			toWrite[0] = (byte)((uint)Opcode | (uint)(byte)(IsFinal ? 128u : 0u) | (byte)(Reserved1 ? 64u : 0u) | (byte)(Reserved2 ? 32u : 0u) | (byte)(Reserved3 ? 16u : 0u));
			toWrite[1] = (byte)(_shortPayloadLength | (byte)(IsMasked ? 128u : 0u));
		}
	}
	internal class WebSocketFrame
	{
		public WebSocketOpcode Opcode { get; set; }

		public byte[] Payload { get; set; }

		public WebSocketFrame(WebSocketOpcode opcode, byte[] payload)
		{
			Opcode = opcode;
			Payload = payload;
		}

		internal List<WebSocketFragment> ToFragments(MessageChunkingMode configurationMessageChunkingMode)
		{
			List<WebSocketFragment> list = new List<WebSocketFragment>();
			int num = configurationMessageChunkingMode switch
			{
				MessageChunkingMode.AlwaysUseExtendedLength => int.MaxValue, 
				MessageChunkingMode.NeverUseExtendedLength => 127, 
				MessageChunkingMode.LimitTo16BitExtendedLength => 65535, 
				_ => throw new ArgumentOutOfRangeException("configurationMessageChunkingMode", configurationMessageChunkingMode, null), 
			};
			if (Payload.Length < num)
			{
				list.Add(new WebSocketFragment(final: true, Opcode, Payload, mask: true));
			}
			else
			{
				int num2 = 0;
				int num3 = Payload.Length;
				WebSocketOpcode opcode = Opcode;
				while (num3 > 0)
				{
					int num4 = Math.Min(num3, num);
					byte[] array = new byte[num4];
					Array.Copy(Payload, num2, array, 0, num4);
					num3 -= num4;
					num2 += num4;
					WebSocketFragment item = new WebSocketFragment(num3 == 0, opcode, array, mask: true);
					list.Add(item);
					opcode = WebSocketOpcode.Continuation;
				}
			}
			return list;
		}

		internal static WebSocketFrame FromFragments(List<WebSocketFragment> fragments)
		{
			List<byte> list = new List<byte>();
			foreach (WebSocketFragment fragment in fragments)
			{
				list.AddRange(fragment.Payload);
			}
			return new WebSocketFrame(fragments[0].Opcode, list.ToArray());
		}

		internal static WebSocketFrame FromFragment(WebSocketFragment fragment)
		{
			return new WebSocketFrame(fragment.Opcode, fragment.Payload);
		}
	}
	public enum WebSocketOpcode : byte
	{
		Continuation,
		Text,
		Binary,
		ReservedData3,
		ReservedData4,
		ReservedData5,
		ReservedData6,
		ReservedData7,
		Close,
		Ping,
		Pong,
		ReservedControlB,
		ReservedControlC,
		ReservedControlD,
		ReservedControlE
	}
}
namespace WebSocketDotNet.Messages
{
	public class WebSocketBinaryMessage : WebSocketMessage
	{
		public byte[] Data { get; private set; }

		protected override WebSocketOpcode OpcodeToSend => WebSocketOpcode.Binary;

		public WebSocketBinaryMessage(byte[] data)
		{
			Data = data;
		}

		internal WebSocketBinaryMessage()
		{
			Data = MiscUtils.EmptyArray<byte>();
		}

		protected override void ReadData(byte[] payload)
		{
			Data = payload;
		}

		protected override byte[] GetPayload()
		{
			return Data;
		}
	}
	public class WebSocketCloseMessage : WebSocketMessage
	{
		public WebSocketCloseCode CloseReason { get; private set; }

		public string? CloseReasonText { get; private set; }

		protected override WebSocketOpcode OpcodeToSend => WebSocketOpcode.Close;

		public WebSocketCloseMessage(WebSocketCloseCode closeReason, string? closeReasonText = null)
		{
			CloseReason = closeReason;
			CloseReasonText = closeReasonText;
		}

		internal WebSocketCloseMessage()
		{
			CloseReason = WebSocketCloseCode.NoStatus;
		}

		protected override void ReadData(byte[] payload)
		{
			if (payload.Length != 0)
			{
				if (payload.Length < 2)
				{
					throw new WebSocketProtocolException($"Close message payload is too short. Expected at least 2 bytes, got {payload.Length}");
				}
				CloseReason = (WebSocketCloseCode)((payload[0] << 8) | payload[1]);
				if (payload.Length > 2)
				{
					CloseReasonText = Encoding.UTF8.GetString(payload, 2, payload.Length - 2);
				}
			}
		}

		protected override byte[] GetPayload()
		{
			if (CloseReasonText == null)
			{
				if (CloseReason != 0)
				{
					return new byte[2]
					{
						(byte)((int)CloseReason >> 8),
						(byte)(CloseReason & (WebSocketCloseCode)255)
					};
				}
				return MiscUtils.EmptyArray<byte>();
			}
			byte[] array = new byte[Encoding.UTF8.GetByteCount(CloseReasonText) + 2];
			array[0] = (byte)((int)CloseReason >> 8);
			array[1] = (byte)(CloseReason & (WebSocketCloseCode)255);
			Encoding.UTF8.GetBytes(CloseReasonText, 0, CloseReasonText.Length, array, 2);
			return array;
		}
	}
	public abstract class WebSocketMessage
	{
		protected abstract WebSocketOpcode OpcodeToSend { get; }

		protected abstract void ReadData(byte[] payload);

		protected abstract byte[] GetPayload();

		internal WebSocketFrame ToFrame()
		{
			return new WebSocketFrame(OpcodeToSend, GetPayload());
		}

		internal static WebSocketMessage FromFrame(WebSocketFrame frame)
		{
			WebSocketMessage webSocketMessage;
			switch (frame.Opcode)
			{
			case WebSocketOpcode.Continuation:
				throw new Exception("How did we get here? Received continuation frame?");
			case WebSocketOpcode.Text:
				webSocketMessage = new WebSocketTextMessage();
				break;
			case WebSocketOpcode.Binary:
				webSocketMessage = new WebSocketBinaryMessage();
				break;
			case WebSocketOpcode.Close:
				webSocketMessage = new WebSocketCloseMessage();
				break;
			case WebSocketOpcode.Ping:
				webSocketMessage = new WebSocketPingMessage();
				break;
			case WebSocketOpcode.Pong:
				webSocketMessage = new WebSocketPongMessage();
				break;
			case WebSocketOpcode.ReservedData3:
			case WebSocketOpcode.ReservedData4:
			case WebSocketOpcode.ReservedData5:
			case WebSocketOpcode.ReservedData6:
			case WebSocketOpcode.ReservedData7:
			case WebSocketOpcode.ReservedControlB:
			case WebSocketOpcode.ReservedControlC:
			case WebSocketOpcode.ReservedControlD:
			case WebSocketOpcode.ReservedControlE:
				throw new WebSocketProtocolException($"Received frame with reserved opcode {frame.Opcode}");
			default:
				throw new ArgumentOutOfRangeException("Opcode", "Unknown opcode");
			}
			webSocketMessage.ReadData(frame.Payload);
			return webSocketMessage;
		}
	}
	public class WebSocketPingMessage : WebSocketMessage
	{
		public byte[] PingPayload { get; private set; }

		protected override WebSocketOpcode OpcodeToSend => WebSocketOpcode.Ping;

		public WebSocketPingMessage()
			: this(MiscUtils.EmptyArray<byte>())
		{
		}

		public WebSocketPingMessage(string payload)
			: this(Encoding.UTF8.GetBytes(payload))
		{
		}

		public WebSocketPingMessage(byte[] payload)
		{
			if (payload.Length > 125)
			{
				throw new ArgumentException("Ping payload must be at most 125 bytes", "payload");
			}
			PingPayload = payload;
		}

		protected override void ReadData(byte[] payload)
		{
			PingPayload = payload;
		}

		protected override byte[] GetPayload()
		{
			return PingPayload;
		}
	}
	public class WebSocketPongMessage : WebSocketMessage
	{
		public byte[] PongPayload { get; private set; }

		protected override WebSocketOpcode OpcodeToSend => WebSocketOpcode.Pong;

		public WebSocketPongMessage(byte[] pongPayload)
		{
			PongPayload = pongPayload;
		}

		internal WebSocketPongMessage()
		{
			PongPayload = MiscUtils.EmptyArray<byte>();
		}

		protected override void ReadData(byte[] payload)
		{
			PongPayload = payload;
		}

		protected override byte[] GetPayload()
		{
			return PongPayload;
		}
	}
	public class WebSocketTextMessage : WebSocketMessage
	{
		public string Text { get; private set; }

		protected override WebSocketOpcode OpcodeToSend => WebSocketOpcode.Text;

		public WebSocketTextMessage(string text)
		{
			Text = text;
		}

		internal WebSocketTextMessage()
		{
			Text = "Incoming message not decoded yet.";
		}

		protected override void ReadData(byte[] payload)
		{
			Text = Encoding.UTF8.GetString(payload);
		}

		protected override byte[] GetPayload()
		{
			return Encoding.UTF8.GetBytes(Text);
		}
	}
}
namespace WebSocketDotNet.Http
{
	internal class EncryptedNetworkStreamProvider : RawTcpNetworkStreamProvider
	{
		public EncryptedNetworkStreamProvider(string host, int port)
			: base(host, port)
		{
		}

		public override Stream GetStream()
		{
			SslStream sslStream = new SslStream(base.GetStream(), leaveInnerStreamOpen: false);
			sslStream.AuthenticateAsClient(base.Host);
			return sslStream;
		}
	}
	internal class HttpHandler
	{
		private Uri _uri;

		private NetworkStreamProvider _underlyingClient;

		private Stream? _stream;

		public bool AnyDataAvailable => _underlyingClient.AnythingToRead;

		public Stream GetOrOpenStream()
		{
			return _stream ?? (_stream = _underlyingClient.GetStream());
		}

		public void CloseAnyExistingStream()
		{
			_stream?.Close();
			_stream = null;
		}

		public HttpHandler(Uri uri)
		{
			_uri = uri;
			_underlyingClient = ((_uri.Scheme == "wss") ? new EncryptedNetworkStreamProvider(uri.DnsSafeHost, uri.Port) : new RawTcpNetworkStreamProvider(uri.DnsSafeHost, uri.Port));
		}

		public HttpResponse SendRequestWithHeaders(Dictionary<string, string> headers)
		{
			AddRequiredHeaders(headers);
			Stream orOpenStream = GetOrOpenStream();
			Extensions.Write(orOpenStream, GetRequestBytes(headers));
			_underlyingClient.WaitForData();
			return HttpResponse.Parse(orOpenStream.ReadToEnd(_underlyingClient));
		}

		private byte[] GetRequestBytes(Dictionary<string, string> headers)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(BuildProtocolLine()).Append("\r\n");
			foreach (KeyValuePair<string, string> header in headers)
			{
				stringBuilder.Append(BuildHeaderLine(header)).Append("\r\n");
			}
			stringBuilder.Append("\r\n");
			string s = stringBuilder.ToString();
			return Encoding.UTF8.GetBytes(s);
		}

		private void AddRequiredHeaders(Dictionary<string, string> headers)
		{
			if (!headers.ContainsKey("User-Agent"))
			{
				headers.Add("User-Agent", $"{AssemblyInfo.Name}/{AssemblyInfo.Version}");
			}
			headers["Host"] = _uri.Host;
		}

		private string BuildProtocolLine()
		{
			return "GET " + _uri.PathAndQuery + " HTTP/1.1";
		}

		private string BuildHeaderLine(KeyValuePair<string, string> header)
		{
			if (!header.Key.Contains(":"))
			{
				return header.Key + ": " + header.Value;
			}
			throw new Exception("Invalid HTTP Header " + header.Key);
		}
	}
	internal class HttpResponse
	{
		public HttpStatusCode StatusCode { get; }

		public string StatusDescription { get; }

		public Dictionary<string, string> Headers { get; }

		private HttpResponse(HttpStatusCode statusCode, string statusDescription, Dictionary<string, string> headers)
		{
			StatusCode = statusCode;
			StatusDescription = statusDescription;
			Headers = headers;
		}

		public static HttpResponse Parse(byte[] resultBytes)
		{
			string @string = Encoding.UTF8.GetString(resultBytes);
			if (!@string.StartsWith("HTTP/1.1"))
			{
				throw new Exception("Invalid response from server - not a HTTP/1.1 response");
			}
			string[] array = @string.Split(new string[1] { "\r\n" }, StringSplitOptions.None);
			string text = array[0];
			string text2 = text.Substring(9, text.Length - 9);
			int num = text2.IndexOf(' ');
			int statusCode = int.Parse(text2.Substring(0, num));
			text = text2;
			int num2 = num + 1;
			string statusDescription = text.Substring(num2, text.Length - num2);
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			for (int i = 1; i < array.Length; i++)
			{
				string text3 = array[i];
				if (text3.Length == 0)
				{
					break;
				}
				int num3 = text3.IndexOf(':');
				string key = text3.Substring(0, num3);
				text = text3;
				num2 = num3 + 2;
				string value = text.Substring(num2, text.Length - num2);
				dictionary.Add(key, value);
			}
			return new HttpResponse((HttpStatusCode)statusCode, statusDescription, dictionary);
		}
	}
	internal abstract class NetworkStreamProvider
	{
		private const int WaitIntervalMs = 10;

		protected string Host { get; }

		protected int Port { get; }

		public abstract bool AnythingToRead { get; }

		protected NetworkStreamProvider(string host, int port)
		{
			Host = host;
			Port = port;
		}

		public abstract Stream GetStream();

		public void WaitForData(int timeout = 5000)
		{
			int num = 0;
			while (!AnythingToRead)
			{
				if ((num += 10) > timeout)
				{
					throw new Exception("Timeout waiting for response to initial handshake");
				}
				Thread.Sleep(10);
			}
		}
	}
	internal class RawTcpNetworkStreamProvider : NetworkStreamProvider
	{
		private TcpClient? _client;

		private NetworkStream? _lastStream;

		public override bool AnythingToRead => _lastStream?.DataAvailable ?? false;

		public virtual bool IsClosed => false;

		public RawTcpNetworkStreamProvider(string host, int port)
			: base(host, port)
		{
		}

		private void ResetClient()
		{
			_client?.Close();
			_client = new TcpClient();
			_lastStream = null;
		}

		public override Stream GetStream()
		{
			ResetClient();
			_client.Connect(base.Host, base.Port);
			return _lastStream = _client.GetStream();
		}
	}
}

BepInEx-BepInEx_MLLoader/Demeo.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Boardgame.Modding;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Modules;
using Prototyping;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MelonLoader")]
[assembly: AssemblyDescription("MelonLoader")]
[assembly: AssemblyCompany("discord.gg/2Wn3N2P")]
[assembly: AssemblyProduct("MelonLoader")]
[assembly: AssemblyCopyright("Created by Lava Gang")]
[assembly: AssemblyTrademark("discord.gg/2Wn3N2P")]
[assembly: Guid("FEAA0159-5871-4419-9827-3CF5CAD69A53")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: PatchShield]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.7.0")]
[module: UnverifiableCode]
namespace MelonLoader
{
	[AttributeUsage(AttributeTargets.Assembly)]
	public class Demeo_LobbyRequirement : Attribute
	{
	}
}
namespace MelonLoader.CompatibilityLayers
{
	internal static class Extensions
	{
		private static FieldInfo name_field;

		private static MethodInfo name_get_method;

		private static MethodInfo name_set_method;

		private static FieldInfo version_field;

		private static MethodInfo version_method;

		private static FieldInfo author_field;

		private static MethodInfo author_method;

		private static FieldInfo description_field;

		private static MethodInfo description_method;

		private static FieldInfo isNetworkCompatible_field;

		private static MethodInfo isNetworkCompatible_method;

		internal static string GetName(this ModInformation info)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				if (name_get_method == null)
				{
					name_get_method = AccessTools.Property(typeof(ModInformation), "name").GetGetMethod();
				}
				if (name_get_method != null)
				{
					return (string)name_get_method.Invoke(info, new object[0]);
				}
			}
			else
			{
				if (name_field == null)
				{
					name_field = AccessTools.Field(typeof(ModInformation), "name");
				}
				if (name_field != null)
				{
					return (string)name_field.GetValue(info);
				}
			}
			return null;
		}

		internal static void SetName(this ModInformation info, string name)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				if (name_set_method == null)
				{
					name_set_method = AccessTools.Property(typeof(ModInformation), "name").GetSetMethod();
				}
				if (name_set_method != null)
				{
					name_set_method.Invoke(info, new object[1] { name });
				}
			}
			else
			{
				if (name_field == null)
				{
					name_field = AccessTools.Field(typeof(ModInformation), "name");
				}
				if (name_field != null)
				{
					name_field.SetValue(info, name);
				}
			}
		}

		internal static string GetVersion(this ModInformation info)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				if (version_method == null)
				{
					version_method = AccessTools.Property(typeof(ModInformation), "version").GetGetMethod();
				}
				if (version_method != null)
				{
					return (string)version_method.Invoke(info, new object[0]);
				}
			}
			else
			{
				if (version_field == null)
				{
					version_field = AccessTools.Field(typeof(ModInformation), "version");
				}
				if (version_field != null)
				{
					return (string)version_field.GetValue(info);
				}
			}
			return null;
		}

		internal static void SetVersion(this ModInformation info, string version)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				if (version_method == null)
				{
					version_method = AccessTools.Property(typeof(ModInformation), "version").GetSetMethod();
				}
				if (version_method != null)
				{
					version_method.Invoke(info, new object[1] { version });
				}
			}
			else
			{
				if (version_field == null)
				{
					version_field = AccessTools.Field(typeof(ModInformation), "version");
				}
				if (version_field != null)
				{
					version_field.SetValue(info, version);
				}
			}
		}

		internal static string GetAuthor(this ModInformation info)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				if (author_method == null)
				{
					author_method = AccessTools.Property(typeof(ModInformation), "author").GetGetMethod();
				}
				if (author_method != null)
				{
					return (string)author_method.Invoke(info, new object[0]);
				}
			}
			else
			{
				if (author_field == null)
				{
					author_field = AccessTools.Field(typeof(ModInformation), "author");
				}
				if (author_field != null)
				{
					return (string)author_field.GetValue(info);
				}
			}
			return null;
		}

		internal static void SetAuthor(this ModInformation info, string author)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				if (author_method == null)
				{
					author_method = AccessTools.Property(typeof(ModInformation), "author").GetSetMethod();
				}
				if (author_method != null)
				{
					author_method.Invoke(info, new object[1] { author });
				}
			}
			else
			{
				if (author_field == null)
				{
					author_field = AccessTools.Field(typeof(ModInformation), "author");
				}
				if (author_field != null)
				{
					author_field.SetValue(info, author);
				}
			}
		}

		internal static void SetDescription(this ModInformation info, string description)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				if (description_method == null)
				{
					description_method = AccessTools.Property(typeof(ModInformation), "description").GetSetMethod();
				}
				if (description_method != null)
				{
					description_method.Invoke(info, new object[1] { description });
				}
			}
			else
			{
				if (description_field == null)
				{
					description_field = AccessTools.Field(typeof(ModInformation), "description");
				}
				if (description_field != null)
				{
					description_field.SetValue(info, description);
				}
			}
		}

		internal static void SetIsNetworkCompatible(this ModInformation info, bool isNetworkCompatible)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				if (isNetworkCompatible_method == null)
				{
					isNetworkCompatible_method = AccessTools.Property(typeof(ModInformation), "isNetworkCompatible").GetSetMethod();
				}
				if (isNetworkCompatible_method != null)
				{
					isNetworkCompatible_method.Invoke(info, new object[1] { isNetworkCompatible });
				}
			}
			else
			{
				if (isNetworkCompatible_field == null)
				{
					isNetworkCompatible_field = AccessTools.Field(typeof(ModInformation), "isNetworkCompatible");
				}
				if (isNetworkCompatible_field != null)
				{
					isNetworkCompatible_field.SetValue(info, isNetworkCompatible);
				}
			}
		}
	}
	internal class Demeo_Module : MelonModule
	{
		private static Dictionary<MelonBase, ModInformation> ModInformation = new Dictionary<MelonBase, ModInformation>();

		public override void OnInitialize()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((MelonEventBase<LemonAction>)(object)MelonEvents.OnApplicationStart).Subscribe(new LemonAction(OnPreAppStart), int.MaxValue, false);
			((MelonEventBase<LemonAction<MelonBase>>)(object)MelonBase.OnMelonRegistered).Subscribe((LemonAction<MelonBase>)ParseMelon<MelonBase>, int.MaxValue, false);
			((MelonEventBase<LemonAction<MelonBase>>)(object)MelonBase.OnMelonUnregistered).Subscribe((LemonAction<MelonBase>)OnUnregister, int.MaxValue, false);
		}

		private static void OnPreAppStart()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("DemeoIntegration").Patch((MethodBase)Assembly.Load("Assembly-CSharp").GetType("Prototyping.RG").GetMethod("Initialize", BindingFlags.Static | BindingFlags.Public), MelonUtils.ToNewHarmonyMethod(typeof(Demeo_Module).GetMethod("InitFix", BindingFlags.Static | BindingFlags.NonPublic)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			foreach (MelonPlugin registeredMelon in MelonTypeBase<MelonPlugin>.RegisteredMelons)
			{
				ParseMelon<MelonPlugin>(registeredMelon);
			}
			foreach (MelonMod registeredMelon2 in MelonTypeBase<MelonMod>.RegisteredMelons)
			{
				ParseMelon<MelonMod>(registeredMelon2);
			}
		}

		private static void OnUnregister(MelonBase melon)
		{
			if (melon != null && ModInformation.ContainsKey(melon))
			{
				ModInformation.Remove(melon);
				if (ModdingAPI.ExternallyInstalledMods == null)
				{
					ModdingAPI.ExternallyInstalledMods = new List<ModInformation>();
				}
				else
				{
					ModdingAPI.ExternallyInstalledMods.Remove(ModInformation[melon]);
				}
			}
		}

		private static void ParseMelon<T>(T melon) where T : MelonBase
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (melon != null && !ModInformation.ContainsKey((MelonBase)(object)melon))
			{
				ModInformation val = new ModInformation();
				val.SetName(((MelonBase)melon).Info.Name);
				val.SetVersion(((MelonBase)melon).Info.Version);
				val.SetAuthor(((MelonBase)melon).Info.Author);
				val.SetDescription(((MelonBase)melon).Info.DownloadLink);
				val.SetIsNetworkCompatible(MelonUtils.PullAttributeFromAssembly<Demeo_LobbyRequirement>(((MelonBase)melon).MelonAssembly.Assembly, false) == null);
				ModInformation.Add((MelonBase)(object)melon, val);
				if (ModdingAPI.ExternallyInstalledMods == null)
				{
					ModdingAPI.ExternallyInstalledMods = new List<ModInformation>();
				}
				ModdingAPI.ExternallyInstalledMods.Add(val);
			}
		}

		private static bool InitFix()
		{
			if (MotherbrainGlobalVars.IsRunningOnDesktop)
			{
				RG.SetVrMode(false);
			}
			else
			{
				RG.SetVrMode(RG.XRDeviceIsPresent());
			}
			return true;
		}
	}
}

BepInEx-BepInEx_MLLoader/IPA.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using IllusionInjector;
using IllusionPlugin;
using MelonLoader;
using MelonLoader.Modules;
using MelonLoader.MonoInternals;
using MelonLoader.Preferences;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MelonLoader")]
[assembly: AssemblyDescription("MelonLoader")]
[assembly: AssemblyCompany("discord.gg/2Wn3N2P")]
[assembly: AssemblyProduct("MelonLoader")]
[assembly: AssemblyCopyright("Created by Lava Gang")]
[assembly: AssemblyTrademark("discord.gg/2Wn3N2P")]
[assembly: Guid("5100810A-9842-4073-9658-E5841FDF9D73")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: PatchShield]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.7.0")]
[module: UnverifiableCode]
namespace IllusionInjector
{
	public static class PluginManager
	{
		public class AppInfo
		{
			public static string StartupPath => MelonUtils.GameDirectory;
		}

		internal static List<IPlugin> _Plugins = new List<IPlugin>();

		public static IEnumerable<IPlugin> Plugins => _Plugins;
	}
}
namespace IllusionPlugin
{
	public interface IEnhancedPlugin : IPlugin
	{
		string[] Filter { get; }

		void OnLateUpdate();
	}
	public interface IPlugin
	{
		string Name { get; }

		string Version { get; }

		void OnApplicationStart();

		void OnApplicationQuit();

		void OnLevelWasLoaded(int level);

		void OnLevelWasInitialized(int level);

		void OnUpdate();

		void OnFixedUpdate();
	}
	public static class ModPrefs
	{
		public static string GetString(string section, string name, string defaultValue = "", bool autoSave = false)
		{
			MelonPreferences_Category val = MelonPreferences.GetCategory(section);
			if (val == null)
			{
				val = MelonPreferences.CreateCategory(section);
			}
			MelonPreferences_Entry<string> val2 = val.GetEntry<string>(name);
			if (val2 == null)
			{
				val2 = val.CreateEntry<string>(name, defaultValue, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			}
			return val2.Value;
		}

		public static int GetInt(string section, string name, int defaultValue = 0, bool autoSave = false)
		{
			MelonPreferences_Category val = MelonPreferences.GetCategory(section);
			if (val == null)
			{
				val = MelonPreferences.CreateCategory(section);
			}
			MelonPreferences_Entry<int> val2 = val.GetEntry<int>(name);
			if (val2 == null)
			{
				val2 = val.CreateEntry<int>(name, defaultValue, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			}
			return val2.Value;
		}

		public static float GetFloat(string section, string name, float defaultValue = 0f, bool autoSave = false)
		{
			MelonPreferences_Category val = MelonPreferences.GetCategory(section);
			if (val == null)
			{
				val = MelonPreferences.CreateCategory(section);
			}
			MelonPreferences_Entry<float> val2 = val.GetEntry<float>(name);
			if (val2 == null)
			{
				val2 = val.CreateEntry<float>(name, defaultValue, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			}
			return val2.Value;
		}

		public static bool GetBool(string section, string name, bool defaultValue = false, bool autoSave = false)
		{
			MelonPreferences_Category val = MelonPreferences.GetCategory(section);
			if (val == null)
			{
				val = MelonPreferences.CreateCategory(section);
			}
			MelonPreferences_Entry<bool> val2 = val.GetEntry<bool>(name);
			if (val2 == null)
			{
				val2 = val.CreateEntry<bool>(name, defaultValue, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			}
			return val2.Value;
		}

		public static bool HasKey(string section, string name)
		{
			return MelonPreferences.HasEntry(section, name);
		}

		public static void SetFloat(string section, string name, float value)
		{
			MelonPreferences_Category val = MelonPreferences.GetCategory(section);
			if (val == null)
			{
				val = MelonPreferences.CreateCategory(section);
			}
			MelonPreferences_Entry<float> val2 = val.GetEntry<float>(name);
			if (val2 == null)
			{
				val2 = val.CreateEntry<float>(name, value, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			}
			val2.Value = value;
		}

		public static void SetInt(string section, string name, int value)
		{
			MelonPreferences_Category val = MelonPreferences.GetCategory(section);
			if (val == null)
			{
				val = MelonPreferences.CreateCategory(section);
			}
			MelonPreferences_Entry<int> val2 = val.GetEntry<int>(name);
			if (val2 == null)
			{
				val2 = val.CreateEntry<int>(name, value, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			}
			val2.Value = value;
		}

		public static void SetString(string section, string name, string value)
		{
			MelonPreferences_Category val = MelonPreferences.GetCategory(section);
			if (val == null)
			{
				val = MelonPreferences.CreateCategory(section);
			}
			MelonPreferences_Entry<string> val2 = val.GetEntry<string>(name);
			if (val2 == null)
			{
				val2 = val.CreateEntry<string>(name, value, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			}
			val2.Value = value;
		}

		public static void SetBool(string section, string name, bool value)
		{
			MelonPreferences_Category val = MelonPreferences.GetCategory(section);
			if (val == null)
			{
				val = MelonPreferences.CreateCategory(section);
			}
			MelonPreferences_Entry<bool> val2 = val.GetEntry<bool>(name);
			if (val2 == null)
			{
				val2 = val.CreateEntry<bool>(name, value, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			}
			val2.Value = value;
		}
	}
}
namespace MelonLoader.CompatibilityLayers
{
	internal class IPAPluginWrapper : MelonMod
	{
		internal IPlugin pluginInstance;

		public override void OnInitializeMelon()
		{
			pluginInstance.OnApplicationStart();
		}

		public override void OnDeinitializeMelon()
		{
			pluginInstance.OnApplicationQuit();
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			pluginInstance.OnLevelWasLoaded(buildIndex);
		}

		public override void OnSceneWasInitialized(int buildIndex, string sceneName)
		{
			pluginInstance.OnLevelWasInitialized(buildIndex);
		}

		public override void OnUpdate()
		{
			pluginInstance.OnUpdate();
		}

		public override void OnFixedUpdate()
		{
			pluginInstance.OnFixedUpdate();
		}

		public override void OnLateUpdate()
		{
			if (pluginInstance is IEnhancedPlugin enhancedPlugin)
			{
				enhancedPlugin.OnLateUpdate();
			}
		}
	}
	internal class IPA_Module : MelonModule
	{
		public override void OnInitialize()
		{
			string[] obj = new string[2] { "IllusionPlugin", "IllusionInjector" };
			Assembly assembly = typeof(IPA_Module).Assembly;
			string[] array = obj;
			for (int i = 0; i < array.Length; i++)
			{
				MonoResolveManager.GetAssemblyResolveInfo(array[i]).Override = assembly;
			}
			MelonAssembly.CustomMelonResolvers += Resolve;
		}

		private ResolvedMelons Resolve(Assembly asm)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			IEnumerable<Type> validTypes = MelonUtils.GetValidTypes(asm, (LemonFunc<Type, bool>)delegate(Type x)
			{
				Type[] interfaces = x.GetInterfaces();
				return interfaces != null && interfaces.Any() && interfaces.Contains(typeof(IPlugin));
			});
			if (validTypes != null && validTypes.Any())
			{
				List<MelonBase> list = new List<MelonBase>();
				List<RottenMelon> list2 = new List<RottenMelon>();
				foreach (Type item in validTypes)
				{
					RottenMelon rottenMelon;
					MelonBase val = LoadPlugin(asm, item, out rottenMelon);
					if (val != null)
					{
						list.Add(val);
					}
					else
					{
						list2.Add(rottenMelon);
					}
				}
				return new ResolvedMelons(list.ToArray(), list2.ToArray());
			}
			return new ResolvedMelons((MelonBase[])null, (RottenMelon[])null);
		}

		private MelonBase LoadPlugin(Assembly asm, Type pluginType, out RottenMelon rottenMelon)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			rottenMelon = null;
			IPlugin plugin;
			try
			{
				plugin = Activator.CreateInstance(pluginType) as IPlugin;
			}
			catch (Exception ex)
			{
				rottenMelon = new RottenMelon(pluginType, "Failed to create a new instance of the IPA Plugin.", ex);
				return null;
			}
			MelonProcessAttribute[] array = null;
			if (plugin is IEnhancedPlugin enhancedPlugin)
			{
				array = enhancedPlugin.Filter?.Select((Func<string, MelonProcessAttribute>)((string x) => new MelonProcessAttribute(x))).ToArray();
			}
			string text = plugin.Name;
			if (string.IsNullOrEmpty(text))
			{
				text = pluginType.FullName;
			}
			string text2 = plugin.Version;
			if (string.IsNullOrEmpty(text2))
			{
				text2 = asm.GetName().Version.ToString();
			}
			if (string.IsNullOrEmpty(text2) || text2.Equals("0.0.0.0"))
			{
				text2 = "1.0.0.0";
			}
			IPAPluginWrapper iPAPluginWrapper = MelonBase.CreateWrapper<IPAPluginWrapper>(text, (string)null, text2, (MelonGameAttribute[])null, array, 0, (ConsoleColor?)null, (ConsoleColor?)null, (string)null);
			iPAPluginWrapper.pluginInstance = plugin;
			PluginManager._Plugins.Add(plugin);
			return (MelonBase)(object)iPAPluginWrapper;
		}
	}
}

BepInEx-BepInEx_MLLoader/MelonStartScreen.dll

Decompiled 6 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using AssetRipper.VersionUtilities;
using Il2CppSystem;
using MelonLoader;
using MelonLoader.InternalUtils;
using MelonLoader.MelonStartScreen.NativeUtils;
using MelonLoader.MelonStartScreen.Properties;
using MelonLoader.MelonStartScreen.UI;
using MelonLoader.MelonStartScreen.UI.Objects;
using MelonLoader.MelonStartScreen.UI.Themes;
using MelonLoader.Modules;
using MelonLoader.NativeUtils;
using MelonLoader.NativeUtils.PEParser;
using MelonLoader.Preferences;
using MelonUnityEngine;
using MelonUnityEngine.CoreModule;
using MelonUnityEngine.Rendering;
using Tomlet;
using Tomlet.Attributes;
using Tomlet.Models;
using UnhollowerMini;
using UnityPlayer;
using Windows;
using mgGif;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MelonLoader")]
[assembly: AssemblyDescription("MelonLoader")]
[assembly: AssemblyCompany("discord.gg/2Wn3N2P")]
[assembly: AssemblyProduct("MelonLoader")]
[assembly: AssemblyCopyright("Created by Lava Gang")]
[assembly: AssemblyTrademark("discord.gg/2Wn3N2P")]
[assembly: Guid("762d7545-6f6b-441a-b040-49cc31a1713b")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.7.0")]
[module: UnverifiableCode]
namespace Windows
{
	[StructLayout(LayoutKind.Sequential)]
	internal class DropFile
	{
		private uint pFiles = 14u;

		public Point pt;

		public bool fNC;

		private bool fWide = true;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
		public string file = "";
	}
	internal struct Msg
	{
		public IntPtr hwnd;

		public WindowMessage message;

		public IntPtr wParam;

		public IntPtr lParam;

		public uint time;

		public Point pt;
	}
	internal struct Point
	{
		public int x;

		public int y;
	}
	internal static class User32
	{
		public delegate void TimerProc(IntPtr hWnd, uint uMsg, IntPtr nIDEvent, uint dwTime);

		[DllImport("user32.dll")]
		public static extern bool PeekMessage(out Msg lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);

		[DllImport("user32.dll")]
		public static extern bool TranslateMessage([In] ref Msg lpMsg);

		[DllImport("user32.dll")]
		public static extern IntPtr DispatchMessage([In] ref Msg lpmsg);

		[DllImport("user32.dll")]
		public static extern IntPtr GetMessageExtraInfo();

		[DllImport("user32.dll", ExactSpelling = true)]
		public static extern IntPtr SetTimer(IntPtr hWnd, IntPtr nIDEvent, uint uElapse, TimerProc lpTimerFunc);

		[DllImport("user32.dll", ExactSpelling = true)]
		public static extern bool KillTimer(IntPtr hWnd, IntPtr uIDEvent);

		[DllImport("user32.dll")]
		public static extern IntPtr SetClipboardData(uint uFormat, ref DropFile hMem);
	}
	internal enum WindowMessage : uint
	{
		NULL = 0u,
		CREATE = 1u,
		DESTROY = 2u,
		MOVE = 3u,
		SIZE = 5u,
		ACTIVATE = 6u,
		SETFOCUS = 7u,
		KILLFOCUS = 8u,
		ENABLE = 10u,
		SETREDRAW = 11u,
		SETTEXT = 12u,
		GETTEXT = 13u,
		GETTEXTLENGTH = 14u,
		PAINT = 15u,
		CLOSE = 16u,
		QUERYENDSESSION = 17u,
		QUERYOPEN = 19u,
		ENDSESSION = 22u,
		QUIT = 18u,
		ERASEBKGND = 20u,
		SYSCOLORCHANGE = 21u,
		SHOWWINDOW = 24u,
		WININICHANGE = 26u,
		SETTINGCHANGE = 26u,
		DEVMODECHANGE = 27u,
		ACTIVATEAPP = 28u,
		FONTCHANGE = 29u,
		TIMECHANGE = 30u,
		CANCELMODE = 31u,
		SETCURSOR = 32u,
		MOUSEACTIVATE = 33u,
		CHILDACTIVATE = 34u,
		QUEUESYNC = 35u,
		GETMINMAXINFO = 36u,
		PAINTICON = 38u,
		ICONERASEBKGND = 39u,
		NEXTDLGCTL = 40u,
		SPOOLERSTATUS = 42u,
		DRAWITEM = 43u,
		MEASUREITEM = 44u,
		DELETEITEM = 45u,
		VKEYTOITEM = 46u,
		CHARTOITEM = 47u,
		SETFONT = 48u,
		GETFONT = 49u,
		SETHOTKEY = 50u,
		GETHOTKEY = 51u,
		QUERYDRAGICON = 55u,
		COMPAREITEM = 57u,
		GETOBJECT = 61u,
		COMPACTING = 65u,
		[Obsolete]
		COMMNOTIFY = 68u,
		WINDOWPOSCHANGING = 70u,
		WINDOWPOSCHANGED = 71u,
		[Obsolete]
		POWER = 72u,
		COPYDATA = 74u,
		CANCELJOURNAL = 75u,
		NOTIFY = 78u,
		INPUTLANGCHANGEREQUEST = 80u,
		INPUTLANGCHANGE = 81u,
		TCARD = 82u,
		HELP = 83u,
		USERCHANGED = 84u,
		NOTIFYFORMAT = 85u,
		CONTEXTMENU = 123u,
		STYLECHANGING = 124u,
		STYLECHANGED = 125u,
		DISPLAYCHANGE = 126u,
		GETICON = 127u,
		SETICON = 128u,
		NCCREATE = 129u,
		NCDESTROY = 130u,
		NCCALCSIZE = 131u,
		NCHITTEST = 132u,
		NCPAINT = 133u,
		NCACTIVATE = 134u,
		GETDLGCODE = 135u,
		SYNCPAINT = 136u,
		NCMOUSEMOVE = 160u,
		NCLBUTTONDOWN = 161u,
		NCLBUTTONUP = 162u,
		NCLBUTTONDBLCLK = 163u,
		NCRBUTTONDOWN = 164u,
		NCRBUTTONUP = 165u,
		NCRBUTTONDBLCLK = 166u,
		NCMBUTTONDOWN = 167u,
		NCMBUTTONUP = 168u,
		NCMBUTTONDBLCLK = 169u,
		NCXBUTTONDOWN = 171u,
		NCXBUTTONUP = 172u,
		NCXBUTTONDBLCLK = 173u,
		INPUT_DEVICE_CHANGE = 254u,
		INPUT = 255u,
		KEYFIRST = 256u,
		KEYDOWN = 256u,
		KEYUP = 257u,
		CHAR = 258u,
		DEADCHAR = 259u,
		SYSKEYDOWN = 260u,
		SYSKEYUP = 261u,
		SYSCHAR = 262u,
		SYSDEADCHAR = 263u,
		UNICHAR = 265u,
		KEYLAST = 264u,
		IME_STARTCOMPOSITION = 269u,
		IME_ENDCOMPOSITION = 270u,
		IME_COMPOSITION = 271u,
		IME_KEYLAST = 271u,
		INITDIALOG = 272u,
		COMMAND = 273u,
		SYSCOMMAND = 274u,
		TIMER = 275u,
		HSCROLL = 276u,
		VSCROLL = 277u,
		INITMENU = 278u,
		INITMENUPOPUP = 279u,
		MENUSELECT = 287u,
		MENUCHAR = 288u,
		ENTERIDLE = 289u,
		MENURBUTTONUP = 290u,
		MENUDRAG = 291u,
		MENUGETOBJECT = 292u,
		UNINITMENUPOPUP = 293u,
		MENUCOMMAND = 294u,
		CHANGEUISTATE = 295u,
		UPDATEUISTATE = 296u,
		QUERYUISTATE = 297u,
		CTLCOLORMSGBOX = 306u,
		CTLCOLOREDIT = 307u,
		CTLCOLORLISTBOX = 308u,
		CTLCOLORBTN = 309u,
		CTLCOLORDLG = 310u,
		CTLCOLORSCROLLBAR = 311u,
		CTLCOLORSTATIC = 312u,
		MOUSEFIRST = 512u,
		MOUSEMOVE = 512u,
		LBUTTONDOWN = 513u,
		LBUTTONUP = 514u,
		LBUTTONDBLCLK = 515u,
		RBUTTONDOWN = 516u,
		RBUTTONUP = 517u,
		RBUTTONDBLCLK = 518u,
		MBUTTONDOWN = 519u,
		MBUTTONUP = 520u,
		MBUTTONDBLCLK = 521u,
		MOUSEWHEEL = 522u,
		XBUTTONDOWN = 523u,
		XBUTTONUP = 524u,
		XBUTTONDBLCLK = 525u,
		MOUSEHWHEEL = 526u,
		MOUSELAST = 526u,
		PARENTNOTIFY = 528u,
		ENTERMENULOOP = 529u,
		EXITMENULOOP = 530u,
		NEXTMENU = 531u,
		SIZING = 532u,
		CAPTURECHANGED = 533u,
		MOVING = 534u,
		POWERBROADCAST = 536u,
		DEVICECHANGE = 537u,
		MDICREATE = 544u,
		MDIDESTROY = 545u,
		MDIACTIVATE = 546u,
		MDIRESTORE = 547u,
		MDINEXT = 548u,
		MDIMAXIMIZE = 549u,
		MDITILE = 550u,
		MDICASCADE = 551u,
		MDIICONARRANGE = 552u,
		MDIGETACTIVE = 553u,
		MDISETMENU = 560u,
		ENTERSIZEMOVE = 561u,
		EXITSIZEMOVE = 562u,
		DROPFILES = 563u,
		MDIREFRESHMENU = 564u,
		IME_SETCONTEXT = 641u,
		IME_NOTIFY = 642u,
		IME_CONTROL = 643u,
		IME_COMPOSITIONFULL = 644u,
		IME_SELECT = 645u,
		IME_CHAR = 646u,
		IME_REQUEST = 648u,
		IME_KEYDOWN = 656u,
		IME_KEYUP = 657u,
		MOUSEHOVER = 673u,
		MOUSELEAVE = 675u,
		NCMOUSEHOVER = 672u,
		NCMOUSELEAVE = 674u,
		WTSSESSION_CHANGE = 689u,
		TABLET_FIRST = 704u,
		TABLET_LAST = 735u,
		CUT = 768u,
		COPY = 769u,
		PASTE = 770u,
		CLEAR = 771u,
		UNDO = 772u,
		RENDERFORMAT = 773u,
		RENDERALLFORMATS = 774u,
		DESTROYCLIPBOARD = 775u,
		DRAWCLIPBOARD = 776u,
		PAINTCLIPBOARD = 777u,
		VSCROLLCLIPBOARD = 778u,
		SIZECLIPBOARD = 779u,
		ASKCBFORMATNAME = 780u,
		CHANGECBCHAIN = 781u,
		HSCROLLCLIPBOARD = 782u,
		QUERYNEWPALETTE = 783u,
		PALETTEISCHANGING = 784u,
		PALETTECHANGED = 785u,
		HOTKEY = 786u,
		PRINT = 791u,
		PRINTCLIENT = 792u,
		APPCOMMAND = 793u,
		THEMECHANGED = 794u,
		CLIPBOARDUPDATE = 797u,
		DWMCOMPOSITIONCHANGED = 798u,
		DWMNCRENDERINGCHANGED = 799u,
		DWMCOLORIZATIONCOLORCHANGED = 800u,
		DWMWINDOWMAXIMIZEDCHANGE = 801u,
		GETTITLEBARINFOEX = 831u,
		HANDHELDFIRST = 856u,
		HANDHELDLAST = 863u,
		AFXFIRST = 864u,
		AFXLAST = 895u,
		PENWINFIRST = 896u,
		PENWINLAST = 911u,
		APP = 32768u,
		USER = 1024u,
		CPL_LAUNCH = 5120u,
		CPL_LAUNCHED = 5121u,
		SYSTIMER = 280u,
		HSHELL_ACCESSIBILITYSTATE = 11u,
		HSHELL_ACTIVATESHELLWINDOW = 3u,
		HSHELL_APPCOMMAND = 12u,
		HSHELL_GETMINRECT = 5u,
		HSHELL_LANGUAGE = 8u,
		HSHELL_REDRAW = 6u,
		HSHELL_TASKMAN = 7u,
		HSHELL_WINDOWCREATED = 1u,
		HSHELL_WINDOWDESTROYED = 2u,
		HSHELL_WINDOWACTIVATED = 4u,
		HSHELL_WINDOWREPLACED = 13u
	}
}
namespace UnityPlayer
{
	internal class GfxDevice
	{
		private delegate void PresentFrameDelegate();

		private delegate void WaitForLastPresentationAndGetTimestampDelegate(IntPtr gfxDevice);

		private delegate IntPtr GetRealGfxDeviceDelegate();

		[NativeSignature(1u, NativeSignatureFlags.X86, "e8 ?? ?? ?? ?? 85 c0 74 12 e8 ?? ?? ?? ?? 8b ?? 8b ?? 8b 42 70 ff d0 84 c0 75", new string[] { "2017.1.0", "5.6.0", "2017.1.0" })]
		[NativeSignature(2u, NativeSignatureFlags.X86, "55 8b ec 51 e8 ?? ?? ?? ?? 85 c0 74 12 e8 ?? ?? ?? ?? 8b c8 8b 10 8b 42 ?? ff d0 84 c0 75", new string[] { "2018.1.0" })]
		[NativeSignature(3u, NativeSignatureFlags.X86, "55 8b ec 51 e8 ?? ?? ?? ?? 85 c0 74 15 e8 ?? ?? ?? ?? 8b c8 8b 10 8b 82 ?? 00 00 00 ff d0", new string[] { "2018.4.9", "2019.1.0" })]
		[NativeSignature(4u, NativeSignatureFlags.X86, "55 8b ec 51 56 e8 ?? ?? ?? ?? 8b f0 8b ce e8 ?? ?? ?? ?? e8 ?? ?? ?? ?? 85 c0 74 ?? e8", new string[] { "2018.4.18", "2019.3.0", "2020.1.0" })]
		[NativeSignature(1u, NativeSignatureFlags.X64, "48 83 ec 28 e8 ?? ?? ?? ?? 48 85 c0 74 15 e8 ?? ?? ?? ?? 48 8b c8 48 8b 10 ff 92 e0 00 00 00 84 c0", new string[] { "5.6.0", "2017.1.0" })]
		[NativeSignature(2u, NativeSignatureFlags.X64, "48 83 ec 28 e8 ?? ?? ?? ?? 48 85 c0 74 15 e8 ?? ?? ?? ?? 48 8b c8 48 8b 10 ff 92 ?? ?? 00 00 84 c0", new string[] { "2018.3.0", "2019.1.0" })]
		[NativeSignature(3u, NativeSignatureFlags.X64, "40 53 48 83 ec 20 e8 ?? ?? ?? ?? 48 8b c8 48 8b d8 e8 ?? ?? ?? ?? e8 ?? ?? ?? ?? 48 85 c0 74", new string[] { "2018.4.18", "2019.3.0", "2020.1.0" })]
		private static PresentFrameDelegate m_PresentFrame;

		[NativeSignature(0u, NativeSignatureFlags.None, null, new string[] { "2017.1.0" })]
		[NativeSignature(1u, NativeSignatureFlags.X86, "55 8b ec 83 ec 40 53 56 8b d9 57 89 5d fc e8 ?? ?? ?? ?? 6a 02 8b c8", new string[] { "2020.2.7", "2020.3.0", "2021.1.0" })]
		[NativeSignature(2u, NativeSignatureFlags.X86, "55 8b ec 83 ec 48 53 56 8b d9 57 89 5d fc e8 ?? ?? ?? ?? 6a 02 8b c8", new string[] { "2021.1.5", "2021.2.0" })]
		[NativeSignature(3u, NativeSignatureFlags.X86, "55 8b ec 83 ec 58 53 56 8b d9 57 89 5d fc e8 ?? ?? ?? ?? 6a 02 8b c8", new string[] { "2022.1.0" })]
		[NativeSignature(4u, (NativeSignatureFlags)18, null, new string[] { "2020.3.9" })]
		[NativeSignature(1u, NativeSignatureFlags.X64, "48 89 5c 24 10 56 48 81 ec 90 00 00 00 0f 29 b4 24 80 00 00 00 48 8b f1", new string[] { "2020.2.7", "2020.3.0", "2021.1.0" })]
		[NativeSignature(2u, NativeSignatureFlags.X64, "48 89 5c 24 10 56 48 81 ec b0 00 00 00 0f 29 b4 24 a0 00 00 00 48 8b f1", new string[] { "2022.1.0" })]
		private static WaitForLastPresentationAndGetTimestampDelegate m_D3D11WaitForLastPresentationAndGetTimestamp;

		[NativeSignature(0u, NativeSignatureFlags.None, null, new string[] { "2017.1.0" })]
		[NativeSignature(1u, NativeSignatureFlags.X86, "55 8b ec 83 ec 40 53 56 57 8b f9 89 7d f4 e8 ?? ?? ?? ?? 6a 02 8b c8", new string[] { "2020.2.7", "2020.3.0", "2021.1.0" })]
		[NativeSignature(2u, NativeSignatureFlags.X86, "55 8b ec 83 ec 48 56 57 8b f9 89 7d f0 e8 ?? ?? ?? ?? 6a 02 8b c8", new string[] { "2020.3.9", "2021.1.5" })]
		[NativeSignature(3u, NativeSignatureFlags.X86, "55 8b ec 83 ec 48 56 57 8b f9 89 7d f8 e8 ?? ?? ?? ?? 6a 02 8b c8", new string[] { "2021.2.0" })]
		[NativeSignature(4u, NativeSignatureFlags.X86, "55 8b ec 83 ec 58 56 57 8b f9 89 7d f8 e8 ?? ?? ?? ?? 6a 02 8b c8", new string[] { "2022.1.0" })]
		[NativeSignature(1u, NativeSignatureFlags.X64, "48 89 5c 24 08 57 48 81 ec 90 00 00 00 0f 29 b4 24 80 00 00 00 48 8b d9", new string[] { "2020.2.7", "2020.3.0", "2021.1.0" })]
		[NativeSignature(2u, NativeSignatureFlags.X64, "48 89 5c 24 08 57 48 81 ec b0 00 00 00 0f 29 b4 24 a0 00 00 00 48 8b d9", new string[] { "2022.1.0" })]
		private static WaitForLastPresentationAndGetTimestampDelegate m_D3D12WaitForLastPresentationAndGetTimestamp;

		private static GetRealGfxDeviceDelegate m_GetRealGfxDevice;

		static GfxDevice()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			UnityVersion engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[3] { "2020.2.7", "2020.3.0", "2021.1.0" }))
			{
				m_GetRealGfxDevice = (GetRealGfxDeviceDelegate)Marshal.GetDelegateForFunctionPointer(CppUtils.ResolveRelativeInstruction((IntPtr)((long)UnityInternals.ResolveICall("UnityEngine.FrameTimingManager::CaptureFrameTimings") + ((!MelonUtils.IsGame32Bit()) ? 4 : 0))), typeof(GetRealGfxDeviceDelegate));
			}
		}

		public static void PresentFrame()
		{
			m_PresentFrame();
		}

		public static IntPtr GetRealGfxDevice()
		{
			return m_GetRealGfxDevice();
		}

		internal static void WaitForLastPresentationAndGetTimestamp(uint deviceType)
		{
			if (m_GetRealGfxDevice == null)
			{
				throw new NotImplementedException();
			}
			IntPtr realGfxDevice = GetRealGfxDevice();
			if (realGfxDevice == IntPtr.Zero)
			{
				throw new NotImplementedException();
			}
			switch (deviceType)
			{
			case 2u:
				if (m_D3D11WaitForLastPresentationAndGetTimestamp == null)
				{
					throw new NotImplementedException();
				}
				m_D3D11WaitForLastPresentationAndGetTimestamp(realGfxDevice);
				break;
			case 18u:
				if (m_D3D12WaitForLastPresentationAndGetTimestamp == null)
				{
					throw new NotImplementedException();
				}
				m_D3D12WaitForLastPresentationAndGetTimestamp(realGfxDevice);
				break;
			default:
				throw new NotImplementedException();
			}
		}
	}
}
namespace MelonUnityEngine
{
	[StructLayout(LayoutKind.Explicit)]
	internal struct Color
	{
		private static readonly IntPtr m_ToString;

		[FieldOffset(0)]
		public float r;

		[FieldOffset(4)]
		public float g;

		[FieldOffset(8)]
		public float b;

		[FieldOffset(12)]
		public float a;

		static Color()
		{
			InternalClassPointerStore<Color>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Color");
			UnityInternals.runtime_class_init(InternalClassPointerStore<Color>.NativeClassPtr);
			m_ToString = UnityInternals.GetMethod(InternalClassPointerStore<Color>.NativeClassPtr, "ToString", "System.String");
		}

		public Color(float r, float g, float b, float a = 1f)
		{
			this.r = r;
			this.g = g;
			this.b = b;
			this.a = a;
		}
	}
	[StructLayout(LayoutKind.Explicit)]
	internal struct Color32
	{
		[FieldOffset(0)]
		public byte r;

		[FieldOffset(1)]
		public byte g;

		[FieldOffset(2)]
		public byte b;

		[FieldOffset(3)]
		public byte a;

		[FieldOffset(0)]
		public int rgba;

		static Color32()
		{
			InternalClassPointerStore<Color32>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Color32");
			UnityInternals.runtime_class_init(InternalClassPointerStore<Color32>.NativeClassPtr);
		}

		public Color32(byte r, byte g, byte b, byte a)
		{
			rgba = 0;
			this.r = r;
			this.g = g;
			this.b = b;
			this.a = a;
		}

		public static implicit operator Color(Color32 c)
		{
			return new Color((float)(int)c.r / 255f, (float)(int)c.g / 255f, (float)(int)c.b / 255f, (float)(int)c.a / 255f);
		}
	}
	internal enum FilterMode
	{
		Point,
		Bilinear,
		Trilinear
	}
	internal sealed class GL
	{
		private delegate bool d_get_sRGBWrite();

		private static readonly d_get_sRGBWrite m_get_sRGBWrite;

		public static bool sRGBWrite => m_get_sRGBWrite();

		static GL()
		{
			m_get_sRGBWrite = UnityInternals.ResolveICall<d_get_sRGBWrite>("UnityEngine.GL::get_sRGBWrite");
		}
	}
	internal class Graphics : InternalObjectBase
	{
		private delegate IntPtr Internal_DrawMeshNow1_InjectedDelegate(IntPtr mesh, int subsetIndex, ref Vector3 position, ref Quaternion rotation);

		private delegate void Internal_DrawTextureDelegate(IntPtr args);

		private static readonly Internal_DrawTextureDelegate fd_Internal_DrawTexture;

		private static readonly Internal_DrawMeshNow1_InjectedDelegate fd_Internal_DrawMeshNow1_Injected;

		private static readonly int m_DrawTexture_Internal_struct;

		static Graphics()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_00a9: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			m_DrawTexture_Internal_struct = -1;
			InternalClassPointerStore<Graphics>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Graphics");
			fd_Internal_DrawTexture = UnityInternals.ResolveICall<Internal_DrawTextureDelegate>("UnityEngine.Graphics::Internal_DrawTexture");
			UnityVersion engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[2] { "2018.2.0", "2019.1.0" }))
			{
				fd_Internal_DrawMeshNow1_Injected = UnityInternals.ResolveICall<Internal_DrawMeshNow1_InjectedDelegate>("UnityEngine.Graphics::Internal_DrawMeshNow1_Injected");
			}
			else
			{
				fd_Internal_DrawMeshNow1_Injected = UnityInternals.ResolveICall<Internal_DrawMeshNow1_InjectedDelegate>("UnityEngine.Graphics::INTERNAL_CALL_Internal_DrawMeshNow1");
			}
			engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[2] { "2019.3.0", "2020.1.0" }))
			{
				m_DrawTexture_Internal_struct = 3;
				return;
			}
			engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[2] { "2018.2.0", "2019.1.0" }))
			{
				m_DrawTexture_Internal_struct = 2;
				return;
			}
			engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[2] { "2017.3.0", "2018.1.0" }))
			{
				m_DrawTexture_Internal_struct = 1;
				return;
			}
			engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2017.2.0" }))
			{
				m_DrawTexture_Internal_struct = 0;
			}
		}

		public Graphics(IntPtr ptr)
			: base(ptr)
		{
		}

		public unsafe static void DrawTexture(Rect screenRect, Texture2D texture)
		{
			if (texture != null && !(texture.Pointer == IntPtr.Zero))
			{
				if (m_DrawTexture_Internal_struct == 0)
				{
					Internal_DrawTextureArguments_2017 internal_DrawTextureArguments_ = default(Internal_DrawTextureArguments_2017);
					internal_DrawTextureArguments_.screenRect = screenRect;
					internal_DrawTextureArguments_.sourceRect = new Rect(0, 0, 1, 1);
					internal_DrawTextureArguments_.color = new Color32(128, 128, 128, 128);
					internal_DrawTextureArguments_.texture = UnityInternals.ObjectBaseToPtrNotNull(texture);
					fd_Internal_DrawTexture((IntPtr)(&internal_DrawTextureArguments_));
				}
				else if (m_DrawTexture_Internal_struct == 1)
				{
					Internal_DrawTextureArguments_2018 internal_DrawTextureArguments_2 = default(Internal_DrawTextureArguments_2018);
					internal_DrawTextureArguments_2.screenRect = screenRect;
					internal_DrawTextureArguments_2.sourceRect = new Rect(0, 0, 1, 1);
					internal_DrawTextureArguments_2.color = new Color32(128, 128, 128, 128);
					internal_DrawTextureArguments_2.texture = UnityInternals.ObjectBaseToPtrNotNull(texture);
					fd_Internal_DrawTexture((IntPtr)(&internal_DrawTextureArguments_2));
				}
				else if (m_DrawTexture_Internal_struct == 2)
				{
					Internal_DrawTextureArguments_2019 internal_DrawTextureArguments_3 = default(Internal_DrawTextureArguments_2019);
					internal_DrawTextureArguments_3.screenRect = screenRect;
					internal_DrawTextureArguments_3.sourceRect = new Rect(0, 0, 1, 1);
					internal_DrawTextureArguments_3.color = new Color(0.5f, 0.5f, 0.5f, 0.5f);
					internal_DrawTextureArguments_3.texture = UnityInternals.ObjectBaseToPtrNotNull(texture);
					fd_Internal_DrawTexture((IntPtr)(&internal_DrawTextureArguments_3));
				}
				else if (m_DrawTexture_Internal_struct == 3)
				{
					Internal_DrawTextureArguments_2020 internal_DrawTextureArguments_4 = default(Internal_DrawTextureArguments_2020);
					internal_DrawTextureArguments_4.screenRect = screenRect;
					internal_DrawTextureArguments_4.sourceRect = new Rect(0, 0, 1, 1);
					internal_DrawTextureArguments_4.color = new Color(0.5f, 0.5f, 0.5f, 0.5f);
					internal_DrawTextureArguments_4.leftBorderColor = new Color(0f, 0f, 0f);
					internal_DrawTextureArguments_4.topBorderColor = new Color(0f, 0f, 0f);
					internal_DrawTextureArguments_4.rightBorderColor = new Color(0f, 0f, 0f);
					internal_DrawTextureArguments_4.bottomBorderColor = new Color(0f, 0f, 0f);
					internal_DrawTextureArguments_4.smoothCorners = true;
					internal_DrawTextureArguments_4.texture = UnityInternals.ObjectBaseToPtrNotNull(texture);
					fd_Internal_DrawTexture((IntPtr)(&internal_DrawTextureArguments_4));
				}
			}
		}

		public static void DrawMeshNow(Mesh mesh, Vector3 position, Quaternion rotation)
		{
			DrawMeshNow(mesh, position, rotation, -1);
		}

		public static void DrawMeshNow(Mesh mesh, Vector3 position, Quaternion rotation, int materialIndex)
		{
			if (mesh == null)
			{
				throw new ArgumentNullException("mesh");
			}
			Internal_DrawMeshNow1(mesh, materialIndex, position, rotation);
		}

		private static void Internal_DrawMeshNow1(Mesh mesh, int subsetIndex, Vector3 position, Quaternion rotation)
		{
			Internal_DrawMeshNow1_Injected(mesh, subsetIndex, ref position, ref rotation);
		}

		private static void Internal_DrawMeshNow1_Injected(Mesh mesh, int subsetIndex, ref Vector3 position, ref Quaternion rotation)
		{
			if (mesh != null && !(mesh.Pointer == IntPtr.Zero))
			{
				fd_Internal_DrawMeshNow1_Injected(UnityInternals.ObjectBaseToPtr(mesh), subsetIndex, ref position, ref rotation);
			}
		}
	}
	internal enum HideFlags
	{
		None = 0,
		HideInHierarchy = 1,
		HideInInspector = 2,
		DontSaveInEditor = 4,
		NotEditable = 8,
		DontSaveInBuild = 16,
		DontUnloadUnusedAsset = 32,
		DontSave = 52,
		HideAndDontSave = 61
	}
	internal static class ImageConversion
	{
		private delegate bool ImageConversion_LoadImage_Delegate(IntPtr tex, IntPtr data, bool markNonReadable);

		private static ImageConversion_LoadImage_Delegate ImageConversion_LoadImage;

		static ImageConversion()
		{
			IntPtr intPtr = UnityInternals.ResolveICall("UnityEngine.ImageConversion::LoadImage(UnityEngine.Texture2D,System.Byte[],System.Boolean)");
			if (intPtr != IntPtr.Zero)
			{
				ImageConversion_LoadImage = (ImageConversion_LoadImage_Delegate)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(ImageConversion_LoadImage_Delegate));
			}
			else
			{
				MelonLogger.Error("Failed to resolve icall UnityEngine.ImageConversion::LoadImage(UnityEngine.Texture2D,System.Byte[],System.Boolean)");
			}
		}

		public unsafe static bool LoadImage(Texture2D tex, byte[] data, bool markNonReadable)
		{
			if (ImageConversion_LoadImage == null)
			{
				MelonLogger.Error("Failed to run UnityEngine.ImageConversion::LoadImage(UnityEngine.Texture2D,System.Byte[],System.Boolean)");
				return false;
			}
			IntPtr intPtr = UnityInternals.array_new(InternalClassPointerStore<byte>.NativeClassPtr, (uint)data.Length);
			for (int i = 0; i < data.Length; i++)
			{
				((byte*)((IntPtr)((long)intPtr + 4 * IntPtr.Size)).ToPointer())[i] = data[i];
			}
			return ImageConversion_LoadImage(tex.Pointer, intPtr, markNonReadable);
		}
	}
	internal struct Internal_DrawTextureArguments_2017
	{
		public Rect screenRect;

		public Rect sourceRect;

		public int leftBorder;

		public int rightBorder;

		public int topBorder;

		public int bottomBorder;

		public Color32 color;

		public Vector4 borderWidths;

		public float cornerRadius;

		public int pass;

		public IntPtr texture;

		public IntPtr mat;
	}
	internal struct Internal_DrawTextureArguments_2018
	{
		public Rect screenRect;

		public Rect sourceRect;

		public int leftBorder;

		public int rightBorder;

		public int topBorder;

		public int bottomBorder;

		public Color32 color;

		public Vector4 borderWidths;

		public Vector4 cornerRadius;

		public int pass;

		public IntPtr texture;

		public IntPtr mat;
	}
	internal struct Internal_DrawTextureArguments_2019
	{
		public Rect screenRect;

		public Rect sourceRect;

		public int leftBorder;

		public int rightBorder;

		public int topBorder;

		public int bottomBorder;

		public Color color;

		public Vector4 borderWidths;

		public Vector4 cornerRadius;

		public int pass;

		public IntPtr texture;

		public IntPtr mat;
	}
	internal struct Internal_DrawTextureArguments_2020
	{
		public Rect screenRect;

		public Rect sourceRect;

		public int leftBorder;

		public int rightBorder;

		public int topBorder;

		public int bottomBorder;

		public Color leftBorderColor;

		public Color rightBorderColor;

		public Color topBorderColor;

		public Color bottomBorderColor;

		public Color color;

		public Vector4 borderWidths;

		public Vector4 cornerRadiuses;

		public bool smoothCorners;

		public int pass;

		public IntPtr texture;

		public IntPtr mat;
	}
	internal class Material : UnityObject
	{
		private delegate bool d_SetPass(IntPtr @this, int pass);

		private static readonly d_SetPass m_SetPass;

		static Material()
		{
			InternalClassPointerStore<Material>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Material");
			UnityInternals.runtime_class_init(InternalClassPointerStore<Material>.NativeClassPtr);
			m_SetPass = UnityInternals.ResolveICall<d_SetPass>("UnityEngine.Material::SetPass");
		}

		public Material(IntPtr ptr)
			: base(ptr)
		{
		}

		public bool SetPass(int pass)
		{
			return m_SetPass(UnityInternals.ObjectBaseToPtrNotNull(this), pass);
		}
	}
	internal sealed class Mesh : UnityObject
	{
		private delegate void SetArrayForChannelImpl_2017(IntPtr @this, int channel, int format, int dim, IntPtr values, int arraySize);

		private delegate void SetArrayForChannelImpl_2019(IntPtr @this, int channel, int format, int dim, IntPtr values, int arraySize, int valuesStart, int valuesCount);

		private delegate void SetArrayForChannelImpl_2020(IntPtr @this, int channel, int format, int dim, IntPtr values, int arraySize, int valuesStart, int valuesCount, int updateFlags);

		private static readonly IntPtr m_ctor;

		private static readonly IntPtr m_set_triangles;

		private static readonly IntPtr m_RecalculateBounds;

		private static readonly SetArrayForChannelImpl_2017 m_SetArrayForChannelImpl_2017;

		private static readonly SetArrayForChannelImpl_2019 m_SetArrayForChannelImpl_2019;

		private static readonly SetArrayForChannelImpl_2020 m_SetArrayForChannelImpl_2020;

		private static readonly int type_SetArrayForChannelImpl;

		public unsafe Vector3[] vertices
		{
			set
			{
				int num = value.Length;
				IntPtr intPtr = UnityInternals.array_new(InternalClassPointerStore<Vector3>.NativeClassPtr, (ulong)num);
				for (int i = 0; i < num; i++)
				{
					*(Vector3*)((nint)((long)intPtr + 4 * IntPtr.Size) + (nint)i * (nint)sizeof(Vector3)) = value[i];
				}
				SetArrayForChannelImpl(VertexAttribute.Vertex, intPtr, 3, num);
			}
		}

		public unsafe Vector3[] normals
		{
			set
			{
				int num = value.Length;
				IntPtr intPtr = UnityInternals.array_new(InternalClassPointerStore<Vector3>.NativeClassPtr, (ulong)num);
				for (int i = 0; i < num; i++)
				{
					*(Vector3*)((nint)((long)intPtr + 4 * IntPtr.Size) + (nint)i * (nint)sizeof(Vector3)) = value[i];
				}
				SetArrayForChannelImpl(VertexAttribute.Normal, intPtr, 3, num);
			}
		}

		public unsafe Vector4[] tangents
		{
			set
			{
				int num = value.Length;
				IntPtr intPtr = UnityInternals.array_new(InternalClassPointerStore<Vector4>.NativeClassPtr, (ulong)num);
				for (int i = 0; i < num; i++)
				{
					*(Vector4*)((nint)((long)intPtr + 4 * IntPtr.Size) + (nint)i * (nint)sizeof(Vector4)) = value[i];
				}
				SetArrayForChannelImpl(VertexAttribute.Tangent, intPtr, 4, num);
			}
		}

		public unsafe Vector2[] uv
		{
			set
			{
				int num = value.Length;
				IntPtr intPtr = UnityInternals.array_new(InternalClassPointerStore<Vector2>.NativeClassPtr, (ulong)num);
				for (int i = 0; i < num; i++)
				{
					*(Vector2*)((nint)((long)intPtr + 4 * IntPtr.Size) + (nint)i * (nint)sizeof(Vector2)) = value[i];
				}
				SetArrayForChannelImpl(VertexAttribute.TexCoord0, intPtr, 2, num);
			}
		}

		public unsafe Color[] colors
		{
			set
			{
				int num = value.Length;
				IntPtr intPtr = UnityInternals.array_new(InternalClassPointerStore<Color>.NativeClassPtr, (ulong)num);
				for (int i = 0; i < num; i++)
				{
					*(Color*)((nint)((long)intPtr + 4 * IntPtr.Size) + (nint)i * (nint)sizeof(Color)) = value[i];
				}
				SetArrayForChannelImpl(VertexAttribute.Color, intPtr, 4, num);
			}
		}

		public unsafe int[] triangles
		{
			set
			{
				UnityInternals.ObjectBaseToPtrNotNull(this);
				IntPtr intPtr = UnityInternals.array_new(InternalClassPointerStore<int>.NativeClassPtr, (ulong)value.Length);
				for (int i = 0; i < value.Length; i++)
				{
					*(int*)((nint)((long)intPtr + 4 * IntPtr.Size) + (nint)i * (nint)4) = value[i];
				}
				void** ptr = stackalloc void*[1];
				*ptr = (void*)intPtr;
				IntPtr exc = default(IntPtr);
				UnityInternals.runtime_invoke(m_set_triangles, UnityInternals.ObjectBaseToPtrNotNull(this), ptr, ref exc);
				Il2CppException.RaiseExceptionIfNecessary(exc);
			}
		}

		static Mesh()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			type_SetArrayForChannelImpl = -1;
			InternalClassPointerStore<Mesh>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Mesh");
			UnityInternals.runtime_class_init(InternalClassPointerStore<Mesh>.NativeClassPtr);
			m_ctor = UnityInternals.GetMethod(InternalClassPointerStore<Mesh>.NativeClassPtr, ".ctor", "System.Void");
			m_set_triangles = UnityInternals.GetMethod(InternalClassPointerStore<Mesh>.NativeClassPtr, "set_triangles", "System.Void", "System.Int32[]");
			m_RecalculateBounds = UnityInternals.GetMethod(InternalClassPointerStore<Mesh>.NativeClassPtr, "RecalculateBounds", "System.Void");
			UnityVersion engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2020.1.0" }))
			{
				m_SetArrayForChannelImpl_2020 = UnityInternals.ResolveICall<SetArrayForChannelImpl_2020>("UnityEngine.Mesh::SetArrayForChannelImpl");
				type_SetArrayForChannelImpl = 2;
				return;
			}
			engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2019.3.0" }))
			{
				m_SetArrayForChannelImpl_2019 = UnityInternals.ResolveICall<SetArrayForChannelImpl_2019>("UnityEngine.Mesh::SetArrayForChannelImpl");
				type_SetArrayForChannelImpl = 1;
				return;
			}
			engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2017.1.0" }))
			{
				m_SetArrayForChannelImpl_2017 = UnityInternals.ResolveICall<SetArrayForChannelImpl_2017>("UnityEngine.Mesh::SetArrayForChannelImpl");
				type_SetArrayForChannelImpl = 0;
			}
		}

		public Mesh(IntPtr ptr)
			: base(ptr)
		{
		}

		public unsafe Mesh()
			: base(UnityInternals.object_new(InternalClassPointerStore<Mesh>.NativeClassPtr))
		{
			IntPtr exc = default(IntPtr);
			UnityInternals.runtime_invoke(m_ctor, UnityInternals.ObjectBaseToPtrNotNull(this), null, ref exc);
			Il2CppException.RaiseExceptionIfNecessary(exc);
		}

		private void SetArrayForChannelImpl(int channel, IntPtr values, int channelDimensions, int valuesCount)
		{
			if (type_SetArrayForChannelImpl == 0)
			{
				m_SetArrayForChannelImpl_2017(UnityInternals.ObjectBaseToPtrNotNull(this), channel, 0, channelDimensions, values, valuesCount);
				return;
			}
			if (type_SetArrayForChannelImpl == 1)
			{
				m_SetArrayForChannelImpl_2019(UnityInternals.ObjectBaseToPtrNotNull(this), channel, 0, channelDimensions, values, valuesCount, 0, valuesCount);
				return;
			}
			if (type_SetArrayForChannelImpl == 2)
			{
				m_SetArrayForChannelImpl_2020(UnityInternals.ObjectBaseToPtrNotNull(this), channel, 0, channelDimensions, values, valuesCount, 0, valuesCount, 0);
				return;
			}
			throw new NotImplementedException("SetArrayForChannel isn't implemented for this version of Unity");
		}

		public unsafe void RecalculateBounds()
		{
			UnityInternals.ObjectBaseToPtrNotNull(this);
			IntPtr exc = default(IntPtr);
			UnityInternals.runtime_invoke(m_RecalculateBounds, UnityInternals.ObjectBaseToPtrNotNull(this), null, ref exc);
			Il2CppException.RaiseExceptionIfNecessary(exc);
		}
	}
	[StructLayout(LayoutKind.Explicit)]
	internal struct Quaternion
	{
		[FieldOffset(0)]
		public float x;

		[FieldOffset(4)]
		public float y;

		[FieldOffset(8)]
		public float z;

		[FieldOffset(12)]
		public float w;

		public static Quaternion identity => default(Quaternion);

		static Quaternion()
		{
			InternalClassPointerStore<Quaternion>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Quaternion");
		}
	}
	[StructLayout(LayoutKind.Explicit)]
	internal struct Rect
	{
		[FieldOffset(0)]
		public float m_XMin;

		[FieldOffset(4)]
		public float m_YMin;

		[FieldOffset(8)]
		public float m_Width;

		[FieldOffset(12)]
		public float m_Height;

		static Rect()
		{
			InternalClassPointerStore<Rect>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Rect");
			UnityInternals.runtime_class_init(InternalClassPointerStore<Rect>.NativeClassPtr);
		}

		public Rect(int x, int y, int width, int height)
		{
			m_XMin = x;
			m_YMin = y;
			m_Width = width;
			m_Height = height;
		}
	}
	internal class Resources
	{
		private static readonly IntPtr m_GetBuiltinResource;

		static Resources()
		{
			InternalClassPointerStore<Resources>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Resources");
			m_GetBuiltinResource = UnityInternals.GetMethod(InternalClassPointerStore<Resources>.NativeClassPtr, "GetBuiltinResource", "UnityEngine.Object", "System.Type", "System.String");
		}

		public unsafe static IntPtr GetBuiltinResource(Il2CppSystem.Type type, string path)
		{
			void** ptr = stackalloc void*[2];
			*ptr = (void*)UnityInternals.ObjectBaseToPtr(type);
			ptr[1] = (void*)UnityInternals.ManagedStringToInternal(path);
			IntPtr exc = default(IntPtr);
			MelonDebug.Msg("Calling runtime_invoke for GetBuiltinResource");
			IntPtr result = UnityInternals.runtime_invoke(m_GetBuiltinResource, IntPtr.Zero, ptr, ref exc);
			MelonDebug.Msg("returnedException: " + exc + ", objectPointer: " + result);
			Il2CppException.RaiseExceptionIfNecessary(exc);
			return result;
		}

		public static T GetBuiltinResource<T>(string path) where T : InternalObjectBase
		{
			MelonDebug.Msg("GetBuiltinResource<T>");
			IntPtr builtinResource = GetBuiltinResource(InternalType.Of<T>(), path);
			if (!(builtinResource != IntPtr.Zero))
			{
				return null;
			}
			return (T)typeof(T).GetConstructor(new System.Type[1] { typeof(IntPtr) }).Invoke(new object[1] { builtinResource });
		}
	}
	internal class Screen
	{
		private static IntPtr m_get_width;

		private static IntPtr m_get_height;

		public unsafe static int width
		{
			get
			{
				IntPtr* param = null;
				IntPtr exc = IntPtr.Zero;
				IntPtr obj = UnityInternals.runtime_invoke(m_get_width, IntPtr.Zero, (void**)param, ref exc);
				Il2CppException.RaiseExceptionIfNecessary(exc);
				return *(int*)(void*)UnityInternals.object_unbox(obj);
			}
		}

		public unsafe static int height
		{
			get
			{
				IntPtr* param = null;
				IntPtr exc = IntPtr.Zero;
				IntPtr obj = UnityInternals.runtime_invoke(m_get_height, IntPtr.Zero, (void**)param, ref exc);
				Il2CppException.RaiseExceptionIfNecessary(exc);
				return *(int*)(void*)UnityInternals.object_unbox(obj);
			}
		}

		static Screen()
		{
			InternalClassPointerStore<Screen>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Screen");
			m_get_width = UnityInternals.GetMethod(InternalClassPointerStore<Screen>.NativeClassPtr, "get_width", "System.Int32");
			m_get_height = UnityInternals.GetMethod(InternalClassPointerStore<Screen>.NativeClassPtr, "get_height", "System.Int32");
		}
	}
	internal class Texture : UnityObject
	{
		private delegate int GetDataWidthDelegate(IntPtr @this);

		private delegate int GetDataHeightDelegate(IntPtr @this);

		private delegate int set_filterModeDelegate(IntPtr @this, FilterMode filterMode);

		private static readonly GetDataWidthDelegate getDataWidth;

		private static readonly GetDataHeightDelegate getDataHeight;

		private static readonly set_filterModeDelegate set_filterMode_;

		public int width => getDataWidth(UnityInternals.ObjectBaseToPtrNotNull(this));

		public int height => getDataHeight(UnityInternals.ObjectBaseToPtrNotNull(this));

		public FilterMode filterMode
		{
			set
			{
				set_filterMode_(UnityInternals.ObjectBaseToPtrNotNull(this), value);
			}
		}

		static Texture()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			InternalClassPointerStore<Texture>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Texture");
			UnityVersion engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2018.1.0" }))
			{
				getDataWidth = UnityInternals.ResolveICall<GetDataWidthDelegate>("UnityEngine.Texture::GetDataWidth");
				getDataHeight = UnityInternals.ResolveICall<GetDataHeightDelegate>("UnityEngine.Texture::GetDataHeight");
			}
			else
			{
				engineVersion = UnityInformationHandler.EngineVersion;
				if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2017.1.0" }))
				{
					getDataWidth = UnityInternals.ResolveICall<GetDataWidthDelegate>("UnityEngine.Texture::Internal_GetWidth");
					getDataHeight = UnityInternals.ResolveICall<GetDataHeightDelegate>("UnityEngine.Texture::Internal_GetHeight");
				}
			}
			set_filterMode_ = UnityInternals.ResolveICall<set_filterModeDelegate>("UnityEngine.Texture::set_filterMode");
		}

		public Texture(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	internal class Texture2D : Texture
	{
		private delegate void SetPixelsImplDelegate_2017(IntPtr @this, int x, int y, int w, int h, IntPtr pixel, int miplevel);

		private delegate void SetPixelsImplDelegate_2018(IntPtr @this, int x, int y, int w, int h, IntPtr pixel, int miplevel, int frame);

		private static readonly IntPtr m_get_whiteTexture;

		private static readonly IntPtr m_ctor;

		private static readonly SetPixelsImplDelegate_2017 m_SetPixelsImpl_2017;

		private static readonly SetPixelsImplDelegate_2018 m_SetPixelsImpl_2018;

		private static readonly IntPtr m_Apply;

		private static readonly int type_SetPixelsImpl;

		public unsafe static Texture2D whiteTexture
		{
			get
			{
				IntPtr exc = IntPtr.Zero;
				IntPtr intPtr = UnityInternals.runtime_invoke(m_get_whiteTexture, IntPtr.Zero, null, ref exc);
				Il2CppException.RaiseExceptionIfNecessary(exc);
				if (!(intPtr == IntPtr.Zero))
				{
					return new Texture2D(intPtr);
				}
				return null;
			}
		}

		static Texture2D()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			type_SetPixelsImpl = -1;
			InternalClassPointerStore<Texture2D>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Texture2D");
			UnityInternals.runtime_class_init(InternalClassPointerStore<Texture2D>.NativeClassPtr);
			m_ctor = UnityInternals.GetMethod(InternalClassPointerStore<Texture2D>.NativeClassPtr, ".ctor", "System.Void", "System.Int32", "System.Int32");
			m_get_whiteTexture = UnityInternals.GetMethod(InternalClassPointerStore<Texture2D>.NativeClassPtr, "get_whiteTexture", "UnityEngine.Texture2D");
			UnityVersion engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2018.1.0" }))
			{
				type_SetPixelsImpl = 1;
				m_SetPixelsImpl_2018 = UnityInternals.ResolveICall<SetPixelsImplDelegate_2018>("UnityEngine.Texture2D::SetPixelsImpl");
			}
			else
			{
				engineVersion = UnityInformationHandler.EngineVersion;
				if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2017.1.0" }))
				{
					type_SetPixelsImpl = 0;
					m_SetPixelsImpl_2017 = UnityInternals.ResolveICall<SetPixelsImplDelegate_2017>("UnityEngine.Texture2D::SetPixels");
				}
			}
			m_Apply = UnityInternals.GetMethod(InternalClassPointerStore<Texture2D>.NativeClassPtr, "Apply", "System.Void");
		}

		public Texture2D(IntPtr ptr)
			: base(ptr)
		{
		}

		public unsafe Texture2D(int width, int height)
			: base(UnityInternals.object_new(InternalClassPointerStore<Texture2D>.NativeClassPtr))
		{
			void** ptr = stackalloc void*[2];
			*ptr = &width;
			ptr[1] = &height;
			IntPtr exc = default(IntPtr);
			UnityInternals.runtime_invoke(m_ctor, UnityInternals.ObjectBaseToPtrNotNull(this), ptr, ref exc);
			Il2CppException.RaiseExceptionIfNecessary(exc);
		}

		public void SetPixels(Color[] colors)
		{
			SetPixels(0, 0, base.width, base.height, colors);
		}

		public void SetPixels(int x, int y, int blockWidth, int blockHeight, Color[] colors, int miplevel = 0)
		{
			SetPixelsImpl(x, y, blockWidth, blockHeight, colors, miplevel, 0);
		}

		public unsafe void SetPixelsImpl(int x, int y, int w, int h, Color[] pixel, int miplevel, int frame)
		{
			IntPtr intPtr = UnityInternals.array_new(InternalClassPointerStore<Color>.NativeClassPtr, (uint)pixel.Length);
			for (int i = 0; i < pixel.Length; i++)
			{
				*(Color*)((byte*)((IntPtr)((long)intPtr + 4 * IntPtr.Size)).ToPointer() + (nint)i * (nint)sizeof(Color)) = pixel[i];
			}
			if (type_SetPixelsImpl == 0)
			{
				m_SetPixelsImpl_2017(UnityInternals.ObjectBaseToPtrNotNull(this), x, y, w, h, intPtr, miplevel);
			}
			else if (type_SetPixelsImpl == 1)
			{
				m_SetPixelsImpl_2018(UnityInternals.ObjectBaseToPtrNotNull(this), x, y, w, h, intPtr, miplevel, frame);
			}
		}

		public unsafe void Apply()
		{
			IntPtr exc = default(IntPtr);
			UnityInternals.runtime_invoke(m_Apply, UnityInternals.ObjectBaseToPtrNotNull(this), null, ref exc);
			Il2CppException.RaiseExceptionIfNecessary(exc);
		}
	}
	internal static class UnityDebug
	{
		private delegate bool get_isDebugBuild_Delegate();

		private static get_isDebugBuild_Delegate get_isDebugBuild_Ptr;

		internal static bool isDebugBuild => get_isDebugBuild_Ptr();

		static UnityDebug()
		{
			IntPtr intPtr = UnityInternals.ResolveICall("UnityEngine.Debug::get_isDebugBuild");
			if (intPtr != IntPtr.Zero)
			{
				get_isDebugBuild_Ptr = (get_isDebugBuild_Delegate)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(get_isDebugBuild_Delegate));
			}
			else
			{
				MelonLogger.Error("Failed to resolve icall UnityEngine.Debug::get_isDebugBuild");
			}
		}
	}
	internal class UnityObject : InternalObjectBase
	{
		private delegate HideFlags get_hideFlags_Delegate(IntPtr obj);

		private delegate void set_hideFlags_Delegate(IntPtr obj, HideFlags hideFlags);

		private static get_hideFlags_Delegate m_get_hideFlags;

		private static set_hideFlags_Delegate m_set_hideFlags;

		private static IntPtr m_DestroyImmediate;

		private static IntPtr m_DontDestroyOnLoad;

		public HideFlags hideFlags
		{
			get
			{
				if (base.Pointer == IntPtr.Zero)
				{
					return HideFlags.None;
				}
				return m_get_hideFlags(base.Pointer);
			}
			set
			{
				if (!(base.Pointer == IntPtr.Zero))
				{
					m_set_hideFlags(base.Pointer, value);
				}
			}
		}

		static UnityObject()
		{
			InternalClassPointerStore<UnityObject>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Object");
			m_DestroyImmediate = UnityInternals.GetMethod(InternalClassPointerStore<UnityObject>.NativeClassPtr, "DestroyImmediate", "System.Void", "UnityEngine.Object");
			m_DontDestroyOnLoad = UnityInternals.GetMethod(InternalClassPointerStore<UnityObject>.NativeClassPtr, "DontDestroyOnLoad", "System.Void", "UnityEngine.Object");
			m_get_hideFlags = UnityInternals.ResolveICall<get_hideFlags_Delegate>("UnityEngine.Object::get_hideFlags(UnityEngine.Object)");
			m_set_hideFlags = UnityInternals.ResolveICall<set_hideFlags_Delegate>("UnityEngine.Object::set_hideFlags(UnityEngine.Object)");
		}

		public UnityObject(IntPtr ptr)
			: base(ptr)
		{
		}

		public unsafe void DestroyImmediate()
		{
			if (!(base.Pointer == IntPtr.Zero))
			{
				void** ptr = stackalloc void*[1];
				*ptr = base.Pointer.ToPointer();
				IntPtr exc = IntPtr.Zero;
				UnityInternals.runtime_invoke(m_DestroyImmediate, IntPtr.Zero, ptr, ref exc);
				Il2CppException.RaiseExceptionIfNecessary(exc);
			}
		}

		public unsafe void DontDestroyOnLoad()
		{
			if (!(base.Pointer == IntPtr.Zero))
			{
				void** ptr = stackalloc void*[1];
				*ptr = base.Pointer.ToPointer();
				IntPtr exc = IntPtr.Zero;
				UnityInternals.runtime_invoke(m_DontDestroyOnLoad, IntPtr.Zero, ptr, ref exc);
				Il2CppException.RaiseExceptionIfNecessary(exc);
			}
		}
	}
	[StructLayout(LayoutKind.Explicit)]
	internal struct Vector2
	{
		[FieldOffset(0)]
		public float x;

		[FieldOffset(4)]
		public float y;

		static Vector2()
		{
			InternalClassPointerStore<Vector2>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Vector2");
		}

		public Vector2(float x, float y)
		{
			this.x = x;
			this.y = y;
		}
	}
	[StructLayout(LayoutKind.Explicit)]
	internal struct Vector3
	{
		[FieldOffset(0)]
		public float x;

		[FieldOffset(4)]
		public float y;

		[FieldOffset(8)]
		public float z;

		public static Vector3 zero => default(Vector3);

		static Vector3()
		{
			InternalClassPointerStore<Vector3>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Vector3");
		}

		public Vector3(float x, float y, float z)
		{
			this.x = x;
			this.y = y;
			this.z = z;
		}

		public static Vector3 operator *(Vector3 a, float d)
		{
			return new Vector3(a.x * d, a.y * d, a.z * d);
		}

		public override string ToString()
		{
			return $"{x} {y} {z}";
		}
	}
	[StructLayout(LayoutKind.Explicit)]
	internal struct Vector4
	{
		[FieldOffset(0)]
		public float x;

		[FieldOffset(4)]
		public float y;

		[FieldOffset(8)]
		public float z;

		[FieldOffset(12)]
		public float w;

		static Vector4()
		{
			InternalClassPointerStore<Vector4>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.CoreModule.dll", "UnityEngine", "Vector4");
		}

		public static explicit operator Vector2(Vector4 src)
		{
			return new Vector2(src.x, src.y);
		}
	}
	internal enum VerticalWrapMode
	{
		Truncate,
		Overflow
	}
	internal class Font : UnityObject
	{
		private static IntPtr m_get_material;

		public unsafe Material material
		{
			get
			{
				UnityInternals.ObjectBaseToPtrNotNull(this);
				IntPtr exc = default(IntPtr);
				IntPtr intPtr = UnityInternals.runtime_invoke(m_get_material, UnityInternals.ObjectBaseToPtrNotNull(this), null, ref exc);
				Il2CppException.RaiseExceptionIfNecessary(exc);
				if (!(intPtr != IntPtr.Zero))
				{
					return null;
				}
				return new Material(intPtr);
			}
		}

		static Font()
		{
			InternalClassPointerStore<Font>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.TextRenderingModule.dll", "UnityEngine", "Font");
			UnityInternals.runtime_class_init(InternalClassPointerStore<Font>.NativeClassPtr);
			m_get_material = UnityInternals.GetMethod(InternalClassPointerStore<Font>.NativeClassPtr, "get_material", "UnityEngine.Material");
		}

		public Font(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	internal enum FontStyle
	{
		Normal,
		Bold,
		Italic,
		BoldAndItalic
	}
	internal enum TextAnchor
	{
		UpperLeft,
		UpperCenter,
		UpperRight,
		MiddleLeft,
		MiddleCenter,
		MiddleRight,
		LowerLeft,
		LowerCenter,
		LowerRight
	}
	internal class TextGenerationSettings : InternalObjectBase
	{
		private static readonly int classsize;

		private static readonly IntPtr f_font;

		private static readonly IntPtr f_color;

		private static readonly IntPtr f_fontSize;

		private static readonly IntPtr f_lineSpacing;

		private static readonly IntPtr f_richText;

		private static readonly IntPtr f_scaleFactor;

		private static readonly IntPtr f_fontStyle;

		private static readonly IntPtr f_textAnchor;

		private static readonly IntPtr f_verticalOverflow;

		private static readonly IntPtr f_generationExtents;

		private static readonly IntPtr f_pivot;

		public unsafe Font font
		{
			get
			{
				IntPtr intPtr = *(IntPtr*)((uint)(int)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_font));
				if (!(intPtr != IntPtr.Zero))
				{
					return null;
				}
				return new Font(intPtr);
			}
			set
			{
				*(IntPtr*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_font)) = UnityInternals.ObjectBaseToPtr(value);
			}
		}

		public unsafe Color color
		{
			get
			{
				return *(Color*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_color));
			}
			set
			{
				*(Color*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_color)) = value;
			}
		}

		public unsafe int fontSize
		{
			get
			{
				return *(int*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_fontSize));
			}
			set
			{
				*(int*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_fontSize)) = value;
			}
		}

		public unsafe float lineSpacing
		{
			get
			{
				return *(float*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_lineSpacing));
			}
			set
			{
				*(float*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_lineSpacing)) = value;
			}
		}

		public unsafe bool richText
		{
			get
			{
				return *(bool*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_richText));
			}
			set
			{
				*(bool*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_richText)) = value;
			}
		}

		public unsafe float scaleFactor
		{
			get
			{
				return *(float*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_scaleFactor));
			}
			set
			{
				*(float*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_scaleFactor)) = value;
			}
		}

		public unsafe FontStyle fontStyle
		{
			get
			{
				return *(FontStyle*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_fontStyle));
			}
			set
			{
				*(FontStyle*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_fontStyle)) = value;
			}
		}

		public unsafe TextAnchor textAnchor
		{
			get
			{
				return *(TextAnchor*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_textAnchor));
			}
			set
			{
				*(TextAnchor*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_textAnchor)) = value;
			}
		}

		public unsafe VerticalWrapMode verticalOverflow
		{
			get
			{
				return *(VerticalWrapMode*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_verticalOverflow));
			}
			set
			{
				*(VerticalWrapMode*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_verticalOverflow)) = value;
			}
		}

		public unsafe Vector2 generationExtents
		{
			get
			{
				return *(Vector2*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_generationExtents));
			}
			set
			{
				*(Vector2*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_generationExtents)) = value;
			}
		}

		public unsafe Vector2 pivot
		{
			get
			{
				return *(Vector2*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_pivot));
			}
			set
			{
				*(Vector2*)((long)UnityInternals.ObjectBaseToPtrNotNull(this) + UnityInternals.field_get_offset(f_pivot)) = value;
			}
		}

		static TextGenerationSettings()
		{
			InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.TextRenderingModule.dll", "UnityEngine", "TextGenerationSettings");
			uint align = 0u;
			classsize = UnityInternals.class_value_size(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, ref align);
			f_font = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "font");
			f_color = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "color");
			f_fontSize = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "fontSize");
			f_lineSpacing = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "lineSpacing");
			f_richText = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "richText");
			f_scaleFactor = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "scaleFactor");
			f_fontStyle = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "fontStyle");
			f_textAnchor = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "textAnchor");
			f_verticalOverflow = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "verticalOverflow");
			f_generationExtents = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "generationExtents");
			f_pivot = UnityInternals.GetField(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, "pivot");
		}

		public TextGenerationSettings(IntPtr ptr)
			: base(ptr)
		{
		}

		public unsafe TextGenerationSettings()
		{
			byte** ptr = stackalloc byte*[classsize];
			IntPtr obj = UnityInternals.value_box(InternalClassPointerStore<TextGenerationSettings>.NativeClassPtr, (IntPtr)ptr);
			myGcHandle = UnityInternals.gchandle_new(obj, pinned: false);
		}
	}
	internal class TextGenerator : InternalObjectBase
	{
		private delegate int get_vertexCountDelegate(IntPtr @this);

		private delegate IntPtr GetVerticesArrayDelegate(IntPtr @this);

		private static readonly IntPtr m_ctor;

		private static readonly IntPtr m_Populate;

		private static readonly get_vertexCountDelegate fd_get_vertexCount;

		private static readonly GetVerticesArrayDelegate fd_GetVerticesArray;

		public int vertexCount => fd_get_vertexCount(UnityInternals.ObjectBaseToPtrNotNull(this));

		static TextGenerator()
		{
			InternalClassPointerStore<TextGenerator>.NativeClassPtr = UnityInternals.GetClass("UnityEngine.TextRenderingModule.dll", "UnityEngine", "TextGenerator");
			UnityInternals.runtime_class_init(InternalClassPointerStore<TextGenerator>.NativeClassPtr);
			m_ctor = UnityInternals.GetMethod(InternalClassPointerStore<TextGenerator>.NativeClassPtr, ".ctor", "System.Void");
			m_Populate = UnityInternals.GetMethod(InternalClassPointerStore<TextGenerator>.NativeClassPtr, "Populate", "System.Boolean", "System.String", "UnityEngine.TextGenerationSettings");
			fd_get_vertexCount = UnityInternals.ResolveICall<get_vertexCountDelegate>("UnityEngine.TextGenerator::get_vertexCount");
			fd_GetVerticesArray = UnityInternals.ResolveICall<GetVerticesArrayDelegate>("UnityEngine.TextGenerator::GetVerticesArray");
		}

		public TextGenerator(IntPtr ptr)
			: base(ptr)
		{
		}

		public unsafe TextGenerator()
			: this(UnityInternals.object_new(InternalClassPointerStore<TextGenerator>.NativeClassPtr))
		{
			IntPtr exc = default(IntPtr);
			UnityInternals.runtime_invoke(m_ctor, UnityInternals.ObjectBaseToPtrNotNull(this), null, ref exc);
			Il2CppException.RaiseExceptionIfNecessary(exc);
		}

		public unsafe bool Populate(string str, TextGenerationSettings settings)
		{
			void** ptr = stackalloc void*[2];
			*ptr = (void*)UnityInternals.ManagedStringToInternal(str);
			ptr[1] = (void*)UnityInternals.object_unbox(UnityInternals.ObjectBaseToPtrNotNull(settings));
			IntPtr exc = default(IntPtr);
			IntPtr obj = UnityInternals.runtime_invoke(m_Populate, UnityInternals.ObjectBaseToPtrNotNull(this), ptr, ref exc);
			Il2CppException.RaiseExceptionIfNecessary(exc);
			return *(bool*)(void*)UnityInternals.object_unbox(obj);
		}

		public UIVertexWrapper[] GetVerticesArray()
		{
			IntPtr intPtr = fd_GetVerticesArray(UnityInternals.ObjectBaseToPtrNotNull(this));
			if (intPtr == IntPtr.Zero)
			{
				return null;
			}
			UIVertexWrapper[] array = new UIVertexWrapper[UnityInternals.array_length(intPtr)];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = new UIVertexWrapper((IntPtr)((long)intPtr + 4 * IntPtr.Size + i * UIVertexWrapper.sizeOfElement));
			}
			return array;
		}
	}
	internal struct UIVertex_2020
	{
		public Vector3 position;

		public Vector3 normal;

		public Vector4 tangent;

		public Color32 color;

		public Vector4 uv0;

		public Vector4 uv1;

		public Vector4 uv2;

		public Vector4 uv3;
	}
	internal struct UIVertex_2018
	{
		public Vector3 position;

		public Vector3 normal;

		public Vector4 tangent;

		public Color32 color;

		public Vector2 uv0;

		public Vector2 uv1;

		public Vector2 uv2;

		public Vector2 uv3;
	}
	internal struct UIVertex_2017
	{
		public Vector3 position;

		public Vector3 normal;

		public Color32 color;

		public Vector2 uv0;

		public Vector2 uv1;

		public Vector2 uv2;

		public Vector2 uv3;

		public Vector4 tangent;
	}
	internal struct UIVertexWrapper
	{
		private static readonly int mode;

		public static readonly int sizeOfElement;

		private IntPtr ptr;

		public unsafe Vector3 position
		{
			get
			{
				if (mode != 2)
				{
					if (mode != 1)
					{
						if (mode != 0)
						{
							throw new Exception("UIVertex mode not set");
						}
						return ((UIVertex_2017*)(void*)ptr)->position;
					}
					return ((UIVertex_2018*)(void*)ptr)->position;
				}
				return ((UIVertex_2020*)(void*)ptr)->position;
			}
		}

		public unsafe Vector3 normal
		{
			get
			{
				if (mode != 2)
				{
					if (mode != 1)
					{
						if (mode != 0)
						{
							throw new Exception("UIVertex mode not set");
						}
						return ((UIVertex_2017*)(void*)ptr)->normal;
					}
					return ((UIVertex_2018*)(void*)ptr)->normal;
				}
				return ((UIVertex_2020*)(void*)ptr)->normal;
			}
		}

		public unsafe Vector4 tangent
		{
			get
			{
				if (mode != 2)
				{
					if (mode != 1)
					{
						if (mode != 0)
						{
							throw new Exception("UIVertex mode not set");
						}
						return ((UIVertex_2017*)(void*)ptr)->tangent;
					}
					return ((UIVertex_2018*)(void*)ptr)->tangent;
				}
				return ((UIVertex_2020*)(void*)ptr)->tangent;
			}
		}

		public unsafe Color32 color
		{
			get
			{
				if (mode != 2)
				{
					if (mode != 1)
					{
						if (mode != 0)
						{
							throw new Exception("UIVertex mode not set");
						}
						return ((UIVertex_2017*)(void*)ptr)->color;
					}
					return ((UIVertex_2018*)(void*)ptr)->color;
				}
				return ((UIVertex_2020*)(void*)ptr)->color;
			}
		}

		public unsafe Vector2 uv0
		{
			get
			{
				if (mode != 2)
				{
					if (mode != 1)
					{
						if (mode != 0)
						{
							throw new Exception("UIVertex mode not set");
						}
						return ((UIVertex_2017*)(void*)ptr)->uv0;
					}
					return ((UIVertex_2018*)(void*)ptr)->uv0;
				}
				return (Vector2)((UIVertex_2020*)(void*)ptr)->uv0;
			}
		}

		unsafe static UIVertexWrapper()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			mode = -1;
			sizeOfElement = 0;
			UnityVersion engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[2] { "2020.2.0", "2021.1.0" }))
			{
				mode = 2;
				sizeOfElement = sizeof(UIVertex_2020);
				return;
			}
			engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2018.1.0" }))
			{
				mode = 1;
				sizeOfElement = sizeof(UIVertex_2018);
				return;
			}
			engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2017.2.0" }))
			{
				mode = 0;
				sizeOfElement = sizeof(UIVertex_2017);
			}
		}

		public UIVertexWrapper(IntPtr ptr)
		{
			this.ptr = ptr;
		}
	}
}
namespace MelonUnityEngine.Rendering
{
	internal static class VertexAttribute
	{
		public static int Vertex = 0;

		public static int Normal = 1;

		[NativeFieldValue(1u, NativeSignatureFlags.None, 7, new string[] { "2017.1.0" })]
		[NativeFieldValue(2u, NativeSignatureFlags.None, 2, new string[] { "2018.1.0" })]
		public static int Tangent = 0;

		[NativeFieldValue(1u, NativeSignatureFlags.None, 2, new string[] { "2017.1.0" })]
		[NativeFieldValue(2u, NativeSignatureFlags.None, 3, new string[] { "2018.1.0" })]
		public static int Color = 0;

		[NativeFieldValue(1u, NativeSignatureFlags.None, 3, new string[] { "2017.1.0" })]
		[NativeFieldValue(2u, NativeSignatureFlags.None, 4, new string[] { "2018.1.0" })]
		public static int TexCoord0 = 0;
	}
}
namespace MelonUnityEngine.CoreModule
{
	internal sealed class SystemInfo
	{
		private delegate uint d_GetGraphicsDeviceType();

		private static readonly d_GetGraphicsDeviceType m_GetGraphicsDeviceType;

		static SystemInfo()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			UnityVersion engineVersion = UnityInformationHandler.EngineVersion;
			if (NativeSignatureResolver.IsUnityVersionOverOrEqual(((UnityVersion)(ref engineVersion)).ToStringWithoutType(), new string[1] { "2018.1.0" }))
			{
				m_GetGraphicsDeviceType = UnityInternals.ResolveICall<d_GetGraphicsDeviceType>("UnityEngine.SystemInfo::GetGraphicsDeviceType");
			}
			else
			{
				m_GetGraphicsDeviceType = UnityInternals.ResolveICall<d_GetGraphicsDeviceType>("UnityEngine.SystemInfo::get_graphicsDeviceType");
			}
		}

		public static uint GetGraphicsDeviceType()
		{
			return m_GetGraphicsDeviceType();
		}
	}
}
namespace Il2CppSystem
{
	[StructLayout(LayoutKind.Explicit)]
	internal class Byte
	{
		[FieldOffset(0)]
		public byte m_value;

		static Byte()
		{
			InternalClassPointerStore<byte>.NativeClassPtr = UnityInternals.GetClass("mscorlib.dll", "System", "Byte");
			UnityInternals.runtime_class_init(InternalClassPointerStore<byte>.NativeClassPtr);
		}
	}
	[StructLayout(LayoutKind.Explicit)]
	internal class Int32
	{
		[FieldOffset(0)]
		public int m_value;

		static Int32()
		{
			InternalClassPointerStore<int>.NativeClassPtr = UnityInternals.GetClass("mscorlib.dll", "System", "Int32");
			UnityInternals.runtime_class_init(InternalClassPointerStore<int>.NativeClassPtr);
		}
	}
	internal class Type : InternalObjectBase
	{
		private static readonly IntPtr m_internal_from_handle;

		static Type()
		{
			InternalClassPointerStore<Type>.NativeClassPtr = UnityInternals.GetClass("mscorlib.dll", "System", "Type");
			m_internal_from_handle = UnityInternals.GetMethod(InternalClassPointerStore<Type>.NativeClassPtr, "internal_from_handle", "System.Type", "System.IntPtr");
		}

		public Type(IntPtr ptr)
			: base(ptr)
		{
		}

		public unsafe static Type internal_from_handle(IntPtr handle)
		{
			void** ptr = stackalloc void*[1];
			*ptr = &handle;
			IntPtr exc = default(IntPtr);
			IntPtr intPtr = UnityInternals.runtime_invoke(m_internal_from_handle, IntPtr.Zero, ptr, ref exc);
			Il2CppException.RaiseExceptionIfNecessary(exc);
			if (!(intPtr != IntPtr.Zero))
			{
				return null;
			}
			return new Type(intPtr);
		}
	}
}
namespace UnhollowerMini
{
	internal class Il2CppException : Exception
	{
		[ThreadStatic]
		private static byte[] ourMessageBytes;

		public static Func<IntPtr, string> ParseMessageHook;

		public Il2CppException(IntPtr exception)
			: base(BuildMessage(exception))
		{
		}

		private unsafe static string BuildMessage(IntPtr exception)
		{
			if (ParseMessageHook != null)
			{
				return ParseMessageHook(exception);
			}
			if (ourMessageBytes == null)
			{
				ourMessageBytes = new byte[65536];
			}
			fixed (byte* message = ourMessageBytes)
			{
				UnityInternals.format_exception(exception, message, ourMessageBytes.Length);
			}
			string @string = Encoding.UTF8.GetString(ourMessageBytes, 0, Array.IndexOf(ourMessageBytes, (byte)0));
			fixed (byte* output = ourMessageBytes)
			{
				UnityInternals.format_stack_trace(exception, output, ourMessageBytes.Length);
			}
			return @string + "\n" + Encoding.UTF8.GetString(ourMessageBytes, 0, Array.IndexOf(ourMessageBytes, (byte)0));
		}

		public static void RaiseExceptionIfNecessary(IntPtr returnedException)
		{
			if (returnedException == IntPtr.Zero)
			{
				return;
			}
			throw new Il2CppException(returnedException);
		}
	}
	internal static class InternalClassPointerStore<T>
	{
		public static IntPtr NativeClassPtr;

		public static System.Type CreatedTypeRedirect;

		static InternalClassPointerStore()
		{
			System.Type typeFromHandle = typeof(T);
			RuntimeHelpers.RunClassConstructor(typeFromHandle.TypeHandle);
			if (typeFromHandle.IsPrimitive || (object)typeFromHandle == typeof(string))
			{
				MelonDebug.Msg("Running class constructor on Il2Cpp" + typeFromHandle.FullName);
				RuntimeHelpers.RunClassConstructor(typeof(InternalClassPointerStore<>).Assembly.GetType("Il2Cpp" + typeFromHandle.FullName).TypeHandle);
				MelonDebug.Msg("Done running class constructor");
			}
		}
	}
	internal class InternalObjectBase
	{
		protected uint myGcHandle;

		public IntPtr Pointer
		{
			get
			{
				IntPtr intPtr = UnityInternals.gchandle_get_target(myGcHandle);
				if (intPtr == IntPtr.Zero)
				{
					throw new ObjectCollectedException("Object was garbage collected");
				}
				return intPtr;
			}
		}

		protected InternalObjectBase()
		{
		}

		public InternalObjectBase(IntPtr pointer)
		{
			if (pointer == IntPtr.Zero)
			{
				throw new NullReferenceException();
			}
			myGcHandle = UnityInternals.gchandle_new(pointer, pinned: false);
		}

		~InternalObjectBase()
		{
			UnityInternals.gchandle_free(myGcHandle);
		}
	}
	internal static class InternalType
	{
		public static Il2CppSystem.Type TypeFromPointer(IntPtr classPointer, string typeName = "<unknown type>")
		{
			if (classPointer == IntPtr.Zero)
			{
				throw new ArgumentException(typeName + " does not have a corresponding internal class pointer");
			}
			IntPtr intPtr = UnityInternals.class_get_type(classPointer);
			if (intPtr == IntPtr.Zero)
			{
				throw new ArgumentException(typeName + " does not have a corresponding class type pointer");
			}
			return Il2CppSystem.Type.internal_from_handle(intPtr);
		}

		public static Il2CppSystem.Type Of<T>()
		{
			return TypeFromPointer(InternalClassPointerStore<T>.NativeClassPtr, typeof(T).Name);
		}
	}
	internal class ObjectCollectedException : Exception
	{
		public ObjectCollectedException(string message)
			: base(message)
		{
		}
	}
	internal static class UnityInternals
	{
		private delegate void delegate_gfunc_mono_assembly_foreach(IntPtr assembly, IntPtr user_data);

		private class InternalAssembly
		{
			public IntPtr ptr;

			public string name;

			public InternalAssembly(IntPtr ptr)
			{
				this.ptr = ptr;
				if (MelonUtils.IsGameIl2Cpp())
				{
					name = Marshal.PtrToStringAnsi(il2cpp_image_get_filename(this.ptr));
				}
				else
				{
					name = Marshal.PtrToStringAnsi(mono_image_get_filename(this.ptr));
				}
			}
		}

		private class InternalClass
		{
			public IntPtr ptr;

			public string name;

			public string name_space;

			public InternalClass(IntPtr ptr)
			{
				this.ptr = ptr;
				if (MelonUtils.IsGameIl2Cpp())
				{
					name = Marshal.PtrToStringAnsi(il2cpp_class_get_name(ptr));
					name_space = Marshal.PtrToStringAnsi(il2cpp_class_get_namespace(ptr));
					return;
				}
				throw new NotImplementedException();
			}

			public InternalClass(IntPtr ptr, string name, string name_space)
			{
				if (MelonUtils.IsGameIl2Cpp())
				{
					throw new NotImplementedException();
				}
				this.ptr = ptr;
				this.name = name;
				this.name_space = name_space;
			}
		}

		private struct MonoMethod
		{
			public ushort flags;

			public ushort iflags;

			public uint token;

			public unsafe MonoClass* klass;

			public unsafe MonoMethodSignature* signature;

			public unsafe byte* name;

			public IntPtr method_pointer;

			public IntPtr invoke_pointer;

			public ushort bitfield;

			public int slot;

			internal unsafe void applyZeroes()
			{
				flags = 0;
				iflags = 0;
				token = 0u;
				klass = null;
				signature = null;
				name = null;
				method_pointer = IntPtr.Zero;
				invoke_pointer = IntPtr.Zero;
				bitfield = 0;
				slot = 0;
			}
		}

		private struct MonoMethodSignature
		{
			public IntPtr ret;

			public ushort param_cout;

			internal void ApplyZeroes()
			{
				ret = (IntPtr)0;
				param_cout = 0;
			}
		}

		private struct MonoClass
		{
			public unsafe MonoClass* element_class;

			public unsafe MonoClass* cast_class;

			public unsafe MonoClass** supertypes;

			public ushort idepth;

			public byte rank;

			public byte class_kind;

			public int instance_size;

			public uint bitfield1;

			public byte min_align;

			public uint bitfield2;

			private byte exception_type;

			public unsafe MonoClass* parent;

			public unsafe MonoClass* nested_in;

			public IntPtr nested_in_0x04;

			public IntPtr nested_in_0x08;

			public IntPtr nested_in_0x0C;

			public IntPtr nested_in_0x10;

			internal unsafe void applyZeroes()
			{
				element_class = null;
				cast_class = null;
				supertypes = null;
				idepth = 0;
				rank = 0;
				class_kind = 0;
				instance_size = 0;
				bitfield1 = 0u;
				min_align = 0;
				bitfield2 = 0u;
				exception_type = 0;
				parent = null;
				nested_in = null;
				nested_in_0x04 = (IntPtr)0;
				nested_in_0x08 = (IntPtr)0;
				nested_in_0x0C = (IntPtr)0;
				nested_in_0x10 = (IntPtr)0;
			}
		}

		private struct MonoType
		{
			public IntPtr data;

			public short attrs;

			public byte type;

			public byte bitflags;

			internal void applyZeroes()
			{
				data = (IntPtr)0;
				attrs = 0;
				type = 0;
				bitflags = 0;
			}
		}

		private static readonly IntPtr domain;

		private static readonly List<InternalAssembly> assemblies;

		private static readonly uint monoClassOffset;

		unsafe static UnityInternals()
		{
			assemblies = new List<InternalAssembly>();
			monoClassOffset = 0u;
			if (MelonUtils.IsGameIl2Cpp())
			{
				domain = il2cpp_domain_get();
				uint size = 0u;
				IntPtr* ptr = il2cpp_domain_get_assemblies(domain, ref size);
				for (int i = 0; i < size; i++)
				{
					assemblies.Add(new InternalAssembly(il2cpp_assembly_get_image(ptr[i])));
				}
				return;
			}
			domain = mono_domain_get();
			MonoClass* ptr2 = (MonoClass*)(void*)Marshal.AllocHGlobal(sizeof(MonoClass));
			ptr2->applyZeroes();
			ptr2->nested_in_0x04 = (IntPtr)4660;
			ptr2->nested_in_0x08 = (IntPtr)22136;
			ptr2->nested_in_0x0C = (IntPtr)36882;
			long num = (long)mono_class_get_name((IntPtr)ptr2);
			MelonDebug.Msg($"returnedName {num:X}");
			Marshal.FreeHGlobal((IntPtr)ptr2);
			switch (num)
			{
			case 4660L:
				monoClassOffset = 0u;
				break;
			case 22136L:
				monoClassOffset = (uint)IntPtr.Size;
				break;
			case 36882L:
				monoClassOffset = (uint)(IntPtr.Size * 2);
				break;
			default:
				throw new Exception("Failed to find MonoClass name offset");
			}
			MelonDebug.Msg("monoClassOffset? " + monoClassOffset);
		}

		internal unsafe static IntPtr GetClass(string assemblyname, string name_space, string classname)
		{
			MelonDebug.Msg("GetClass " + assemblyname + " " + name_space + " " + classname);
			if (MelonUtils.IsGameIl2Cpp())
			{
				IntPtr intPtr = il2cpp_class_from_name((assemblies.FirstOrDefault((InternalAssembly a) => a.name == assemblyname) ?? throw new Exception("Unable to find assembly " + assemblyname + " in il2cpp domain")).ptr, name_space, classname);
				MelonDebug.Msg($" > 0x{(long)intPtr:X}");
				return intPtr;
			}
			string text = (string.IsNullOrEmpty(name_space) ? "" : (name_space + "." + classname));
			System.Type type = (AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name + ".dll" == assemblyname) ?? throw new Exception("Unable to find assembly " + assemblyname + " in mono domain")).GetType(text);
			if ((object)type == null)
			{
				throw new Exception("Unable to find class " + text + " in assembly " + assemblyname);
			}
			MelonDebug.Msg($" > 0x{(long)(*(IntPtr*)(void*)type.TypeHandle.Value):X}");
			return *(IntPtr*)(void*)type.TypeHandle.Value;
		}

		public static IntPtr GetField(IntPtr clazz, string fieldName)
		{
			MelonDebug.Msg("GetField " + fieldName);
			if (clazz == IntPtr.Zero)
			{
				return IntPtr.Zero;
			}
			IntPtr intPtr = (MelonUtils.IsGameIl2Cpp() ? il2cpp_class_get_field_from_name(clazz, fieldName) : mono_class_get_field_from_name(clazz, fieldName));
			if (intPtr == IntPtr.Zero)
			{
				throw new Exception("Field " + fieldName + " was not found on class " + Marshal.PtrToStringAnsi(MelonUtils.IsGameIl2Cpp() ? il2cpp_class_get_name(clazz) : mono_class_get_name(clazz)));
			}
			MelonDebug.Msg($" > 0x{(long)intPtr:X}");
			return intPtr;
		}

		internal static IntPtr GetMethod(IntPtr clazz, string name, string returntype, params string[] parameters)
		{
			MelonDebug.Msg("GetMethod " + returntype + " " + name + "(" + string.Join(", ", parameters) + ")");
			if (MelonUtils.IsGameIl2Cpp())
			{
				IntPtr iter = IntPtr.Zero;
				IntPtr intPtr;
				while ((intPtr = il2cpp_class_get_methods(clazz, ref iter)) != IntPtr.Zero)
				{
					if (Marshal.PtrToStringAnsi(il2cpp_method_get_name(intPtr)) != name || Marshal.PtrToStringAnsi(il2cpp_type_get_name(il2cpp_method_get_return_type(intPtr))) != returntype || parameters.Length != il2cpp_method_get_param_count(intPtr))
					{
						continue;
					}
					bool flag = true;
					for (uint num = 0u; num < parameters.Length; num++)
					{
						if (Marshal.PtrToStringAnsi(il2cpp_type_get_name(il2cpp_method_get_param(intPtr, num))) != parameters[num])
						{
							flag = false;
							break;
						}
					}
					if (flag)
					{
						MelonDebug.Msg($" > 0x{(long)intPtr:X}");
						return intPtr;
					}
				}
			}
			else
			{
				IntPtr iter2 = IntPtr.Zero;
				IntPtr intPtr2;
				while ((intPtr2 = mono_class_get_methods(clazz, ref iter2)) != IntPtr.Zero)
				{
					if (Marshal.PtrToStringAnsi(mono_method_get_name(intPtr2)) != name)
					{
						continue;
					}
					IntPtr sig = mono_method_get_signature(intPtr2, IntPtr.Zero, 0u);
					if (Marshal.PtrToStringAnsi(mono_type_get_name(mono_signature_get_return_type(sig))) != returntype || parameters.Length != mono_signature_get_param_count(sig))
					{
						continue;
					}
					bool flag2 = true;
					IntPtr iter3 = IntPtr.Zero;
					int num2 = 0;
					IntPtr type;
					while ((type = mono_signature_get_params(sig, ref iter3)) != IntPtr.Zero)
					{
						if (Marshal.PtrToStringAnsi(mono_type_get_name(type)) != parameters[num2])
						{
							flag2 = false;
							break;
						}
						num2++;
					}
					if (flag2)
					{
						MelonDebug.Msg($" > 0x{(long)intPtr2:X}");
						return intPtr2;
					}
				}
			}
			throw new Exception("Unable to find method " + returntype + " " + name + "(" + string.Join(", ", parameters) + ")");
		}

		public static IntPtr ObjectBaseToPtr(InternalObjectBase obj)
		{
			return obj?.Pointer ?? IntPtr.Zero;
		}

		public static IntPtr ObjectBaseToPtrNotNull(InternalObjectBase obj)
		{
			if (obj == null)
			{
				throw new NullReferenceException();
			}
			return obj.Pointer;
		}

		public unsafe static IntPtr ManagedStringToInternal(string str)
		{
			if (str == null)
			{
				return IntPtr.Zero;
			}
			fixed (char* text = str)
			{
				if (!MelonUtils.IsGameIl2Cpp())
				{
					return mono_string_new_utf16(domain, text, str.Length);
				}
				return il2cpp_string_new_utf16(text, str.Length);
			}
		}

		public unsafe static IntPtr ResolveICall(string signature)
		{
			MelonDebug.Msg("Resolving ICall " + signature);
			IntPtr intPtr;
			if (MelonUtils.IsGameIl2Cpp())
			{
				intPtr = il2cpp_resolve_icall(signature);
			}
			else
			{
				MonoMethod* intPtr2 = IcallToFakeMonoMethod(signature);
				intPtr = mono_lookup_internal_call((IntPtr)intPtr2);
				DestroyFakeMonoMethod(intPtr2);
			}
			if (intPtr == IntPtr.Zero)
			{
				throw new Exception("ICall " + signature + " not resolved");
			}
			MelonDebug.Msg($" > 0x{(long)intPtr:X}");
			return intPtr;
		}

		public static T ResolveICall<T>(string signature) where T : Delegate
		{
			IntPtr intPtr = ResolveICall(signature);
			if (!(intPtr == IntPtr.Zero))
			{
				return (T)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(T));
			}
			return null;
		}

		private unsafe static MonoMethod* IcallToFakeMonoMethod(string icallName)
		{
			string[] array = icallName.Split(new string[1] { "::" }, StringSplitOptions.None);
			int num = array[1].IndexOf('(');
			if (num >= 0)
			{
				array[1] = array[1].Substring(0, num);
			}
			MonoMethod* ptr = (MonoMethod*)(void*)Marshal.AllocHGlobal(sizeof(MonoMethod) + 256);
			ptr->applyZeroes();
			ptr->klass = (MonoClass*)(void*)Marshal.AllocHGlobal(sizeof(MonoClass) + 256);
			ptr->klass->applyZeroes();
			ptr->name = (byte*)(void*)Marshal.StringToHGlobalAnsi(array[1]);
			int num2 = array[0].LastIndexOf('.');
			if (num2 < 0)
			{
				*(IntPtr*)((ulong)(&ptr->klass->nested_in_0x08) + (ulong)monoClassOffset) = Marshal.StringToHGlobalAnsi("");
				*(IntPtr*)((ulong)(&ptr->klass->nested_in_0x04) + (ulong)monoClassOffset) = Marshal.StringToHGlobalAnsi(array[0]);
			}
			else
			{
				string s = array[0].Substring(0, num2);
				string s2 = array[0].Substring(num2 + 1);
				*(IntPtr*)((ulong)(&ptr->klass->nested_in_0x08) + (ulong)monoClassOffset) = Marshal.StringToHGlobalAnsi(s);
				*(IntPtr*)((ulong)(&ptr->klass->nested_in_0x04) + (ulong)monoClassOffset) = Marshal.StringToHGlobalAnsi(s2);
			}
			MonoMethodSignature* ptr2 = (MonoMethodSignature*)(void*)Marshal.AllocHGlobal(sizeof(MonoMethodSignature));
			ptr2->ApplyZeroes();
			ptr->signature = ptr2;
			return ptr;
		}

		private unsafe static void DestroyFakeMonoMethod(MonoMethod* monoMethod)
		{
			Marshal.FreeHGlobal((IntPtr)monoMethod->signature);
			Marshal.FreeHGlobal(*(IntPtr*)((ulong)(&monoMethod->klass->nested_in_0x04) + (ulong)monoClassOffset));
			Marshal.FreeHGlobal(*(IntPtr*)((ulong)(&monoMethod->klass->nested_in_0x08) + (ulong)monoClassOffset));
			Marshal.FreeHGlobal((IntPtr)monoMethod->klass);
			Marshal.FreeHGlobal((IntPtr)monoMethod->name);
			Marshal.FreeHGlobal((IntPtr)monoMethod);
		}

		public static IntPtr class_get_type(IntPtr klass)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return mono_class_get_type(klass);
			}
			return il2cpp_class_get_type(klass);
		}

		public static void runtime_class_init(IntPtr klass)
		{
			if (klass == IntPtr.Zero)
			{
				throw new ArgumentException("Class to init is null");
			}
			if (MelonUtils.IsGameIl2Cpp())
			{
				il2cpp_runtime_class_init(klass);
			}
			else
			{
				mono_runtime_class_init(klass);
			}
		}

		public unsafe static IntPtr runtime_invoke(IntPtr method, IntPtr obj, void** param, ref IntPtr exc)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return mono_runtime_invoke(method, obj, param, ref exc);
			}
			return il2cpp_runtime_invoke(method, obj, param, ref exc);
		}

		public static IntPtr array_new(IntPtr elementTypeInfo, ulong length)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return mono_array_new(domain, elementTypeInfo, length);
			}
			return il2cpp_array_new(elementTypeInfo, length);
		}

		public unsafe static uint array_length(IntPtr array)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return *(uint*)((long)array + IntPtr.Size * 3);
			}
			return il2cpp_array_length(array);
		}

		public static uint field_get_offset(IntPtr field)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return mono_field_get_offset(field);
			}
			return il2cpp_field_get_offset(field);
		}

		public static IntPtr object_unbox(IntPtr obj)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return mono_object_unbox(obj);
			}
			return il2cpp_object_unbox(obj);
		}

		public static IntPtr object_new(IntPtr klass)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return mono_object_new(domain, klass);
			}
			return il2cpp_object_new(klass);
		}

		public static int class_value_size(IntPtr klass, ref uint align)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return mono_class_value_size(klass, ref align);
			}
			return il2cpp_class_value_size(klass, ref align);
		}

		public static uint gchandle_new(IntPtr obj, bool pinned)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return mono_gchandle_new(obj, pinned ? 1 : 0);
			}
			return il2cpp_gchandle_new(obj, pinned);
		}

		public static void gchandle_free(uint gchandle)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				il2cpp_gchandle_free(gchandle);
			}
			else
			{
				mono_gchandle_free(gchandle);
			}
		}

		public static IntPtr gchandle_get_target(uint gchandle)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return mono_gchandle_get_target(gchandle);
			}
			return il2cpp_gchandle_get_target(gchandle);
		}

		public static IntPtr value_box(IntPtr klass, IntPtr val)
		{
			if (!MelonUtils.IsGameIl2Cpp())
			{
				return mono_value_box(domain, klass, val);
			}
			return il2cpp_value_box(klass, val);
		}

		public unsafe static void format_exception(IntPtr ex, void* message, int message_size)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				il2cpp_format_exception(ex, message, message_size);
			}
		}

		public unsafe static void format_stack_trace(IntPtr ex, void* output, int output_size)
		{
			if (MelonUtils.IsGameIl2Cpp())
			{
				il2cpp_format_stack_trace(ex, output, output_size);
			}
		}

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_domain_get();

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern void mono_assembly_foreach(delegate_gfunc_mono_assembly_foreach func, IntPtr user_data);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_assembly_get_image(IntPtr assembly);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_image_get_filename(IntPtr image);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern uint mono_image_get_class_count(IntPtr image);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_image_get_class(IntPtr image, uint index);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_class_get_name(IntPtr klass);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_class_get_namespace(IntPtr klass);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_lookup_internal_call(IntPtr method);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		public static extern IntPtr mono_class_get_type(IntPtr klass);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private unsafe static extern IntPtr mono_runtime_invoke(IntPtr method, IntPtr obj, void** param, ref IntPtr exc);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern void mono_runtime_class_init(IntPtr klass);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_array_new(IntPtr domain, IntPtr eclass, ulong n);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern uint mono_field_get_offset(IntPtr field);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_object_unbox(IntPtr obj);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_object_new(IntPtr domain, IntPtr klass);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern int mono_class_value_size(IntPtr klass, ref uint align);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern uint mono_gchandle_new(IntPtr obj, int pinned);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern void mono_gchandle_free(uint gchandle);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_gchandle_get_target(uint gchandle);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_class_get_field_from_name(IntPtr klass, [MarshalAs(UnmanagedType.LPStr)] string name);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_value_box(IntPtr domain, IntPtr klass, IntPtr data);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_class_get_methods(IntPtr klass, ref IntPtr iter);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		public static extern IntPtr mono_method_get_name(IntPtr method);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_type_get_name(IntPtr type);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_image_get_table_info(IntPtr image, int table_id);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern int mono_table_info_get_rows(IntPtr table);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern void mono_metadata_decode_row(IntPtr t, int idx, uint[] res, int res_size);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_metadata_string_heap(IntPtr meta, uint index);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_class_from_name(IntPtr image, string name_space, string name);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_domain_try_type_resolve(IntPtr domain, string name, IntPtr typebuilder_raw);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_method_get_signature(IntPtr method, IntPtr image, uint token);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_signature_get_return_type(IntPtr sig);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern uint mono_signature_get_param_count(IntPtr sig);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr mono_signature_get_params(IntPtr sig, ref IntPtr iter);

		[DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private unsafe static extern IntPtr mono_string_new_utf16(IntPtr domain, char* text, int len);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_domain_get();

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_resolve_icall([MarshalAs(UnmanagedType.LPStr)] string name);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern uint il2cpp_array_length(IntPtr array);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_array_new(IntPtr elementTypeInfo, ulong length);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_assembly_get_image(IntPtr assembly);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_class_get_field_from_name(IntPtr klass, [MarshalAs(UnmanagedType.LPStr)] string name);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_class_get_methods(IntPtr klass, ref IntPtr iter);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_class_get_name(IntPtr klass);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_class_get_namespace(IntPtr klass);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		public static extern IntPtr il2cpp_class_get_type(IntPtr klass);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern int il2cpp_class_value_size(IntPtr klass, ref uint align);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private unsafe static extern IntPtr* il2cpp_domain_get_assemblies(IntPtr domain, ref uint size);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private unsafe static extern void il2cpp_format_exception(IntPtr ex, void* message, int message_size);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private unsafe static extern void il2cpp_format_stack_trace(IntPtr ex, void* output, int output_size);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern uint il2cpp_field_get_offset(IntPtr field);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern uint il2cpp_gchandle_new(IntPtr obj, bool pinned);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_gchandle_get_target(uint gchandle);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern void il2cpp_gchandle_free(uint gchandle);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_method_get_return_type(IntPtr method);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern uint il2cpp_method_get_param_count(IntPtr method);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_method_get_param(IntPtr method, uint index);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		public static extern IntPtr il2cpp_method_get_name(IntPtr method);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_object_new(IntPtr klass);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_object_unbox(IntPtr obj);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_value_box(IntPtr klass, IntPtr data);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private unsafe static extern IntPtr il2cpp_runtime_invoke(IntPtr method, IntPtr obj, void** param, ref IntPtr exc);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern void il2cpp_runtime_class_init(IntPtr klass);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private unsafe static extern IntPtr il2cpp_string_new_utf16(char* text, int len);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_type_get_name(IntPtr type);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_image_get_filename(IntPtr image);

		[DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
		private static extern IntPtr il2cpp_class_from_name(IntPtr image, string namespaze, string name);
	}
}
namespace mgGif
{
	internal class Decoder : IDisposable
	{
		private enum ImageFlag
		{
			Interlaced = 64,
			ColourTable = 128,
			TableSizeMask = 7,
			BitDepthMask = 112
		}

		private enum Block
		{
			Image = 44,
			Extension = 33,
			End = 59
		}

		private enum Extension
		{
			GraphicControl = 249,
			Comments = 254,
			PlainText = 1,
			ApplicationData = 255
		}

		private enum Disposal
		{
			None = 0,
			DoNotDispose = 4,
			RestoreBackground = 8,
			ReturnToPrevious = 12
		}

		private enum ControlFlags
		{
			HasTransparency = 1,
			DisposalMask = 12
		}

		public string Version;

		public ushort Width;

		public ushort Height;

		public Color32 BackgroundColour;

		private const uint NoCode = 65535u;

		private const ushort NoTransparency = ushort.MaxValue;

		private byte[] Input;

		private int D;

		private Color32[] GlobalColourTable;

		private Color32[] LocalColourTable;

		private Color32[] ActiveColourTable;

		private ushort TransparentIndex;

		private Image Image = new Image();

		private ushort ImageLeft;

		private ushort ImageTop;

		private ushort ImageWidth;

		private ushort ImageHeight;

		private Color32[] Output;

		private Color32[] PreviousImage;

		private readonly int[] Pow2 = new int[13]
		{
			1, 2, 4, 8, 16, 32, 64, 128, 256, 512,
			1024, 2048, 4096
		};

		private int[] Indices = new int[4096];

		private ushort[] Codes = new ushort[131072];

		private uint[] CurBlock = new uint[64];

		public Decoder(byte[] data)
			: this()
		{
			Load(data);
		}

		public Decoder Load(byte[] data)
		{
			Input = data;
			D = 0;
			GlobalColourTable = new Color32[256];
			LocalColourTable = new Color32[256];
			TransparentIndex = ushort.MaxValue;
			Output = null;
			PreviousImage = null;
			Image.Delay = 0;
			return this;
		}

		private byte ReadByte()
		{
			return Input[D++];
		}

		private ushort ReadUInt16()
		{
			return (ushort)(Input[D++] | (Input[D++] << 8));
		}

		private void ReadHeader()
		{
			if (Input == null || Input.Length <= 12)
			{
				throw new Exception("Invalid data");
			}
			Version = Encoding.ASCII.GetString(Input, 0, 6);
			D = 6;
			if (Version != "GIF87a" && Version != "GIF89a")
			{
				throw new Exception("Unsupported GIF version");
			}
			Width = ReadUInt16();
			Height = ReadUInt16();
			Image.Width = Width;
			Image.Height = Height;
			ImageFlag imageFlag = (ImageFlag)ReadByte();
			byte b = ReadByte();
			ReadByte();
			if (EnumExtensions.HasFlag((Enum)imageFlag, (Enum)ImageFlag.ColourTable))
			{
				ReadColourTable(GlobalColourTable, imageFlag);
			}
			BackgroundColour = GlobalColourTable[b];
		}

		public Image NextImage()
		{
			if (D == 0)
			{
				ReadHeader();
			}
			while (true)
			{
				switch ((Block)ReadByte())
				{
				case Block.Image:
				{
					Image image = ReadImageBlock();
					if (image != null)
					{
						return image;
					}
					break;
				}
				case Block.Extension:
					if (ReadByte() == 249)
					{
						ReadControlBlock();
					}
					else
					{
						SkipBlocks();
					}
					break;
				case Block.End:
					return null;
				default:
					throw new Exception("Unexpected block type");
				}
			}
		}

		private Color32[] ReadColourTable(Color32[] colourTable, ImageFlag flags)
		{
			int num = Pow2[(int)((flags & ImageFlag.TableSizeMask) + 1)];
			for (int i = 0; i < num; i++)
			{
				colourTable[i] = new Color32(Input[D++], Input[D++], Input[D++], byte.MaxValue);
			}
			return colourTable;
		}

		private void SkipBlocks()
		{
			for (byte b = Input[D++]; b != 0; b = Input[D++])
			{
				D += b;
			}
		}

		private void ReadControlBlock()
		{
			ReadByte();
			byte num = ReadByte();
			Image.Delay = ReadUInt16() * 10;
			byte transparentIndex = ReadByte();
			ReadByte();
			if (EnumExtensions.HasFlag((Enum)(ControlFlags)num, (Enum)ControlFlags.HasTransparency))
			{
				TransparentIndex = transparentIndex;
			}
			else
			{
				TransparentIndex = ushort.MaxValue;
			}
			switch ((Disposal)(num & 0xC))
			{
			default:
				PreviousImage = Output;
				break;
			case Disposal.RestoreBackground:
				Output = new Color32[Width * Height];
				break;
			case Disposal.ReturnToPrevious:
				Output = new Color32[Width * Height];
				if (PreviousImage != null)
				{
					Array.Copy(PreviousImage, Output, Output.Length);
				}
				break;
			}
		}

		private Image ReadImageBlock()
		{
			ImageLeft = ReadUInt16();
			ImageTop = ReadUInt16();
			ImageWidth = ReadUInt16();
			ImageHeight = ReadUInt16();
			ImageFlag imageFlag = (ImageFlag)ReadByte();
			if (ImageWidth == 0 || ImageHeight == 0)
			{
				return null;
	

BepInEx-BepInEx_MLLoader/Mono.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using MelonLoader;
using MelonLoader.Support.Preferences;
using Tomlet;
using Tomlet.Models;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MelonLoader")]
[assembly: AssemblyDescription("MelonLoader")]
[assembly: AssemblyCompany("discord.gg/2Wn3N2P")]
[assembly: AssemblyProduct("MelonLoader")]
[assembly: AssemblyCopyright("Created by Lava Gang")]
[assembly: AssemblyTrademark("discord.gg/2Wn3N2P")]
[assembly: Guid("EE48CA52-CCD3-48A5-B507-91773672E216")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: PatchShield]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.7.0")]
[module: UnverifiableCode]
namespace MelonLoader.Support
{
	internal static class Main
	{
		internal static ISupportModule_From Interface;

		internal static GameObject obj;

		internal static SM_Component component;

		private static ISupportModule_To Initialize(ISupportModule_From interface_from)
		{
			Interface = interface_from;
			UnityMappers.RegisterMappers();
			if (IsUnity53OrLower())
			{
				SM_Component.Create();
			}
			else
			{
				SceneHandler.Init();
			}
			return (ISupportModule_To)(object)new SupportModule_To();
		}

		private static bool IsUnity53OrLower()
		{
			try
			{
				Assembly assembly = Assembly.Load("UnityEngine");
				if ((object)assembly == null)
				{
					return true;
				}
				Type type = assembly.GetType("UnityEngine.SceneManagement.SceneManager");
				if ((object)type == null)
				{
					return true;
				}
				if ((object)type.GetEvent("sceneLoaded") == null)
				{
					return true;
				}
				return false;
			}
			catch
			{
				return true;
			}
		}
	}
	internal class SM_Component : MonoBehaviour
	{
		private bool isQuitting;

		private static MethodInfo SetAsLastSiblingMethod;

		static SM_Component()
		{
			try
			{
				SetAsLastSiblingMethod = typeof(Transform).GetMethod("SetAsLastSibling", BindingFlags.Instance | BindingFlags.Public);
			}
			catch (Exception arg)
			{
				MelonLogger.Warning($"Exception while Getting Transform.SetAsLastSibling: {arg}");
			}
		}

		internal static void Create()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (!((Object)(object)Main.component != (Object)null))
			{
				Main.obj = new GameObject();
				Object.DontDestroyOnLoad((Object)(object)Main.obj);
				((Object)Main.obj).hideFlags = (HideFlags)52;
				Main.component = (SM_Component)(object)Main.obj.AddComponent(typeof(SM_Component));
				Main.component.SiblingFix();
			}
		}

		private void SiblingFix()
		{
			SetAsLastSiblingMethod?.Invoke(((Component)this).gameObject.transform, new object[0]);
			SetAsLastSiblingMethod?.Invoke(((Component)this).transform, new object[0]);
		}

		internal void Destroy()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void Start()
		{
			if (!((Object)(object)Main.component != (Object)null) || !((Object)(object)Main.component != (Object)(object)this))
			{
				SiblingFix();
				Main.Interface.OnApplicationLateStart();
			}
		}

		private void Awake()
		{
			if ((Object)(object)Main.component != (Object)null && (Object)(object)Main.component != (Object)(object)this)
			{
				return;
			}
			foreach (IEnumerator queuedCoroutine in SupportModule_To.QueuedCoroutines)
			{
				((MonoBehaviour)this).StartCoroutine(queuedCoroutine);
			}
			SupportModule_To.QueuedCoroutines.Clear();
		}

		private void Update()
		{
			if (!((Object)(object)Main.component != (Object)null) || !((Object)(object)Main.component != (Object)(object)this))
			{
				isQuitting = false;
				SiblingFix();
				SceneHandler.OnUpdate();
				Main.Interface.Update();
			}
		}

		private void OnDestroy()
		{
			if (!((Object)(object)Main.component != (Object)null) || !((Object)(object)Main.component != (Object)(object)this))
			{
				if (!isQuitting)
				{
					Create();
				}
				else
				{
					OnApplicationDefiniteQuit();
				}
			}
		}

		private void OnApplicationQuit()
		{
			if (!((Object)(object)Main.component != (Object)null) || !((Object)(object)Main.component != (Object)(object)this))
			{
				isQuitting = true;
				Main.Interface.Quit();
			}
		}

		private void OnApplicationDefiniteQuit()
		{
			Main.Interface.DefiniteQuit();
		}

		private void FixedUpdate()
		{
			if (!((Object)(object)Main.component != (Object)null) || !((Object)(object)Main.component != (Object)(object)this))
			{
				Main.Interface.FixedUpdate();
			}
		}

		private void LateUpdate()
		{
			if (!((Object)(object)Main.component != (Object)null) || !((Object)(object)Main.component != (Object)(object)this))
			{
				Main.Interface.LateUpdate();
			}
		}

		private void OnGUI()
		{
			if (!((Object)(object)Main.component != (Object)null) || !((Object)(object)Main.component != (Object)(object)this))
			{
				Main.Interface.OnGUI();
			}
		}
	}
	internal class SupportModule_To : ISupportModule_To
	{
		internal static readonly List<IEnumerator> QueuedCoroutines = new List<IEnumerator>();

		public object StartCoroutine(IEnumerator coroutine)
		{
			if ((Object)(object)Main.component != (Object)null)
			{
				return ((MonoBehaviour)Main.component).StartCoroutine(coroutine);
			}
			QueuedCoroutines.Add(coroutine);
			return coroutine;
		}

		public void StopCoroutine(object coroutineToken)
		{
			if ((Object)(object)Main.component == (Object)null)
			{
				QueuedCoroutines.Remove(coroutineToken as IEnumerator);
			}
			else
			{
				((MonoBehaviour)Main.component).StopCoroutine((Coroutine)((coroutineToken is Coroutine) ? coroutineToken : null));
			}
		}

		public void UnityDebugLog(string msg)
		{
			Debug.Log((object)msg);
		}
	}
	internal static class SceneHandler
	{
		internal class SceneInitEvent
		{
			internal int buildIndex;

			internal string name;

			internal bool wasLoadedThisTick;
		}

		private static Queue<SceneInitEvent> scenesLoaded = new Queue<SceneInitEvent>();

		internal static void Init()
		{
			try
			{
				SceneManager.sceneLoaded += OnSceneLoad;
			}
			catch (Exception arg)
			{
				MelonLogger.Error($"SceneManager.sceneLoaded override failed: {arg}");
			}
			try
			{
				SceneManager.sceneUnloaded += OnSceneUnload;
			}
			catch (Exception arg2)
			{
				MelonLogger.Error($"SceneManager.sceneUnloaded override failed: {arg2}");
			}
		}

		private static void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Main.obj == (Object)null)
			{
				SM_Component.Create();
			}
			if ((object)scene != null)
			{
				Main.Interface.OnSceneWasLoaded(((Scene)(ref scene)).buildIndex, ((Scene)(ref scene)).name);
				scenesLoaded.Enqueue(new SceneInitEvent
				{
					buildIndex = ((Scene)(ref scene)).buildIndex,
					name = ((Scene)(ref scene)).name
				});
			}
		}

		private static void OnSceneUnload(Scene scene)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if ((object)scene != null)
			{
				Main.Interface.OnSceneWasUnloaded(((Scene)(ref scene)).buildIndex, ((Scene)(ref scene)).name);
			}
		}

		internal static void OnUpdate()
		{
			if (scenesLoaded.Count <= 0)
			{
				return;
			}
			Queue<SceneInitEvent> queue = new Queue<SceneInitEvent>();
			SceneInitEvent sceneInitEvent = null;
			while (scenesLoaded.Count > 0 && (sceneInitEvent = scenesLoaded.Dequeue()) != null)
			{
				if (sceneInitEvent.wasLoadedThisTick)
				{
					Main.Interface.OnSceneWasInitialized(sceneInitEvent.buildIndex, sceneInitEvent.name);
					continue;
				}
				sceneInitEvent.wasLoadedThisTick = true;
				queue.Enqueue(sceneInitEvent);
			}
			while (queue.Count > 0 && (sceneInitEvent = queue.Dequeue()) != null)
			{
				scenesLoaded.Enqueue(sceneInitEvent);
			}
		}
	}
}
namespace MelonLoader.Support.Preferences
{
	internal static class UnityMappers
	{
		internal static void RegisterMappers()
		{
			TomletMain.RegisterMapper<Color>((Serialize<Color>)WriteColor, (Deserialize<Color>)ReadColor);
			TomletMain.RegisterMapper<Color32>((Serialize<Color32>)WriteColor32, (Deserialize<Color32>)ReadColor32);
			TomletMain.RegisterMapper<Vector2>((Serialize<Vector2>)WriteVector2, (Deserialize<Vector2>)ReadVector2);
			TomletMain.RegisterMapper<Vector3>((Serialize<Vector3>)WriteVector3, (Deserialize<Vector3>)ReadVector3);
			TomletMain.RegisterMapper<Vector4>((Serialize<Vector4>)WriteVector4, (Deserialize<Vector4>)ReadVector4);
			TomletMain.RegisterMapper<Quaternion>((Serialize<Quaternion>)WriteQuaternion, (Deserialize<Quaternion>)ReadQuaternion);
		}

		private static Color ReadColor(TomlValue value)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			float[] array = MelonPreferences.Mapper.ReadArray<float>(value);
			if (array == null || array.Length != 4)
			{
				return default(Color);
			}
			return new Color(array[0] / 255f, array[1] / 255f, array[2] / 255f, array[3] / 255f);
		}

		private static TomlValue WriteColor(Color value)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			float[] array = new float[4]
			{
				value.r * 255f,
				value.g * 255f,
				value.b * 255f,
				value.a * 255f
			};
			return (TomlValue)(object)MelonPreferences.Mapper.WriteArray<float>(array);
		}

		private static Color32 ReadColor32(TomlValue value)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			byte[] array = MelonPreferences.Mapper.ReadArray<byte>(value);
			if (array == null || array.Length != 4)
			{
				return default(Color32);
			}
			return new Color32(array[0], array[1], array[2], array[3]);
		}

		private static TomlValue WriteColor32(Color32 value)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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)
			byte[] array = new byte[4] { value.r, value.g, value.b, value.a };
			return (TomlValue)(object)MelonPreferences.Mapper.WriteArray<byte>(array);
		}

		private static Vector2 ReadVector2(TomlValue value)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			float[] array = MelonPreferences.Mapper.ReadArray<float>(value);
			if (array == null || array.Length != 2)
			{
				return default(Vector2);
			}
			return new Vector2(array[0], array[1]);
		}

		private static TomlValue WriteVector2(Vector2 value)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			float[] array = new float[2] { value.x, value.y };
			return (TomlValue)(object)MelonPreferences.Mapper.WriteArray<float>(array);
		}

		private static Vector3 ReadVector3(TomlValue value)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			float[] array = MelonPreferences.Mapper.ReadArray<float>(value);
			if (array == null || array.Length != 3)
			{
				return default(Vector3);
			}
			return new Vector3(array[0], array[1], array[2]);
		}

		private static TomlValue WriteVector3(Vector3 value)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			float[] array = new float[3] { value.x, value.y, value.z };
			return (TomlValue)(object)MelonPreferences.Mapper.WriteArray<float>(array);
		}

		private static Vector4 ReadVector4(TomlValue value)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			float[] array = MelonPreferences.Mapper.ReadArray<float>(value);
			if (array == null || array.Length != 4)
			{
				return default(Vector4);
			}
			return new Vector4(array[0], array[1], array[2], array[3]);
		}

		private static TomlValue WriteVector4(Vector4 value)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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)
			float[] array = new float[4] { value.x, value.y, value.z, value.w };
			return (TomlValue)(object)MelonPreferences.Mapper.WriteArray<float>(array);
		}

		private static Quaternion ReadQuaternion(TomlValue value)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			float[] array = MelonPreferences.Mapper.ReadArray<float>(value);
			if (array == null || array.Length != 4)
			{
				return default(Quaternion);
			}
			return new Quaternion(array[0], array[1], array[2], array[3]);
		}

		private static TomlValue WriteQuaternion(Quaternion value)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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)
			float[] array = new float[4] { value.x, value.y, value.z, value.w };
			return (TomlValue)(object)MelonPreferences.Mapper.WriteArray<float>(array);
		}
	}
}

BepInEx-BepInEx_MLLoader/Muse_Dash_Mono.dll

Decompiled 6 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.InteropServices;
using System.Security;
using System.Security.Permissions;
using MelonLoader;
using MelonLoader.Modules;
using MelonLoader.MonoInternals;
using ModHelper;
using ModLoader;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MelonLoader")]
[assembly: AssemblyDescription("MelonLoader")]
[assembly: AssemblyCompany("discord.gg/2Wn3N2P")]
[assembly: AssemblyProduct("MelonLoader")]
[assembly: AssemblyCopyright("Created by Lava Gang")]
[assembly: AssemblyTrademark("discord.gg/2Wn3N2P")]
[assembly: Guid("C268E68B-3DF1-4EE3-A49F-750A8F55B799")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: PatchShield]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.7.0")]
[module: UnverifiableCode]
namespace ModLoader
{
	public class ModLoader
	{
		internal static List<IMod> mods = new List<IMod>();

		internal static Dictionary<string, Assembly> depends = new Dictionary<string, Assembly>();

		public static void LoadDependency(Assembly assembly)
		{
			string[] manifestResourceNames = assembly.GetManifestResourceNames();
			foreach (string text in manifestResourceNames)
			{
				string text2 = assembly.GetName().Name + ".Depends.";
				if (!text.StartsWith(text2) || !text.EndsWith(".dll"))
				{
					continue;
				}
				string text3 = text.Remove(text.LastIndexOf(".dll")).Remove(0, text2.Length);
				if (depends.ContainsKey(text3))
				{
					MelonLogger.Error("Dependency conflict: " + text3 + " First at: " + depends[text3].GetName().Name);
					continue;
				}
				Assembly value;
				using (Stream stream = assembly.GetManifestResourceStream(text))
				{
					byte[] array = new byte[stream.Length];
					stream.Read(array, 0, array.Length);
					value = Assembly.Load(array);
				}
				depends.Add(text3, value);
			}
		}
	}
}
namespace ModHelper
{
	public interface IMod
	{
		string Name { get; }

		string Description { get; }

		string Author { get; }

		string HomePage { get; }

		void DoPatching();
	}
	public static class ModLogger
	{
		public static void Debug(object obj)
		{
			StackFrame? frame = new StackTrace().GetFrame(1);
			string name = frame.GetMethod().ReflectedType.Name;
			string name2 = frame.GetMethod().Name;
			AddLog(name, name2, obj);
		}

		public static void AddLog(string className, string methodName, object obj)
		{
			MelonLogger.Msg($"[{className}:{methodName}]: {obj}");
		}
	}
}
namespace MelonLoader
{
	internal class MuseDashModWrapper : MelonMod
	{
		internal IMod modInstance;

		public override void OnInitializeMelon()
		{
			modInstance.DoPatching();
		}
	}
}
namespace MelonLoader.CompatibilityLayers
{
	internal class Muse_Dash_Mono_Module : MelonModule
	{
		public override void OnInitialize()
		{
			string[] obj = new string[2] { "ModHelper", "ModLoader" };
			Assembly assembly = typeof(Muse_Dash_Mono_Module).Assembly;
			string[] array = obj;
			for (int i = 0; i < array.Length; i++)
			{
				MonoResolveManager.GetAssemblyResolveInfo(array[i]).Override = assembly;
			}
			MelonAssembly.CustomMelonResolvers += Resolve;
		}

		private ResolvedMelons Resolve(Assembly asm)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			IEnumerable<Type> validTypes = MelonUtils.GetValidTypes(asm, (LemonFunc<Type, bool>)delegate(Type x)
			{
				Type[] interfaces = x.GetInterfaces();
				return interfaces != null && interfaces.Any() && interfaces.Contains(typeof(IMod));
			});
			if (validTypes != null && validTypes.Any())
			{
				List<MelonBase> list = new List<MelonBase>();
				List<RottenMelon> list2 = new List<RottenMelon>();
				foreach (Type item in validTypes)
				{
					RottenMelon rottenMelon;
					MelonBase val = LoadMod(asm, item, out rottenMelon);
					if (val != null)
					{
						list.Add(val);
					}
					else
					{
						list2.Add(rottenMelon);
					}
				}
				return new ResolvedMelons(list.ToArray(), list2.ToArray());
			}
			return new ResolvedMelons((MelonBase[])null, (RottenMelon[])null);
		}

		private MelonBase LoadMod(Assembly asm, Type modType, out RottenMelon rottenMelon)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			rottenMelon = null;
			IMod mod;
			try
			{
				mod = Activator.CreateInstance(modType) as IMod;
			}
			catch (Exception ex)
			{
				rottenMelon = new RottenMelon(modType, "Failed to create an instance of the MMDL Mod.", ex);
				return null;
			}
			string text = mod.Name;
			if (string.IsNullOrEmpty(text))
			{
				text = modType.FullName;
			}
			string text2 = asm.GetName().Version.ToString();
			if (string.IsNullOrEmpty(text2) || text2.Equals("0.0.0.0"))
			{
				text2 = "1.0.0.0";
			}
			MuseDashModWrapper museDashModWrapper = MelonBase.CreateWrapper<MuseDashModWrapper>(text, (string)null, text2, (MelonGameAttribute[])null, (MelonProcessAttribute[])null, 0, (ConsoleColor?)null, (ConsoleColor?)null, (string)null);
			museDashModWrapper.modInstance = mod;
			global::ModLoader.ModLoader.mods.Add(mod);
			global::ModLoader.ModLoader.LoadDependency(asm);
			return (MelonBase)(object)museDashModWrapper;
		}
	}
}

BepInEx-BepInEx_MLLoader/Preload.dll

Decompiled 6 months ago
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using MelonLoader.Support.Properties;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MelonLoader")]
[assembly: AssemblyDescription("MelonLoader")]
[assembly: AssemblyCompany("discord.gg/2Wn3N2P")]
[assembly: AssemblyProduct("MelonLoader")]
[assembly: AssemblyCopyright("Created by Lava Gang")]
[assembly: AssemblyTrademark("discord.gg/2Wn3N2P")]
[assembly: Guid("08BE056B-C854-4F88-92E8-F3B39187B6AF")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.7.0")]
[module: UnverifiableCode]
namespace MelonLoader
{
	public static class BuildInfo
	{
		public const string Name = "MelonLoader";

		public const string Description = "MelonLoader";

		public const string Author = "Lava Gang";

		public const string Company = "discord.gg/2Wn3N2P";

		public const string Version = "0.5.7";
	}
}
namespace MelonLoader.Support
{
	internal static class Preload
	{
		private static void Initialize()
		{
			string path = string.Copy(GetManagedDirectory());
			string path2 = Path.Combine(path, "System.dll");
			if (!File.Exists(path2))
			{
				File.WriteAllBytes(path2, Resources.System);
			}
			string path3 = Path.Combine(path, "System.Core.dll");
			if (!File.Exists(path3))
			{
				File.WriteAllBytes(path3, Resources.System_Core);
			}
		}

		[MethodImpl(MethodImplOptions.InternalCall)]
		[return: MarshalAs(UnmanagedType.LPStr)]
		private static extern string GetManagedDirectory();
	}
}
namespace MelonLoader.Support.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("MelonLoader.Support.Properties.Resources", typeof(Resources).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] System => (byte[])ResourceManager.GetObject("System", resourceCulture);

		internal static byte[] System_Core => (byte[])ResourceManager.GetObject("System_Core", resourceCulture);

		internal Resources()
		{
		}
	}
}

Drakorle-MoreItems/MoreItems.dll

Decompiled 6 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreItems.Patches;

[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("MoreItems")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreItems")]
[assembly: AssemblyTitle("MoreItems")]
[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 MoreItems
{
	[BepInPlugin("MoreItems", "MoreItems", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("MoreItems");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MoreItems is loaded!");
			harmony.PatchAll(typeof(StartOfRoundPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MoreItems";

		public const string PLUGIN_NAME = "MoreItems";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MoreItems.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		private const int newMaxItemCapacity = 999;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void IncreaseShipItemCapacity(ref int ___maxShipItemCapacity)
		{
			___maxShipItemCapacity = 999;
			Logger.CreateLogSource("MoreItems").LogInfo((object)$"Maximum amount of items that can be saved set to {999}.");
		}
	}
}

Evaisa-LethalLib/LethalLib/LethalLib.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On;
using Unity.Netcode;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalLib")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e777ef6b3cc96696c529b621f2dcc6659d040926")]
[assembly: AssemblyProduct("LethalLib")]
[assembly: AssemblyTitle("LethalLib")]
[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 LethalLib
{
	[BepInPlugin("evaisa.lethallib", "LethalLib", "0.4.5")]
	public class Plugin : BaseUnityPlugin
	{
		public const string ModGUID = "evaisa.lethallib";

		public const string ModName = "LethalLib";

		public const string ModVersion = "0.4.5";

		public static AssetBundle MainAssets;

		public static ManualLogSource logger;

		private void Awake()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			logger = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalLib loaded!!");
			new ILHook((MethodBase)typeof(StackTrace).GetMethod("AddFrames", BindingFlags.Instance | BindingFlags.NonPublic), new Manipulator(IlHook));
			Enemies.Init();
			Items.Init();
			Unlockables.Init();
			NetworkPrefabs.Init();
		}

		private void IlHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)typeof(StackFrame).GetMethod("GetFileLineNumber", BindingFlags.Instance | BindingFlags.Public))
			});
			val.RemoveRange(2);
			val.EmitDelegate<Func<StackFrame, string>>((Func<StackFrame, string>)GetLineOrIL);
		}

		private static string GetLineOrIL(StackFrame instance)
		{
			int fileLineNumber = instance.GetFileLineNumber();
			if (fileLineNumber == -1 || fileLineNumber == 0)
			{
				return "IL_" + instance.GetILOffset().ToString("X4");
			}
			return fileLineNumber.ToString();
		}
	}
}
namespace LethalLib.Modules
{
	public class Enemies
	{
		public enum SpawnType
		{
			Default,
			Daytime,
			Outside
		}

		public class SpawnableEnemy
		{
			public EnemyType enemy;

			public int rarity;

			public Levels.LevelTypes spawnLevels;

			public SpawnType spawnType;

			public TerminalNode terminalNode;

			public TerminalKeyword infoKeyword;

			public string modName;

			public SpawnableEnemy(EnemyType enemy, int rarity, Levels.LevelTypes spawnLevels, SpawnType spawnType)
			{
				this.enemy = enemy;
				this.rarity = rarity;
				this.spawnLevels = spawnLevels;
				this.spawnType = spawnType;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__RegisterLevelEnemies;

			public static hook_Start <1>__Terminal_Start;
		}

		public static List<SpawnableEnemy> spawnableEnemies = new List<SpawnableEnemy>();

		public static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			object obj = <>O.<0>__RegisterLevelEnemies;
			if (obj == null)
			{
				hook_Awake val = RegisterLevelEnemies;
				<>O.<0>__RegisterLevelEnemies = val;
				obj = (object)val;
			}
			StartOfRound.Awake += (hook_Awake)obj;
			object obj2 = <>O.<1>__Terminal_Start;
			if (obj2 == null)
			{
				hook_Start val2 = Terminal_Start;
				<>O.<1>__Terminal_Start = val2;
				obj2 = (object)val2;
			}
			Terminal.Start += (hook_Start)obj2;
		}

		private static void Terminal_Start(orig_Start orig, Terminal self)
		{
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Expected O, but got Unknown
			TerminalKeyword val = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info");
			List<string> list = new List<string>();
			foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies)
			{
				if (list.Contains(spawnableEnemy.enemy.enemyName))
				{
					Plugin.logger.LogInfo((object)("Skipping " + spawnableEnemy.enemy.enemyName + " because it was already added"));
					continue;
				}
				if ((Object)(object)spawnableEnemy.terminalNode == (Object)null)
				{
					spawnableEnemy.terminalNode = ScriptableObject.CreateInstance<TerminalNode>();
					spawnableEnemy.terminalNode.displayText = spawnableEnemy.enemy.enemyName + "\n\nDanger level: Unknown\n\n[No information about this creature was found.]\n\n";
					spawnableEnemy.terminalNode.clearPreviousText = true;
					spawnableEnemy.terminalNode.maxCharactersToType = 35;
					spawnableEnemy.terminalNode.creatureName = spawnableEnemy.enemy.enemyName;
				}
				TerminalKeyword val2 = (((Object)(object)spawnableEnemy.infoKeyword != (Object)null) ? spawnableEnemy.infoKeyword : TerminalUtils.CreateTerminalKeyword(spawnableEnemy.terminalNode.creatureName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val));
				val2.defaultVerb = val;
				List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList();
				list2.Add(val2);
				self.terminalNodes.allKeywords = list2.ToArray();
				List<CompatibleNoun> list3 = val.compatibleNouns.ToList();
				list3.Add(new CompatibleNoun
				{
					noun = val2,
					result = spawnableEnemy.terminalNode
				});
				val.compatibleNouns = list3.ToArray();
				spawnableEnemy.terminalNode.creatureFileID = self.enemyFiles.Count;
				self.enemyFiles.Add(spawnableEnemy.terminalNode);
				spawnableEnemy.enemy.enemyPrefab.GetComponentInChildren<ScanNodeProperties>().creatureScanID = spawnableEnemy.terminalNode.creatureFileID;
			}
			orig.Invoke(self);
		}

		private static void RegisterLevelEnemies(orig_Awake orig, StartOfRound self)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			orig.Invoke(self);
			SelectableLevel[] levels = self.levels;
			foreach (SelectableLevel val in levels)
			{
				string name = ((Object)val).name;
				if (!Enum.IsDefined(typeof(Levels.LevelTypes), name))
				{
					continue;
				}
				Levels.LevelTypes levelTypes = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name);
				foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies)
				{
					if (!spawnableEnemy.spawnLevels.HasFlag(levelTypes))
					{
						continue;
					}
					SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity
					{
						enemyType = spawnableEnemy.enemy,
						rarity = spawnableEnemy.rarity
					};
					switch (spawnableEnemy.spawnType)
					{
					case SpawnType.Default:
						if (!val.Enemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy))
						{
							val.Enemies.Add(item);
							Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Default]"));
						}
						break;
					case SpawnType.Daytime:
						if (!val.DaytimeEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy))
						{
							val.DaytimeEnemies.Add(item);
							Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Daytime]"));
						}
						break;
					case SpawnType.Outside:
						if (!val.OutsideEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy))
						{
							val.OutsideEnemies.Add(item);
							Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Outside]"));
						}
						break;
					}
				}
			}
		}

		public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, TerminalNode infoNode = null)
		{
			RegisterEnemy(enemy, rarity, levelFlags, spawnType, infoNode, null);
		}

		public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, TerminalNode infoNode = null)
		{
			RegisterEnemy(enemy, rarity, levelFlags, SpawnType.Default, infoNode);
		}

		public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null)
		{
			SpawnableEnemy spawnableEnemy = new SpawnableEnemy(enemy, rarity, levelFlags, spawnType);
			spawnableEnemy.terminalNode = infoNode;
			spawnableEnemy.infoKeyword = infoKeyword;
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			spawnableEnemy.modName = name;
			spawnableEnemies.Add(spawnableEnemy);
		}

		public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null)
		{
			SpawnableEnemy spawnableEnemy = new SpawnableEnemy(enemy, rarity, levelFlags, enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default));
			spawnableEnemy.terminalNode = infoNode;
			spawnableEnemy.infoKeyword = infoKeyword;
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			spawnableEnemy.modName = name;
			spawnableEnemies.Add(spawnableEnemy);
		}
	}
	public class Items
	{
		public class ScrapItem
		{
			public Item item;

			public int rarity;

			public Levels.LevelTypes spawnLevels;

			public string modName;

			public ScrapItem(Item item, int rarity, Levels.LevelTypes spawnLevels)
			{
				this.item = item;
				this.rarity = rarity;
				this.spawnLevels = spawnLevels;
			}
		}

		public class ShopItem
		{
			public Item item;

			public TerminalNode buyNode1;

			public TerminalNode buyNode2;

			public TerminalNode itemInfo;

			public int price;

			public string modName;

			public ShopItem(Item item, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = 0)
			{
				this.item = item;
				this.price = price;
				if ((Object)(object)buyNode1 != (Object)null)
				{
					this.buyNode1 = buyNode1;
				}
				if ((Object)(object)buyNode2 != (Object)null)
				{
					this.buyNode2 = buyNode2;
				}
				if ((Object)(object)itemInfo != (Object)null)
				{
					this.itemInfo = itemInfo;
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__StartOfRound_Awake;

			public static hook_Awake <1>__Terminal_Awake;
		}

		public static List<ScrapItem> scrapItems = new List<ScrapItem>();

		public static List<ShopItem> shopItems = new List<ShopItem>();

		public static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			object obj = <>O.<0>__StartOfRound_Awake;
			if (obj == null)
			{
				hook_Awake val = StartOfRound_Awake;
				<>O.<0>__StartOfRound_Awake = val;
				obj = (object)val;
			}
			StartOfRound.Awake += (hook_Awake)obj;
			object obj2 = <>O.<1>__Terminal_Awake;
			if (obj2 == null)
			{
				hook_Awake val2 = Terminal_Awake;
				<>O.<1>__Terminal_Awake = val2;
				obj2 = (object)val2;
			}
			Terminal.Awake += (hook_Awake)obj2;
		}

		private static void Terminal_Awake(orig_Awake orig, Terminal self)
		{
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Expected O, but got Unknown
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Expected O, but got Unknown
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Expected O, but got Unknown
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Expected O, but got Unknown
			List<Item> list = self.buyableItemsList.ToList();
			TerminalKeyword val = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy");
			TerminalNode result = val.compatibleNouns[0].result.terminalOptions[1].result;
			TerminalKeyword val2 = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info");
			Plugin.logger.LogInfo((object)$"Adding {shopItems.Count} items to terminal");
			foreach (ShopItem item in shopItems)
			{
				if (list.Any((Item x) => x.itemName == item.item.itemName))
				{
					Plugin.logger.LogInfo((object)("Item " + item.item.itemName + " already exists in terminal, skipping"));
					continue;
				}
				if (item.price == -1)
				{
					item.price = item.item.creditsWorth;
				}
				else
				{
					item.item.creditsWorth = item.price;
				}
				list.Add(item.item);
				string itemName = item.item.itemName;
				char c = itemName[itemName.Length - 1];
				string text = itemName;
				TerminalNode val3 = item.buyNode2;
				if ((Object)(object)val3 == (Object)null)
				{
					val3 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val3).name = itemName.Replace(" ", "-") + "BuyNode2";
					val3.displayText = "Ordered [variableAmount] " + text + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n";
					val3.clearPreviousText = true;
					val3.maxCharactersToType = 15;
				}
				val3.buyItemIndex = list.Count - 1;
				val3.isConfirmationNode = false;
				val3.itemCost = item.price;
				val3.playSyncedClip = 0;
				TerminalNode val4 = item.buyNode1;
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val4).name = itemName.Replace(" ", "-") + "BuyNode1";
					val4.displayText = "You have requested to order " + text + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n";
					val4.clearPreviousText = true;
					val4.maxCharactersToType = 35;
				}
				val4.buyItemIndex = list.Count - 1;
				val4.isConfirmationNode = true;
				val4.overrideOptions = true;
				val4.itemCost = item.price;
				val4.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
				{
					new CompatibleNoun
					{
						noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "confirm"),
						result = val3
					},
					new CompatibleNoun
					{
						noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "deny"),
						result = result
					}
				};
				TerminalKeyword val5 = TerminalUtils.CreateTerminalKeyword(itemName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val);
				List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList();
				list2.Add(val5);
				self.terminalNodes.allKeywords = list2.ToArray();
				List<CompatibleNoun> list3 = val.compatibleNouns.ToList();
				list3.Add(new CompatibleNoun
				{
					noun = val5,
					result = val4
				});
				val.compatibleNouns = list3.ToArray();
				TerminalNode val6 = item.itemInfo;
				if ((Object)(object)val6 == (Object)null)
				{
					val6 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val6).name = itemName.Replace(" ", "-") + "InfoNode";
					val6.displayText = "[No information about this object was found.]\n\n";
					val6.clearPreviousText = true;
					val6.maxCharactersToType = 25;
				}
				self.terminalNodes.allKeywords = list2.ToArray();
				List<CompatibleNoun> list4 = val2.compatibleNouns.ToList();
				list4.Add(new CompatibleNoun
				{
					noun = val5,
					result = val6
				});
				val2.compatibleNouns = list4.ToArray();
				Plugin.logger.LogInfo((object)(item.modName + " registered item: " + item.item.itemName));
			}
			self.buyableItemsList = list.ToArray();
			orig.Invoke(self);
		}

		private static void StartOfRound_Awake(orig_Awake orig, StartOfRound self)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			orig.Invoke(self);
			SelectableLevel[] levels = self.levels;
			foreach (SelectableLevel val in levels)
			{
				string name = ((Object)val).name;
				if (!Enum.IsDefined(typeof(Levels.LevelTypes), name))
				{
					continue;
				}
				Levels.LevelTypes levelTypes = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name);
				foreach (ScrapItem scrapItem in scrapItems)
				{
					if (scrapItem.spawnLevels.HasFlag(levelTypes))
					{
						SpawnableItemWithRarity item = new SpawnableItemWithRarity
						{
							spawnableItem = scrapItem.item,
							rarity = scrapItem.rarity
						};
						if (!val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)scrapItem.item))
						{
							val.spawnableScrap.Add(item);
						}
					}
				}
			}
			foreach (ScrapItem scrapItem2 in scrapItems)
			{
				if (!self.allItemsList.itemsList.Contains(scrapItem2.item))
				{
					Plugin.logger.LogInfo((object)(scrapItem2.modName + " registered item: " + scrapItem2.item.itemName));
					self.allItemsList.itemsList.Add(scrapItem2.item);
				}
			}
			foreach (ShopItem shopItem in shopItems)
			{
				if (!self.allItemsList.itemsList.Contains(shopItem.item))
				{
					Plugin.logger.LogInfo((object)(shopItem.modName + " registered item: " + shopItem.item.itemName));
					self.allItemsList.itemsList.Add(shopItem.item);
				}
			}
		}

		public static void RegisterScrap(Item spawnableItem, int rarity, Levels.LevelTypes levelFlags)
		{
			ScrapItem scrapItem = new ScrapItem(spawnableItem, rarity, levelFlags);
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			scrapItem.modName = name;
			scrapItems.Add(scrapItem);
		}

		public static void RegisterShopItem(Item shopItem, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1)
		{
			ShopItem shopItem2 = new ShopItem(shopItem, buyNode1, buyNode2, itemInfo, price);
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			shopItem2.modName = name;
			shopItems.Add(shopItem2);
		}

		public static void RegisterShopItem(Item shopItem, int price = -1)
		{
			ShopItem shopItem2 = new ShopItem(shopItem, null, null, null, price);
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			shopItem2.modName = name;
			shopItems.Add(shopItem2);
		}
	}
	public class Levels
	{
		[Flags]
		public enum LevelTypes
		{
			None = 1,
			ExperimentationLevel = 2,
			AssuranceLevel = 4,
			VowLevel = 8,
			OffenseLevel = 0x10,
			MarchLevel = 0x20,
			RendLevel = 0x40,
			DineLevel = 0x80,
			TitanLevel = 0x100,
			All = 0x1FE
		}
	}
	public class NetworkPrefabs
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__GameNetworkManager_Start;
		}

		private static List<GameObject> _networkPrefabs = new List<GameObject>();

		internal static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__GameNetworkManager_Start;
			if (obj == null)
			{
				hook_Start val = GameNetworkManager_Start;
				<>O.<0>__GameNetworkManager_Start = val;
				obj = (object)val;
			}
			GameNetworkManager.Start += (hook_Start)obj;
		}

		public static void RegisterNetworkPrefab(GameObject prefab)
		{
			_networkPrefabs.Add(prefab);
		}

		private static void GameNetworkManager_Start(orig_Start orig, GameNetworkManager self)
		{
			orig.Invoke(self);
			foreach (GameObject networkPrefab in _networkPrefabs)
			{
				((Component)self).GetComponent<NetworkManager>().AddNetworkPrefab(networkPrefab);
			}
		}
	}
	public class Shaders
	{
		public static void FixShaders(GameObject gameObject)
		{
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				Material[] materials = val.materials;
				foreach (Material val2 in materials)
				{
					if (((Object)val2.shader).name.Contains("Standard"))
					{
						val2.shader = Shader.Find("HDRP/Lit");
					}
				}
			}
		}
	}
	public class TerminalUtils
	{
		public static TerminalKeyword CreateTerminalKeyword(string word, bool isVerb = false, CompatibleNoun[] compatibleNouns = null, TerminalNode specialKeywordResult = null, TerminalKeyword defaultVerb = null, bool accessTerminalObjects = false)
		{
			TerminalKeyword val = ScriptableObject.CreateInstance<TerminalKeyword>();
			((Object)val).name = word;
			val.word = word;
			val.isVerb = isVerb;
			val.compatibleNouns = compatibleNouns;
			val.specialKeywordResult = specialKeywordResult;
			val.defaultVerb = defaultVerb;
			val.accessTerminalObjects = accessTerminalObjects;
			return val;
		}
	}
	public enum StoreType
	{
		None,
		ShipUpgrade,
		Decor
	}
	public class Unlockables
	{
		public class RegisteredUnlockable
		{
			public UnlockableItem unlockable;

			public StoreType StoreType;

			public TerminalNode buyNode1;

			public TerminalNode buyNode2;

			public TerminalNode itemInfo;

			public int price;

			public string modName;

			public RegisteredUnlockable(UnlockableItem unlockable, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1)
			{
				this.unlockable = unlockable;
				this.buyNode1 = buyNode1;
				this.buyNode2 = buyNode2;
				this.itemInfo = itemInfo;
				this.price = price;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__StartOfRound_Awake;

			public static hook_Awake <1>__Terminal_Awake;

			public static hook_TextPostProcess <2>__Terminal_TextPostProcess;
		}

		public static List<RegisteredUnlockable> registeredUnlockables = new List<RegisteredUnlockable>();

		public static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			object obj = <>O.<0>__StartOfRound_Awake;
			if (obj == null)
			{
				hook_Awake val = StartOfRound_Awake;
				<>O.<0>__StartOfRound_Awake = val;
				obj = (object)val;
			}
			StartOfRound.Awake += (hook_Awake)obj;
			object obj2 = <>O.<1>__Terminal_Awake;
			if (obj2 == null)
			{
				hook_Awake val2 = Terminal_Awake;
				<>O.<1>__Terminal_Awake = val2;
				obj2 = (object)val2;
			}
			Terminal.Awake += (hook_Awake)obj2;
			object obj3 = <>O.<2>__Terminal_TextPostProcess;
			if (obj3 == null)
			{
				hook_TextPostProcess val3 = Terminal_TextPostProcess;
				<>O.<2>__Terminal_TextPostProcess = val3;
				obj3 = (object)val3;
			}
			Terminal.TextPostProcess += (hook_TextPostProcess)obj3;
		}

		private static string Terminal_TextPostProcess(orig_TextPostProcess orig, Terminal self, string modifiedDisplayText, TerminalNode node)
		{
			if (modifiedDisplayText.Contains("[buyableItemsList]") && modifiedDisplayText.Contains("[unlockablesSelectionList]"))
			{
				int num = modifiedDisplayText.IndexOf(":");
				foreach (RegisteredUnlockable registeredUnlockable in registeredUnlockables)
				{
					if (registeredUnlockable.StoreType == StoreType.ShipUpgrade)
					{
						string unlockableName = registeredUnlockable.unlockable.unlockableName;
						int price = registeredUnlockable.price;
						string value = $"\n* {unlockableName}    //    Price: ${price}";
						modifiedDisplayText = modifiedDisplayText.Insert(num + 1, value);
					}
				}
			}
			return orig.Invoke(self, modifiedDisplayText, node);
		}

		private static void Terminal_Awake(orig_Awake orig, Terminal self)
		{
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Expected O, but got Unknown
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Expected O, but got Unknown
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Expected O, but got Unknown
			//IL_0537: Unknown result type (might be due to invalid IL or missing references)
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Expected O, but got Unknown
			orig.Invoke(self);
			TerminalKeyword val = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy");
			TerminalNode result = val.compatibleNouns[0].result.terminalOptions[1].result;
			TerminalKeyword val2 = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info");
			List<RegisteredUnlockable> list = registeredUnlockables.FindAll((RegisteredUnlockable unlockable) => unlockable.price != -1).ToList();
			Plugin.logger.LogInfo((object)$"Adding {list.Count} items to terminal");
			foreach (RegisteredUnlockable item in list)
			{
				string unlockableName = item.unlockable.unlockableName;
				TerminalKeyword keyword3 = TerminalUtils.CreateTerminalKeyword(unlockableName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val);
				if (self.terminalNodes.allKeywords.Any((TerminalKeyword kw) => kw.word == keyword3.word))
				{
					Plugin.logger.LogInfo((object)("Keyword " + keyword3.word + " already registed, skipping."));
					continue;
				}
				int shipUnlockableID = StartOfRound.Instance.unlockablesList.unlockables.FindIndex((UnlockableItem unlockable) => unlockable.unlockableName == item.unlockable.unlockableName);
				if (item.price == -1 && (Object)(object)item.buyNode1 != (Object)null)
				{
					item.price = item.buyNode1.itemCost;
				}
				char c = unlockableName[unlockableName.Length - 1];
				string text = unlockableName;
				TerminalNode val3 = item.buyNode2;
				if ((Object)(object)val3 == (Object)null)
				{
					val3 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val3).name = unlockableName.Replace(" ", "-") + "BuyNode2";
					val3.displayText = "Ordered [variableAmount] " + text + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n";
					val3.clearPreviousText = true;
					val3.maxCharactersToType = 15;
				}
				val3.buyItemIndex = -1;
				val3.shipUnlockableID = shipUnlockableID;
				val3.buyUnlockable = true;
				val3.creatureName = unlockableName;
				val3.isConfirmationNode = false;
				val3.itemCost = item.price;
				val3.playSyncedClip = 0;
				TerminalNode val4 = item.buyNode1;
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val4).name = unlockableName.Replace(" ", "-") + "BuyNode1";
					val4.displayText = "You have requested to order " + text + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n";
					val4.clearPreviousText = true;
					val4.maxCharactersToType = 35;
				}
				val4.buyItemIndex = -1;
				val4.shipUnlockableID = shipUnlockableID;
				val4.creatureName = unlockableName;
				val4.isConfirmationNode = true;
				val4.overrideOptions = true;
				val4.itemCost = item.price;
				val4.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2]
				{
					new CompatibleNoun
					{
						noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "confirm"),
						result = val3
					},
					new CompatibleNoun
					{
						noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "deny"),
						result = result
					}
				};
				if (item.StoreType == StoreType.Decor)
				{
					item.unlockable.shopSelectionNode = val4;
				}
				else
				{
					item.unlockable.shopSelectionNode = null;
				}
				List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList();
				list2.Add(keyword3);
				self.terminalNodes.allKeywords = list2.ToArray();
				List<CompatibleNoun> list3 = val.compatibleNouns.ToList();
				list3.Add(new CompatibleNoun
				{
					noun = keyword3,
					result = val4
				});
				val.compatibleNouns = list3.ToArray();
				TerminalNode val5 = item.itemInfo;
				if ((Object)(object)val5 == (Object)null)
				{
					val5 = ScriptableObject.CreateInstance<TerminalNode>();
					((Object)val5).name = unlockableName.Replace(" ", "-") + "InfoNode";
					val5.displayText = "[No information about this object was found.]\n\n";
					val5.clearPreviousText = true;
					val5.maxCharactersToType = 25;
				}
				self.terminalNodes.allKeywords = list2.ToArray();
				List<CompatibleNoun> list4 = val2.compatibleNouns.ToList();
				list4.Add(new CompatibleNoun
				{
					noun = keyword3,
					result = val5
				});
				val2.compatibleNouns = list4.ToArray();
				Plugin.logger.LogInfo((object)(item.modName + " registered item: " + item.unlockable.unlockableName));
			}
			orig.Invoke(self);
		}

		private static void StartOfRound_Awake(orig_Awake orig, StartOfRound self)
		{
			orig.Invoke(self);
			Plugin.logger.LogInfo((object)$"Adding {registeredUnlockables.Count} unlockables to unlockables list");
			foreach (RegisteredUnlockable unlockable in registeredUnlockables)
			{
				if (self.unlockablesList.unlockables.Any((UnlockableItem x) => x.unlockableName == unlockable.unlockable.unlockableName))
				{
					Plugin.logger.LogInfo((object)("Unlockable " + unlockable.unlockable.unlockableName + " already exists in unlockables list, skipping"));
					continue;
				}
				if ((Object)(object)unlockable.unlockable.prefabObject != (Object)null)
				{
					PlaceableShipObject componentInChildren = unlockable.unlockable.prefabObject.GetComponentInChildren<PlaceableShipObject>();
					if ((Object)(object)componentInChildren != (Object)null)
					{
						componentInChildren.unlockableID = self.unlockablesList.unlockables.Count;
					}
				}
				self.unlockablesList.unlockables.Add(unlockable.unlockable);
			}
		}

		public static void RegisterUnlockable(UnlockableItemDef unlockable, int price = -1, StoreType storeType = StoreType.None)
		{
			RegisterUnlockable(unlockable.unlockable, storeType, null, null, null, price);
		}

		public static void RegisterUnlockable(UnlockableItem unlockable, int price = -1, StoreType storeType = StoreType.None)
		{
			RegisterUnlockable(unlockable, storeType, null, null, null, price);
		}

		public static void RegisterUnlockable(UnlockableItemDef unlockable, StoreType storeType = StoreType.None, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1)
		{
			RegisterUnlockable(unlockable.unlockable, storeType, buyNode1, buyNode2, itemInfo, price);
		}

		public static void RegisterUnlockable(UnlockableItem unlockable, StoreType storeType = StoreType.None, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1)
		{
			RegisteredUnlockable registeredUnlockable = new RegisteredUnlockable(unlockable, buyNode1, buyNode2, itemInfo, price);
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string name = callingAssembly.GetName().Name;
			registeredUnlockable.modName = name;
			registeredUnlockable.StoreType = storeType;
			registeredUnlockables.Add(registeredUnlockable);
		}
	}
}
namespace LethalLib.Extras
{
	[CreateAssetMenu(menuName = "ScriptableObjects/UnlockableItem")]
	public class UnlockableItemDef : ScriptableObject
	{
		public StoreType storeType = StoreType.None;

		public UnlockableItem unlockable;
	}
}

femboytv-LethalPosters/LethalPosters.dll

Decompiled 6 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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7", FrameworkDisplayName = ".NET Framework 4.7")]
[assembly: AssemblyCompany("LethalPosters")]
[assembly: AssemblyConfiguration("release")]
[assembly: AssemblyDescription("LethalCopmany posters API")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalPosters")]
[assembly: AssemblyTitle("LethalPosters")]
[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 LethalPosters
{
	internal class Config
	{
		private static ConfigFile ConfigFile { get; set; }

		static Config()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			ConfigFile = new ConfigFile(Paths.ConfigPath + "\\LethalPosters.cfg", true);
			foreach (string posterFolder in Plugin.PosterFolders)
			{
				int num = posterFolder.IndexOf("plugins\\", StringComparison.Ordinal) + "plugins\\".Length;
				int num2 = posterFolder.IndexOf("\\LethalPosters", num, StringComparison.Ordinal);
				string text = posterFolder.Substring(num, num2 - num);
				if (!ConfigFile.Bind<bool>(text, "Enabled", true, "Enable or disable " + text).Value)
				{
					Directory.Move(posterFolder, posterFolder + ".Disabled");
				}
			}
		}
	}
	internal class Patches
	{
		private static ManualLogSource Logger { get; set; }

		public static void Init(ManualLogSource logger)
		{
			Logger = logger;
		}

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			Logger.LogInfo((object)"Patching Start in StartOfRound");
			UpdateMaterials(0);
		}

		[HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")]
		[HarmonyPostfix]
		private static void GenerateNewLevelClientRpcPatch(int randomSeed)
		{
			Logger.LogInfo((object)"Patching GenerateNewLevelClientRpc in RoundManager");
			UpdateMaterials(randomSeed);
		}

		private static void UpdateMaterials(int seed)
		{
			Logger.LogInfo((object)"Patching the textures");
			Plugin.Rand = new Random(seed);
			Material[] materials = ((Renderer)GameObject.Find("HangarShip/Plane.001").GetComponent<MeshRenderer>()).materials;
			UpdateTexture(Plugin.PosterFiles, materials[0]);
			UpdateTexture(Plugin.TipFiles, materials[1]);
		}

		private static void UpdateTexture(IReadOnlyList<string> files, Material material)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (files.Count != 0)
			{
				int index = Plugin.Rand.Next(files.Count);
				Texture2D val = new Texture2D(2, 2);
				Logger.LogInfo((object)("Patching " + ((Object)material).name + " with " + files[index]));
				ImageConversion.LoadImage(val, File.ReadAllBytes(files[index]));
				material.mainTexture = (Texture)(object)val;
			}
		}
	}
	[BepInPlugin("LethalPosters", "LethalPosters", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static List<string> PosterFolders = new List<string>();

		public static readonly List<string> PosterFiles = new List<string>();

		public static readonly List<string> TipFiles = new List<string>();

		public static Random Rand = new Random();

		private void Awake()
		{
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			PosterFolders = Directory.GetDirectories(Paths.PluginPath, "LethalPosters", SearchOption.AllDirectories).ToList();
			foreach (string posterFolder in PosterFolders)
			{
				string[] files = Directory.GetFiles(Path.Combine(posterFolder, "posters"));
				foreach (string text in files)
				{
					if (Path.GetExtension(text) != ".old")
					{
						PosterFiles.Add(text);
					}
				}
				files = Directory.GetFiles(Path.Combine(posterFolder, "tips"));
				foreach (string text2 in files)
				{
					if (Path.GetExtension(text2) != ".old")
					{
						TipFiles.Add(text2);
					}
				}
			}
			Patches.Init(((BaseUnityPlugin)this).Logger);
			new Harmony("LethalPosters").PatchAll(typeof(Patches));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalPosters (1.0.0) is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalPosters";

		public const string PLUGIN_NAME = "LethalPosters";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

FlipMods-BetterStamina/BetterStamina.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BetterStamina.Config;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BetterStamina")]
[assembly: AssemblyDescription("Mod made by flipf17")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterStamina")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1c42022e-b386-4342-baf0-67de1b7529e2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BetterStamina
{
	[BepInPlugin("FlipMods.BetterStamina", "BetterStamina", "1.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		public static Plugin instance;

		private void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			instance = this;
			ConfigSettings.BindConfigSettings();
			_harmony = new Harmony("BetterStamina");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BetterStamina loaded");
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}

		public static void LogError(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogError((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.BetterStamina";

		public const string PLUGIN_NAME = "BetterStamina";

		public const string PLUGIN_VERSION = "1.2.1";
	}
}
namespace BetterStamina.Patches
{
	[HarmonyPatch]
	internal class BetterStaminaPatcher
	{
		private static float currentCarryWeight;

		private static float reducedWeight;

		private static float currentSprintMeter;

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPrefix]
		public static void UpdateStaminaPrefix(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
			{
				currentSprintMeter = __instance.sprintMeter;
				currentCarryWeight = __instance.carryWeight;
				reducedWeight = Mathf.Max(__instance.carryWeight * ConfigSync.instance.carryWeightPenaltyMultiplier, 1f);
				__instance.carryWeight = reducedWeight;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		public static void UpdateStaminaPostfix(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
			{
				float num = __instance.sprintMeter - currentSprintMeter;
				if (num < 0f)
				{
					__instance.sprintMeter = Mathf.Max(currentSprintMeter + num * ConfigSync.instance.staminaConsumptionMultiplier, 0f);
				}
				else if (num > 0f)
				{
					__instance.sprintMeter = Mathf.Min(currentSprintMeter + num * ConfigSync.instance.staminaRegenMultiplier, 1f);
				}
				__instance.carryWeight = currentCarryWeight + (__instance.carryWeight - reducedWeight);
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
		[HarmonyPrefix]
		public static void LateUpdatePrefix(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
			{
				currentSprintMeter = __instance.sprintMeter;
				currentCarryWeight = __instance.carryWeight;
				reducedWeight = Mathf.Max(__instance.carryWeight * ConfigSync.instance.carryWeightPenaltyMultiplier, 1f);
				__instance.carryWeight = reducedWeight;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
		[HarmonyPostfix]
		public static void LateUpdateStaminaPostfix(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
			{
				float num = __instance.sprintMeter - currentSprintMeter;
				if (num < 0f)
				{
					__instance.sprintMeter = Mathf.Max(currentSprintMeter + num * ConfigSync.instance.staminaConsumptionMultiplier, 0f);
				}
				else if (num > 0f)
				{
					__instance.sprintMeter = Mathf.Min(currentSprintMeter + num * ConfigSync.instance.staminaRegenMultiplier, 1f);
				}
				__instance.carryWeight = currentCarryWeight + (__instance.carryWeight - reducedWeight);
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")]
		[HarmonyPrefix]
		public static void JumpPerformedPrefix(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
			{
				currentSprintMeter = __instance.sprintMeter;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")]
		[HarmonyPostfix]
		public static void JumpPerformedPostfix(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
			{
				float num = __instance.sprintMeter - currentSprintMeter;
				if (num < 0f)
				{
					__instance.sprintMeter = Mathf.Max(new float[1] { currentSprintMeter + num * ConfigSync.instance.jumpStaminaConsumptionMultiplier });
				}
			}
		}
	}
}
namespace BetterStamina.Config
{
	[Serializable]
	public static class ConfigSettings
	{
		public static ConfigEntry<float> staminaConsumptionMultiplierConfig;

		public static ConfigEntry<float> staminaRegenMultiplierConfig;

		public static ConfigEntry<float> jumpStaminaConsumptionMultiplierConfig;

		public static ConfigEntry<float> carryWeightPenaltyMultiplierConfig;

		public static ConfigEntry<float> movementSpeedMultiplierConfig;

		public static void BindConfigSettings()
		{
			Plugin.Log("BindingConfigs");
			staminaConsumptionMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "StaminaConsumptionMultiplier", 0.75f, "Multiplier for how much stamina drains while sprinting.");
			staminaRegenMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "StaminaRegenMultiplier", 1.5f, "Multiplier for how fast your stamina regens.");
			jumpStaminaConsumptionMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "JumpStaminaConsumptionMultiplier", 0.75f, "Multiplier for how much stamina jumping consumes.");
			carryWeightPenaltyMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "CarryWeightPenaltyMultiplier", 0.5f, "Multiplier for how much your speed/stamina consumption are affected by weight.");
			movementSpeedMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "MovementSpeedMultiplier", 1f, "Player movement speed multiplier.");
			ConfigSync.BuildDefaultConfig();
		}
	}
	[Serializable]
	[HarmonyPatch]
	public class ConfigSync
	{
		public static ConfigSync defaultConfig;

		public static ConfigSync instance;

		public static PlayerControllerB localPlayerController;

		public static bool isSynced = false;

		private static float defaultMovementSpeed = 4.6f;

		public float staminaConsumptionMultiplier;

		public float staminaRegenMultiplier;

		public float jumpStaminaConsumptionMultiplier;

		public float carryWeightPenaltyMultiplier;

		public float movementSpeedMultiplier;

		public static void BuildDefaultConfig()
		{
			if (defaultConfig == null)
			{
				defaultConfig = new ConfigSync();
				defaultConfig.staminaConsumptionMultiplier = ConfigSettings.staminaConsumptionMultiplierConfig.Value;
				defaultConfig.staminaRegenMultiplier = ConfigSettings.staminaRegenMultiplierConfig.Value;
				defaultConfig.jumpStaminaConsumptionMultiplier = ConfigSettings.jumpStaminaConsumptionMultiplierConfig.Value;
				defaultConfig.carryWeightPenaltyMultiplier = ConfigSettings.carryWeightPenaltyMultiplierConfig.Value;
				defaultConfig.movementSpeedMultiplier = ConfigSettings.movementSpeedMultiplierConfig.Value;
				instance = defaultConfig;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void InitializeLocalPlayer(PlayerControllerB __instance)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			localPlayerController = __instance;
			if (NetworkManager.Singleton.IsServer)
			{
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterStaminaOnRequestConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSyncRequest));
				OnLocalClientConfigSync();
			}
			else
			{
				isSynced = false;
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterStaminaOnReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSync));
				RequestConfigSync();
			}
		}

		public static void RequestConfigSync()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsClient)
			{
				Plugin.Log("Sending config sync request to server.");
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterStaminaOnRequestConfigSync", 0uL, val, (NetworkDelivery)3);
			}
			else
			{
				Plugin.LogError("Failed to send config sync request.");
			}
		}

		public static void OnReceiveConfigSyncRequest(ulong clientId, FastBufferReader reader)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsServer)
			{
				Plugin.Log("Receiving config sync request from client with id: " + clientId + ". Sending config sync to client.");
				byte[] array = SerializeConfigToByteArray(instance);
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(array.Length + 4, (Allocator)2, -1);
				int num = array.Length;
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0);
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterStaminaOnReceiveConfigSync", clientId, val, (NetworkDelivery)3);
			}
		}

		public static void OnReceiveConfigSync(ulong clientId, FastBufferReader reader)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (((FastBufferReader)(ref reader)).TryBeginRead(4))
			{
				int num = default(int);
				((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
				if (((FastBufferReader)(ref reader)).TryBeginRead(num))
				{
					Plugin.Log("Receiving config sync from server.");
					byte[] data = new byte[num];
					((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0);
					instance = DeserializeFromByteArray(data);
					OnLocalClientConfigSync();
				}
				else
				{
					Plugin.LogError("Error receiving sync from server.");
				}
			}
			else
			{
				Plugin.LogError("Error receiving bytes length.");
			}
		}

		public static void OnLocalClientConfigSync()
		{
			localPlayerController.movementSpeed = defaultMovementSpeed * instance.movementSpeedMultiplier;
			isSynced = true;
		}

		public static byte[] SerializeConfigToByteArray(ConfigSync config)
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			MemoryStream memoryStream = new MemoryStream();
			binaryFormatter.Serialize(memoryStream, config);
			return memoryStream.ToArray();
		}

		public static ConfigSync DeserializeFromByteArray(byte[] data)
		{
			MemoryStream serializationStream = new MemoryStream(data);
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			return (ConfigSync)binaryFormatter.Deserialize(serializationStream);
		}
	}
}

FlipMods-LetMeLookDown/LetMeLookDown.dll

Decompiled 6 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LetMeLookDown")]
[assembly: AssemblyDescription("Mod made by flipf17")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LetMeLookDown")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a9c88d54-8f01-44a7-be0d-bd61d38aadcb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LetMeLookDown
{
	[BepInPlugin("FlipMods.LetMeLookDown", "LetMeLookDown", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private static Plugin instance;

		public static float maxAngle = 80f;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_harmony = new Harmony("LetMeLookDown");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LetMeLookDown mod loaded");
			instance = this;
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.LetMeLookDown";

		public const string PLUGIN_NAME = "LetMeLookDown";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace LetMeLookDown.Patches
{
	[HarmonyPatch]
	internal class AdjustSmoothLookingPatcher
	{
		[HarmonyPatch(typeof(PlayerControllerB), "CalculateSmoothLookingInput")]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 60f)
				{
					list[i].operand = Plugin.maxAngle;
					break;
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch]
	internal class AdjustNormalLookingPatcher
	{
		[HarmonyPatch(typeof(PlayerControllerB), "CalculateNormalLookingInput")]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 60f)
				{
					list[i].operand = Plugin.maxAngle;
					break;
				}
			}
			return list.AsEnumerable();
		}
	}
}

FlipMods-ReservedFlashlightSlot/ReservedFlashlightSlot.dll

Decompiled 6 months ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using ReservedFlashlightSlot.Patches;
using ReservedItemSlotCore;
using ReservedItemSlotCore.Networking;
using ReservedItemSlotCore.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ReservedFlashlightSlot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReservedFlashlightSlot")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5b7d6563-4e51-4a69-bcf9-fa1dea6eff75")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ReservedFlashlightSlot
{
	public static class ConfigSettings
	{
		public static ConfigEntry<string> activateFlashlightKey;

		public static ConfigEntry<bool> hideFlashlightMeshShoulder;

		public static string activateFlashlightDisplayName;

		public static void BindConfigSettings()
		{
			Plugin.Log("BindingConfigs");
			activateFlashlightKey = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("ReservedItemSlotCore", "ActivateFlashlightKey", "<Keyboard>/f", "Activate flashlight keybind.");
			hideFlashlightMeshShoulder = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("ReservedItemSlotCore", "HideFlashlightOnShoulder", false, "Hides the flashlight mesh while on your shoulder.");
			activateFlashlightDisplayName = GetDisplayName(activateFlashlightKey.Value);
		}

		public static string GetDisplayName(string key)
		{
			key = key.Replace("<Keyboard>/", "");
			key = key.Replace("<Mouse>/", "");
			string text = key;
			text = text.Replace("leftAlt", "Alt");
			text = text.Replace("rightAlt", "Alt");
			text = text.Replace("leftCtrl", "Ctrl");
			text = text.Replace("rightCtrl", "Ctrl");
			text = text.Replace("leftShift", "Shift");
			text = text.Replace("rightShift", "Shift");
			text = text.Replace("leftButton", "LMB");
			text = text.Replace("rightButton", "RMB");
			return text.Replace("middleButton", "MMB");
		}
	}
	[HarmonyPatch]
	internal static class Keybinds
	{
		public static PlayerControllerB localPlayerController;

		private static InputAction activateFlashlightAction;

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void OnLocalPlayerConnect(PlayerControllerB __instance)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			localPlayerController = __instance;
			activateFlashlightAction = new InputAction((string)null, (InputActionType)0, ConfigSettings.activateFlashlightKey.Value, "Press", (string)null, (string)null);
			if (((Component)localPlayerController).gameObject.activeSelf)
			{
				SubscribeToEvents();
			}
		}

		private static void SubscribeToEvents()
		{
			if (activateFlashlightAction != null)
			{
				activateFlashlightAction.Enable();
				activateFlashlightAction.performed += OnActivateFlashlightPerformed;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "OnEnable")]
		[HarmonyPostfix]
		public static void OnEnable(PlayerControllerB __instance)
		{
			if ((Object)(object)__instance == (Object)(object)localPlayerController)
			{
				SubscribeToEvents();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable()
		{
			if (activateFlashlightAction != null)
			{
				activateFlashlightAction.performed -= OnActivateFlashlightPerformed;
				activateFlashlightAction.Disable();
			}
		}

		private static void OnActivateFlashlightPerformed(CallbackContext context)
		{
			if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerControlled || localPlayerController.inTerminalMenu || (((NetworkBehaviour)localPlayerController).IsServer && !localPlayerController.isHostPlayerObject))
			{
				return;
			}
			FlashlightItem mainFlashlight = ReservedFlashlightSlotPatcher.GetMainFlashlight(localPlayerController);
			if (((CallbackContext)(ref context)).performed && !((Object)(object)mainFlashlight == (Object)null))
			{
				float num = (float)Traverse.Create((object)localPlayerController).Field("timeSinceSwitchingSlots").GetValue();
				if (!(num < 0.075f))
				{
					((GrabbableObject)mainFlashlight).UseItemOnClient(!((GrabbableObject)mainFlashlight).isBeingUsed);
					Traverse.Create((object)localPlayerController).Field("timeSinceSwitchingSlots").SetValue((object)0);
				}
			}
		}
	}
	[BepInPlugin("FlipMods.ReservedFlashlightSlot", "ReservedFlashlightSlot", "1.4.1")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		private Harmony _harmony;

		public static ReservedItemInfo proFlashlightInfo = new ReservedItemInfo("Pro-flashlight", 120, true, true, true, true);

		public static ReservedItemInfo flashlightInfo = new ReservedItemInfo("Flashlight", 120, true, true, true, true);

		private void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			instance = this;
			ConfigSettings.BindConfigSettings();
			_harmony = new Harmony("ReservedFlashlightSlot");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ReservedFlashlightSlot loaded");
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.ReservedFlashlightSlot";

		public const string PLUGIN_NAME = "ReservedFlashlightSlot";

		public const string PLUGIN_VERSION = "1.4.1";
	}
}
namespace ReservedFlashlightSlot.Patches
{
	[HarmonyPatch]
	internal static class ReservedFlashlightSlotPatcher
	{
		private static Vector3 playerShoulderPositionOffset = new Vector3(0.2f, 0f, 0f);

		private static Vector3 playerShoulderRotationOffset = new Vector3(90f, 0f, 0f);

		private static string originalControlTooltip = "";

		public static PlayerControllerB localPlayerController => PlayerControllerPatcher.localPlayerController;

		public static PlayerControllerB GetPreviousPlayerHeldBy(FlashlightItem flashlightItem)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			return (PlayerControllerB)Traverse.Create((object)flashlightItem).Field("previousPlayerHeldBy").GetValue();
		}

		public static FlashlightItem GetMainFlashlight(PlayerControllerB playerController)
		{
			return GetCurrentlySelectedFlashlight(playerController) ?? GetReservedFlashlight(playerController);
		}

		public static FlashlightItem GetReservedFlashlight(PlayerControllerB playerController)
		{
			GrabbableObject obj = ((playerController != null) ? playerController.ItemSlots[Plugin.flashlightInfo.indexInInventory] : null);
			return (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null);
		}

		public static FlashlightItem GetCurrentlySelectedFlashlight(PlayerControllerB playerController)
		{
			GrabbableObject obj = ((playerController != null) ? playerController.ItemSlots[playerController.currentItemSlot] : null);
			return (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null);
		}

		public static bool IsFlashlightOn(PlayerControllerB playerController)
		{
			return ((GrabbableObject)(GetMainFlashlight(playerController)?)).isBeingUsed ?? false;
		}

		[HarmonyPatch(typeof(FlashlightItem), "__initializeVariables")]
		[HarmonyPostfix]
		public static void EditTooltips(FlashlightItem __instance)
		{
			if (originalControlTooltip == "")
			{
				originalControlTooltip = ((GrabbableObject)__instance).itemProperties.toolTips[((GrabbableObject)__instance).itemProperties.toolTips.Length - 1];
			}
			((GrabbableObject)__instance).itemProperties.toolTips[((GrabbableObject)__instance).itemProperties.toolTips.Length - 1] = $"{originalControlTooltip}[{ConfigSettings.activateFlashlightDisplayName.ToUpper()}]";
		}

		[HarmonyPatch(typeof(MenuManager), "OnEnable")]
		[HarmonyPostfix]
		public static void ResetVariables()
		{
			Keybinds.localPlayerController = null;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ActivateItem_performed")]
		[HarmonyPrefix]
		public static bool PreventActivatingDuplicateItem(CallbackContext context, PlayerControllerB __instance)
		{
			FlashlightItem currentlySelectedFlashlight = GetCurrentlySelectedFlashlight(__instance);
			if ((Object)(object)__instance != (Object)(object)localPlayerController || (Object)(object)currentlySelectedFlashlight == (Object)null)
			{
				return true;
			}
			FlashlightItem reservedFlashlight = GetReservedFlashlight(__instance);
			if ((Object)(object)currentlySelectedFlashlight != (Object)(object)reservedFlashlight || !((GrabbableObject)reservedFlashlight).itemProperties.requiresBattery || !((GrabbableObject)reservedFlashlight).insertedBattery.empty)
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(FlashlightItem), "SwitchFlashlight")]
		[HarmonyPostfix]
		public static void OnSwitchOnOffFlashlight(bool on, FlashlightItem __instance)
		{
			if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null))
			{
				UpdateAllFlashlightStates(((GrabbableObject)__instance).playerHeldBy, on);
			}
		}

		[HarmonyPatch(typeof(FlashlightItem), "PocketItem")]
		[HarmonyPostfix]
		public static void OnPocketFlashlightLocal(FlashlightItem __instance)
		{
			OnPocketFlashlight(__instance, ((GrabbableObject)__instance).isBeingUsed);
		}

		[HarmonyPatch(typeof(FlashlightItem), "PocketFlashlightClientRpc")]
		[HarmonyPrefix]
		public static bool OnPocketFlashlightClientRpc(bool stillUsingFlashlight, FlashlightItem __instance)
		{
			if (!NetworkHelper.IsValidClientRpcExecStage((NetworkBehaviour)(object)__instance) || ((NetworkBehaviour)__instance).IsOwner || (Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null || (Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)localPlayerController || !NetworkHelper.IsClientExecStage((NetworkBehaviour)(object)__instance))
			{
				return false;
			}
			((MonoBehaviour)__instance).StartCoroutine(OnPocketFlashlightEndOfFrame(__instance, stillUsingFlashlight));
			return true;
		}

		private static IEnumerator OnPocketFlashlightEndOfFrame(FlashlightItem flashlightItem, bool stillUsingFlashlight)
		{
			yield return (object)new WaitForEndOfFrame();
			OnPocketFlashlight(flashlightItem, stillUsingFlashlight);
		}

		private static void OnPocketFlashlight(FlashlightItem flashlightItem, bool stillUsingFlashlight = false)
		{
			if (!((Object)(object)((GrabbableObject)flashlightItem).playerHeldBy == (Object)null))
			{
				((GrabbableObject)flashlightItem).playerHeldBy.pocketedFlashlight = (GrabbableObject)(object)flashlightItem;
				((GrabbableObject)flashlightItem).parentObject = ((GrabbableObject)flashlightItem).playerHeldBy.playerGlobalHead;
				if (!((Object)(object)((GrabbableObject)flashlightItem).playerHeldBy == (Object)(object)localPlayerController) && (Object)(object)flashlightItem == (Object)(object)GetReservedFlashlight(((GrabbableObject)flashlightItem).playerHeldBy))
				{
					((GrabbableObject)flashlightItem).EnableItemMeshes(true);
				}
			}
		}

		[HarmonyPatch(typeof(FlashlightItem), "EquipItem")]
		[HarmonyPostfix]
		public static void OnEquipFlashlight(FlashlightItem __instance)
		{
			if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null))
			{
				if ((Object)(object)__instance == (Object)(object)((GrabbableObject)__instance).playerHeldBy.pocketedFlashlight)
				{
					((GrabbableObject)__instance).playerHeldBy.pocketedFlashlight = null;
				}
				((GrabbableObject)__instance).parentObject = (((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)localPlayerController) ? ((GrabbableObject)__instance).playerHeldBy.localItemHolder : ((GrabbableObject)__instance).playerHeldBy.serverItemHolder);
			}
		}

		[HarmonyPatch(typeof(GrabbableObject), "LateUpdate")]
		[HarmonyPostfix]
		public static void SetPositionOffset(GrabbableObject __instance)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			if (__instance is FlashlightItem && (Object)(object)__instance.playerHeldBy != (Object)null && __instance.isPocketed && (Object)(object)__instance.parentObject != (Object)null && (Object)(object)__instance.playerHeldBy != (Object)(object)localPlayerController && (Object)(object)__instance != (Object)(object)GetCurrentlySelectedFlashlight(__instance.playerHeldBy))
			{
				Transform transform = ((Component)__instance.parentObject).transform;
				((Component)__instance).transform.rotation = ((Component)__instance.parentObject).transform.rotation * Quaternion.Euler(playerShoulderRotationOffset);
				((Component)__instance).transform.position = transform.position + transform.rotation * playerShoulderPositionOffset;
			}
		}

		[HarmonyPatch(typeof(GrabbableObject), "EnableItemMeshes")]
		[HarmonyPrefix]
		public static void OnEnableItemMeshes(ref bool enable, GrabbableObject __instance)
		{
			if (__instance is FlashlightItem && (Object)(object)__instance.playerHeldBy != (Object)null && ((Object)(object)__instance.playerHeldBy != (Object)(object)localPlayerController || (Object)(object)__instance == (Object)(object)GetCurrentlySelectedFlashlight(__instance.playerHeldBy)))
			{
				enable = true;
			}
		}

		private static void UpdateAllFlashlightStates(PlayerControllerB playerController, bool mainFlashlightActive = true)
		{
			FlashlightItem mainFlashlight = GetMainFlashlight(playerController);
			if ((Object)(object)mainFlashlight == (Object)null)
			{
				((Behaviour)playerController.helmetLight).enabled = false;
				mainFlashlightActive = false;
			}
			else
			{
				playerController.ChangeHelmetLight(mainFlashlight.flashlightTypeID, mainFlashlightActive && (Object)(object)playerController == (Object)(object)localPlayerController && (Object)(object)playerController.ItemSlots[playerController.currentItemSlot] != (Object)(object)mainFlashlight);
			}
			for (int i = 0; i < PlayerControllerPatcher.combinedHotbarSize; i++)
			{
				GrabbableObject obj = playerController.ItemSlots[i];
				FlashlightItem val = (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null);
				if ((Object)(object)val != (Object)null)
				{
					UpdateFlashlightState(val, (Object)(object)val == (Object)(object)mainFlashlight && mainFlashlightActive);
				}
			}
		}

		private static void UpdateFlashlightState(FlashlightItem flashlightItem, bool active)
		{
			if (!((Object)(object)((GrabbableObject)flashlightItem).playerHeldBy == (Object)null))
			{
				PlayerControllerB playerHeldBy = ((GrabbableObject)flashlightItem).playerHeldBy;
				((GrabbableObject)flashlightItem).isBeingUsed = active;
				bool flag = (Object)(object)playerHeldBy != (Object)(object)localPlayerController || (Object)(object)playerHeldBy.ItemSlots[playerHeldBy.currentItemSlot] == (Object)(object)flashlightItem;
				((Behaviour)flashlightItem.flashlightBulb).enabled = active && flag;
				((Behaviour)flashlightItem.flashlightBulbGlow).enabled = active && flag;
				flashlightItem.usingPlayerHelmetLight = active && !flag;
			}
		}
	}
}

FlipMods-ReservedItemSlotCore/ReservedItemSlotCore.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using ReservedItemSlotCore.Networking;
using ReservedItemSlotCore.Patches;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ReservedItemSlotCore")]
[assembly: AssemblyDescription("Mod made by flipf17")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReservedItemSlotCore")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("238ce080-e339-46b6-9b08-992a950453a1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ReservedItemSlotCore
{
	public static class ConfigSettings
	{
		public static ConfigEntry<string> focusReservedHotbarHotkey;

		public static ConfigEntry<string> specialReservedItemUseHotkey;

		public static string focusReservedHotbarHotkeyDisplayName;

		public static void BindConfigSettings()
		{
			Plugin.Log("BindingConfigs");
			focusReservedHotbarHotkey = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("ReservedItemSlotCore", "FocusReservedItemSlotsHotkey", "<Keyboard>/leftAlt", "Which key will focus your reserved item slots hotbar to allow selcting, dropping, charging, etc.");
			specialReservedItemUseHotkey = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("ReservedItemSlotCore", "SpecialReservedItemUseHotkey", "<Mouse>/middleButton", "[REMOVED] Which key will focus your reserved item slots hotbar to allow selcting, dropping, charging, etc.");
			focusReservedHotbarHotkeyDisplayName = GetDisplayName(focusReservedHotbarHotkey.Value);
		}

		public static string GetDisplayName(string key)
		{
			key = key.Replace("<Keyboard>/", "");
			key = key.Replace("<Mouse>/", "");
			string text = key;
			text = text.Replace("leftAlt", "Alt");
			text = text.Replace("rightAlt", "Alt");
			text = text.Replace("leftCtrl", "Ctrl");
			text = text.Replace("rightCtrl", "Ctrl");
			text = text.Replace("leftShift", "Shift");
			text = text.Replace("rightShift", "Shift");
			text = text.Replace("leftButton", "LMB");
			text = text.Replace("rightButton", "RMB");
			return text.Replace("middleButton", "MMB");
		}
	}
	[HarmonyPatch]
	internal static class HotbarSlotSync
	{
		public static PlayerControllerB localPlayerController;

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void Init(PlayerControllerB __instance)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)__instance)
			{
				localPlayerController = __instance;
				NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("OnSwapHotbarClientRpc", new HandleNamedMessageDelegate(OnSwapHotbarClientRpc));
				if (NetworkManager.Singleton.IsServer)
				{
					NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("OnSwapHotbarServerRpc", new HandleNamedMessageDelegate(OnSwapHotbarServerRpc));
				}
			}
		}

		private static void SendSwapHotbarUpdate(int hotbarSlot)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsClient)
			{
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1);
				try
				{
					Plugin.Log("Sending hotbar swap slot: " + hotbarSlot);
					((FastBufferWriter)(ref val)).WriteValue<int>(ref hotbarSlot, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("OnSwapHotbarServerRpc", 0uL, val, (NetworkDelivery)3);
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			Plugin.Log("Failed to send hotbar swap index.");
		}

		private static void OnSwapHotbarServerRpc(ulong clientId, FastBufferReader reader)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkManager.Singleton.IsServer)
			{
				return;
			}
			if (((FastBufferReader)(ref reader)).TryBeginRead(4))
			{
				int num = default(int);
				((FastBufferReader)(ref reader)).ReadValue<int>(ref num, default(ForPrimitives));
				Plugin.Log("Receiving request for hotbar swap. Slot: " + num + " ClientId: " + clientId);
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1);
				try
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref clientId, default(ForPrimitives));
					NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("OnSwapHotbarClientRpc", val, (NetworkDelivery)3);
					return;
				}
				finally
				{
					((IDisposable)(FastBufferWriter)(ref val)).Dispose();
				}
			}
			Plugin.Log("Failed to receive hotbar swap index from Client: " + clientId);
		}

		private static void OnSwapHotbarClientRpc(ulong clientId, FastBufferReader reader)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkManager.Singleton.IsClient)
			{
				return;
			}
			if (((FastBufferReader)(ref reader)).TryBeginRead(12))
			{
				int hotbarSlot = default(int);
				((FastBufferReader)(ref reader)).ReadValue<int>(ref hotbarSlot, default(ForPrimitives));
				ulong num = default(ulong);
				((FastBufferReader)(ref reader)).ReadValue<ulong>(ref num, default(ForPrimitives));
				Plugin.Log("Receiving update for hotbar swap. Slot: " + hotbarSlot + " ClientId: " + num);
				if (num == localPlayerController.actualClientId || UpdateClientHotbarSlot(num, hotbarSlot))
				{
					return;
				}
				Plugin.Log("Failed to receive hotbar swap index from Client: " + num);
			}
			Plugin.Log("Failed to receive hotbar swap index from Client");
		}

		private static bool UpdateClientHotbarSlot(ulong clientId, int hotbarSlot)
		{
			Plugin.Log("Updating hotbar slot: " + hotbarSlot + " ClientId: " + clientId);
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				if (StartOfRound.Instance.allPlayerScripts[i].actualClientId == clientId)
				{
					CallSwitchToItemSlotMethod(StartOfRound.Instance.allPlayerScripts[i], hotbarSlot);
					return true;
				}
			}
			return false;
		}

		public static void SwapHotbarSlot(int hotbarIndex)
		{
			SendSwapHotbarUpdate(hotbarIndex);
			CallSwitchToItemSlotMethod(localPlayerController, hotbarIndex);
			Traverse.Create((object)localPlayerController).Field("timeSinceSwitchingSlots").SetValue((object)0);
		}

		private static void CallSwitchToItemSlotMethod(PlayerControllerB playerController, int hotbarIndex)
		{
			ShipBuildModeManager.Instance.CancelBuildMode(true);
			MethodInfo method = ((object)playerController).GetType().GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic);
			method.Invoke(playerController, new object[2] { hotbarIndex, null });
			if ((Object)(object)playerController.currentlyHeldObjectServer != (Object)null)
			{
				((Component)playerController.currentlyHeldObjectServer).gameObject.GetComponent<AudioSource>().PlayOneShot(playerController.currentlyHeldObjectServer.itemProperties.grabSFX, 0.6f);
			}
		}
	}
	[HarmonyPatch]
	internal static class Keybinds
	{
		public static PlayerControllerB localPlayerController;

		public static InputAction focusReservedHotbarAction;

		public static bool holdingModifierKey;

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void OnLocalPlayerConnect(PlayerControllerB __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			localPlayerController = __instance;
			focusReservedHotbarAction = new InputAction((string)null, (InputActionType)0, ConfigSettings.focusReservedHotbarHotkey.Value, (string)null, (string)null, (string)null);
			if (((Component)localPlayerController).gameObject.activeSelf)
			{
				SubscribeToEvents();
			}
		}

		private static void SubscribeToEvents()
		{
			if (focusReservedHotbarAction != null && Plugin.numReservedItemSlots > 0)
			{
				focusReservedHotbarAction.performed += FocusReservedHotbarSlotsAction;
				focusReservedHotbarAction.canceled += UnfocusReservedHotbarSlotsPerformed;
				focusReservedHotbarAction.Enable();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "OnEnable")]
		[HarmonyPostfix]
		public static void OnEnable(PlayerControllerB __instance)
		{
			if ((Object)(object)__instance == (Object)(object)localPlayerController)
			{
				SubscribeToEvents();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable()
		{
			if (focusReservedHotbarAction != null && Plugin.numReservedItemSlots > 0)
			{
				focusReservedHotbarAction.performed -= FocusReservedHotbarSlotsAction;
				focusReservedHotbarAction.canceled -= UnfocusReservedHotbarSlotsPerformed;
				focusReservedHotbarAction.Disable();
			}
		}

		private static void FocusReservedHotbarSlotsAction(CallbackContext context)
		{
			if (!((Object)(object)localPlayerController == (Object)null) && ((NetworkBehaviour)localPlayerController).IsOwner && localPlayerController.isPlayerControlled && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject))
			{
				holdingModifierKey = true;
				bool flag = (bool)Traverse.Create((object)localPlayerController).Field("throwingObject").GetValue();
				if (!(localPlayerController.inTerminalMenu || localPlayerController.isPlayerDead || localPlayerController.isGrabbingObjectAnimation || localPlayerController.inSpecialInteractAnimation || flag) && !localPlayerController.isTypingChat && !localPlayerController.twoHanded && !localPlayerController.activatingItem && ((CallbackContext)(ref context)).performed)
				{
					ReservedItemPatcher.SetFocusReservedHotbarSlots(active: true);
				}
			}
		}

		private static void UnfocusReservedHotbarSlotsPerformed(CallbackContext context)
		{
			if (!((Object)(object)localPlayerController == (Object)null) && ((NetworkBehaviour)localPlayerController).IsOwner && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject))
			{
				holdingModifierKey = false;
				bool flag = (bool)Traverse.Create((object)localPlayerController).Field("throwingObject").GetValue();
				if (!(localPlayerController.isGrabbingObjectAnimation || localPlayerController.inSpecialInteractAnimation || flag) && !localPlayerController.activatingItem && ((CallbackContext)(ref context)).canceled)
				{
					ReservedItemPatcher.SetFocusReservedHotbarSlots(active: false);
				}
			}
		}
	}
	[BepInPlugin("FlipMods.ReservedItemSlotCore", "ReservedItemSlotCore", "1.4.1")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		public static Plugin instance;

		public static Dictionary<string, ReservedItemInfo> reservedItemsDict => ReservedItemInfo.reservedItemsDict;

		public static List<ReservedItemInfo> reservedItemsList => ReservedItemInfo.reservedItemsList;

		public static List<ReservedItemInfo> reservedItemSlotReps => ReservedItemInfo.reservedItemSlotReps;

		public static int numReservedItemSlots => ReservedItemInfo.numReservedItemSlots;

		private void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			instance = this;
			ConfigSettings.BindConfigSettings();
			_harmony = new Harmony("ReservedItemSlotCore");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ReservedItemSlotCore loaded");
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}

		public static bool IsReservedItem(string itemName)
		{
			return reservedItemsDict.ContainsKey(itemName);
		}

		public static ReservedItemInfo GetReservedItemInfo(string itemName)
		{
			return IsReservedItem(itemName) ? reservedItemsDict[itemName] : null;
		}

		public static ReservedItemInfo GetReservedItemInfo(GrabbableObject item)
		{
			return ((Object)(object)item != (Object)null) ? GetReservedItemInfo(item.itemProperties.itemName) : null;
		}

		public static int GetReservedItemHotbarIndex(string itemName)
		{
			return IsReservedItem(itemName) ? reservedItemsDict[itemName].indexInInventory : (-1);
		}
	}
	public class ReservedItemInfo
	{
		public static Dictionary<string, ReservedItemInfo> reservedItemsDict = new Dictionary<string, ReservedItemInfo>();

		public static List<ReservedItemInfo> reservedItemsList = new List<ReservedItemInfo>();

		public static List<ReservedItemInfo> reservedItemSlotReps = new List<ReservedItemInfo>();

		public static int defaultHotbarSlotPriority = 10;

		public static int currentUndefinedHotbarSlotPriority = 0;

		public string itemName;

		public int hotbarSlotPriority;

		private int undefinedHotbarSlotPriority = -1;

		public int reservedItemIndex;

		public bool forceUpdateCanBeGrabbedBeforeGameStart = false;

		public bool canBeGrabbedBeforeGameStart = false;

		public bool forceUpdateRequiresBattery = false;

		public bool requiresBattery = false;

		public static int numReservedItemSlots => reservedItemSlotReps.Count;

		public int indexInInventory => ((Object)(object)PlayerControllerPatcher.localPlayerController != (Object)null) ? (PlayerControllerPatcher.localPlayerController.ItemSlots.Length - (numReservedItemSlots - reservedItemIndex)) : (-1);

		public ReservedItemInfo(string itemName, int hotbarSlotPriority = -1, bool forceUpdateCanBeGrabbedBeforeGameStart = false, bool canBeGrabbedBeforeGameStart = false, bool forceUpdateRequiresBattery = false, bool requiresBattery = false)
		{
			this.itemName = itemName;
			this.forceUpdateCanBeGrabbedBeforeGameStart = forceUpdateCanBeGrabbedBeforeGameStart;
			this.canBeGrabbedBeforeGameStart = canBeGrabbedBeforeGameStart;
			this.forceUpdateRequiresBattery = forceUpdateRequiresBattery;
			this.requiresBattery = requiresBattery;
			if (hotbarSlotPriority != -1)
			{
				this.hotbarSlotPriority = hotbarSlotPriority;
			}
			else
			{
				this.hotbarSlotPriority = defaultHotbarSlotPriority;
				undefinedHotbarSlotPriority = ++currentUndefinedHotbarSlotPriority;
			}
			if (!reservedItemsDict.ContainsKey(this.itemName))
			{
				reservedItemsDict.Add(this.itemName, this);
				reservedItemsList.Add(this);
				int i;
				for (i = 0; i < reservedItemSlotReps.Count; i++)
				{
					ReservedItemInfo reservedItemInfo = reservedItemSlotReps[i];
					if (this.hotbarSlotPriority == reservedItemInfo.hotbarSlotPriority)
					{
						if (undefinedHotbarSlotPriority == reservedItemInfo.undefinedHotbarSlotPriority)
						{
							i = -1;
						}
						break;
					}
					if (this.hotbarSlotPriority > reservedItemInfo.hotbarSlotPriority)
					{
						break;
					}
				}
				if (i >= 0)
				{
					reservedItemIndex = i;
					reservedItemSlotReps.Insert(i, this);
					for (int j = i + 1; j < reservedItemSlotReps.Count; j++)
					{
						reservedItemSlotReps[j].reservedItemIndex = j;
					}
				}
			}
			else
			{
				Plugin.Log($"Tried to add duplicate item name to the ReservedItems list: {this.itemName}");
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.ReservedItemSlotCore";

		public const string PLUGIN_NAME = "ReservedItemSlotCore";

		public const string PLUGIN_VERSION = "1.4.1";
	}
}
namespace ReservedItemSlotCore.Patches
{
	[HarmonyPatch]
	public static class PlayerControllerPatcher
	{
		public static PlayerControllerB localPlayerController;

		public static int vanillaHotbarSize = -1;

		public static int INTERACTABLE_OBJECT_MASK { get; private set; }

		public static int unreservedHotbarSize => ((Object)(object)localPlayerController != (Object)null) ? (localPlayerController.ItemSlots.Length - reservedHotbarSize) : vanillaHotbarSize;

		public static int reservedHotbarSize => Plugin.numReservedItemSlots;

		public static int combinedHotbarSize => unreservedHotbarSize + reservedHotbarSize;

		[HarmonyPatch(typeof(MenuManager), "OnEnable")]
		[HarmonyPostfix]
		public static void ResetVariables(MenuManager __instance)
		{
			localPlayerController = null;
			vanillaHotbarSize = -1;
			ReservedItemPatcher.isReservedHotbarFocused = false;
			ReservedItemPatcher.indexUnfocusedReservedHotbar = 0;
			ReservedItemPatcher.indexFocusedReservedHotbar = -1;
			Keybinds.localPlayerController = null;
			Keybinds.focusReservedHotbarAction = null;
			Keybinds.holdingModifierKey = false;
			HotbarSlotSync.localPlayerController = null;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Awake")]
		[HarmonyPostfix]
		public static void InitializePlayerController(PlayerControllerB __instance)
		{
			if (vanillaHotbarSize == -1)
			{
				vanillaHotbarSize = __instance.ItemSlots.Length;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Start")]
		[HarmonyPostfix]
		public static void InitializePlayerControllerLate(PlayerControllerB __instance)
		{
			__instance.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[__instance.ItemSlots.Length + reservedHotbarSize];
			Plugin.Log("VanillaHotbarSize: " + vanillaHotbarSize);
			Plugin.Log("UnreservedHotbarSize: " + unreservedHotbarSize);
			Plugin.Log("ReservedHotbarSize: " + reservedHotbarSize);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void OnLocalPlayerConnect(PlayerControllerB __instance)
		{
			localPlayerController = __instance;
			INTERACTABLE_OBJECT_MASK = (int)Traverse.Create((object)__instance).Field("interactableObjectsMask").GetValue();
		}
	}
	[HarmonyPatch]
	public static class ReservedItemPatcher
	{
		public static bool isReservedHotbarFocused;

		public static int indexUnfocusedReservedHotbar;

		public static int indexFocusedReservedHotbar;

		public static Dictionary<PlayerControllerB, ReservedItemInfo> grabbingReservedItemInfoDict;

		private static GrabbableObject previouslyHeldObjectServer;

		private static CanvasScaler canvasScaler;

		private static AspectRatioFitter aspectRatioFitter;

		private static float iconWidth;

		private static float xPos;

		public static PlayerControllerB localPlayerController => PlayerControllerPatcher.localPlayerController;

		public static int unreservedHotbarSize => PlayerControllerPatcher.unreservedHotbarSize;

		public static int reservedHotbarSize => Plugin.numReservedItemSlots;

		public static int combinedHotbarSize => PlayerControllerPatcher.combinedHotbarSize;

		public static ReservedItemInfo grabbingReservedItemInfoLocal
		{
			get
			{
				return ((Object)(object)localPlayerController != (Object)null) ? grabbingReservedItemInfoDict[localPlayerController] : null;
			}
			set
			{
				if (!((Object)(object)localPlayerController == (Object)null))
				{
					grabbingReservedItemInfoDict[localPlayerController] = value;
				}
			}
		}

		[HarmonyPatch(typeof(MenuManager), "OnEnable")]
		[HarmonyPrefix]
		public static void ResetVariables(MenuManager __instance)
		{
			if (grabbingReservedItemInfoDict == null)
			{
				grabbingReservedItemInfoDict = new Dictionary<PlayerControllerB, ReservedItemInfo>();
			}
			if (grabbingReservedItemInfoDict.Count > 0)
			{
				grabbingReservedItemInfoDict.Clear();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void OnLocalPlayerConnect(PlayerControllerB __instance)
		{
			grabbingReservedItemInfoDict[__instance] = null;
		}

		private static GrabbableObject GetCurrentlyGrabbingObject(PlayerControllerB playerController)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			return (GrabbableObject)Traverse.Create((object)playerController).Field("currentlyGrabbingObject").GetValue();
		}

		private static void SetCurrentlyGrabbingObject(PlayerControllerB playerController, GrabbableObject grabbable)
		{
			Traverse.Create((object)playerController).Field("currentlyGrabbingObject").SetValue((object)grabbable);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "BeginGrabObject")]
		[HarmonyPrefix]
		public static bool GrabReservedItemPrefix(PlayerControllerB __instance)
		{
			//IL_0021: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Expected O, but got Unknown
			if (isReservedHotbarFocused)
			{
				return false;
			}
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward);
			RaycastHit val2 = default(RaycastHit);
			if (!Physics.Raycast(val, ref val2, __instance.grabDistance, PlayerControllerPatcher.INTERACTABLE_OBJECT_MASK) || ((Component)((RaycastHit)(ref val2)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref val2)).collider).tag == "PhysicsProp") || __instance.twoHanded || __instance.sinkingValue > 0.73f)
			{
				grabbingReservedItemInfoLocal = null;
				return true;
			}
			GrabbableObject component = ((Component)((Component)((RaycastHit)(ref val2)).collider).transform).gameObject.GetComponent<GrabbableObject>();
			grabbingReservedItemInfoLocal = Plugin.GetReservedItemInfo(component);
			if (grabbingReservedItemInfoLocal == null)
			{
				return true;
			}
			if (!GameNetworkManager.Instance.gameHasStarted && !component.itemProperties.canBeGrabbedBeforeGameStart && !StartOfRound.Instance.testRoom.activeSelf)
			{
				return false;
			}
			Traverse.Create((object)__instance).Field("grabInvalidated").SetValue((object)false);
			SetCurrentlyGrabbingObject(__instance, component);
			if (__instance.inSpecialInteractAnimation || component.isHeld || component.isPocketed)
			{
				return false;
			}
			NetworkObject networkObject = ((NetworkBehaviour)component).NetworkObject;
			if ((Object)(object)networkObject == (Object)null || !networkObject.IsSpawned)
			{
				return false;
			}
			if (grabbingReservedItemInfoLocal == null || !IsItemSlotEmpty(grabbingReservedItemInfoLocal))
			{
				return true;
			}
			((Behaviour)__instance.cursorIcon).enabled = false;
			((TMP_Text)__instance.cursorTip).text = "";
			__instance.twoHanded = component.itemProperties.twoHanded;
			__instance.carryWeight += Mathf.Clamp(component.itemProperties.weight - 1f, 0f, 10f);
			__instance.grabObjectAnimationTime = 0f;
			MethodInfo method = ((object)__instance).GetType().GetMethod("GrabObjectServerRpc", BindingFlags.Instance | BindingFlags.NonPublic);
			method.Invoke(__instance, new object[1] { NetworkObjectReference.op_Implicit(networkObject) });
			Coroutine val3 = (Coroutine)Traverse.Create((object)__instance).Field("grabObjectCoroutine").GetValue();
			if (val3 != null)
			{
				((MonoBehaviour)__instance).StopCoroutine(val3);
			}
			MethodInfo method2 = ((object)__instance).GetType().GetMethod("GrabObject", BindingFlags.Instance | BindingFlags.NonPublic);
			val3 = ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)method2.Invoke(__instance, new object[0]));
			Traverse.Create((object)__instance).Field("grabObjectCoroutine").SetValue((object)val3);
			return false;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")]
		[HarmonyPrefix]
		public static bool GrabReservedItemClientRpcPrefix(bool grabValidated, NetworkObjectReference grabbedObject, PlayerControllerB __instance)
		{
			if (!NetworkHelper.IsClientExecStage((NetworkBehaviour)(object)__instance))
			{
				return true;
			}
			if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsListening)
			{
				if (grabValidated)
				{
					NetworkObject val = default(NetworkObject);
					if (((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null))
					{
						GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>();
						ReservedItemInfo reservedItemInfo = Plugin.GetReservedItemInfo(component);
						if (reservedItemInfo != null && IsItemSlotEmpty(reservedItemInfo, __instance))
						{
							__instance.ItemSlots[reservedItemInfo.indexInInventory] = component;
							component.playerHeldBy = __instance;
							component.isHeld = true;
							component.EnablePhysics(false);
							component.hasHitGround = false;
							component.isInFactory = __instance.isInsideFactory;
							component.EnableItemMeshes(false);
							Traverse.Create((object)component).Field("previousPlayerHeldBy").SetValue((object)__instance);
							component.PocketItem();
							if ((Object)(object)__instance != (Object)(object)localPlayerController)
							{
								Plugin.Log("Grab object completed on client: " + __instance.actualClientId);
								if ((Object)(object)component.itemProperties.grabSFX != (Object)null)
								{
									__instance.itemAudio.PlayOneShot(component.itemProperties.grabSFX, 1f);
								}
								grabbingReservedItemInfoDict[__instance] = null;
							}
							else
							{
								HUDManager.Instance.itemSlotIcons[reservedItemInfo.indexInInventory].sprite = component.itemProperties.itemIcon;
								((Behaviour)HUDManager.Instance.itemSlotIcons[reservedItemInfo.indexInInventory]).enabled = true;
								HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, 1.5f, 1f, 0.13f);
								previouslyHeldObjectServer = localPlayerController.currentlyHeldObjectServer;
								localPlayerController.currentlyHeldObjectServer = component;
							}
							return false;
						}
					}
				}
				else if ((Object)(object)__instance == (Object)(object)localPlayerController)
				{
					Plugin.Log("Failed to validate ReservedItemGrab by the local player. Object id: " + ((NetworkObjectReference)(ref grabbedObject)).NetworkObjectId + ".");
					Traverse.Create((object)localPlayerController).Field("grabInvalidated").SetValue((object)true);
				}
				else
				{
					Plugin.Log("Failed to validate ReservedItemGrab by player with id: " + __instance.actualClientId + ". Object id: " + ((NetworkObjectReference)(ref grabbedObject)).NetworkObjectId + ".");
				}
			}
			grabbingReservedItemInfoDict[__instance] = null;
			return true;
		}

		[HarmonyPatch(typeof(GrabbableObject), "GrabItemOnClient")]
		[HarmonyPrefix]
		public static void OnReservedItemGrabbed(GrabbableObject __instance)
		{
			if (grabbingReservedItemInfoLocal != null && !((Object)(object)__instance != (Object)(object)GetCurrentlyGrabbingObject(localPlayerController)))
			{
				OnLocalPlayerGrabbedReservedItem();
				__instance.PocketItem();
			}
		}

		private static void OnLocalPlayerGrabbedReservedItem()
		{
			localPlayerController.currentlyHeldObjectServer = previouslyHeldObjectServer;
			previouslyHeldObjectServer = null;
			grabbingReservedItemInfoLocal = null;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "FirstEmptyItemSlot")]
		[HarmonyPostfix]
		public static void GetReservedItemSlotPlacementIndex(ref int __result, PlayerControllerB __instance)
		{
			ReservedItemInfo reservedItemInfo = grabbingReservedItemInfoDict[__instance];
			if (reservedItemInfo != null)
			{
				if (__result == reservedItemInfo.indexInInventory && IsItemSlotEmpty(reservedItemInfo, __instance))
				{
					return;
				}
				grabbingReservedItemInfoDict[__instance] = null;
			}
			if (__result < unreservedHotbarSize)
			{
				return;
			}
			__result = -1;
			for (int i = 0; i < unreservedHotbarSize; i++)
			{
				if ((Object)(object)__instance.ItemSlots[i] == (Object)null)
				{
					__result = i;
					break;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "NextItemSlot")]
		[HarmonyPrefix]
		public static bool PreventScrollingOtherHotbar(ref int __result, bool forward, PlayerControllerB __instance)
		{
			__result = __instance.currentItemSlot;
			bool flag = __instance.currentItemSlot >= unreservedHotbarSize;
			int num = (forward ? 1 : (-1));
			if (!flag)
			{
				__result = Mathf.Clamp(__result, 0, unreservedHotbarSize - 1) + num;
				if (__result < 0)
				{
					__result = unreservedHotbarSize - 1;
				}
				else if (__result >= unreservedHotbarSize)
				{
					__result = 0;
				}
			}
			else
			{
				__result = Mathf.Clamp(__result, unreservedHotbarSize, combinedHotbarSize - 1) + num;
				if (__result < unreservedHotbarSize)
				{
					__result = combinedHotbarSize - 1;
				}
				else if (__result >= combinedHotbarSize)
				{
					__result = unreservedHotbarSize;
				}
			}
			return false;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPrefix]
		public static void RefocusReservedHotbarAfterAnimation(PlayerControllerB __instance)
		{
			if (!((Object)(object)__instance != (Object)(object)localPlayerController) && Keybinds.holdingModifierKey != isReservedHotbarFocused && !__instance.inSpecialInteractAnimation)
			{
				SetFocusReservedHotbarSlots(Keybinds.holdingModifierKey);
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "UpdateSpecialAnimationValue")]
		[HarmonyPostfix]
		public static void OnSpecialAnimationUpdate(bool specialAnimation, PlayerControllerB __instance, short yVal = 0, float timed = 0f, bool climbingLadder = false)
		{
			if (!((Object)(object)__instance != (Object)(object)localPlayerController))
			{
				if (specialAnimation && isReservedHotbarFocused)
				{
					SetFocusReservedHotbarSlots(active: false);
				}
				if (!specialAnimation && isReservedHotbarFocused != Keybinds.holdingModifierKey)
				{
					SetFocusReservedHotbarSlots(Keybinds.holdingModifierKey);
				}
			}
		}

		public static void SetFocusReservedHotbarSlots(bool active)
		{
			if (reservedHotbarSize <= 0 || isReservedHotbarFocused == active)
			{
				return;
			}
			Plugin.Log("SettingFocusReservedHotbar to: " + active);
			isReservedHotbarFocused = active;
			int num = localPlayerController.currentItemSlot;
			if (isReservedHotbarFocused && num < unreservedHotbarSize)
			{
				if (indexFocusedReservedHotbar == -1)
				{
					indexFocusedReservedHotbar = unreservedHotbarSize;
				}
				indexUnfocusedReservedHotbar = num;
				num = Mathf.Max(indexFocusedReservedHotbar, unreservedHotbarSize);
				if ((Object)(object)localPlayerController.ItemSlots[num] == (Object)null)
				{
					for (int i = 0; i < reservedHotbarSize; i++)
					{
						int num2 = unreservedHotbarSize + i;
						if ((Object)(object)localPlayerController.ItemSlots[num2] != (Object)null)
						{
							num = num2;
							break;
						}
					}
				}
			}
			else if (!isReservedHotbarFocused && num >= unreservedHotbarSize)
			{
				indexFocusedReservedHotbar = num;
				num = Mathf.Min(indexUnfocusedReservedHotbar, unreservedHotbarSize - 1);
			}
			HotbarSlotSync.SwapHotbarSlot(num);
		}

		public static bool IsItemSlotEmpty(string itemName, PlayerControllerB player = null)
		{
			return IsItemSlotEmpty(Plugin.GetReservedItemInfo(itemName), player);
		}

		public static bool IsItemSlotEmpty(ReservedItemInfo itemInfo, PlayerControllerB player = null)
		{
			if ((Object)(object)player == (Object)null)
			{
				player = localPlayerController;
			}
			if ((Object)(object)player == (Object)null)
			{
				return false;
			}
			return itemInfo != null && itemInfo.indexInInventory < player.ItemSlots.Length && (Object)(object)player.ItemSlots[itemInfo.indexInInventory] == (Object)null;
		}

		public static GrabbableObject GetHeldReservedObject(string itemName, PlayerControllerB player = null)
		{
			if ((Object)(object)player == (Object)null)
			{
				player = localPlayerController;
			}
			if ((Object)(object)player == (Object)null)
			{
				return null;
			}
			int reservedItemHotbarIndex = Plugin.GetReservedItemHotbarIndex(itemName);
			return (reservedItemHotbarIndex >= 0 && reservedItemHotbarIndex < player.ItemSlots.Length && (Object)(object)player.ItemSlots[reservedItemHotbarIndex] != (Object)null) ? player.ItemSlots[reservedItemHotbarIndex] : null;
		}

		[HarmonyPatch(typeof(GrabbableObject), "Start")]
		[HarmonyPostfix]
		public static void InitializeReservedItemProperties(GrabbableObject __instance)
		{
			ReservedItemInfo reservedItemInfo = Plugin.GetReservedItemInfo(__instance.itemProperties.itemName);
			if (reservedItemInfo != null)
			{
				if (reservedItemInfo.forceUpdateCanBeGrabbedBeforeGameStart)
				{
					__instance.itemProperties.canBeGrabbedBeforeGameStart = reservedItemInfo.canBeGrabbedBeforeGameStart;
				}
				if (reservedItemInfo.forceUpdateRequiresBattery)
				{
					__instance.itemProperties.requiresBattery = reservedItemInfo.requiresBattery;
				}
			}
		}

		[HarmonyPatch(typeof(HUDManager), "Awake")]
		[HarmonyPrefix]
		public static void Initialize(HUDManager __instance)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			canvasScaler = ((Component)__instance.itemSlotIconFrames[0]).GetComponentInParent<CanvasScaler>();
			aspectRatioFitter = ((Component)__instance.itemSlotIconFrames[0]).GetComponentInParent<AspectRatioFitter>();
			iconWidth = ((Component)__instance.itemSlotIconFrames[0]).GetComponent<RectTransform>().sizeDelta.x;
			xPos = canvasScaler.referenceResolution.x / 2f / aspectRatioFitter.aspectRatio - iconWidth / 4f;
		}

		[HarmonyPatch(typeof(HUDManager), "Start")]
		[HarmonyPostfix]
		public static void AddNewHotbarSlotsHud(HUDManager __instance)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			if (reservedHotbarSize > 0)
			{
				List<Image> list = new List<Image>(__instance.itemSlotIconFrames);
				List<Image> list2 = new List<Image>(__instance.itemSlotIcons);
				float y = ((Component)list[0]).GetComponent<RectTransform>().sizeDelta.y;
				Vector3 eulerAngles = ((Transform)((Component)list[0]).GetComponent<RectTransform>()).eulerAngles;
				Vector3 eulerAngles2 = ((Transform)((Component)list2[0]).GetComponent<RectTransform>()).eulerAngles;
				Plugin.Log($"Adding {ReservedItemInfo.reservedItemsList.Count} Reserved Item slots to the inventory HUD. Previous inventory HUD size: {unreservedHotbarSize}");
				for (int i = 0; i < Plugin.reservedItemSlotReps.Count; i++)
				{
					ReservedItemInfo reservedItemInfo = Plugin.reservedItemSlotReps[i];
					Plugin.Log($"Adding Reserved Item slot for item types [{reservedItemInfo.itemName}]. Inventory index: {list.Count}");
					float num = ((Graphic)list[0]).rectTransform.anchoredPosition.y + 1.125f * y * (float)i;
					Image val = Object.Instantiate<Image>(list[unreservedHotbarSize - 1], ((Component)list[0]).transform.parent);
					((Object)val).name = $"ReservedItemSlot{i} [{reservedItemInfo.itemName}]";
					((Graphic)val).rectTransform.anchoredPosition = new Vector2(xPos, num);
					((Transform)((Graphic)val).rectTransform).eulerAngles = eulerAngles;
					CanvasGroup val2 = ((Component)val).gameObject.AddComponent<CanvasGroup>();
					val2.ignoreParentGroups = true;
					val2.alpha = 1f;
					Image component = ((Component)((Component)val).transform.GetChild(0)).GetComponent<Image>();
					((Object)component).name = "Icon";
					((Transform)((Graphic)component).rectTransform).eulerAngles = eulerAngles2;
					list.Add(val);
					list2.Add(component);
				}
				if (Plugin.numReservedItemSlots > 0)
				{
					TextMeshProUGUI component2 = new GameObject("ReservedItemSlotTooltip", new Type[2]
					{
						typeof(RectTransform),
						typeof(TextMeshProUGUI)
					}).GetComponent<TextMeshProUGUI>();
					RectTransform rectTransform = ((TMP_Text)component2).rectTransform;
					((Component)rectTransform).transform.parent = ((Component)list[unreservedHotbarSize]).transform;
					((Transform)rectTransform).localScale = Vector3.one;
					rectTransform.sizeDelta = new Vector2(((Graphic)list[unreservedHotbarSize]).rectTransform.sizeDelta.x * 2f, 10f);
					rectTransform.pivot = Vector2.one / 2f;
					rectTransform.anchoredPosition3D = new Vector3(0f, (0f - rectTransform.sizeDelta.x / 2f) * 1.2f, 0f);
					((TMP_Text)component2).font = ((TMP_Text)__instance.controlTipLines[0]).font;
					((TMP_Text)component2).fontSize = 7f;
					((TMP_Text)component2).alignment = (TextAlignmentOptions)514;
					((TMP_Text)component2).text = string.Format($"Hold: [{ConfigSettings.GetDisplayName(ConfigSettings.focusReservedHotbarHotkey.Value)}]");
				}
				__instance.itemSlotIconFrames = list.ToArray();
				__instance.itemSlotIcons = list2.ToArray();
				Plugin.Log($"Finished adding {list.Count - unreservedHotbarSize} Reserved Item slots in the inventory HUD.");
			}
		}
	}
}
namespace ReservedItemSlotCore.Networking
{
	public static class NetworkHelper
	{
		private static int NONE_EXEC_STAGE = 0;

		private static int SERVER_EXEC_STAGE = 1;

		private static int CLIENT_EXEC_STAGE = 2;

		public static int GetExecStage(NetworkBehaviour __instance)
		{
			return (int)Traverse.Create((object)__instance).Field("__rpc_exec_stage").GetValue();
		}

		public static bool IsClientExecStage(NetworkBehaviour __instance)
		{
			return GetExecStage(__instance) == CLIENT_EXEC_STAGE;
		}

		public static bool IsServerExecStage(NetworkBehaviour __instance)
		{
			return GetExecStage(__instance) == SERVER_EXEC_STAGE;
		}

		public static bool IsValidClientRpcExecStage(NetworkBehaviour __instance)
		{
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null || !singleton.IsListening)
			{
				return false;
			}
			int num = (int)Traverse.Create((object)__instance).Field("__rpc_exec_stage").GetValue();
			if ((singleton.IsServer || singleton.IsHost) && num != 2)
			{
				return false;
			}
			return true;
		}
	}
}

FlipMods-ReservedWalkieSlot/ReservedWalkieSlot.dll.old

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using ReservedItemSlotCore;
using ReservedItemSlotCore.Patches;
using ReservedWalkieSlot.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ReservedWalkieSlot")]
[assembly: AssemblyDescription("Mod made by flipf17")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReservedWalkieSlot")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c15c320f-d8fc-4f1c-be3c-f2d2ffc41edd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ReservedWalkieSlot
{
	public static class ConfigSettings
	{
		public static ConfigEntry<string> activateWalkieKey;

		public static string activateWalkieDisplayName;

		public static void BindConfigSettings()
		{
			Plugin.Log("BindingConfigs");
			activateWalkieKey = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("ReservedWalkieSlot", "ActivateWalkieKey", "<Keyboard>/x", "Activate walkie keybind.");
			activateWalkieDisplayName = GetDisplayName(activateWalkieKey.Value);
		}

		public static string GetDisplayName(string key)
		{
			key = key.Replace("<Keyboard>/", "");
			key = key.Replace("<Mouse>/", "");
			string text = key;
			text = text.Replace("leftAlt", "Alt");
			text = text.Replace("rightAlt", "Alt");
			text = text.Replace("leftCtrl", "Ctrl");
			text = text.Replace("rightCtrl", "Ctrl");
			text = text.Replace("leftShift", "Shift");
			text = text.Replace("rightShift", "Shift");
			text = text.Replace("leftButton", "LMB");
			text = text.Replace("rightButton", "RMB");
			return text.Replace("middleButton", "MMB");
		}
	}
	[HarmonyPatch]
	internal static class Keybinds
	{
		public static PlayerControllerB localPlayerController;

		private static InputAction activateWalkieAction;

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		public static void OnLocalPlayerConnect(PlayerControllerB __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			localPlayerController = __instance;
			activateWalkieAction = new InputAction((string)null, (InputActionType)0, ConfigSettings.activateWalkieKey.Value, (string)null, (string)null, (string)null);
			if (((Component)localPlayerController).gameObject.activeSelf)
			{
				SubscribeToEvents();
			}
		}

		private static void SubscribeToEvents()
		{
			if (activateWalkieAction != null)
			{
				activateWalkieAction.performed += OnPressWalkieButtonPerformed;
				activateWalkieAction.canceled += OnReleaseWalkieButtonPerformed;
				activateWalkieAction.Enable();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "OnEnable")]
		[HarmonyPostfix]
		public static void OnEnable(PlayerControllerB __instance)
		{
			if ((Object)(object)__instance == (Object)(object)localPlayerController)
			{
				SubscribeToEvents();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable()
		{
			if (activateWalkieAction != null)
			{
				activateWalkieAction.performed -= OnPressWalkieButtonPerformed;
				activateWalkieAction.canceled -= OnReleaseWalkieButtonPerformed;
				activateWalkieAction.Disable();
			}
		}

		private static void OnPressWalkieButtonPerformed(CallbackContext context)
		{
			if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerControlled || (((NetworkBehaviour)localPlayerController).IsServer && !localPlayerController.isHostPlayerObject))
			{
				return;
			}
			WalkieTalkie mainWalkie = ReservedWalkieSlotPatcher.GetMainWalkie(localPlayerController);
			if (((CallbackContext)(ref context)).performed && !((Object)(object)mainWalkie == (Object)null) && ((GrabbableObject)mainWalkie).isBeingUsed)
			{
				float num = (float)Traverse.Create((object)localPlayerController).Field("timeSinceSwitchingSlots").GetValue();
				if (!(num < 0.075f))
				{
					Plugin.Log("Talking into walkie");
					ShipBuildModeManager.Instance.CancelBuildMode(true);
					((GrabbableObject)mainWalkie).UseItemOnClient(true);
					Traverse.Create((object)localPlayerController).Field("timeSinceSwitchingSlots").SetValue((object)0);
				}
			}
		}

		private static void OnReleaseWalkieButtonPerformed(CallbackContext context)
		{
			if (!((Object)(object)localPlayerController == (Object)null) && localPlayerController.isPlayerControlled && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject))
			{
				WalkieTalkie mainWalkie = ReservedWalkieSlotPatcher.GetMainWalkie(localPlayerController);
				if (((CallbackContext)(ref context)).canceled && !((Object)(object)mainWalkie == (Object)null))
				{
					Plugin.Log("Not talking into walkie");
					ShipBuildModeManager.Instance.CancelBuildMode(true);
					((GrabbableObject)mainWalkie).UseItemOnClient(false);
				}
			}
		}
	}
	[BepInPlugin("FlipMods.ReservedWalkieSlot", "ReservedWalkieSlot", "1.4.1")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		private Harmony _harmony;

		public static ReservedItemInfo walkieInfo = new ReservedItemInfo("Walkie-talkie", 100, true, true, true, true);

		private void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			instance = this;
			ConfigSettings.BindConfigSettings();
			_harmony = new Harmony("ReservedWalkieSlot");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ReservedWalkieSlot loaded");
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.ReservedWalkieSlot";

		public const string PLUGIN_NAME = "ReservedWalkieSlot";

		public const string PLUGIN_VERSION = "1.4.1";
	}
}
namespace ReservedWalkieSlot.Patches
{
	[HarmonyPatch]
	internal static class ReservedWalkieSlotPatcher
	{
		private static Vector3 localPlayerShoulderPositionOffset = new Vector3(0.125f, 0.4f, 0.125f);

		private static Vector3 playerShoulderPositionOffset = new Vector3(0.15f, -0.05f, 0.25f);

		private static Vector3 playerShoulderRotationOffset = new Vector3(0f, 270f, 100f);

		private static string originalControlTooltip = "";

		public static PlayerControllerB localPlayerController => PlayerControllerPatcher.localPlayerController;

		public static WalkieTalkie GetMainWalkie(PlayerControllerB playerController)
		{
			return GetCurrentlySelectedWalkie(playerController) ?? GetReservedWalkie(playerController);
		}

		public static WalkieTalkie GetReservedWalkie(PlayerControllerB playerController)
		{
			GrabbableObject obj = ((playerController != null) ? playerController.ItemSlots[Plugin.walkieInfo.indexInInventory] : null);
			return (WalkieTalkie)(object)((obj is WalkieTalkie) ? obj : null);
		}

		public static WalkieTalkie GetCurrentlySelectedWalkie(PlayerControllerB playerController)
		{
			GrabbableObject obj = ((playerController != null) ? playerController.ItemSlots[playerController.currentItemSlot] : null);
			return (WalkieTalkie)(object)((obj is WalkieTalkie) ? obj : null);
		}

		[HarmonyPatch(typeof(WalkieTalkie), "__initializeVariables")]
		[HarmonyPostfix]
		public static void EditTooltips(WalkieTalkie __instance)
		{
			if (originalControlTooltip == "")
			{
				originalControlTooltip = ((GrabbableObject)__instance).itemProperties.toolTips[((GrabbableObject)__instance).itemProperties.toolTips.Length - 1];
			}
			((GrabbableObject)__instance).itemProperties.toolTips[((GrabbableObject)__instance).itemProperties.toolTips.Length - 1] = $"{originalControlTooltip}[{ConfigSettings.activateWalkieDisplayName.ToUpper()}]";
		}

		[HarmonyPatch(typeof(MenuManager), "OnEnable")]
		[HarmonyPostfix]
		public static void ResetVariables()
		{
			Keybinds.localPlayerController = null;
		}

		[HarmonyPatch(typeof(WalkieTalkie), "PocketItem")]
		[HarmonyPostfix]
		public static void OnPocketWalkie(WalkieTalkie __instance)
		{
			if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null))
			{
				if ((Object)(object)__instance == (Object)(object)GetReservedWalkie(((GrabbableObject)__instance).playerHeldBy) && (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)(object)localPlayerController)
				{
					((GrabbableObject)__instance).EnableItemMeshes(true);
				}
				((GrabbableObject)__instance).parentObject = ((Component)((GrabbableObject)__instance).playerHeldBy.playerBadgeMesh).transform.parent;
			}
		}

		[HarmonyPatch(typeof(WalkieTalkie), "EquipItem")]
		[HarmonyPostfix]
		public static void OnEquipWalkie(WalkieTalkie __instance)
		{
			if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null))
			{
				((GrabbableObject)__instance).parentObject = (((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)localPlayerController) ? ((GrabbableObject)__instance).playerHeldBy.localItemHolder : ((GrabbableObject)__instance).playerHeldBy.serverItemHolder);
			}
		}

		[HarmonyPatch(typeof(GrabbableObject), "LateUpdate")]
		[HarmonyPostfix]
		public static void SetPositionOffset(GrabbableObject __instance)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			if (__instance is WalkieTalkie && (Object)(object)__instance.playerHeldBy != (Object)null && __instance.isPocketed && (Object)(object)__instance.parentObject != (Object)null && (Object)(object)__instance != (Object)(object)GetCurrentlySelectedWalkie(__instance.playerHeldBy))
			{
				Transform transform = ((Component)__instance.parentObject).transform;
				((Component)__instance).transform.rotation = ((Component)__instance.parentObject).transform.rotation * Quaternion.Euler(playerShoulderRotationOffset);
				((Component)__instance).transform.position = transform.position + transform.rotation * playerShoulderPositionOffset;
			}
		}

		[HarmonyPatch(typeof(GrabbableObject), "EnableItemMeshes")]
		[HarmonyPrefix]
		public static void OnEnableItemMeshes(ref bool enable, GrabbableObject __instance)
		{
			if (__instance is FlashlightItem && (Object)(object)__instance.playerHeldBy != (Object)null && ((Object)(object)__instance.playerHeldBy != (Object)(object)localPlayerController || (Object)(object)__instance == (Object)(object)GetCurrentlySelectedWalkie(__instance.playerHeldBy)))
			{
				enable = true;
			}
		}
	}
}

malco-Lategame_Upgrades/MoreShipUpgrades/MoreShipUpgrades.dll

Decompiled 6 months ago
using System;
using System.Collections;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using MoreShipUpgrades.Managers;
using MoreShipUpgrades.Misc;
using MoreShipUpgrades.UpgradeComponents;
using Newtonsoft.Json;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[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: AssemblyVersion("0.0.0.0")]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace MoreShipUpgrades
{
	[BepInPlugin("com.malco.lethalcompany.moreshipupgrades", "More Ship Upgrades", "1.3.1")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.malco.lethalcompany.moreshipupgrades");

		public static Plugin instance;

		public static ManualLogSource mls;

		public static PluginConfig cfg { get; private set; }

		private void Awake()
		{
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Expected O, but got Unknown
			cfg = new PluginConfig(((BaseUnityPlugin)this).Config);
			cfg.InitBindings();
			mls = Logger.CreateLogSource("More Ship Upgrades");
			instance = this;
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "shipupgrades");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			GameObject val2 = new GameObject("UpgradeBus");
			val2.AddComponent<UpgradeBus>();
			GameObject val3 = val.LoadAsset<GameObject>("Assets/ShipUpgrades/LGUStore.prefab");
			val3.AddComponent<LGUStore>();
			NetworkPrefabs.RegisterNetworkPrefab(val3);
			UpgradeBus.instance.modStorePrefab = val3;
			AudioClip itemBreak = val.LoadAsset<AudioClip>("Assets/ShipUpgrades/break.mp3");
			AudioClip error = val.LoadAsset<AudioClip>("Assets/ShipUpgrades/error.mp3");
			AudioClip buttonPress = val.LoadAsset<AudioClip>("Assets/ShipUpgrades/ButtonPress2.ogg");
			Item val4 = val.LoadAsset<Item>("Assets/ShipUpgrades/TpButton.asset");
			val4.itemName = "Portable Tele";
			TPButtonScript tPButtonScript = val4.spawnPrefab.AddComponent<TPButtonScript>();
			((GrabbableObject)tPButtonScript).itemProperties = val4;
			((GrabbableObject)tPButtonScript).grabbable = true;
			((GrabbableObject)tPButtonScript).grabbableToEnemies = true;
			tPButtonScript.ItemBreak = itemBreak;
			((GrabbableObject)tPButtonScript).useCooldown = 2f;
			tPButtonScript.error = error;
			tPButtonScript.buttonPress = buttonPress;
			val4.creditsWorth = cfg.WEAK_TELE_PRICE;
			NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
			if (cfg.WEAK_TELE_ENABLED)
			{
				TerminalNode val5 = new TerminalNode();
				val5.displayText = "A button that when pressed teleports you and your loot back to the ship. Must have Ship Teleporter unlocked!!!\n\nHas a 90% chance to self destruct on use.";
				Items.RegisterShopItem(val4, (TerminalNode)null, (TerminalNode)null, val5, val4.creditsWorth);
			}
			Item val6 = val.LoadAsset<Item>("Assets/ShipUpgrades/TpButtonAdv.asset");
			val6.creditsWorth = cfg.ADVANCED_TELE_PRICE;
			val6.itemName = "Advanced Portable Tele";
			AdvTPButtonScript advTPButtonScript = val6.spawnPrefab.AddComponent<AdvTPButtonScript>();
			((GrabbableObject)advTPButtonScript).itemProperties = val6;
			((GrabbableObject)advTPButtonScript).grabbable = true;
			((GrabbableObject)advTPButtonScript).useCooldown = 2f;
			((GrabbableObject)advTPButtonScript).grabbableToEnemies = true;
			advTPButtonScript.ItemBreak = itemBreak;
			advTPButtonScript.error = error;
			advTPButtonScript.buttonPress = buttonPress;
			NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
			if (cfg.ADVANCED_TELE_ENABLED)
			{
				TerminalNode val7 = new TerminalNode();
				val7.displayText = "A button that when pressed teleports you and your loot back to the ship. Must have Ship Teleporter unlocked!!!";
				Items.RegisterShopItem(val6, (TerminalNode)null, (TerminalNode)null, val7, val6.creditsWorth);
			}
			Item val8 = val.LoadAsset<Item>("Assets/ShipUpgrades/beekeeper.asset");
			val8.spawnPrefab.AddComponent<beekeeperScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab);
			if (cfg.BEEKEEPER_ENABLED)
			{
				CustomTerminalNode item = new CustomTerminalNode("Beekeeper", cfg.BEEKEEPER_PRICE, $"Circuit bees do %{Mathf.Round(100f * cfg.BEEKEEPER_DAMAGE_MULTIPLIER)} of their base damage.", val8.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item);
			}
			Item val9 = val.LoadAsset<Item>("Assets/ShipUpgrades/BiggerLungs.asset");
			val9.spawnPrefab.AddComponent<biggerLungScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
			if (cfg.BIGGER_LUNGS_ENABLED)
			{
				CustomTerminalNode item2 = new CustomTerminalNode("Bigger Lungs", cfg.BIGGER_LUNGS_PRICE, $"Stamina Time is {UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE - 11f} units longer", val9.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item2);
			}
			Item val10 = val.LoadAsset<Item>("Assets/ShipUpgrades/runningShoes.asset");
			val10.spawnPrefab.AddComponent<runningShoeScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab);
			if (cfg.RUNNING_SHOES_ENABLED)
			{
				CustomTerminalNode item3 = new CustomTerminalNode("Running Shoes", cfg.RUNNING_SHOES_PRICE, $"You can run {UpgradeBus.instance.cfg.MOVEMENT_SPEED - 4.6f} units faster", val10.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item3);
			}
			Item val11 = val.LoadAsset<Item>("Assets/ShipUpgrades/strongLegs.asset");
			val11.spawnPrefab.AddComponent<strongLegsScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val11.spawnPrefab);
			if (cfg.STRONG_LEGS_ENABLED)
			{
				CustomTerminalNode item4 = new CustomTerminalNode("Strong Legs", cfg.STRONG_LEGS_PRICE, $"Jump {cfg.JUMP_FORCE - 13f} units higher.", val11.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item4);
			}
			Item val12 = val.LoadAsset<Item>("Assets/ShipUpgrades/destructiveCodes.asset");
			val12.spawnPrefab.AddComponent<trapDestroyerScript>();
			string text2 = "";
			text2 = ((!cfg.DESTROY_TRAP) ? $"Broadcasted codes now disable map hazards for {cfg.DISARM_TIME} seconds." : ((!cfg.EXPLODE_TRAP) ? "Broadcasted codes now destroy map hazards." : "Broadcasted codes now explode map hazards."));
			NetworkPrefabs.RegisterNetworkPrefab(val12.spawnPrefab);
			if (cfg.MALWARE_BROADCASTER_ENABLED)
			{
				CustomTerminalNode item5 = new CustomTerminalNode("Malware Broadcaster", cfg.MALWARE_BROADCASTER_PRICE, text2, val12.spawnPrefab);
				UpgradeBus.instance.terminalNodes.Add(item5);
			}
			Item val13 = val.LoadAsset<Item>("Assets/ShipUpgrades/LightFooted.asset");
			val13.spawnPrefab.AddComponent<lightFootedScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab);
			if (cfg.LIGHT_FOOTED_ENABLED)
			{
				CustomTerminalNode item6 = new CustomTerminalNode("Light Footed", cfg.LIGHT_FOOTED_PRICE, $"Audible Noise Distance is reduced by {UpgradeBus.instance.cfg.NOISE_REDUCTION} units. \nApplies to both sprinting and walking.", val13.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item6);
			}
			Item val14 = val.LoadAsset<Item>("Assets/ShipUpgrades/NightVision.asset");
			val14.spawnPrefab.AddComponent<nightVisionScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val14.spawnPrefab);
			if (cfg.NIGHT_VISION_ENABLED)
			{
				CustomTerminalNode item7 = new CustomTerminalNode("Night Vision", cfg.NIGHT_VISION_PRICE, $"Allows you to see in the dark. Press Left-Alt to turn on.  \nDrain speed is {cfg.NIGHT_VIS_DRAIN_SPEED}  \nRegen speed is {cfg.NIGHT_VIS_REGEN_SPEED}", val14.spawnPrefab);
				UpgradeBus.instance.terminalNodes.Add(item7);
			}
			Item val15 = val.LoadAsset<Item>("Assets/ShipUpgrades/terminalFlash.asset");
			AudioClip flashNoise = val.LoadAsset<AudioClip>("Assets/ShipUpgrades/flashbangsfx.ogg");
			UpgradeBus.instance.flashNoise = flashNoise;
			val15.spawnPrefab.AddComponent<terminalFlashScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val15.spawnPrefab);
			if (cfg.DISCOMBOBULATOR_ENABLED)
			{
				CustomTerminalNode item8 = new CustomTerminalNode("Discombobulator", cfg.DISCOMBOBULATOR_PRICE, $"Stun enemies around your ship in a {cfg.DISCOMBOBULATOR_RADIUS} unit radius.", val15.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item8);
			}
			Item val16 = val.LoadAsset<Item>("Assets/ShipUpgrades/strongScanner.asset");
			val16.spawnPrefab.AddComponent<strongerScannerScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val16.spawnPrefab);
			if (cfg.BETTER_SCANNER_ENABLED)
			{
				string text3 = (cfg.REQUIRE_LINE_OF_SIGHT ? "Does not remove" : "Removes");
				string text4 = $"Increase distance nodes can be scanned by {cfg.NODE_DISTANCE_INCREASE} units.  \nIncrease distance Ship and Entrance can be scanned by {cfg.SHIP_AND_ENTRANCE_DISTANCE_INCREASE} units.  \n";
				text4 = text4 + text3 + " LOS requirement";
				CustomTerminalNode item9 = new CustomTerminalNode("Better Scanner", cfg.BETTER_SCANNER_PRICE, text4, val16.spawnPrefab);
				UpgradeBus.instance.terminalNodes.Add(item9);
			}
			Item val17 = val.LoadAsset<Item>("Assets/ShipUpgrades/exoskeleton.asset");
			val17.spawnPrefab.AddComponent<exoskeletonScript>();
			NetworkPrefabs.RegisterNetworkPrefab(val17.spawnPrefab);
			if (cfg.BACK_MUSCLES_ENABLED)
			{
				CustomTerminalNode item10 = new CustomTerminalNode("Back Muscles", cfg.BACK_MUSCLES_PRICE, $"Carry weight becomes %{Mathf.Round(cfg.CARRY_WEIGHT_REDUCTION * 100f)} of original", val17.spawnPrefab, 3);
				UpgradeBus.instance.terminalNodes.Add(item10);
			}
			UpgradeBus.instance.CreateDeepNodeCopy();
			Debug.Log((object)UpgradeBus.instance.terminalNodes);
			harmony.PatchAll();
			mls.LogInfo((object)"More Ship Upgrades has been patched");
		}
	}
}
namespace MoreShipUpgrades.UpgradeComponents
{
	internal class AdvTPButtonScript : GrabbableObject
	{
		public AudioClip ItemBreak;

		public AudioClip error;

		public AudioClip buttonPress;

		private AudioSource audio;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			audio = ((Component)this).GetComponent<AudioSource>();
			((Component)this).gameObject.GetComponent<NetworkObject>().Spawn(false);
		}

		public override void DiscardItem()
		{
			base.playerHeldBy.activatingItem = false;
			((GrabbableObject)this).DiscardItem();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!Mouse.current.leftButton.isPressed)
			{
				return;
			}
			audio.PlayOneShot(buttonPress);
			if (!base.itemUsedUp)
			{
				ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>();
				ShipTeleporter val = null;
				ShipTeleporter[] array2 = array;
				foreach (ShipTeleporter val2 in array2)
				{
					if (!val2.isInverseTeleporter)
					{
						val = val2;
						break;
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					audio.PlayOneShot(error);
					return;
				}
				int num = -1;
				for (int j = 0; j < StartOfRound.Instance.mapScreen.radarTargets.Count(); j++)
				{
					if ((Object)(object)((Component)StartOfRound.Instance.mapScreen.radarTargets[j].transform).gameObject.GetComponent<PlayerControllerB>() == (Object)(object)base.playerHeldBy)
					{
						num = j;
					}
				}
				if (num == -1)
				{
					StartOfRound.Instance.mapScreen.targetedPlayer = base.playerHeldBy;
					UpgradeBus.instance.TPButtonPressed = true;
					val.PressTeleportButtonOnLocalClient();
				}
				else
				{
					StartOfRound.Instance.mapScreen.SwitchRadarTargetAndSync(num);
					((MonoBehaviour)this).StartCoroutine(WaitToTP(val));
				}
			}
			else
			{
				audio.PlayOneShot(error);
			}
		}

		private IEnumerator WaitToTP(ShipTeleporter tele)
		{
			yield return (object)new WaitForSeconds(0.15f);
			ReqUpdateTpDropStatusServerRpc();
			tele.PressTeleportButtonOnLocalClient();
			if (Random.Range(0f, 1f) < UpgradeBus.instance.cfg.ADV_CHANCE_TO_BREAK)
			{
				audio.PlayOneShot(ItemBreak);
				base.itemUsedUp = true;
				TextMeshProUGUI chatText = HUDManager.Instance.chatText;
				((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>The teleporter button has suffered irreparable damage and destroyed itself!</color>";
				base.playerHeldBy.DespawnHeldObject();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ReqUpdateTpDropStatusServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3988692149u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3988692149u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ChangeTPButtonPressedClientRpc();
				}
			}
		}

		[ClientRpc]
		private void ChangeTPButtonPressedClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2793166939u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2793166939u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					UpgradeBus.instance.TPButtonPressed = true;
				}
			}
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AdvTPButtonScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3988692149u, new RpcReceiveHandler(__rpc_handler_3988692149));
			NetworkManager.__rpc_func_table.Add(2793166939u, new RpcReceiveHandler(__rpc_handler_2793166939));
		}

		private static void __rpc_handler_3988692149(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AdvTPButtonScript)(object)target).ReqUpdateTpDropStatusServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2793166939(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AdvTPButtonScript)(object)target).ChangeTPButtonPressedClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "AdvTPButtonScript";
		}
	}
	internal class beekeeperScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.beekeeper = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Beekeeper is active!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "beekeeper" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Beekeeper", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.beeLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "beekeeper")
				{
					terminalNode.Description = $"Circuit bees do %{Mathf.Round(100f * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT))} of their base damage.";
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "beekeeperScript";
		}
	}
	internal class biggerLungScript : BaseUpgrade
	{
		private PlayerControllerB[] players;

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(LateApply());
		}

		private IEnumerator LateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			players = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array = players;
			foreach (PlayerControllerB player in array)
			{
				player.sprintTime = UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE;
			}
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "Bigger Lungs" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.biggerLungs = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Bigger Lungs is active!</color>";
			UpgradeBus.instance.UpgradeObjects.Add("Bigger Lungs", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.lungLevel++;
			players = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array = players;
			foreach (PlayerControllerB val in array)
			{
				val.sprintTime += UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT;
			}
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "bigger lungs")
				{
					terminalNode.Description = $"Stamina Time is {UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE - 11f + (float)UpgradeBus.instance.lungLevel * UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT} units longer";
				}
			}
		}

		public override void load()
		{
			float num = 0f;
			for (int i = 0; i < UpgradeBus.instance.lungLevel; i++)
			{
				num += UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT;
			}
			players = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array = players;
			foreach (PlayerControllerB val in array)
			{
				val.sprintTime += num;
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "biggerLungScript";
		}
	}
	internal class exoskeletonScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.exoskeleton = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Back Muscles is active!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "back muscles" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Back Muscles", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.backLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "back muscles")
				{
					terminalNode.Description = $"Carry weight becomes %{Mathf.Round((UpgradeBus.instance.cfg.CARRY_WEIGHT_REDUCTION - UpgradeBus.instance.cfg.CARRY_WEIGHT_INCREMENT * (float)UpgradeBus.instance.backLevel) * 100f)} of original";
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "exoskeletonScript";
		}
	}
	internal class lightFootedScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.softSteps = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Light Footed is active!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "light footed" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Light Footed", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.lightLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "light footed")
				{
					terminalNode.Description = $"Audible Noise Distance is reduced by {UpgradeBus.instance.cfg.NOISE_REDUCTION + UpgradeBus.instance.cfg.NOISE_REDUCTION_INCREMENT * (float)UpgradeBus.instance.lightLevel} units. \nApplies to both sprinting and walking.";
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "lightFootedScript";
		}
	}
	internal class nightVisionScript : BaseUpgrade
	{
		private float nightBattery;

		private Transform batteryBar;

		private PlayerControllerB client;

		private bool batteryExhaustion;

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
			batteryBar = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).transform;
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.nightVision = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Press Left-Alt to toggle Night Vision!!!</color>";
			client = GameNetworkManager.Instance.localPlayerController;
			UpgradeBus.instance.UpgradeObjects.Add("Night Vision", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		private void LateUpdate()
		{
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)client == (Object)null)
			{
				return;
			}
			if (((ButtonControl)Keyboard.current[(Key)53]).wasPressedThisFrame && !batteryExhaustion)
			{
				UpgradeBus.instance.nightVisionActive = !UpgradeBus.instance.nightVisionActive;
				if (UpgradeBus.instance.nightVisionActive)
				{
					UpgradeBus.instance.nightVisColor = client.nightVision.color;
					UpgradeBus.instance.nightVisRange = client.nightVision.range;
					UpgradeBus.instance.nightVisIntensity = client.nightVision.intensity;
					client.nightVision.color = UpgradeBus.instance.cfg.NIGHT_VIS_COLOR;
					client.nightVision.range = UpgradeBus.instance.cfg.NIGHT_VIS_RANGE;
					client.nightVision.intensity = UpgradeBus.instance.cfg.NIGHT_VIS_INTENSITY;
					nightBattery -= UpgradeBus.instance.cfg.NIGHT_VIS_STARTUP;
				}
				else
				{
					client.nightVision.color = UpgradeBus.instance.nightVisColor;
					client.nightVision.range = UpgradeBus.instance.nightVisRange;
					client.nightVision.intensity = UpgradeBus.instance.nightVisIntensity;
				}
			}
			if (UpgradeBus.instance.nightVisionActive)
			{
				nightBattery -= Time.deltaTime * UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_SPEED;
				nightBattery = Mathf.Clamp(nightBattery, 0f, 1f);
				((Component)batteryBar.parent).gameObject.SetActive(true);
				if (nightBattery <= 0f)
				{
					UpgradeBus.instance.nightVisionActive = false;
					client.nightVision.color = UpgradeBus.instance.nightVisColor;
					client.nightVision.range = UpgradeBus.instance.nightVisRange;
					client.nightVision.intensity = UpgradeBus.instance.nightVisIntensity;
					batteryExhaustion = true;
					((MonoBehaviour)this).StartCoroutine(BatteryRecovery());
				}
			}
			else if (!batteryExhaustion)
			{
				nightBattery += Time.deltaTime * UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_SPEED;
				nightBattery = Mathf.Clamp(nightBattery, 0f, 1f);
				if (nightBattery >= 1f)
				{
					((Component)batteryBar.parent).gameObject.SetActive(false);
				}
				else
				{
					((Component)batteryBar.parent).gameObject.SetActive(true);
				}
			}
			if (client.isInsideFactory || UpgradeBus.instance.nightVisionActive)
			{
				((Behaviour)client.nightVision).enabled = true;
			}
			else
			{
				((Behaviour)client.nightVision).enabled = false;
			}
			batteryBar.localScale = new Vector3(nightBattery, 1f, 1f);
		}

		private IEnumerator BatteryRecovery()
		{
			yield return (object)new WaitForSeconds(UpgradeBus.instance.cfg.NIGHT_VIS_EXHAUST);
			batteryExhaustion = false;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "nightVisionScript";
		}
	}
	internal class runningShoeScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(LateApply());
		}

		private IEnumerator LateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.runningShoes = true;
			PlayerControllerB[] players = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array = players;
			foreach (PlayerControllerB player in array)
			{
				player.movementSpeed = UpgradeBus.instance.cfg.MOVEMENT_SPEED;
			}
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Running Shoes is active!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "running shoes" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Running Shoes", ((Component)this).gameObject);
			load();
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		}

		public override void Increment()
		{
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array2 = array;
			foreach (PlayerControllerB val in array2)
			{
				val.movementSpeed += UpgradeBus.instance.cfg.MOVEMENT_INCREMENT;
			}
			UpgradeBus.instance.runningLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "running shoes")
				{
					terminalNode.Description = $"You can run {UpgradeBus.instance.cfg.MOVEMENT_SPEED - 4.6f + UpgradeBus.instance.cfg.MOVEMENT_INCREMENT * (float)UpgradeBus.instance.runningLevel} units faster";
				}
			}
		}

		public override void load()
		{
			float num = 0f;
			for (int i = 0; i < UpgradeBus.instance.runningLevel; i++)
			{
				num += UpgradeBus.instance.cfg.MOVEMENT_INCREMENT;
			}
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array2 = array;
			foreach (PlayerControllerB val in array2)
			{
				val.movementSpeed += num;
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "runningShoeScript";
		}
	}
	internal class strongerScannerScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.scannerUpgrade = true;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Better Scanner is active!</color>";
			UpgradeBus.instance.UpgradeObjects.Add("Better Scanner", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "better scanner")
				{
					terminalNode.Description = $"Can scan the ship from an additional {UpgradeBus.instance.cfg.SHIP_AND_ENTRANCE_DISTANCE_INCREASE} units away.  \nCan scan all other nodes from an additional {UpgradeBus.instance.cfg.NODE_DISTANCE_INCREASE} units away.";
					if (!UpgradeBus.instance.cfg.REQUIRE_LINE_OF_SIGHT)
					{
						terminalNode.Description += "  \nDoes not require Line of Sight!";
					}
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "strongerScannerScript";
		}
	}
	internal class strongLegsScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.strongLegs = true;
			PlayerControllerB[] players = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array = players;
			foreach (PlayerControllerB player in array)
			{
				player.jumpForce = UpgradeBus.instance.cfg.JUMP_FORCE;
			}
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Strong Legs is active!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "strong legs" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Strong Legs", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.legLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "strong legs")
				{
					terminalNode.Description = $"Can jump an additional {UpgradeBus.instance.cfg.JUMP_FORCE - 13f + (float)UpgradeBus.instance.legLevel * UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT} units high.";
					PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
					PlayerControllerB[] array2 = array;
					foreach (PlayerControllerB val in array2)
					{
						val.jumpForce += UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT;
					}
				}
			}
		}

		public override void load()
		{
			float num = 0f;
			for (int i = 0; i < UpgradeBus.instance.legLevel; i++)
			{
				num += UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT;
			}
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array2 = array;
			foreach (PlayerControllerB val in array2)
			{
				val.jumpForce += num;
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "strongLegsScript";
		}
	}
	public class terminalFlashScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.terminalFlash = true;
			UpgradeBus.instance.flashScript = this;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Discombobulator is active!\nType 'cooldown' into the terminal for info!!!</color>";
			foreach (CustomTerminalNode node in UpgradeBus.instance.terminalNodes)
			{
				if (node.Name.ToLower() == "discombobulator" && node.Price > 0)
				{
					node.Price /= 2;
				}
			}
			UpgradeBus.instance.UpgradeObjects.Add("Discombobulator", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		public override void Increment()
		{
			UpgradeBus.instance.discoLevel++;
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name.ToLower() == "discombobulator")
				{
					terminalNode.Description = $"Enemies are stunned for {UpgradeBus.instance.cfg.DISCOMBOBULATOR_STUN_DURATION + (float)UpgradeBus.instance.discoLevel * UpgradeBus.instance.cfg.DISCOMBOBULATOR_INCREMENT} seconds.";
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlayAudioAndUpdateCooldownServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1135781697u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1135781697u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayAudioAndUpdateCooldownClientRpc();
				}
			}
		}

		[ClientRpc]
		private void PlayAudioAndUpdateCooldownClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1412806528u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1412806528u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Terminal component = GameObject.Find("TerminalScript").GetComponent<Terminal>();
			component.terminalAudio.maxDistance = 100f;
			component.terminalAudio.PlayOneShot(UpgradeBus.instance.flashNoise);
			((MonoBehaviour)this).StartCoroutine(ResetRange(component));
			UpgradeBus.instance.flashCooldown = UpgradeBus.instance.cfg.DISCOMBOBULATOR_COOLDOWN;
			Collider[] array = Physics.OverlapSphere(((Component)component).transform.position, UpgradeBus.instance.cfg.DISCOMBOBULATOR_RADIUS, 524288);
			if (array.Length == 0)
			{
				return;
			}
			for (int i = 0; i < array.Length; i++)
			{
				EnemyAICollisionDetect component2 = ((Component)array[i]).GetComponent<EnemyAICollisionDetect>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.mainScript.SetEnemyStunned(true, UpgradeBus.instance.cfg.DISCOMBOBULATOR_STUN_DURATION + UpgradeBus.instance.cfg.DISCOMBOBULATOR_INCREMENT * (float)UpgradeBus.instance.discoLevel, (PlayerControllerB)null);
				}
			}
		}

		private IEnumerator ResetRange(Terminal terminal)
		{
			yield return (object)new WaitForSeconds(2f);
			terminal.terminalAudio.maxDistance = 17f;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_terminalFlashScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1135781697u, new RpcReceiveHandler(__rpc_handler_1135781697));
			NetworkManager.__rpc_func_table.Add(1412806528u, new RpcReceiveHandler(__rpc_handler_1412806528));
		}

		private static void __rpc_handler_1135781697(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((terminalFlashScript)(object)target).PlayAudioAndUpdateCooldownServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1412806528(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((terminalFlashScript)(object)target).PlayAudioAndUpdateCooldownClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "terminalFlashScript";
		}
	}
	internal class TPButtonScript : GrabbableObject
	{
		public AudioClip ItemBreak;

		public AudioClip error;

		public AudioClip buttonPress;

		private AudioSource audio;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			audio = ((Component)this).GetComponent<AudioSource>();
			((Component)this).gameObject.GetComponent<NetworkObject>().Spawn(false);
		}

		public override void DiscardItem()
		{
			base.playerHeldBy.activatingItem = false;
			((GrabbableObject)this).DiscardItem();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!Mouse.current.leftButton.isPressed)
			{
				return;
			}
			audio.PlayOneShot(buttonPress);
			if (!base.itemUsedUp)
			{
				ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>();
				ShipTeleporter val = null;
				ShipTeleporter[] array2 = array;
				foreach (ShipTeleporter val2 in array2)
				{
					if (!val2.isInverseTeleporter)
					{
						val = val2;
						break;
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					audio.PlayOneShot(error);
					return;
				}
				int num = -1;
				for (int j = 0; j < StartOfRound.Instance.mapScreen.radarTargets.Count(); j++)
				{
					if ((Object)(object)((Component)StartOfRound.Instance.mapScreen.radarTargets[j].transform).gameObject.GetComponent<PlayerControllerB>() == (Object)(object)base.playerHeldBy)
					{
						num = j;
					}
				}
				if (num == -1)
				{
					StartOfRound.Instance.mapScreen.targetedPlayer = base.playerHeldBy;
					UpgradeBus.instance.TPButtonPressed = true;
					val.PressTeleportButtonOnLocalClient();
					if (Random.Range(0f, 1f) > UpgradeBus.instance.cfg.CHANCE_TO_BREAK)
					{
						audio.PlayOneShot(ItemBreak);
						base.itemUsedUp = true;
						base.playerHeldBy.DespawnHeldObject();
					}
				}
				else
				{
					StartOfRound.Instance.mapScreen.SwitchRadarTargetAndSync(num);
					((MonoBehaviour)this).StartCoroutine(WaitToTP(val));
				}
			}
			else
			{
				audio.PlayOneShot(error);
			}
		}

		private IEnumerator WaitToTP(ShipTeleporter tele)
		{
			yield return (object)new WaitForSeconds(0.15f);
			ReqUpdateTpDropStatusServerRpc();
			tele.PressTeleportButtonOnLocalClient();
			if (Random.Range(0f, 1f) < UpgradeBus.instance.cfg.CHANCE_TO_BREAK)
			{
				audio.PlayOneShot(ItemBreak);
				base.itemUsedUp = true;
				TextMeshProUGUI chatText = HUDManager.Instance.chatText;
				((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>The teleporter button has suffered irreparable damage and destroyed itself!</color>";
				base.playerHeldBy.DespawnHeldObject();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ReqUpdateTpDropStatusServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3777354640u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3777354640u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ChangeTPButtonPressedClientRpc();
				}
			}
		}

		[ClientRpc]
		private void ChangeTPButtonPressedClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3413730949u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3413730949u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					UpgradeBus.instance.TPButtonPressed = true;
				}
			}
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_TPButtonScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3777354640u, new RpcReceiveHandler(__rpc_handler_3777354640));
			NetworkManager.__rpc_func_table.Add(3413730949u, new RpcReceiveHandler(__rpc_handler_3413730949));
		}

		private static void __rpc_handler_3777354640(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TPButtonScript)(object)target).ReqUpdateTpDropStatusServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3413730949(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((TPButtonScript)(object)target).ChangeTPButtonPressedClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "TPButtonScript";
		}
	}
	public class trapDestroyerScript : BaseUpgrade
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(lateApply());
		}

		private IEnumerator lateApply()
		{
			yield return (object)new WaitForSeconds(1f);
			UpgradeBus.instance.DestroyTraps = true;
			UpgradeBus.instance.trapHandler = this;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Malware Broadcaster is active!</color>";
			UpgradeBus.instance.UpgradeObjects.Add("Malware Broadcaster", ((Component)this).gameObject);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			load();
		}

		[ServerRpc(RequireOwnership = false)]
		public void ReqDestroyObjectServerRpc(NetworkObjectReference go)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1254388238u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref go, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1254388238u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			NetworkObject val3 = default(NetworkObject);
			((NetworkObjectReference)(ref go)).TryGet(ref val3, (NetworkManager)null);
			if ((Object)(object)val3 == (Object)null)
			{
				HUDManager.Instance.AddTextToChatOnServer("Can't retrieve obj", 0);
			}
			else if (((Object)((Component)val3).gameObject).name == "Landmine(Clone)" || ((Object)((Component)val3).gameObject).name == "TurretContainer(Clone)")
			{
				if (UpgradeBus.instance.cfg.EXPLODE_TRAP)
				{
					SpawnExplosionClientRpc(((Component)val3).gameObject.transform.position);
				}
				Object.Destroy((Object)(object)((Component)val3).gameObject);
			}
		}

		[ClientRpc]
		private void SpawnExplosionClientRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3507995715u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3507995715u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && UpgradeBus.instance.cfg.EXPLODE_TRAP)
				{
					Landmine.SpawnExplosion(position + Vector3.up, true, 5.7f, 6.4f);
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_trapDestroyerScript()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1254388238u, new RpcReceiveHandler(__rpc_handler_1254388238));
			NetworkManager.__rpc_func_table.Add(3507995715u, new RpcReceiveHandler(__rpc_handler_3507995715));
		}

		private static void __rpc_handler_1254388238(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference go = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref go, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((trapDestroyerScript)(object)target).ReqDestroyObjectServerRpc(go);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3507995715(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((trapDestroyerScript)(object)target).SpawnExplosionClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "trapDestroyerScript";
		}
	}
}
namespace MoreShipUpgrades.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("MeetsScanNodeRequirements")]
		private static void alterReqs(ref HUDManager __instance, ScanNodeProperties node, ref bool __result, PlayerControllerB playerScript)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			if (UpgradeBus.instance.scannerUpgrade)
			{
				float num = ((node.headerText == "Main entrance" || node.headerText == "Ship") ? UpgradeBus.instance.cfg.SHIP_AND_ENTRANCE_DISTANCE_INCREASE : UpgradeBus.instance.cfg.NODE_DISTANCE_INCREASE);
				if ((Object)(object)node == (Object)null)
				{
					__result = false;
					return;
				}
				if (UpgradeBus.instance.cfg.REQUIRE_LINE_OF_SIGHT && Physics.Linecast(((Component)playerScript.gameplayCamera).transform.position, ((Component)node).transform.position, 256, (QueryTriggerInteraction)1))
				{
					__result = false;
					return;
				}
				float num2 = Vector3.Distance(((Component)playerScript).transform.position, ((Component)node).transform.position);
				__result = num2 < (float)node.maxRange + num && num2 > (float)node.minRange;
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("Disconnect")]
		private static void ResetUpgradeBus()
		{
			UpgradeBus.instance.ResetAllValues();
		}

		[HarmonyPrefix]
		[HarmonyPatch("SaveGame")]
		private static void saveLGU(GameNetworkManager __instance)
		{
			if (__instance.isHostingGame)
			{
				LGUStore.instance.ServerSaveFileServerRpc();
			}
		}
	}
	[HarmonyPatch(typeof(DeleteFileButton))]
	internal class DeleteButtonPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("DeleteFile")]
		private static void deleteLGUFile(DeleteFileButton __instance)
		{
			string path = Path.Combine(Application.persistentDataPath, $"LGU_{__instance.fileToDelete}.json");
			if (File.Exists(path))
			{
				File.Delete(path);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("DamagePlayer")]
		private static void beekeeperReduceDamage(ref int damageNumber, CauseOfDeath causeOfDeath)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			if (UpgradeBus.instance.beekeeper && (int)causeOfDeath == 11 && damageNumber == 10)
			{
				damageNumber = Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT)), 0, 100);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DamagePlayerServerRpc")]
		private static void beekeeperReduceDamageServer(ref int damageNumber)
		{
			if (UpgradeBus.instance.beekeeper && damageNumber == 10)
			{
				damageNumber = Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT)), 0, 100);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DamagePlayerClientRpc")]
		private static void beekeeperReduceDamageClient(ref int damageNumber)
		{
			if (UpgradeBus.instance.beekeeper && damageNumber == 10)
			{
				damageNumber = Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT)), 0, 100);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DamageOnOtherClients")]
		private static void beekeeperReduceDamageOther(ref int damageNumber)
		{
			if (UpgradeBus.instance.beekeeper && damageNumber == 10)
			{
				damageNumber = Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT)), 0, 100);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DropAllHeldItems")]
		private static bool DontDropItems(PlayerControllerB __instance)
		{
			if (UpgradeBus.instance.TPButtonPressed)
			{
				UpgradeBus.instance.TPButtonPressed = false;
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("Update")]
		private static void noCarryWeight(ref PlayerControllerB __instance)
		{
			if (!UpgradeBus.instance.exoskeleton || __instance.ItemSlots.Length == 0 || !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)__instance))
			{
				return;
			}
			UpgradeBus.instance.alteredWeight = 1f;
			for (int i = 0; i < __instance.ItemSlots.Length; i++)
			{
				GrabbableObject val = __instance.ItemSlots[i];
				if ((Object)(object)val != (Object)null)
				{
					UpgradeBus.instance.alteredWeight += Mathf.Clamp(val.itemProperties.weight - 1f, 0f, 10f) * (UpgradeBus.instance.cfg.CARRY_WEIGHT_REDUCTION - (float)UpgradeBus.instance.backLevel * UpgradeBus.instance.cfg.CARRY_WEIGHT_INCREMENT);
				}
			}
			__instance.carryWeight = UpgradeBus.instance.alteredWeight;
			if (__instance.carryWeight < 1f)
			{
				__instance.carryWeight = 1f;
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("PlayAudibleNoise")]
		private static void MakeFootstepsQuiet(ref float noiseRange)
		{
			if (UpgradeBus.instance.softSteps)
			{
				noiseRange -= UpgradeBus.instance.cfg.NOISE_REDUCTION;
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void InitLGUStore(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).NetworkManager.IsHost || ((NetworkBehaviour)__instance).NetworkManager.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(UpgradeBus.instance.modStorePrefab);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("playersFiredGameOver")]
		private static void GameOverResetUpgradeManager(StartOfRound __instance)
		{
			UpgradeBus.instance.ResetAllValues();
			if (((NetworkBehaviour)__instance).NetworkManager.IsHost || ((NetworkBehaviour)__instance).NetworkManager.IsServer)
			{
				LGUStore.instance.PlayersFired();
			}
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array2 = array;
			foreach (PlayerControllerB val in array2)
			{
				val.movementSpeed = 4.6f;
				val.sprintTime = 11f;
				val.jumpForce = 13f;
			}
		}
	}
	[HarmonyPatch(typeof(TerminalAccessibleObject))]
	internal class TerminalAccessibleObjectPatcher
	{
		[HarmonyPrefix]
		[HarmonyPatch("CallFunctionFromTerminal")]
		private static bool DestroyObject(ref TerminalAccessibleObject __instance, ref float ___currentCooldownTimer, ref bool ___inCooldown)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (!UpgradeBus.instance.DestroyTraps || ((Component)__instance).gameObject.layer != LayerMask.NameToLayer("MapHazards"))
			{
				return true;
			}
			if (UpgradeBus.instance.cfg.DESTROY_TRAP)
			{
				UpgradeBus.instance.trapHandler.ReqDestroyObjectServerRpc(new NetworkObjectReference(((Component)((Component)__instance).gameObject.transform.parent).gameObject.GetComponent<NetworkObject>()));
				return false;
			}
			if (!___inCooldown)
			{
				___currentCooldownTimer = UpgradeBus.instance.cfg.DISARM_TIME;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class TerminalPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void Counter()
		{
			if (UpgradeBus.instance.flashCooldown > 0f)
			{
				UpgradeBus.instance.flashCooldown -= Time.deltaTime;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ParsePlayerSentence")]
		private static void DestroyObject(ref Terminal __instance, ref TerminalNode __result)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Expected O, but got Unknown
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Expected O, but got Unknown
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Expected O, but got Unknown
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Expected O, but got Unknown
			string text = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded);
			if (text.ToLower() == "initattack" || text.ToLower() == "atk")
			{
				if (!UpgradeBus.instance.terminalFlash)
				{
					TerminalNode val = new TerminalNode();
					val.displayText = "You don't have access to this command yet. Purchase the 'Discombobulator'.";
					val.clearPreviousText = true;
					__result = val;
					return;
				}
				if (UpgradeBus.instance.flashCooldown > 0f)
				{
					TerminalNode val2 = new TerminalNode();
					val2.displayText = $"You can discombobulate again in {Mathf.Round(UpgradeBus.instance.flashCooldown)} seconds.\nType 'cooldown' or 'cd' to check discombobulation cooldown.";
					val2.clearPreviousText = true;
					__result = val2;
					return;
				}
				RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 60f, 0.8f, 0, false, 14155);
				UpgradeBus.instance.flashScript.PlayAudioAndUpdateCooldownServerRpc();
				TerminalNode val3 = new TerminalNode();
				Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, UpgradeBus.instance.cfg.DISCOMBOBULATOR_RADIUS, 524288);
				if (array.Length != 0)
				{
					val3.displayText = $"Stun grenade hit {array.Length} enemies.";
					val3.clearPreviousText = true;
					__result = val3;
					if (UpgradeBus.instance.cfg.DISCOMBOBULATOR_NOTIFY_CHAT)
					{
						((MonoBehaviour)__instance).StartCoroutine(CountDownChat(UpgradeBus.instance.cfg.DISCOMBOBULATOR_STUN_DURATION + UpgradeBus.instance.cfg.DISCOMBOBULATOR_INCREMENT * (float)UpgradeBus.instance.discoLevel));
					}
				}
				else
				{
					val3.displayText = "No stunned enemies detected.";
					val3.clearPreviousText = true;
					__result = val3;
				}
				return;
			}
			if (text.ToLower() == "cooldown" || text.ToLower() == "cd")
			{
				if (!UpgradeBus.instance.terminalFlash)
				{
					TerminalNode val4 = new TerminalNode();
					val4.displayText = "You don't have access to this command yet. Purchase 'Discombobulator'.";
					val4.clearPreviousText = true;
					__result = val4;
				}
				else if (UpgradeBus.instance.flashCooldown > 0f)
				{
					TerminalNode val5 = new TerminalNode();
					val5.displayText = $"You can discombobulate again in {Mathf.Round(UpgradeBus.instance.flashCooldown)} seconds.";
					val5.clearPreviousText = true;
					__result = val5;
				}
				else
				{
					TerminalNode val6 = new TerminalNode();
					val6.displayText = "Discombobulate is ready, Type 'initattack' or 'atk' to execute.";
					val6.clearPreviousText = true;
					__result = val6;
				}
				return;
			}
			if (text.ToLower() == "lategame")
			{
				TerminalNode val7 = new TerminalNode();
				val7.clearPreviousText = true;
				val7.displayText = "Late Game Upgrades\n\nType `lategame store` to view upgrades.\n\nMost of the mod is configurable via the config file in BepInEx/config/\n\nThis mod patches and changes quite a bit and may conflict with other mods at the moment.";
				val7.displayText += "\n\nUpgrades are applied immediately after purchasing. You will see a red chat message when they are applied.";
				val7.displayText += "\n\nUse the info command to get info about an item. EX: `info beekeeper`";
				val7.displayText += "\n\nYou must type the exact name of the upgrade (case insensitve). I removed the vanilla keyword integration as it's prone to stepping on the toes of other keywords.";
				val7.displayText += "\n\nHave fun and please report bugs to the Lethal Company modding discord";
				__result = val7;
				return;
			}
			if (text.ToLower() == "lategame store")
			{
				__result = UpgradeBus.instance.ConstructNode();
				return;
			}
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (text.ToLower() == terminalNode.Name.ToLower())
				{
					TerminalNode val8 = new TerminalNode();
					val8.clearPreviousText = true;
					if (__instance.groupCredits >= terminalNode.Price && (!terminalNode.Unlocked || terminalNode.MaxUpgrade > terminalNode.CurrentUpgrade))
					{
						Terminal obj = __instance;
						obj.groupCredits -= terminalNode.Price;
						if (((NetworkBehaviour)__instance).NetworkManager.IsServer || ((NetworkBehaviour)__instance).NetworkManager.IsHost)
						{
							__instance.SyncTerminalValuesClientRpc(__instance.groupCredits, 0, (int[])null, (int[])null);
						}
						else
						{
							__instance.SyncTerminalValuesServerRpc();
						}
						if (!terminalNode.Unlocked)
						{
							LGUStore.instance.ReqSpawnServerRpc(terminalNode.Name);
							if (terminalNode.MaxUpgrade != 0)
							{
								val8.displayText = $"You Upgraded {terminalNode.Name} to level {terminalNode.CurrentUpgrade + 1}  \n";
							}
							else
							{
								val8.displayText = "You Purchased " + terminalNode.Name + "  \n";
							}
						}
						else if (terminalNode.Unlocked && terminalNode.MaxUpgrade > terminalNode.CurrentUpgrade)
						{
							LGUStore.instance.ReqSpawnServerRpc(terminalNode.Name, increment: true);
							val8.displayText = $"You Upgraded {terminalNode.Name} to level {terminalNode.CurrentUpgrade + 1} \n";
						}
					}
					else if (terminalNode.Unlocked && __instance.groupCredits >= terminalNode.Price)
					{
						if (terminalNode.MaxUpgrade == 0)
						{
							val8.displayText = "You already unlocked this upgrade.  \n";
						}
						else
						{
							val8.displayText = "This upgrade is already max level  \n";
						}
					}
					else
					{
						val8.displayText = "You can't afford this item.  \n";
					}
					__result = val8;
				}
				else if (text.ToLower() == "info " + terminalNode.Name.ToLower())
				{
					TerminalNode val9 = new TerminalNode();
					val9.displayText = terminalNode.Description + "\n\n";
					val9.clearPreviousText = true;
					__result = val9;
				}
			}
		}

		private static IEnumerator CountDownChat(float count)
		{
			((TMP_Text)HUDManager.Instance.chatText).text = "";
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "<color=#FFFFFF>Stun Duration: " + count.ToString("F1") + " seconds.</color>";
			while (count > 0f)
			{
				yield return (object)new WaitForSeconds(1f);
				count -= 1f;
				((TMP_Text)HUDManager.Instance.chatText).text = "";
				TextMeshProUGUI chatText2 = HUDManager.Instance.chatText;
				((TMP_Text)chatText2).text = ((TMP_Text)chatText2).text + "<color=#FFFFFF>Stun Duration: " + count.ToString("F1") + " seconds.</color>";
			}
			((TMP_Text)HUDManager.Instance.chatText).text = "";
			TextMeshProUGUI chatText3 = HUDManager.Instance.chatText;
			((TMP_Text)chatText3).text = ((TMP_Text)chatText3).text + "\n<color=#FF0000>Effected enemies are no longer stunned!</color>";
		}
	}
}
namespace MoreShipUpgrades.Misc
{
	public class BaseUpgrade : NetworkBehaviour
	{
		public virtual void Increment()
		{
		}

		public virtual void load()
		{
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "BaseUpgrade";
		}
	}
	public class CustomTerminalNode
	{
		public string Name;

		public int Price;

		public string Description;

		public GameObject Prefab;

		public bool Unlocked = false;

		public int MaxUpgrade;

		public int CurrentUpgrade { get; set; }

		public CustomTerminalNode(string name, int price, string description, GameObject prefab, int maxUpgrade = 0)
		{
			Name = name;
			Price = price;
			Description = description;
			Prefab = prefab;
			MaxUpgrade = maxUpgrade;
		}

		public CustomTerminalNode Copy()
		{
			return new CustomTerminalNode(Name = Name, Price = Price, Description = Description, Prefab = Prefab, MaxUpgrade = MaxUpgrade);
		}
	}
	public class PluginConfig
	{
		private readonly ConfigFile configFile;

		public bool ADVANCED_TELE_ENABLED { get; set; }

		public bool WEAK_TELE_ENABLED { get; set; }

		public bool BEEKEEPER_ENABLED { get; set; }

		public bool BIGGER_LUNGS_ENABLED { get; set; }

		public bool BACK_MUSCLES_ENABLED { get; set; }

		public bool LIGHT_FOOTED_ENABLED { get; set; }

		public bool NIGHT_VISION_ENABLED { get; set; }

		public bool RUNNING_SHOES_ENABLED { get; set; }

		public bool BETTER_SCANNER_ENABLED { get; set; }

		public bool STRONG_LEGS_ENABLED { get; set; }

		public bool DISCOMBOBULATOR_ENABLED { get; set; }

		public bool MALWARE_BROADCASTER_ENABLED { get; set; }

		public int ADVANCED_TELE_PRICE { get; set; }

		public int WEAK_TELE_PRICE { get; set; }

		public int BEEKEEPER_PRICE { get; set; }

		public int BIGGER_LUNGS_PRICE { get; set; }

		public int BACK_MUSCLES_PRICE { get; set; }

		public int LIGHT_FOOTED_PRICE { get; set; }

		public int NIGHT_VISION_PRICE { get; set; }

		public int RUNNING_SHOES_PRICE { get; set; }

		public int BETTER_SCANNER_PRICE { get; set; }

		public int STRONG_LEGS_PRICE { get; set; }

		public int DISCOMBOBULATOR_PRICE { get; set; }

		public int MALWARE_BROADCASTER_PRICE { get; set; }

		public bool KEEP_ITEMS_ON_TELE { get; set; }

		public float SPRINT_TIME_INCREASE { get; set; }

		public float MOVEMENT_SPEED { get; set; }

		public float JUMP_FORCE { get; set; }

		public bool DESTROY_TRAP { get; set; }

		public float DISARM_TIME { get; set; }

		public bool EXPLODE_TRAP { get; set; }

		public bool REQUIRE_LINE_OF_SIGHT { get; set; }

		public float CARRY_WEIGHT_REDUCTION { get; set; }

		public float NODE_DISTANCE_INCREASE { get; set; }

		public float SHIP_AND_ENTRANCE_DISTANCE_INCREASE { get; set; }

		public float NOISE_REDUCTION { get; set; }

		public float DISCOMBOBULATOR_COOLDOWN { get; set; }

		public float ADV_CHANCE_TO_BREAK { get; set; }

		public float CHANCE_TO_BREAK { get; set; }

		public float BEEKEEPER_DAMAGE_MULTIPLIER { get; set; }

		public float BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT { get; set; }

		public float NIGHT_VIS_DRAIN_SPEED { get; set; }

		public float NIGHT_VIS_REGEN_SPEED { get; set; }

		public float DISCOMBOBULATOR_RADIUS { get; set; }

		public float DISCOMBOBULATOR_STUN_DURATION { get; set; }

		public bool DISCOMBOBULATOR_NOTIFY_CHAT { get; set; }

		public Color NIGHT_VIS_COLOR { get; set; }

		public float NIGHT_VIS_RANGE { get; set; }

		public float NIGHT_VIS_INTENSITY { get; set; }

		public float NIGHT_VIS_STARTUP { get; set; }

		public float NIGHT_VIS_EXHAUST { get; set; }

		public float CARRY_WEIGHT_INCREMENT { get; set; }

		public float MOVEMENT_INCREMENT { get; set; }

		public float SPRINT_TIME_INCREMENT { get; set; }

		public float NOISE_REDUCTION_INCREMENT { get; set; }

		public float JUMP_FORCE_INCREMENT { get; set; }

		public float DISCOMBOBULATOR_INCREMENT { get; set; }

		public PluginConfig(ConfigFile cfg)
		{
			configFile = cfg;
		}

		private T ConfigEntry<T>(string section, string key, T defaultVal, string description)
		{
			return configFile.Bind<T>(section, key, defaultVal, description).Value;
		}

		public void InitBindings()
		{
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			ADVANCED_TELE_ENABLED = ConfigEntry("Advanced Portable Teleporter", "Enable Advanced Portable Teleporter", defaultVal: true, "");
			ADVANCED_TELE_PRICE = ConfigEntry("Advanced Portable Teleporter", "Price of Advanced Portable Teleporter", 1750, "");
			ADV_CHANCE_TO_BREAK = ConfigEntry("Advanced Portable Teleporter", "Chance to break on use", 0.1f, "value should be 0.00 - 1.00");
			WEAK_TELE_ENABLED = ConfigEntry("Portable Teleporter", "Enable Portable Teleporter", defaultVal: true, "");
			WEAK_TELE_PRICE = ConfigEntry("Portable Teleporter", "Price of Portable Teleporter", 300, "");
			CHANCE_TO_BREAK = ConfigEntry("Portable Teleporter", "Chance to break on use", 0.9f, "value should be 0.00 - 1.00");
			KEEP_ITEMS_ON_TELE = ConfigEntry("Portable Teleporter", "Keep Items When Using Portable Teleporters", defaultVal: true, "If set to false you will drop your items like when using the vanilla TP.");
			BEEKEEPER_ENABLED = ConfigEntry("Beekeeper", "Enable Beekeeper Upgrade", defaultVal: true, "Take no damage from bees");
			BEEKEEPER_PRICE = ConfigEntry("Beekeeper", "Price of Beekeeper Upgrade", 450, "");
			BEEKEEPER_DAMAGE_MULTIPLIER = ConfigEntry("Beekeeper", "Multiplied to incoming damage (rounded to int)", 0.64f, "Incoming damage from bees is 10.");
			BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT = ConfigEntry("Beekeeper", "Additional % Reduced per level", 0.15f, "Every time beekeeper is upgraded this value will be subtracted to the base multiplier above.");
			BIGGER_LUNGS_ENABLED = ConfigEntry("Bigger Lungs", "Enable Bigger Lungs Upgrade", defaultVal: true, "More Stamina");
			BIGGER_LUNGS_PRICE = ConfigEntry("Bigger Lungs", "Price of Bigger Lungs Upgrade", 700, "");
			SPRINT_TIME_INCREASE = ConfigEntry("Bigger Lungs", "SprintTime value", 17f, "Vanilla value is 11");
			SPRINT_TIME_INCREMENT = ConfigEntry("Bigger Lungs", "SprintTime Increment", 1.25f, "How much the above value is increased on upgrade.");
			RUNNING_SHOES_ENABLED = ConfigEntry("Running Shoes", "Enable Running Shoes Upgrade", defaultVal: true, "Run Faster");
			RUNNING_SHOES_PRICE = ConfigEntry("Running Shoes", "Price of Running Shoes Upgrade", 1000, "");
			MOVEMENT_SPEED = ConfigEntry("Running Shoes", "Movement Speed Value", 6f, "Vanilla value is 4.6");
			MOVEMENT_INCREMENT = ConfigEntry("Running Shoes", "Movement Speed Increment", 0.5f, "How much the above value is increased on upgrade.");
			STRONG_LEGS_ENABLED = ConfigEntry("Strong Legs", "Enable Strong Legs Upgrade", defaultVal: true, "Jump Higher");
			STRONG_LEGS_PRICE = ConfigEntry("Strong Legs", "Price of Strong Legs Upgrade", 300, "");
			JUMP_FORCE = ConfigEntry("Strong Legs", "Jump Force", 16f, "Vanilla value is 13");
			JUMP_FORCE_INCREMENT = ConfigEntry("Strong Legs", "Jump Force Increment", 0.75f, "How much the above value is increased on upgrade.");
			MALWARE_BROADCASTER_ENABLED = ConfigEntry("Malware Broadcaster", "Enable Malware Broadcaster Upgrade", defaultVal: true, "Explode Map Hazards");
			MALWARE_BROADCASTER_PRICE = ConfigEntry("Malware Broadcaster", "Price of Malware Broadcaster Upgrade", 650, "");
			DESTROY_TRAP = ConfigEntry("Malware Broadcaster", "Destroy Trap", defaultVal: true, "If false Malware Broadcaster will disable the trap for a long time instead of destroying.");
			DISARM_TIME = ConfigEntry("Malware Broadcaster", "Disarm Time", 7f, "If `Destroy Trap` is false this is the duration traps will be disabled.");
			EXPLODE_TRAP = ConfigEntry("Malware Broadcaster", "Explode Trap", defaultVal: true, "Destroy Trap must be true! If this is true when destroying a trap it will also explode.");
			LIGHT_FOOTED_ENABLED = ConfigEntry("Light Footed", "Enable Light Footed Upgrade", defaultVal: true, "Make less noise moving.");
			LIGHT_FOOTED_PRICE = ConfigEntry("Light Footed", "Price of Light Footed Upgrade", 350, "");
			NOISE_REDUCTION = ConfigEntry("Light Footed", "Noise Reduction", 7f, "Distance units to subtract from footstep noise.");
			NOISE_REDUCTION_INCREMENT = ConfigEntry("Light Footed", "Noise Reduction Increment", 1f, "The amount added to above value on upgrade.");
			NIGHT_VISION_ENABLED = ConfigEntry("Night Vision", "Enable Night Vision Upgrade", defaultVal: true, "Toggleable night vision.");
			NIGHT_VISION_PRICE = ConfigEntry("Night Vision", "Price of Night Vision Upgrade", 700, "");
			NIGHT_VIS_DRAIN_SPEED = ConfigEntry("Night Vision", "Multiplier for night vis battery drain", 0.1f, "Multiplied by timedelta. A value of 0.1 will result in a 10 second battery life.");
			NIGHT_VIS_REGEN_SPEED = ConfigEntry("Night Vision", "Multiplier for night vis battery regen", 0.05f, "Multiplied by timedelta.");
			NIGHT_VIS_COLOR = ConfigEntry<Color>("Night Vision", "Night Vision Color", Color.green, "The color your night vision light emits.");
			NIGHT_VIS_RANGE = ConfigEntry("Night Vision", "Night Vision Range", 2000f, "Kind of like the distance your night vision travels.");
			NIGHT_VIS_INTENSITY = ConfigEntry("Night Vision", "Night Vision Intensity", 1000f, "Kind of like the brightness of your Night Vision.");
			NIGHT_VIS_STARTUP = ConfigEntry("Night Vision", "Night Vision StartUp Cost", 0.1f, "The percent battery drained when turned on (0.1 = 10%).");
			NIGHT_VIS_EXHAUST = ConfigEntry("Night Vision", "Night Vision Exhaustion", 2f, "How many seconds night vision stays fully depleted.");
			DISCOMBOBULATOR_ENABLED = ConfigEntry("Discombobulator", "Enable Discombobulator Upgrade", defaultVal: true, "Stun enemies around the ship.");
			DISCOMBOBULATOR_PRICE = ConfigEntry("Discombobulator", "Price of Discombobulator Upgrade", 550, "");
			DISCOMBOBULATOR_COOLDOWN = ConfigEntry("Discombobulator", "Discombobulator Cooldown", 120f, "");
			DISCOMBOBULATOR_RADIUS = ConfigEntry("Discombobulator", "Discombobulator Effect Radius", 40f, "");
			DISCOMBOBULATOR_STUN_DURATION = ConfigEntry("Discombobulator", "Discombobulator Stun Duration", 7.5f, "");
			DISCOMBOBULATOR_NOTIFY_CHAT = ConfigEntry("Discombobulator", "Notify Local Chat of Enemy Stun Duration", defaultVal: true, "");
			DISCOMBOBULATOR_INCREMENT = ConfigEntry("Discombobulator", "Discombobulator Increment", 1f, "The amount added to stun duration on upgrade.");
			BETTER_SCANNER_ENABLED = ConfigEntry("Better Scanner", "Enable Better Scanner Upgrade", defaultVal: true, "Further scan distance, no LOS needed.");
			BETTER_SCANNER_PRICE = ConfigEntry("Better Scanner", "Price of Better Scanner Upgrade", 650, "");
			REQUIRE_LINE_OF_SIGHT = ConfigEntry("Better Scanner", "Require Line Of Sight", defaultVal: false, "Default mod value is false.");
			SHIP_AND_ENTRANCE_DISTANCE_INCREASE = ConfigEntry("Better Scanner", "Ship and Entrance node distance boost", 150f, "How much further away you can scan the ship and entrance.");
			NODE_DISTANCE_INCREASE = ConfigEntry("Better Scanner", "Node distance boost", 20f, "How much further away you can scan other nodes.");
			BACK_MUSCLES_ENABLED = ConfigEntry("Back Muscles", "Enable Back Muscles Upgrade", defaultVal: true, "Reduce carry weight");
			BACK_MUSCLES_PRICE = ConfigEntry("Back Muscles", "Price of Back Muscles Upgrade", 835, "");
			CARRY_WEIGHT_REDUCTION = ConfigEntry("Back Muscles", "Carry Weight Multiplier", 0.5f, "Your carry weight is multiplied by this.");
			CARRY_WEIGHT_INCREMENT = ConfigEntry("Back Muscles", "Carry Weight Increment", 0.1f, "Each upgrade subtracts this from the above coefficient.");
		}
	}
	internal static class Metadata
	{
		public const string GUID = "com.malco.lethalcompany.moreshipupgrades";

		public const string NAME = "More Ship Upgrades";

		public const string VERSION = "1.3.1";
	}
}
namespace MoreShipUpgrades.Managers
{
	public class LGUStore : NetworkBehaviour
	{
		public static LGUStore instance;

		public SaveInfo saveInfo;

		private static Dictionary<string, Func<SaveInfo, bool>> conditions = new Dictionary<string, Func<SaveInfo, bool>>
		{
			{
				"Malware Broadcaster",
				(SaveInfo saveInfo) => saveInfo.DestroyTraps
			},
			{
				"Light Footed",
				(SaveInfo saveInfo) => saveInfo.softSteps
			},
			{
				"Discombobulator",
				(SaveInfo SaveInfo) => SaveInfo.terminalFlash
			},
			{
				"Bigger Lungs",
				(SaveInfo SaveInfo) => SaveInfo.biggerLungs
			},
			{
				"Running Shoes",
				(SaveInfo SaveInfo) => SaveInfo.runningShoes
			},
			{
				"Night Vision",
				(SaveInfo SaveInfo) => SaveInfo.nightVision
			},
			{
				"Strong Legs",
				(SaveInfo SaveInfo) => SaveInfo.strongLegs
			},
			{
				"Better Scanner",
				(SaveInfo SaveInfo) => SaveInfo.scannerUpgrade
			},
			{
				"Beekeeper",
				(SaveInfo SaveInfo) => SaveInfo.beekeeper
			},
			{
				"Back Muscles",
				(SaveInfo SaveInfo) => SaveInfo.exoskeleton
			}
		};

		private static Dictionary<string, Func<SaveInfo, int>> levelConditions = new Dictionary<string, Func<SaveInfo, int>>
		{
			{
				"Malware Broadcaster",
				(SaveInfo saveInfo) => 0
			},
			{
				"Light Footed",
				(SaveInfo saveInfo) => saveInfo.lightLevel
			},
			{
				"Discombobulator",
				(SaveInfo saveInfo) => saveInfo.discoLevel
			},
			{
				"Bigger Lungs",
				(SaveInfo saveInfo) => saveInfo.lungLevel
			},
			{
				"Running Shoes",
				(SaveInfo saveInfo) => saveInfo.runningLevel
			},
			{
				"Night Vision",
				(SaveInfo saveInfo) => 0
			},
			{
				"Strong Legs",
				(SaveInfo saveInfo) => saveInfo.legLevel
			},
			{
				"Better Scanner",
				(SaveInfo saveInfo) => 0
			},
			{
				"Beekeeper",
				(SaveInfo saveInfo) => saveInfo.beeLevel
			},
			{
				"Back Muscles",
				(SaveInfo saveInfo) => saveInfo.backLevel
			}
		};

		private bool hasRun = false;

		private void Start()
		{
			instance = this;
			if (((NetworkBehaviour)this).NetworkManager.IsHost && !hasRun)
			{
				hasRun = true;
				string text = GameNetworkManager.Instance.saveFileNum.ToString();
				string path = Path.Combine(Application.persistentDataPath, "LGU_" + text + ".json");
				if (File.Exists(path))
				{
					string text2 = File.ReadAllText(path);
					saveInfo = JsonConvert.DeserializeObject<SaveInfo>(text2);
					UpdateUpgradeBus();
					HandleSpawns();
				}
				else
				{
					saveInfo = new SaveInfo();
					string contents = JsonConvert.SerializeObject((object)saveInfo);
					File.WriteAllText(path, contents);
				}
			}
			else
			{
				ShareSaveServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ServerSaveFileServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2987346562u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2987346562u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					string text = GameNetworkManager.Instance.saveFileNum.ToString();
					string path = Path.Combine(Application.persistentDataPath, "LGU_" + text + ".json");
					saveInfo = new SaveInfo();
					string contents = JsonConvert.SerializeObject((object)saveInfo);
					File.WriteAllText(path, contents);
				}
			}
		}

		public void HandleSpawns()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Unlocked && !UpgradeBus.instance.UpgradeObjects.Keys.ToList().Contains(terminalNode.Name))
				{
					GameObject val = Object.Instantiate<GameObject>(terminalNode.Prefab, Vector3.zero, Quaternion.identity);
					val.GetComponent<NetworkObject>().Spawn(false);
				}
			}
		}

		public void PlayersFired()
		{
			string text = GameNetworkManager.Instance.saveFileNum.ToString();
			string path = Path.Combine(Application.persistentDataPath, "LGU_" + text + ".json");
			saveInfo = new SaveInfo();
			string contents = JsonConvert.SerializeObject((object)saveInfo);
			File.WriteAllText(path, contents);
		}

		[ServerRpc(RequireOwnership = false)]
		public void ShareSaveServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3123934669u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3123934669u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					string json = JsonConvert.SerializeObject((object)saveInfo);
					ShareSaveClientRpc(json);
				}
			}
		}

		[ClientRpc]
		public void ShareSaveClientRpc(string json)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(472891778u, val, (RpcDelivery)0);
				bool flag = json != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(json, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 472891778u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				saveInfo = JsonConvert.DeserializeObject<SaveInfo>(json);
				UpdateUpgradeBus();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SaveLGUDataServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2446161515u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2446161515u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					string text = GameNetworkManager.Instance.saveFileNum.ToString();
					string path = Path.Combine(Application.persistentDataPath, "LGU_" + text + ".json");
					string contents = JsonConvert.SerializeObject((object)new SaveInfo());
					File.WriteAllText(path, contents);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ReqSpawnServerRpc(string goName, bool increment = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(642173559u, val, (RpcDelivery)0);
				bool flag = goName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(goName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref increment, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 642173559u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			if (!increment)
			{
				foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
				{
					if (terminalNode.Name == goName)
					{
						GameObject val3 = Object.Instantiate<GameObject>(terminalNode.Prefab, Vector3.zero, Quaternion.identity);
						val3.GetComponent<NetworkObject>().Spawn(false);
						UpdateNodesClientRpc(goName);
						break;
					}
				}
				return;
			}
			UpdateNodesClientRpc(goName, increment);
		}

		[ClientRpc]
		private void UpdateNodesClientRpc(string goName, bool increment = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(459135623u, val, (RpcDelivery)0);
				bool flag = goName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(goName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref increment, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 459135623u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			foreach (CustomTerminalNode terminalNode in UpgradeBus.instance.terminalNodes)
			{
				if (terminalNode.Name == goName)
				{
					terminalNode.Unlocked = true;
					if (increment)
					{
						terminalNode.CurrentUpgrade++;
						UpgradeBus.instance.UpgradeObjects[goName].GetComponent<BaseUpgrade>().Increment();
					}
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DeleteUpgradesServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2466427664u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2466427664u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				BaseUpgrade[] array = Object.FindObjectsOfType<BaseUpgrade>();
				BaseUpgrade[] array2 = array;
				foreach (BaseUpgrade baseUpgrade in array2)
				{

MMHOOK/MMHOOK_AmazingAssets.TerrainToMesh.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
using AmazingAssets.TerrainToMesh;
using MonoMod.Cil;
using MonoMod.RuntimeDetour.HookGen;
using On;
using On.AmazingAssets.TerrainToMesh;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: AssemblyVersion("0.0.0.0")]
namespace On
{
	public static class \u200f\u202b\u202b\u202c\u206d\u206e\u206e\u202b\u200d\u202b\u202d\u200e\u206f\u200b\u206a\u202d\u206e\u206d\u200b\u202b\u200d\u206f\u202e\u202b\u200c\u206c\u200b\u202c\u206e\u202d\u206e\u202d\u202a\u200e\u206c\u202d\u206c\u200b\u202c\u200f\u202e
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate object orig_\u206f\u202b\u200f\u206e\u206e\u202c\u202c\u206d\u206b\u206d\u206c\u206f\u202d\u200d\u206b\u200d\u202a\u206c\u200c\u206c\u206b\u200c\u200f\u202a\u202b\u200f\u202c\u206d\u200b\u202e\u202d\u206b\u206a\u200b\u200f\u206a\u200e\u200e\u200e\u202e(TerrainData P_0, bool P_1, bool P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate object hook_\u206f\u202b\u200f\u206e\u206e\u202c\u202c\u206d\u206b\u206d\u206c\u206f\u202d\u200d\u206b\u200d\u202a\u206c\u200c\u206c\u206b\u200c\u200f\u202a\u202b\u200f\u202c\u206d\u200b\u202e\u202d\u206b\u206a\u200b\u200f\u206a\u200e\u200e\u200e\u202e(orig_\u206f\u202b\u200f\u206e\u206e\u202c\u202c\u206d\u206b\u206d\u206c\u206f\u202d\u200d\u206b\u200d\u202a\u206c\u200c\u206c\u206b\u200c\u200f\u202a\u202b\u200f\u202c\u206d\u200b\u202e\u202d\u206b\u206a\u200b\u200f\u206a\u200e\u200e\u200e\u202e orig, TerrainData P_1, bool P_2, bool P_3);

		public static event hook_\u206f\u202b\u200f\u206e\u206e\u202c\u202c\u206d\u206b\u206d\u206c\u206f\u202d\u200d\u206b\u200d\u202a\u206c\u200c\u206c\u206b\u200c\u200f\u202a\u202b\u200f\u202c\u206d\u200b\u202e\u202d\u206b\u206a\u200b\u200f\u206a\u200e\u200e\u200e\u202e \u206f\u202b\u200f\u206e\u206e\u202c\u202c\u206d\u206b\u206d\u206c\u206f\u202d\u200d\u206b\u200d\u202a\u206c\u200c\u206c\u206b\u200c\u200f\u202a\u202b\u200f\u202c\u206d\u200b\u202e\u202d\u206b\u206a\u200b\u200f\u206a\u200e\u200e\u200e\u202e
		{
			add
			{
				HookEndpointManager.Add<hook_\u206f\u202b\u200f\u206e\u206e\u202c\u202c\u206d\u206b\u206d\u206c\u206f\u202d\u200d\u206b\u200d\u202a\u206c\u200c\u206c\u206b\u200c\u200f\u202a\u202b\u200f\u202c\u206d\u200b\u202e\u202d\u206b\u206a\u200b\u200f\u206a\u200e\u200e\u200e\u202e>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_\u206f\u202b\u200f\u206e\u206e\u202c\u202c\u206d\u206b\u206d\u206c\u206f\u202d\u200d\u206b\u200d\u202a\u206c\u200c\u206c\u206b\u200c\u200f\u202a\u202b\u200f\u202c\u206d\u200b\u202e\u202d\u206b\u206a\u200b\u200f\u206a\u200e\u200e\u200e\u202e>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL
{
	public static class \u200f\u202b\u202b\u202c\u206d\u206e\u206e\u202b\u200d\u202b\u202d\u200e\u206f\u200b\u206a\u202d\u206e\u206d\u200b\u202b\u200d\u206f\u202e\u202b\u200c\u206c\u200b\u202c\u206e\u202d\u206e\u202d\u202a\u200e\u206c\u202d\u206c\u200b\u202c\u200f\u202e
	{
		public static event Manipulator \u206f\u202b\u200f\u206e\u206e\u202c\u202c\u206d\u206b\u206d\u206c\u206f\u202d\u200d\u206b\u200d\u202a\u206c\u200c\u206c\u206b\u200c\u200f\u202a\u202b\u200f\u202c\u206d\u200b\u202e\u202d\u206b\u206a\u200b\u200f\u206a\u200e\u200e\u200e\u202e
		{
			add
			{
				HookEndpointManager.Modify<On.\u200f\u202b\u202b\u202c\u206d\u206e\u206e\u202b\u200d\u202b\u202d\u200e\u206f\u200b\u206a\u202d\u206e\u206d\u200b\u202b\u200d\u206f\u202e\u202b\u200c\u206c\u200b\u202c\u206e\u202d\u206e\u202d\u202a\u200e\u206c\u202d\u206c\u200b\u202c\u200f\u202e.hook_\u206f\u202b\u200f\u206e\u206e\u202c\u202c\u206d\u206b\u206d\u206c\u206f\u202d\u200d\u206b\u200d\u202a\u206c\u200c\u206c\u206b\u200c\u200f\u202a\u202b\u200f\u202c\u206d\u200b\u202e\u202d\u206b\u206a\u200b\u200f\u206a\u200e\u200e\u200e\u202e>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.\u200f\u202b\u202b\u202c\u206d\u206e\u206e\u202b\u200d\u202b\u202d\u200e\u206f\u200b\u206a\u202d\u206e\u206d\u200b\u202b\u200d\u206f\u202e\u202b\u200c\u206c\u200b\u202c\u206e\u202d\u206e\u202d\u202a\u200e\u206c\u202d\u206c\u200b\u202c\u200f\u202e.hook_\u206f\u202b\u200f\u206e\u206e\u202c\u202c\u206d\u206b\u206d\u206c\u206f\u202d\u200d\u206b\u200d\u202a\u206c\u200c\u206c\u206b\u200c\u200f\u202a\u202b\u200f\u202c\u206d\u200b\u202e\u202d\u206b\u206a\u200b\u200f\u206a\u200e\u200e\u200e\u202e>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On
{
	public static class \u200f\u202c\u202d\u202a\u206a\u200b\u200b\u202c\u200e\u200c\u200f\u206f\u200d\u200c\u206c\u206e\u200e\u206f\u206b\u206b\u202c\u200f\u206b\u200f\u200c\u206f\u200d\u202d\u206e\u206c\u202c\u200f\u202b\u202a\u200c\u202a\u202a\u206c\u200d\u206f\u202e
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(object self, TerrainData P_1, bool P_2, bool P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, object self, TerrainData P_2, bool P_3, bool P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u202a\u200c\u206b\u206f\u202d\u200d\u200b\u200d\u206e\u202a\u202c\u206e\u200c\u200e\u206a\u202e\u202c\u200e\u206d\u200c\u200e\u200c\u202d\u200f\u206b\u202b\u206b\u206c\u206b\u206f\u202c\u202a\u200b\u202a\u200b\u206e\u202a\u202b\u206e\u206b\u202e(Texture P_0, RenderTexture P_1, bool P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u202a\u200c\u206b\u206f\u202d\u200d\u200b\u200d\u206e\u202a\u202c\u206e\u200c\u200e\u206a\u202e\u202c\u200e\u206d\u200c\u200e\u200c\u202d\u200f\u206b\u202b\u206b\u206c\u206b\u206f\u202c\u202a\u200b\u202a\u200b\u206e\u202a\u202b\u206e\u206b\u202e(orig_\u202a\u200c\u206b\u206f\u202d\u200d\u200b\u200d\u206e\u202a\u202c\u206e\u200c\u200e\u206a\u202e\u202c\u200e\u206d\u200c\u200e\u200c\u202d\u200f\u206b\u202b\u206b\u206c\u206b\u206f\u202c\u202a\u200b\u202a\u200b\u206e\u202a\u202b\u206e\u206b\u202e orig, Texture P_1, RenderTexture P_2, bool P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u200c\u200b\u200b\u200e\u200b\u206d\u202e\u202c\u200b\u200e\u206b\u202b\u200e\u202e\u200b\u200f\u200f\u202e\u206f\u200e\u200c\u200f\u202c\u200f\u206a\u206a\u200c\u206d\u206b\u206d\u206c\u200f\u202a\u202a\u200c\u206d\u206e\u200f\u202b\u202a\u202e(Texture P_0, RenderTexture P_1, Material P_2, bool P_3, int P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u200c\u200b\u200b\u200e\u200b\u206d\u202e\u202c\u200b\u200e\u206b\u202b\u200e\u202e\u200b\u200f\u200f\u202e\u206f\u200e\u200c\u200f\u202c\u200f\u206a\u206a\u200c\u206d\u206b\u206d\u206c\u200f\u202a\u202a\u200c\u206d\u206e\u200f\u202b\u202a\u202e(orig_\u200c\u200b\u200b\u200e\u200b\u206d\u202e\u202c\u200b\u200e\u206b\u202b\u200e\u202e\u200b\u200f\u200f\u202e\u206f\u200e\u200c\u200f\u202c\u200f\u206a\u206a\u200c\u206d\u206b\u206d\u206c\u200f\u202a\u202a\u200c\u206d\u206e\u200f\u202b\u202a\u202e orig, Texture P_1, RenderTexture P_2, Material P_3, bool P_4, int P_5);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D orig_\u206a\u202b\u202b\u200b\u200d\u200e\u202e\u206e\u206b\u206e\u202d\u200d\u202c\u206c\u202b\u200b\u200c\u202b\u202c\u202a\u206f\u206c\u206d\u200e\u206b\u202b\u200f\u200d\u200d\u206c\u206e\u206c\u200d\u206e\u206d\u206f\u206f\u200d\u206c\u202e(Color P_0, TextureFormat P_1, bool P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D hook_\u206a\u202b\u202b\u200b\u200d\u200e\u202e\u206e\u206b\u206e\u202d\u200d\u202c\u206c\u202b\u200b\u200c\u202b\u202c\u202a\u206f\u206c\u206d\u200e\u206b\u202b\u200f\u200d\u200d\u206c\u206e\u206c\u200d\u206e\u206d\u206f\u206f\u200d\u206c\u202e(orig_\u206a\u202b\u202b\u200b\u200d\u200e\u202e\u206e\u206b\u206e\u202d\u200d\u202c\u206c\u202b\u200b\u200c\u202b\u202c\u202a\u206f\u206c\u206d\u200e\u206b\u202b\u200f\u200d\u200d\u206c\u206e\u206c\u200d\u206e\u206d\u206f\u206f\u200d\u206c\u202e orig, Color P_1, TextureFormat P_2, bool P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D orig_\u206f\u206f\u206b\u200e\u202c\u206b\u202c\u200c\u200f\u200c\u202e\u206e\u200c\u202c\u206c\u202c\u202b\u206b\u200f\u202c\u202b\u206a\u200f\u206c\u206f\u200c\u200b\u202e\u206d\u202a\u206a\u206c\u206f\u206b\u206a\u206c\u206d\u202b\u206a\u202b\u202e(int P_0, int P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D hook_\u206f\u206f\u206b\u200e\u202c\u206b\u202c\u200c\u200f\u200c\u202e\u206e\u200c\u202c\u206c\u202c\u202b\u206b\u200f\u202c\u202b\u206a\u200f\u206c\u206f\u200c\u200b\u202e\u206d\u202a\u206a\u206c\u206f\u206b\u206a\u206c\u206d\u202b\u206a\u202b\u202e(orig_\u206f\u206f\u206b\u200e\u202c\u206b\u202c\u200c\u200f\u200c\u202e\u206e\u200c\u202c\u206c\u202c\u202b\u206b\u200f\u202c\u202b\u206a\u200f\u206c\u206f\u200c\u200b\u202e\u206d\u202a\u206a\u206c\u206f\u206b\u206a\u206c\u206d\u202b\u206a\u202b\u202e orig, int P_1, int P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u200c\u206a\u206e\u206f\u200f\u206f\u202a\u200e\u206c\u202e\u202a\u200f\u206e\u202b\u206f\u200e\u200d\u200b\u202c\u202b\u202c\u206b\u200c\u202c\u200d\u202d\u200d\u200e\u202b\u206f\u200f\u206e\u200f\u200b\u206e\u200b\u202b\u202b\u202a\u206d\u202e(RenderTexture P_0, TextureFormat P_1, ref Texture2D P_2, bool P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u200c\u206a\u206e\u206f\u200f\u206f\u202a\u200e\u206c\u202e\u202a\u200f\u206e\u202b\u206f\u200e\u200d\u200b\u202c\u202b\u202c\u206b\u200c\u202c\u200d\u202d\u200d\u200e\u202b\u206f\u200f\u206e\u200f\u200b\u206e\u200b\u202b\u202b\u202a\u206d\u202e(orig_\u200c\u206a\u206e\u206f\u200f\u206f\u202a\u200e\u206c\u202e\u202a\u200f\u206e\u202b\u206f\u200e\u200d\u200b\u202c\u202b\u202c\u206b\u200c\u202c\u200d\u202d\u200d\u200e\u202b\u206f\u200f\u206e\u200f\u200b\u206e\u200b\u202b\u202b\u202a\u206d\u202e orig, RenderTexture P_1, TextureFormat P_2, ref Texture2D P_3, bool P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D orig_\u202d\u200d\u202e\u200b\u202e\u200e\u206b\u206d\u200b\u200f\u206e\u200d\u200e\u200f\u202e\u202a\u202d\u202c\u200e\u200b\u206a\u206e\u202b\u206c\u206f\u206c\u206c\u202c\u202d\u202d\u202c\u200d\u200b\u200e\u200b\u200c\u202d\u200c\u200c\u206c\u202e(Texture2D P_0, bool P_1, int P_2, int P_3, int P_4, int P_5);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D hook_\u202d\u200d\u202e\u200b\u202e\u200e\u206b\u206d\u200b\u200f\u206e\u200d\u200e\u200f\u202e\u202a\u202d\u202c\u200e\u200b\u206a\u206e\u202b\u206c\u206f\u206c\u206c\u202c\u202d\u202d\u202c\u200d\u200b\u200e\u200b\u200c\u202d\u200c\u200c\u206c\u202e(orig_\u202d\u200d\u202e\u200b\u202e\u200e\u206b\u206d\u200b\u200f\u206e\u200d\u200e\u200f\u202e\u202a\u202d\u202c\u200e\u200b\u206a\u206e\u202b\u206c\u206f\u206c\u206c\u202c\u202d\u202d\u202c\u200d\u200b\u200e\u200b\u200c\u202d\u200c\u200c\u206c\u202e orig, Texture2D P_1, bool P_2, int P_3, int P_4, int P_5, int P_6);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D[] orig_\u206f\u202e\u202b\u202b\u200e\u202b\u206e\u202e\u202d\u200e\u206c\u202c\u206c\u206f\u200b\u200b\u200d\u206a\u206f\u206b\u202e\u206e\u202a\u202b\u206b\u206e\u206c\u206f\u202c\u200d\u202d\u202c\u202d\u206b\u200c\u202a\u200e\u206b\u200e\u206e\u202e(Texture2D[] P_0, bool P_1, int P_2, int P_3, int P_4, int P_5);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D[] hook_\u206f\u202e\u202b\u202b\u200e\u202b\u206e\u202e\u202d\u200e\u206c\u202c\u206c\u206f\u200b\u200b\u200d\u206a\u206f\u206b\u202e\u206e\u202a\u202b\u206b\u206e\u206c\u206f\u202c\u200d\u202d\u202c\u202d\u206b\u200c\u202a\u200e\u206b\u200e\u206e\u202e(orig_\u206f\u202e\u202b\u202b\u200e\u202b\u206e\u202e\u202d\u200e\u206c\u202c\u206c\u206f\u200b\u200b\u200d\u206a\u206f\u206b\u202e\u206e\u202a\u202b\u206b\u206e\u206c\u206f\u202c\u200d\u202d\u202c\u202d\u206b\u200c\u202a\u200e\u206b\u200e\u206e\u202e orig, Texture2D[] P_1, bool P_2, int P_3, int P_4, int P_5, int P_6);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D[] orig_\u206f\u206a\u206d\u202c\u202c\u206f\u206f\u200f\u206b\u202a\u206a\u200c\u202a\u202d\u206c\u206d\u206d\u200e\u206d\u200b\u200e\u200b\u202a\u200c\u202d\u200f\u202b\u200e\u206b\u202d\u200d\u202b\u200f\u200b\u200f\u206e\u206f\u206c\u206b\u206d\u202e(Texture2D P_0, bool P_1, int P_2, int P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D[] hook_\u206f\u206a\u206d\u202c\u202c\u206f\u206f\u200f\u206b\u202a\u206a\u200c\u202a\u202d\u206c\u206d\u206d\u200e\u206d\u200b\u200e\u200b\u202a\u200c\u202d\u200f\u202b\u200e\u206b\u202d\u200d\u202b\u200f\u200b\u200f\u206e\u206f\u206c\u206b\u206d\u202e(orig_\u206f\u206a\u206d\u202c\u202c\u206f\u206f\u200f\u206b\u202a\u206a\u200c\u202a\u202d\u206c\u206d\u206d\u200e\u206d\u200b\u200e\u200b\u202a\u200c\u202d\u200f\u202b\u200e\u206b\u202d\u200d\u202b\u200f\u200b\u200f\u206e\u206f\u206c\u206b\u206d\u202e orig, Texture2D P_1, bool P_2, int P_3, int P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D[] orig_\u206a\u206a\u202b\u202b\u200d\u200b\u206f\u200d\u200c\u206a\u206b\u200f\u206c\u202a\u206b\u202a\u200d\u206d\u200f\u206e\u202a\u200e\u206a\u206d\u206b\u200c\u202a\u206c\u206d\u200e\u200f\u206a\u202d\u200d\u202e\u200c\u206d\u202b\u200b\u206d\u202e(Texture2D[] P_0, bool P_1, int P_2, int P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D[] hook_\u206a\u206a\u202b\u202b\u200d\u200b\u206f\u200d\u200c\u206a\u206b\u200f\u206c\u202a\u206b\u202a\u200d\u206d\u200f\u206e\u202a\u200e\u206a\u206d\u206b\u200c\u202a\u206c\u206d\u200e\u200f\u206a\u202d\u200d\u202e\u200c\u206d\u202b\u200b\u206d\u202e(orig_\u206a\u206a\u202b\u202b\u200d\u200b\u206f\u200d\u200c\u206a\u206b\u200f\u206c\u202a\u206b\u202a\u200d\u206d\u200f\u206e\u202a\u200e\u206a\u206d\u206b\u200c\u202a\u206c\u206d\u200e\u200f\u206a\u202d\u200d\u202e\u200c\u206d\u202b\u200b\u206d\u202e orig, Texture2D[] P_1, bool P_2, int P_3, int P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D orig_\u206c\u202c\u206e\u200d\u206e\u200c\u202e\u200f\u200e\u200f\u202b\u200c\u200d\u206f\u202b\u206d\u206d\u206c\u200f\u206f\u202e\u200b\u206b\u200f\u202a\u200e\u202c\u202d\u202b\u206d\u206d\u200b\u202e\u202e\u202d\u202a\u206f\u202a\u202e\u200e\u202e(Texture2D P_0, bool P_1, int P_2, int P_3, int P_4, int P_5);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D hook_\u206c\u202c\u206e\u200d\u206e\u200c\u202e\u200f\u200e\u200f\u202b\u200c\u200d\u206f\u202b\u206d\u206d\u206c\u200f\u206f\u202e\u200b\u206b\u200f\u202a\u200e\u202c\u202d\u202b\u206d\u206d\u200b\u202e\u202e\u202d\u202a\u206f\u202a\u202e\u200e\u202e(orig_\u206c\u202c\u206e\u200d\u206e\u200c\u202e\u200f\u200e\u200f\u202b\u200c\u200d\u206f\u202b\u206d\u206d\u206c\u200f\u206f\u202e\u200b\u206b\u200f\u202a\u200e\u202c\u202d\u202b\u206d\u206d\u200b\u202e\u202e\u202d\u202a\u206f\u202a\u202e\u200e\u202e orig, Texture2D P_1, bool P_2, int P_3, int P_4, int P_5, int P_6);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u206f\u206b\u206c\u200b\u200b\u200e\u200f\u200c\u206a\u200d\u200d\u206e\u206b\u202c\u202d\u206a\u200c\u202e\u200d\u202d\u200b\u202b\u200c\u206a\u200d\u200c\u206f\u206e\u206e\u200d\u206e\u206b\u206f\u206a\u202a\u206e\u206c\u206c\u200f\u200c\u202e(TerrainData P_0, int P_1, out int P_2, out int P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u206f\u206b\u206c\u200b\u200b\u200e\u200f\u200c\u206a\u200d\u200d\u206e\u206b\u202c\u202d\u206a\u200c\u202e\u200d\u202d\u200b\u202b\u200c\u206a\u200d\u200c\u206f\u206e\u206e\u200d\u206e\u206b\u206f\u206a\u202a\u206e\u206c\u206c\u200f\u200c\u202e(orig_\u206f\u206b\u206c\u200b\u200b\u200e\u200f\u200c\u206a\u200d\u200d\u206e\u206b\u202c\u202d\u206a\u200c\u202e\u200d\u202d\u200b\u202b\u200c\u206a\u200d\u200c\u206f\u206e\u206e\u200d\u206e\u206b\u206f\u206a\u202a\u206e\u206c\u206c\u200f\u200c\u202e orig, TerrainData P_1, int P_2, out int P_3, out int P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_\u206a\u200e\u206a\u202a\u200d\u206f\u202b\u206d\u200f\u202b\u206c\u200b\u200e\u202d\u206e\u206e\u206a\u206e\u200d\u202a\u206e\u206b\u200f\u206c\u200b\u200e\u200d\u200b\u202d\u202d\u200c\u206e\u200d\u200e\u206d\u200d\u202e\u202d\u200f\u206b\u202e(int P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_\u206a\u200e\u206a\u202a\u200d\u206f\u202b\u206d\u200f\u202b\u206c\u200b\u200e\u202d\u206e\u206e\u206a\u206e\u200d\u202a\u206e\u206b\u200f\u206c\u200b\u200e\u200d\u200b\u202d\u202d\u200c\u206e\u200d\u200e\u206d\u200d\u202e\u202d\u200f\u206b\u202e(orig_\u206a\u200e\u206a\u202a\u200d\u206f\u202b\u206d\u200f\u202b\u206c\u200b\u200e\u202d\u206e\u206e\u206a\u206e\u200d\u202a\u206e\u206b\u200f\u206c\u200b\u200e\u200d\u200b\u202d\u202d\u200c\u206e\u200d\u200e\u206d\u200d\u202e\u202d\u200f\u206b\u202e orig, int P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_cctor();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_cctor(orig_cctor orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ColorSpace orig_\u206e\u202a\u200f\u206c\u206a\u206c\u200d\u200e\u206b\u200b\u200d\u206c\u202c\u202a\u202c\u200d\u202b\u206b\u200e\u206f\u206b\u200b\u200e\u202b\u206e\u200c\u200d\u206e\u202e\u200e\u202c\u200d\u206d\u200c\u200c\u202c\u200e\u202d\u202c\u206c\u202e();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ColorSpace hook_\u206e\u202a\u200f\u206c\u206a\u206c\u200d\u200e\u206b\u200b\u200d\u206c\u202c\u202a\u202c\u200d\u202b\u206b\u200e\u206f\u206b\u200b\u200e\u202b\u206e\u200c\u200d\u206e\u202e\u200e\u202c\u200d\u206d\u200c\u200c\u202c\u200e\u202d\u202c\u206c\u202e(orig_\u206e\u202a\u200f\u206c\u206a\u206c\u200d\u200e\u206b\u200b\u200d\u206c\u202c\u202a\u202c\u200d\u202b\u206b\u200e\u206f\u206b\u200b\u200e\u202b\u206e\u200c\u200d\u206e\u202e\u200e\u202c\u200d\u206d\u200c\u200c\u202c\u200e\u202d\u202c\u206c\u202e orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u206c\u202d\u206f\u206f\u200d\u202c\u206a\u202b\u202c\u206e\u206b\u206d\u200f\u206b\u202d\u206b\u202e\u202b\u200b\u200f\u206c\u206c\u200f\u202e\u202c\u200c\u206c\u202c\u200b\u206a\u200b\u200e\u202b\u206f\u200d\u200b\u200e\u202c\u206c\u202b\u202e(bool P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u206c\u202d\u206f\u206f\u200d\u202c\u206a\u202b\u202c\u206e\u206b\u206d\u200f\u206b\u202d\u206b\u202e\u202b\u200b\u200f\u206c\u206c\u200f\u202e\u202c\u200c\u206c\u202c\u200b\u206a\u200b\u200e\u202b\u206f\u200d\u200b\u200e\u202c\u206c\u202b\u202e(orig_\u206c\u202d\u206f\u206f\u200d\u202c\u206a\u202b\u202c\u206e\u206b\u206d\u200f\u206b\u202d\u206b\u202e\u202b\u200b\u200f\u206c\u206c\u200f\u202e\u202c\u200c\u206c\u202c\u200b\u206a\u200b\u200e\u202b\u206f\u200d\u200b\u200e\u202c\u206c\u202b\u202e orig, bool P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_\u206c\u200b\u206c\u200b\u202d\u206a\u200e\u200b\u200f\u206e\u202b\u200e\u202a\u202a\u206c\u202c\u206f\u206b\u206c\u206a\u206c\u202a\u206a\u200b\u200b\u202e\u202c\u206e\u206d\u202c\u200c\u202a\u206a\u202d\u200d\u202b\u202c\u200d\u200c\u202b\u202e(Object P_0, Object P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_\u206c\u200b\u206c\u200b\u202d\u206a\u200e\u200b\u200f\u206e\u202b\u200e\u202a\u202a\u206c\u202c\u206f\u206b\u206c\u206a\u206c\u202a\u206a\u200b\u200b\u202e\u202c\u206e\u206d\u202c\u200c\u202a\u206a\u202d\u200d\u202b\u202c\u200d\u200c\u202b\u202e(orig_\u206c\u200b\u206c\u200b\u202d\u206a\u200e\u200b\u200f\u206e\u202b\u200e\u202a\u202a\u206c\u202c\u206f\u206b\u206c\u206a\u206c\u202a\u206a\u200b\u200b\u202e\u202c\u206e\u206d\u202c\u200c\u202a\u206a\u202d\u200d\u202b\u202c\u200d\u200c\u202b\u202e orig, Object P_1, Object P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u206c\u200e\u202a\u206a\u200e\u206d\u206c\u202a\u206e\u200d\u200f\u206e\u200b\u200f\u202d\u206c\u200c\u206f\u206c\u202d\u206b\u200f\u200f\u202b\u206f\u200d\u206c\u202e\u206b\u202c\u202b\u200e\u200b\u202c\u206b\u200c\u202c\u200e\u206d\u202e(Texture P_0, RenderTexture P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u206c\u200e\u202a\u206a\u200e\u206d\u206c\u202a\u206e\u200d\u200f\u206e\u200b\u200f\u202d\u206c\u200c\u206f\u206c\u202d\u206b\u200f\u200f\u202b\u206f\u200d\u206c\u202e\u206b\u202c\u202b\u200e\u200b\u202c\u206b\u200c\u202c\u200e\u206d\u202e(orig_\u206c\u200e\u202a\u206a\u200e\u206d\u206c\u202a\u206e\u200d\u200f\u206e\u200b\u200f\u202d\u206c\u200c\u206f\u206c\u202d\u206b\u200f\u200f\u202b\u206f\u200d\u206c\u202e\u206b\u202c\u202b\u200e\u200b\u202c\u206b\u200c\u202c\u200e\u206d\u202e orig, Texture P_1, RenderTexture P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u200f\u206f\u206c\u200d\u200f\u200c\u206c\u200e\u202a\u202a\u206e\u206a\u200b\u202b\u206d\u206f\u206c\u202c\u206f\u200c\u202b\u200f\u206e\u206b\u202c\u206b\u206b\u200f\u206b\u202b\u200f\u200d\u200e\u206e\u206d\u206e\u200b\u200f\u206b\u206d\u202e(Texture P_0, RenderTexture P_1, Material P_2, int P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u200f\u206f\u206c\u200d\u200f\u200c\u206c\u200e\u202a\u202a\u206e\u206a\u200b\u202b\u206d\u206f\u206c\u202c\u206f\u200c\u202b\u200f\u206e\u206b\u202c\u206b\u206b\u200f\u206b\u202b\u200f\u200d\u200e\u206e\u206d\u206e\u200b\u200f\u206b\u206d\u202e(orig_\u200f\u206f\u206c\u200d\u200f\u200c\u206c\u200e\u202a\u202a\u206e\u206a\u200b\u202b\u206d\u206f\u206c\u202c\u206f\u200c\u202b\u200f\u206e\u206b\u202c\u206b\u206b\u200f\u206b\u202b\u200f\u200d\u200e\u206e\u206d\u206e\u200b\u200f\u206b\u206d\u202e orig, Texture P_1, RenderTexture P_2, Material P_3, int P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D orig_\u202b\u206b\u200d\u202e\u200e\u202c\u206f\u200b\u206e\u200f\u200f\u202d\u206a\u200e\u206f\u200e\u206c\u206d\u202a\u206a\u206e\u200e\u206d\u202a\u202c\u202e\u206b\u202a\u202e\u206e\u200b\u200d\u202b\u206b\u200b\u206f\u202c\u202b\u206d\u202d\u202e(int P_0, int P_1, TextureFormat P_2, bool P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D hook_\u202b\u206b\u200d\u202e\u200e\u202c\u206f\u200b\u206e\u200f\u200f\u202d\u206a\u200e\u206f\u200e\u206c\u206d\u202a\u206a\u206e\u200e\u206d\u202a\u202c\u202e\u206b\u202a\u202e\u206e\u200b\u200d\u202b\u206b\u200b\u206f\u202c\u202b\u206d\u202d\u202e(orig_\u202b\u206b\u200d\u202e\u200e\u202c\u206f\u200b\u206e\u200f\u200f\u202d\u206a\u200e\u206f\u200e\u206c\u206d\u202a\u206a\u206e\u200e\u206d\u202a\u202c\u202e\u206b\u202a\u202e\u206e\u200b\u200d\u202b\u206b\u200b\u206f\u202c\u202b\u206d\u202d\u202e orig, int P_1, int P_2, TextureFormat P_3, bool P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u202b\u202a\u202e\u206a\u202b\u202e\u200b\u206b\u200d\u200c\u206f\u200b\u202d\u206b\u200e\u202d\u206b\u200b\u206e\u206b\u202c\u202d\u206b\u206e\u206b\u202b\u202e\u202a\u200c\u200f\u202c\u206d\u202b\u202a\u200f\u202a\u202a\u206d\u202d\u206c\u202e(Texture2D P_0, Color[] P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u202b\u202a\u202e\u206a\u202b\u202e\u200b\u206b\u200d\u200c\u206f\u200b\u202d\u206b\u200e\u202d\u206b\u200b\u206e\u206b\u202c\u202d\u206b\u206e\u206b\u202b\u202e\u202a\u200c\u200f\u202c\u206d\u202b\u202a\u200f\u202a\u202a\u206d\u202d\u206c\u202e(orig_\u202b\u202a\u202e\u206a\u202b\u202e\u200b\u206b\u200d\u200c\u206f\u200b\u202d\u206b\u200e\u202d\u206b\u200b\u206e\u206b\u202c\u202d\u206b\u206e\u206b\u202b\u202e\u202a\u200c\u200f\u202c\u206d\u202b\u202a\u200f\u202a\u202a\u206d\u202d\u206c\u202e orig, Texture2D P_1, Color[] P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u202e\u202d\u206b\u206b\u206e\u200d\u200e\u200d\u202d\u202a\u206c\u206f\u206d\u202c\u200d\u206c\u202e\u200d\u202c\u206b\u202a\u206f\u206d\u202b\u200e\u202d\u200e\u202d\u206a\u200c\u202e\u206c\u202b\u200d\u200b\u206c\u200d\u206f\u206f\u202c\u202e(Texture2D P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u202e\u202d\u206b\u206b\u206e\u200d\u200e\u200d\u202d\u202a\u206c\u206f\u206d\u202c\u200d\u206c\u202e\u200d\u202c\u206b\u202a\u206f\u206d\u202b\u200e\u202d\u200e\u202d\u206a\u200c\u202e\u206c\u202b\u200d\u200b\u206c\u200d\u206f\u206f\u202c\u202e(orig_\u202e\u202d\u206b\u206b\u206e\u200d\u200e\u200d\u202d\u202a\u206c\u206f\u206d\u202c\u200d\u206c\u202e\u200d\u202c\u206b\u202a\u206f\u206d\u202b\u200e\u202d\u200e\u202d\u206a\u200c\u202e\u206c\u202b\u200d\u200b\u206c\u200d\u206f\u206f\u202c\u202e orig, Texture2D P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate RenderTexture orig_\u202c\u206a\u202e\u202d\u200c\u202e\u206a\u202c\u206b\u206e\u200b\u206c\u200d\u206a\u200e\u206a\u206b\u206a\u202d\u206a\u206e\u206b\u202a\u202a\u206b\u202d\u206f\u202b\u202b\u202d\u206c\u206d\u206c\u202d\u206c\u202a\u206b\u202c\u206c\u202b\u202e(int P_0, int P_1, int P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate RenderTexture hook_\u202c\u206a\u202e\u202d\u200c\u202e\u206a\u202c\u206b\u206e\u200b\u206c\u200d\u206a\u200e\u206a\u206b\u206a\u202d\u206a\u206e\u206b\u202a\u202a\u206b\u202d\u206f\u202b\u202b\u202d\u206c\u206d\u206c\u202d\u206c\u202a\u206b\u202c\u206c\u202b\u202e(orig_\u202c\u206a\u202e\u202d\u200c\u202e\u206a\u202c\u206b\u206e\u200b\u206c\u200d\u206a\u200e\u206a\u206b\u206a\u202d\u206a\u206e\u206b\u202a\u202a\u206b\u202d\u206f\u202b\u202b\u202d\u206c\u206d\u206c\u202d\u206c\u202a\u206b\u202c\u206c\u202b\u202e orig, int P_1, int P_2, int P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_\u202a\u202d\u206c\u200b\u200e\u202c\u200d\u206d\u200e\u202c\u206a\u200c\u206f\u202d\u206e\u200d\u202a\u206f\u200b\u200c\u206b\u202c\u206f\u206b\u202d\u200f\u200f\u206b\u206d\u200f\u202e\u200f\u206d\u206d\u206e\u206f\u206f\u206b\u206c\u200e\u202e(RenderTexture P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_\u202a\u202d\u206c\u200b\u200e\u202c\u200d\u206d\u200e\u202c\u206a\u200c\u206f\u202d\u206e\u200d\u202a\u206f\u200b\u200c\u206b\u202c\u206f\u206b\u202d\u200f\u200f\u206b\u206d\u200f\u202e\u200f\u206d\u206d\u206e\u206f\u206f\u206b\u206c\u200e\u202e(orig_\u202a\u202d\u206c\u200b\u200e\u202c\u200d\u206d\u200e\u202c\u206a\u200c\u206f\u202d\u206e\u200d\u202a\u206f\u200b\u200c\u206b\u202c\u206f\u206b\u202d\u200f\u200f\u206b\u206d\u200f\u202e\u200f\u206d\u206d\u206e\u206f\u206f\u206b\u206c\u200e\u202e orig, RenderTexture P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u202a\u200c\u206a\u202c\u200f\u202e\u202b\u200c\u206d\u202d\u200f\u200c\u206d\u206f\u206d\u200e\u206d\u202a\u200c\u202e\u202a\u206e\u206b\u206f\u206e\u202a\u206d\u202a\u200e\u206f\u206f\u202a\u206e\u202e\u200b\u202a\u202a\u202c\u202a\u206f\u202e(RenderTexture P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u202a\u200c\u206a\u202c\u200f\u202e\u202b\u200c\u206d\u202d\u200f\u200c\u206d\u206f\u206d\u200e\u206d\u202a\u200c\u202e\u202a\u206e\u206b\u206f\u206e\u202a\u206d\u202a\u200e\u206f\u206f\u202a\u206e\u202e\u200b\u202a\u202a\u202c\u202a\u206f\u202e(orig_\u202a\u200c\u206a\u202c\u200f\u202e\u202b\u200c\u206d\u202d\u200f\u200c\u206d\u206f\u206d\u200e\u206d\u202a\u200c\u202e\u202a\u206e\u206b\u206f\u206e\u202a\u206d\u202a\u200e\u206f\u206f\u202a\u206e\u202e\u200b\u202a\u202a\u202c\u202a\u206f\u202e orig, RenderTexture P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_\u202b\u200d\u202a\u202d\u206b\u202c\u202d\u202c\u200e\u206b\u206a\u206a\u202e\u206e\u206b\u200d\u202e\u200e\u206e\u200f\u206a\u202e\u202a\u200f\u200c\u200e\u202e\u206e\u206e\u202a\u200c\u200b\u206c\u202e\u206d\u206f\u202c\u206f\u206e\u202a\u202e();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_\u202b\u200d\u202a\u202d\u206b\u202c\u202d\u202c\u200e\u206b\u206a\u206a\u202e\u206e\u206b\u200d\u202e\u200e\u206e\u200f\u206a\u202e\u202a\u200f\u200c\u200e\u202e\u206e\u206e\u202a\u200c\u200b\u206c\u202e\u206d\u206f\u202c\u206f\u206e\u202a\u202e(orig_\u202b\u200d\u202a\u202d\u206b\u202c\u202d\u202c\u200e\u206b\u206a\u206a\u202e\u206e\u206b\u200d\u202e\u200e\u206e\u200f\u206a\u202e\u202a\u200f\u200c\u200e\u202e\u206e\u206e\u202a\u200c\u200b\u206c\u202e\u206d\u206f\u202c\u206f\u206e\u202a\u202e orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u202c\u206f\u202b\u202b\u206b\u200c\u206d\u206d\u202e\u206c\u202c\u202d\u206e\u200b\u202c\u206f\u206c\u200e\u200e\u202b\u200f\u200d\u200c\u206b\u200b\u200d\u202e\u200c\u202a\u206a\u206e\u206e\u202a\u206e\u202e\u206c\u202d\u206e\u200b\u202e\u202e(Object P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u202c\u206f\u202b\u202b\u206b\u200c\u206d\u206d\u202e\u206c\u202c\u202d\u206e\u200b\u202c\u206f\u206c\u200e\u200e\u202b\u200f\u200d\u200c\u206b\u200b\u200d\u202e\u200c\u202a\u206a\u206e\u206e\u202a\u206e\u202e\u206c\u202d\u206e\u200b\u202e\u202e(orig_\u202c\u206f\u202b\u202b\u206b\u200c\u206d\u206d\u202e\u206c\u202c\u202d\u206e\u200b\u202c\u206f\u206c\u200e\u200e\u202b\u200f\u200d\u200c\u206b\u200b\u200d\u202e\u200c\u202a\u206a\u206e\u206e\u202a\u206e\u202e\u206c\u202d\u206e\u200b\u202e\u202e orig, Object P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u202b\u206b\u202a\u202a\u200f\u200f\u200c\u200f\u202c\u202d\u202a\u202c\u200c\u202a\u206f\u206b\u200f\u200e\u200f\u202a\u202b\u200b\u200c\u202c\u206e\u200f\u206e\u202a\u200c\u200e\u202c\u202a\u200b\u202d\u206d\u200e\u206f\u202c\u206e\u202e(Object P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u202b\u206b\u202a\u202a\u200f\u200f\u200c\u200f\u202c\u202d\u202a\u202c\u200c\u202a\u206f\u206b\u200f\u200e\u200f\u202a\u202b\u200b\u200c\u202c\u206e\u200f\u206e\u202a\u200c\u200e\u202c\u202a\u200b\u202d\u206d\u200e\u206f\u202c\u206e\u202e(orig_\u202b\u206b\u202a\u202a\u200f\u200f\u200c\u200f\u202c\u202d\u202a\u202c\u200c\u202a\u206f\u206b\u200f\u200e\u200f\u202a\u202b\u200b\u200c\u202c\u206e\u200f\u206e\u202a\u200c\u200e\u202c\u202a\u200b\u202d\u206d\u200e\u206f\u202c\u206e\u202e orig, Object P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate RenderTexture orig_\u202c\u206c\u200e\u200c\u200e\u206e\u206d\u206c\u206b\u202b\u200b\u206c\u206b\u206f\u202c\u202b\u202b\u200b\u202c\u200e\u206a\u202a\u202e\u202d\u206d\u202b\u202a\u206e\u202a\u206d\u202b\u206a\u206e\u200f\u206b\u202b\u200d\u206b\u200b\u206d\u202e();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate RenderTexture hook_\u202c\u206c\u200e\u200c\u200e\u206e\u206d\u206c\u206b\u202b\u200b\u206c\u206b\u206f\u202c\u202b\u202b\u200b\u202c\u200e\u206a\u202a\u202e\u202d\u206d\u202b\u202a\u206e\u202a\u206d\u202b\u206a\u206e\u200f\u206b\u202b\u200d\u206b\u200b\u206d\u202e(orig_\u202c\u206c\u200e\u200c\u200e\u206e\u206d\u206c\u206b\u202b\u200b\u206c\u206b\u206f\u202c\u202b\u202b\u200b\u202c\u200e\u206a\u202a\u202e\u202d\u206d\u202b\u202a\u206e\u202a\u206d\u202b\u206a\u206e\u200f\u206b\u202b\u200d\u206b\u200b\u206d\u202e orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u206a\u206d\u200e\u206d\u202d\u206c\u202e\u202e\u200b\u200f\u202b\u206c\u206a\u206f\u206f\u200c\u200e\u200f\u200f\u200e\u206f\u202a\u202d\u200e\u202d\u200f\u206d\u206e\u202a\u206f\u200d\u202e\u206e\u202a\u206e\u200d\u200f\u206a\u200f\u206b\u202e(RenderTexture P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u206a\u206d\u200e\u206d\u202d\u206c\u202e\u202e\u200b\u200f\u202b\u206c\u206a\u206f\u206f\u200c\u200e\u200f\u200f\u200e\u206f\u202a\u202d\u200e\u202d\u200f\u206d\u206e\u202a\u206f\u200d\u202e\u206e\u202a\u206e\u200d\u200f\u206a\u200f\u206b\u202e(orig_\u206a\u206d\u200e\u206d\u202d\u206c\u202e\u202e\u200b\u200f\u202b\u206c\u206a\u206f\u206f\u200c\u200e\u200f\u200f\u200e\u206f\u202a\u202d\u200e\u202d\u200f\u206d\u206e\u202a\u206f\u200d\u202e\u206e\u202a\u206e\u200d\u200f\u206a\u200f\u206b\u202e orig, RenderTexture P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_\u206b\u200f\u206e\u200b\u206e\u200f\u206e\u206a\u200b\u200f\u206b\u206b\u206b\u202a\u200c\u206f\u200d\u200e\u202d\u202c\u206d\u206b\u202c\u202a\u200d\u206d\u206c\u202d\u202c\u202d\u202c\u206e\u200c\u202c\u202a\u200e\u206c\u206c\u200b\u202a\u202e(Texture P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_\u206b\u200f\u206e\u200b\u206e\u200f\u206e\u206a\u200b\u200f\u206b\u206b\u206b\u202a\u200c\u206f\u200d\u200e\u202d\u202c\u206d\u206b\u202c\u202a\u200d\u206d\u206c\u202d\u202c\u202d\u202c\u206e\u200c\u202c\u202a\u200e\u206c\u206c\u200b\u202a\u202e(orig_\u206b\u200f\u206e\u200b\u206e\u200f\u206e\u206a\u200b\u200f\u206b\u206b\u206b\u202a\u200c\u206f\u200d\u200e\u202d\u202c\u206d\u206b\u202c\u202a\u200d\u206d\u206c\u202d\u202c\u202d\u202c\u206e\u200c\u202c\u202a\u200e\u206c\u206c\u200b\u202a\u202e orig, Texture P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_\u206c\u202c\u202c\u206c\u200f\u202d\u200d\u200d\u206c\u206f\u202e\u206f\u202e\u206e\u206c\u202d\u202d\u206c\u200d\u202b\u200f\u200e\u200f\u202e\u206c\u200f\u200c\u202e\u202a\u200d\u206d\u206a\u202a\u206c\u206c\u206e\u202e\u200d\u206c\u206a\u202e(Texture P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_\u206c\u202c\u202c\u206c\u200f\u202d\u200d\u200d\u206c\u206f\u202e\u206f\u202e\u206e\u206c\u202d\u202d\u206c\u200d\u202b\u200f\u200e\u200f\u202e\u206c\u200f\u200c\u202e\u202a\u200d\u206d\u206a\u202a\u206c\u206c\u206e\u202e\u200d\u206c\u206a\u202e(orig_\u206c\u202c\u202c\u206c\u200f\u202d\u200d\u200d\u206c\u206f\u202e\u206f\u202e\u206e\u206c\u202d\u202d\u206c\u200d\u202b\u200f\u200e\u200f\u202e\u206c\u200f\u200c\u202e\u202a\u200d\u206d\u206a\u202a\u206c\u206c\u206e\u202e\u200d\u206c\u206a\u202e orig, Texture P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D orig_\u200e\u200e\u206a\u202b\u200f\u202c\u206d\u206f\u202e\u206d\u200d\u206d\u206c\u206c\u206b\u206d\u202d\u202e\u200c\u202e\u200b\u206c\u200d\u206d\u202d\u200c\u206e\u206c\u200c\u206a\u202e\u202c\u202b\u206d\u202c\u206f\u200e\u202e\u202b\u202e\u202e(int P_0, int P_1, TextureFormat P_2, bool P_3, bool P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Texture2D hook_\u200e\u200e\u206a\u202b\u200f\u202c\u206d\u206f\u202e\u206d\u200d\u206d\u206c\u206c\u206b\u206d\u202d\u202e\u200c\u202e\u200b\u206c\u200d\u206d\u202d\u200c\u206e\u206c\u200c\u206a\u202e\u202c\u202b\u206d\u202c\u206f\u200e\u202e\u202b\u202e\u202e(orig_\u200e\u200e\u206a\u202b\u200f\u202c\u206d\u206f\u202e\u206d\u200d\u206d\u206c\u206c\u206b\u206d\u202d\u202e\u200c\u202e\u200b\u206c\u200d\u206d\u202d\u200c\u206e\u206c\u200c\u206a\u202e\u202c\u202b\u206d\u202c\u206f\u200e\u202e\u202b\u202e\u202e orig, int P_1, int P_2, TextureFormat P_3, bool P_4, bool P_5);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_\u200f\u202a\u200b\u200f\u202c\u200c\u200e\u206a\u206a\u202e\u202c\u202b\u206d\u206a\u202c\u200b\u202c\u200f\u202c\u200d\u200f\u202e\u206e\u200c\u202d\u206f\u206c\u200b\u206a\u200b\u202a\u200c\u200c\u202b\u206f\u200c\u206c\u206e\u206d\u206f\u202e(Texture2D P_0, int P_1, int P_2, TextureFormat P_3, bool P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_\u200f\u202a\u200b\u200f\u202c\u200c\u200e\u206a\u206a\u202e\u202c\u202b\u206d\u206a\u202c\u200b\u202c\u200f\u202c\u200d\u200f\u202e\u206e\u200c\u202d\u206f\u206c\u200b\u206a\u200b\u202a\u200c\u200c\u202b\u206f\u200c\u206c\u206e\u206d\u206f\u202e(orig_\u200f\u202a\u200b\u200f\u202c\u200c\u200e\u206a\u206a\u202e\u202c\u202b\u206d\u206a\u202c\u200b\u202c\u200f\u202c\u200d\u200f\u202e\u206e\u200c\u202d\u206f\u206c\u200b\u206a\u200b\u202a\u200c\u200c\u202b\u206f\u200c\u206c\u206e\u206d\u206f\u202e orig, Texture2D P_1, int P_2, int P_3, TextureFormat P_4, bool P_5);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u202e\u202c\u206f\u202e\u202c\u206d\u200b\u202b\u206b\u200f\u202e\u206e\u200e\u200c\u202c\u206d\u206b\u206a\u206b\u200b\u200b\u206a\u206e\u206e\u202c\u200d\u206c\u206d\u200e\u200b\u200c\u202b\u206b\u206c\u200d\u206d\u206f\u200d\u206d\u206b\u202e(Texture2D P_0, Rect P_1, int P_2, int P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u202e\u202c\u206f\u202e\u202c\u206d\u200b\u202b\u206b\u200f\u202e\u206e\u200e\u200c\u202c\u206d\u206b\u206a\u206b\u200b\u200b\u206a\u206e\u206e\u202c\u200d\u206c\u206d\u200e\u200b\u200c\u202b\u206b\u206c\u200d\u206d\u206f\u200d\u206d\u206b\u202e(orig_\u202e\u202c\u206f\u202e\u202c\u206d\u200b\u202b\u206b\u200f\u202e\u206e\u200e\u200c\u202c\u206d\u206b\u206a\u206b\u200b\u200b\u206a\u206e\u206e\u202c\u200d\u206c\u206d\u200e\u200b\u200c\u202b\u206b\u206c\u200d\u206d\u206f\u200d\u206d\u206b\u202e orig, Texture2D P_1, Rect P_2, int P_3, int P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_\u202c\u206c\u206b\u202c\u200d\u206e\u206f\u200c\u202b\u200e\u202a\u206e\u200e\u200e\u202a\u200e\u202c\u206a\u202e\u200d\u200c\u200d\u202b\u206a\u200d\u200e\u206d\u200d\u200f\u202c\u202a\u202e\u202c\u206c\u206b\u206f\u206b\u206b\u206f\u206f\u202e();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_\u202c\u206c\u206b\u202c\u200d\u206e\u206f\u200c\u202b\u200e\u202a\u206e\u200e\u200e\u202a\u200e\u202c\u206a\u202e\u200d\u200c\u200d\u202b\u206a\u200d\u200e\u206d\u200d\u200f\u202c\u202a\u202e\u202c\u206c\u206b\u206f\u206b\u206b\u206f\u206f\u202e(orig_\u202c\u206c\u206b\u202c\u200d\u206e\u206f\u200c\u202b\u200e\u202a\u206e\u200e\u200e\u202a\u200e\u202c\u206a\u202e\u200d\u200c\u200d\u202b\u206a\u200d\u200e\u206d\u200d\u200f\u202c\u202a\u202e\u202c\u206c\u206b\u206f\u206b\u206b\u206f\u206f\u202e orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig_\u200f\u206c\u202e\u206a\u206a\u202d\u200e\u200d\u200c\u206c\u202d\u200e\u200c\u206d\u206a\u202a\u202c\u202a\u200e\u200b\u206a\u202a\u202d\u200e\u200c\u206e\u202a\u206b\u206e\u200c\u202d\u206c\u206d\u202c\u202e\u202b\u202e\u202b\u200f\u202b\u202e(string P_0, object P_1, object P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook_\u200f\u206c\u202e\u206a\u206a\u202d\u200e\u200d\u200c\u206c\u202d\u200e\u200c\u206d\u206a\u202a\u202c\u202a\u200e\u200b\u206a\u202a\u202d\u200e\u200c\u206e\u202a\u206b\u206e\u200c\u202d\u206c\u206d\u202c\u202e\u202b\u202e\u202b\u200f\u202b\u202e(orig_\u200f\u206c\u202e\u206a\u206a\u202d\u200e\u200d\u200c\u206c\u202d\u200e\u200c\u206d\u206a\u202a\u202c\u202a\u200e\u200b\u206a\u202a\u202d\u200e\u200c\u206e\u202a\u206b\u206e\u200c\u202d\u206c\u206d\u202c\u202e\u202b\u202e\u202b\u200f\u202b\u202e orig, string P_1, object P_2, object P_3);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Color[] orig_\u200d\u200e\u202c\u202c\u206b\u202a\u200b\u206f\u206d\u202c\u206b\u206f\u206f\u202e\u202e\u200d\u206c\u202a\u202a\u206f\u200d\u206c\u200d\u206d\u206a\u206e\u202d\u202a\u206d\u206d\u202c\u202a\u206f\u200d\u206f\u202e\u202a\u200b\u200e\u206f\u202e(Texture2D P_0, int P_1, int P_2, int P_3, int P_4);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Color[] hook_\u200d\u200e\u202c\u202c\u206b\u202a\u200b\u206f\u206d\u202c\u206b\u206f\u206f\u202e\u202e\u200d\u206c\u202a\u202a\u206f\u200d\u206c\u200d\u206d\u206a\u206e\u202d\u202a\u206d\u206d\u202c\u202a\u206f\u200d\u206f\u202e\u202a\u200b\u200e\u206f\u202e(orig_\u200d\u200e\u202c\u202c\u206b\u202a\u200b\u206f\u206d\u202c\u206b\u206f\u206f\u202e\u202e\u200d\u206c\u202a\u202a\u206f\u200d\u206c\u200d\u206d\u206a\u206e\u202d\u202a\u206d\u206d\u202c\u202a\u206f\u200d\u206f\u202e\u202a\u200b\u200e\u206f\u202e orig, Texture2D P_1, int P_2, int P_3, int P_4, int P_5);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate TextureFormat orig_\u200b\u206f\u206e\u200d\u206a\u202a\u206a\u206d\u206f\u200f\u200e\u202b\u202e\u200d\u202d\u200e\u202c\u206e\u200f\u200b\u202d\u202c\u202b\u200c\u202d\u206c\u200d\u202b\u206a\u200f\u206e\u202b\u202a\u200c\u206f\u206a\u200e\u202e\u202a\u200d\u202e(Texture2D P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate TextureFormat hook_\u200b\u206f\u206e\u200d\u206a\u202a\u206a\u206d\u206f\u200f\u200e\u202b\u202e\u200d\u202d\u200e\u202c\u206e\u200f\u200b\u202d\u202c\u202b\u200c\u202d\u206c\u200d\u202b\u206a\u200f\u206e\u202b\u202a\u200c\u206f\u206a\u200e\u202e\u202a\u200d\u202e(orig_\u200b\u206f\u206e\u200d\u206a\u202a\u206a\u206d\u206f\u200f\u200e\u202b\u202e\u200d\u202d\u200e\u202c\u206e\u200f\u200b\u202d\u202c\u202b\u200c\u202d\u206c\u200d\u202b\u206a\u200f\u206e\u202b\u202a\u200c\u206f\u206a\u200e\u202e\u202a\u200d\u202e orig, Texture2D P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u206d\u200d\u206b\u200c\u200e\u206b\u202e\u202e\u206d\u202e\u206c\u202d\u206d\u200e\u206b\u206a\u206f\u202b\u202a\u202c\u206a\u202e\u206a\u202c\u206a\u200e\u202b\u200c\u200c\u200e\u202a\u206f\u200b\u200b\u206f\u200f\u200c\u206a\u202c\u200d\u202e(Texture P_0, TextureWrapMode P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u206d\u200d\u206b\u200c\u200e\u206b\u202e\u202e\u206d\u202e\u206c\u202d\u206d\u200e\u206b\u206a\u206f\u202b\u202a\u202c\u206a\u202e\u206a\u202c\u206a\u200e\u202b\u200c\u200c\u200e\u202a\u206f\u200b\u200b\u206f\u200f\u200c\u206a\u202c\u200d\u202e(orig_\u206d\u200d\u206b\u200c\u200e\u206b\u202e\u202e\u206d\u202e\u206c\u202d\u206d\u200e\u206b\u206a\u206f\u202b\u202a\u202c\u206a\u202e\u206a\u202c\u206a\u200e\u202b\u200c\u200c\u200e\u202a\u206f\u200b\u200b\u206f\u200f\u200c\u206a\u202c\u200d\u202e orig, Texture P_1, TextureWrapMode P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate FilterMode orig_\u200e\u200e\u206f\u200c\u206d\u202c\u202d\u202b\u202e\u206c\u200d\u200e\u206a\u202e\u206c\u202c\u206e\u200b\u206d\u200b\u202d\u200f\u206a\u202d\u206e\u202b\u202c\u202c\u206f\u206e\u200d\u206d\u200d\u202d\u200d\u202c\u206a\u206f\u200d\u202a\u202e(Texture P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate FilterMode hook_\u200e\u200e\u206f\u200c\u206d\u202c\u202d\u202b\u202e\u206c\u200d\u200e\u206a\u202e\u206c\u202c\u206e\u200b\u206d\u200b\u202d\u200f\u206a\u202d\u206e\u202b\u202c\u202c\u206f\u206e\u200d\u206d\u200d\u202d\u200d\u202c\u206a\u206f\u200d\u202a\u202e(orig_\u200e\u200e\u206f\u200c\u206d\u202c\u202d\u202b\u202e\u206c\u200d\u200e\u206a\u202e\u206c\u202c\u206e\u200b\u206d\u200b\u202d\u200f\u206a\u202d\u206e\u202b\u202c\u202c\u206f\u206e\u200d\u206d\u200d\u202d\u200d\u202c\u206a\u206f\u200d\u202a\u202e orig, Texture P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u202c\u206d\u200f\u200c\u206e\u202c\u200b\u202b\u206f\u206a\u200c\u202e\u206a\u202b\u202a\u200b\u206f\u202b\u206b\u202a\u206c\u202b\u202e\u202b\u202e\u206b\u202d\u202b\u206c\u202d\u206c\u202a\u200f\u200e\u202d\u206a\u206f\u202b\u206d\u206a\u202e(Texture P_0, FilterMode P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u202c\u206d\u200f\u200c\u206e\u202c\u200b\u202b\u206f\u206a\u200c\u202e\u206a\u202b\u202a\u200b\u206f\u202b\u206b\u202a\u206c\u202b\u202e\u202b\u202e\u206b\u202d\u202b\u206c\u202d\u206c\u202a\u200f\u200e\u202d\u206a\u206f\u202b\u206d\u206a\u202e(orig_\u202c\u206d\u200f\u200c\u206e\u202c\u200b\u202b\u206f\u206a\u200c\u202e\u206a\u202b\u202a\u200b\u206f\u202b\u206b\u202a\u206c\u202b\u202e\u202b\u202e\u206b\u202d\u202b\u206c\u202d\u206c\u202a\u200f\u200e\u202d\u206a\u206f\u202b\u206d\u206a\u202e orig, Texture P_1, FilterMode P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig_\u206e\u202e\u200f\u206b\u200e\u200c\u206d\u202a\u206b\u200d\u202e\u206a\u200c\u206e\u206f\u200e\u206e\u200d\u200d\u202d\u200c\u206f\u200c\u200b\u202d\u202a\u206f\u202b\u206e\u206c\u200b\u206b\u202d\u206b\u200f\u200b\u206b\u206b\u200e\u206d\u202e(Object P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook_\u206e\u202e\u200f\u206b\u200e\u200c\u206d\u202a\u206b\u200d\u202e\u206a\u200c\u206e\u206f\u200e\u206e\u200d\u200d\u202d\u200c\u206f\u200c\u200b\u202d\u202a\u206f\u202b\u206e\u206c\u200b\u206b\u202d\u206b\u200f\u200b\u206b\u206b\u200e\u206d\u202e(orig_\u206e\u202e\u200f\u206b\u200e\u200c\u206d\u202a\u206b\u200d\u202e\u206a\u200c\u206e\u206f\u200e\u206e\u200d\u200d\u202d\u200c\u206f\u200c\u200b\u202d\u202a\u206f\u202b\u206e\u206c\u200b\u206b\u202d\u206b\u200f\u200b\u206b\u206b\u200e\u206d\u202e orig, Object P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig_\u200c\u200f\u206d\u206b\u200d\u202e\u202c\u200f\u202b\u200f\u200f\u206b\u202a\u202a\u202d\u202b\u206e\u202e\u202d\u200e\u200f\u200d\u206b\u200f\u200c\u202e\u200b\u202c\u202c\u200e\u206f\u206e\u200d\u200b\u206e\u202c\u206d\u200e\u206a\u202e\u202e(string P_0, string P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook_\u200c\u200f\u206d\u206b\u200d\u202e\u202c\u200f\u202b\u200f\u200f\u206b\u202a\u202a\u202d\u202b\u206e\u202e\u202d\u200e\u200f\u200d\u206b\u200f\u200c\u202e\u200b\u202c\u202c\u200e\u206f\u206e\u200d\u200b\u206e\u202c\u206d\u200e\u206a\u202e\u202e(orig_\u200c\u200f\u206d\u206b\u200d\u202e\u202c\u200f\u202b\u200f\u200f\u206b\u202a\u202a\u202d\u202b\u206e\u202e\u202d\u200e\u200f\u200d\u206b\u200f\u200c\u202e\u200b\u202c\u202c\u200e\u206f\u206e\u200d\u200b\u206e\u202c\u206d\u200e\u206a\u202e\u202e orig, string P_1, string P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_\u206e\u206b\u206b\u206b\u206c\u200b\u202e\u200e\u202b\u200d\u206b\u200c\u202b\u202c\u202c\u206f\u202a\u200e\u202e\u206c\u202c\u206b\u202c\u202c\u200b\u202a\u200b\u202c\u200d\u206c\u200b\u206d\u202e\u200e\u202d\u206d\u202b\u200d\u200c\u206b\u202e(Object P_0, string P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_\u206e\u206b\u206b\u206b\u206c\u200b\u202e\u200e\u202b\u200d\u206b\u200c\u202b\u202c\u202c\u206f\u202a\u200e\u202e\u206c\u202c\u206b\u202c\u202c\u200b\u202a\u200b\u202c\u200d\u206c\u200b\u206d\u202e\u200e\u202d\u206d\u202b\u200d\u200c\u206b\u202e(orig_\u206e\u206b\u206b\u206b\u206c\u200b\u202e\u200e\u202b\u200d\u206b\u200c\u202b\u202c\u202c\u206f\u202a\u200e\u202e\u206c\u202c\u206b\u202c\u202c\u200b\u202a\u200b\u202c\u200d\u206c\u200b\u206d\u202e\u200e\u202d\u206d\u202b\u200d\u200c\u206b\u202e orig, Object P_1, string P_2);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Vector3 orig_\u202d\u200e\u200e\u200e\u200d\u206c\u200c\u206b\u200c\u200c\u202a\u202d\u202a\u200d\u206b\u200e\u206f\u202a\u206f\u206c\u202c\u206b\u206f\u206a\u202e\u200b\u206b\u202a\u202a\u206d\u202b\u206f\u206b\u200f\u200e\u200d\u202d\u200d\u202e\u200f\u202e(TerrainData P_0);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate Vector3 hook_\u202d\u200e\u200e\u200e\u200d\u206c\u200c\u206b\u200c\u200c\u202a\u202d\u202a\u200d\u206b\u200e\u206f\u202a\u206f\u206c\u202c\u206b\u206f\u206a\u202e\u200b\u206b\u202a\u202a\u206d\u202b\u206f\u206b\u200f\u200e\u200d\u202d\u200d\u202e\u200f\u202e(orig_\u202d\u200e\u200e\u200e\u200d\u206c\u200c\u206b\u200c\u200c\u202a\u202d\u202a\u200d\u206b\u200e\u206f\u202a\u206f\u206c\u202c\u206b\u206f\u206a\u202e\u200b\u206b\u202a\u202a\u206d\u202b\u206f\u206b\u200f\u200e\u200d\u202d\u200d\u202e\u200f\u202e orig, TerrainData P_1);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_\u206e\u200c\u206b\u202e\u202b\u200f\u206c\u202a\u200b\u206b\u202b\u206c\u206b\u206e\u206e\u206e\u206c\u206c\u206b\u202b\u200c\u202a\u206a\u206d\u206a\u206b\u206d\u200e\u206c\u202e\u206e\u200e\u206a\u200e\u200c\u200b\u206b\u206f\u200d\u206e\u202e();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_\u206e\u200c\u206b\u202e\u202b\u200f\u206c\u202a\u200b\u206b\u202b\u206c\u206b\u206e\u206e\u206e\u206c\u206c\u206b\u202b\u200c\u202a\u206a\u206d\u206a\u206b\u206d\u200e\u206c\u202e\u206e\u200e\u206a\u200e\u200c\u200b\u206b\u206f\u200d\u206e\u202e(orig_\u206e\u200c\u206b\u202e\u202b\u200f\u206c\u202a\u200b\u206b\u202b\u206c\u206b\u206e\u206e\u206e\u206c\u206c\u206b\u202b\u200c\u202a\u206a\u206d\u206a\u206b\u206d\u200e\u206c\u202e\u206e\u200e\u206a\u200e\u200c\u200b\u206b\u206f\u200d\u206e\u202e orig);

		public static class \u206b\u206a\u200c\u206b\u206a\u202a\u200d\u202a\u200f\u202b\u200b\u206b\u200d\u202c\u206c\u206c\u202a\u206e\u200c\u206d\u202a\u206b\u206c\u200e\u200c\u202b\u206e\u206e\u200b\u206f\u200f\u200e\u202e\u206b\u202d\u200f\u200b\u202a\u206d\u202c\u202e
		{
			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_ctor(object self, TerrainData P_1, bool P_2, bool P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_ctor(orig_ctor orig, object self, TerrainData P_2, bool P_3, bool P_4);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] orig_\u200d\u202d\u206a\u202d\u206e\u206e\u206e\u200f\u206c\u206c\u202a\u200f\u200f\u202a\u206a\u202e\u206f\u206f\u206c\u202e\u206c\u200c\u206b\u202e\u206a\u200f\u206b\u200c\u200f\u200d\u200e\u202b\u200f\u200c\u206c\u206d\u202c\u206f\u202a\u200e\u202e(object self, int P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] hook_\u200d\u202d\u206a\u202d\u206e\u206e\u206e\u200f\u206c\u206c\u202a\u200f\u200f\u202a\u206a\u202e\u206f\u206f\u206c\u202e\u206c\u200c\u206b\u202e\u206a\u200f\u206b\u200c\u200f\u200d\u200e\u202b\u200f\u200c\u206c\u206d\u202c\u206f\u202a\u200e\u202e(orig_\u200d\u202d\u206a\u202d\u206e\u206e\u206e\u200f\u206c\u206c\u202a\u200f\u200f\u202a\u206a\u202e\u206f\u206f\u206c\u202e\u206c\u200c\u206b\u202e\u206a\u200f\u206b\u200c\u200f\u200d\u200e\u202b\u200f\u200c\u206c\u206d\u202c\u206f\u202a\u200e\u202e orig, object self, int P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] orig_\u202b\u200f\u206d\u202b\u202e\u206b\u206c\u202d\u206d\u200e\u202c\u206d\u206f\u202b\u200f\u202a\u200c\u206c\u206e\u206b\u202c\u202c\u200b\u200c\u202c\u200f\u206c\u202a\u202b\u206c\u200d\u202c\u202b\u200c\u206b\u202b\u200f\u200b\u206c\u206e\u202e(object self, int P_1, int P_2, int P_3, int P_4, int P_5);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] hook_\u202b\u200f\u206d\u202b\u202e\u206b\u206c\u202d\u206d\u200e\u202c\u206d\u206f\u202b\u200f\u202a\u200c\u206c\u206e\u206b\u202c\u202c\u200b\u200c\u202c\u200f\u206c\u202a\u202b\u206c\u200d\u202c\u202b\u200c\u206b\u202b\u200f\u200b\u206c\u206e\u202e(orig_\u202b\u200f\u206d\u202b\u202e\u206b\u206c\u202d\u206d\u200e\u202c\u206d\u206f\u202b\u200f\u202a\u200c\u206c\u206e\u206b\u202c\u202c\u200b\u200c\u202c\u200f\u206c\u202a\u202b\u206c\u200d\u202c\u202b\u200c\u206b\u202b\u200f\u200b\u206c\u206e\u202e orig, object self, int P_2, int P_3, int P_4, int P_5, int P_6);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] orig_\u206e\u202e\u206d\u206f\u200c\u202d\u206d\u202d\u200b\u200b\u200c\u206c\u206f\u202d\u200b\u206e\u202d\u200c\u202a\u206b\u202e\u202c\u202a\u202e\u206c\u200b\u202c\u200d\u202b\u200e\u206a\u202e\u206f\u202e\u202b\u202d\u206e\u206d\u200c\u200d\u202e(object self, int P_1, int P_2, int P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] hook_\u206e\u202e\u206d\u206f\u200c\u202d\u206d\u202d\u200b\u200b\u200c\u206c\u206f\u202d\u200b\u206e\u202d\u200c\u202a\u206b\u202e\u202c\u202a\u202e\u206c\u200b\u202c\u200d\u202b\u200e\u206a\u202e\u206f\u202e\u202b\u202d\u206e\u206d\u200c\u200d\u202e(orig_\u206e\u202e\u206d\u206f\u200c\u202d\u206d\u202d\u200b\u200b\u200c\u206c\u206f\u202d\u200b\u206e\u202d\u200c\u202a\u206b\u202e\u202c\u202a\u202e\u206c\u200b\u202c\u200d\u202b\u200e\u206a\u202e\u206f\u202e\u202b\u202d\u206e\u206d\u200c\u200d\u202e orig, object self, int P_2, int P_3, int P_4);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D orig_\u206e\u206e\u200e\u206d\u200d\u200d\u200b\u206f\u206f\u200b\u206b\u206c\u206c\u202a\u206e\u206e\u206d\u202e\u206f\u202d\u206c\u206b\u206f\u202d\u202a\u202b\u206d\u206d\u202d\u200d\u200f\u202e\u202e\u206b\u200d\u206c\u200e\u206a\u200f\u202a\u202e(object self, int P_1, bool P_2, bool P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D hook_\u206e\u206e\u200e\u206d\u200d\u200d\u200b\u206f\u206f\u200b\u206b\u206c\u206c\u202a\u206e\u206e\u206d\u202e\u206f\u202d\u206c\u206b\u206f\u202d\u202a\u202b\u206d\u206d\u202d\u200d\u200f\u202e\u202e\u206b\u200d\u206c\u200e\u206a\u200f\u202a\u202e(orig_\u206e\u206e\u200e\u206d\u200d\u200d\u200b\u206f\u206f\u200b\u206b\u206c\u206c\u202a\u206e\u206e\u206d\u202e\u206f\u202d\u206c\u206b\u206f\u202d\u202a\u202b\u206d\u206d\u202d\u200d\u200f\u202e\u202e\u206b\u200d\u206c\u200e\u206a\u200f\u202a\u202e orig, object self, int P_2, bool P_3, bool P_4);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D orig_\u206d\u200c\u200d\u206c\u202a\u206c\u200e\u202b\u200d\u206e\u202b\u200d\u202a\u202d\u206b\u202b\u200b\u206a\u200f\u206d\u200f\u200f\u206a\u206b\u202a\u206c\u202a\u200e\u200e\u200e\u202c\u202b\u206e\u200c\u202d\u206b\u202e\u200b\u200b\u206f\u202e(object self, int P_1, bool P_2, bool P_3, int P_4, int P_5, int P_6, int P_7);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D hook_\u206d\u200c\u200d\u206c\u202a\u206c\u200e\u202b\u200d\u206e\u202b\u200d\u202a\u202d\u206b\u202b\u200b\u206a\u200f\u206d\u200f\u200f\u206a\u206b\u202a\u206c\u202a\u200e\u200e\u200e\u202c\u202b\u206e\u200c\u202d\u206b\u202e\u200b\u200b\u206f\u202e(orig_\u206d\u200c\u200d\u206c\u202a\u206c\u200e\u202b\u200d\u206e\u202b\u200d\u202a\u202d\u206b\u202b\u200b\u206a\u200f\u206d\u200f\u200f\u206a\u206b\u202a\u206c\u202a\u200e\u200e\u200e\u202c\u202b\u206e\u200c\u202d\u206b\u202e\u200b\u200b\u206f\u202e orig, object self, int P_2, bool P_3, bool P_4, int P_5, int P_6, int P_7, int P_8);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] orig_\u206c\u202d\u200c\u206d\u202d\u202c\u206a\u206a\u202e\u206d\u206c\u206e\u200b\u206d\u202c\u202b\u202d\u206a\u200c\u206f\u206a\u202e\u202d\u206f\u200f\u206b\u200f\u202e\u202d\u200c\u202a\u200f\u200b\u202d\u202a\u206c\u202c\u206c\u206b\u202a\u202e(object self, int P_1, bool P_2, bool P_3, int P_4, int P_5);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] hook_\u206c\u202d\u200c\u206d\u202d\u202c\u206a\u206a\u202e\u206d\u206c\u206e\u200b\u206d\u202c\u202b\u202d\u206a\u200c\u206f\u206a\u202e\u202d\u206f\u200f\u206b\u200f\u202e\u202d\u200c\u202a\u200f\u200b\u202d\u202a\u206c\u202c\u206c\u206b\u202a\u202e(orig_\u206c\u202d\u200c\u206d\u202d\u202c\u206a\u206a\u202e\u206d\u206c\u206e\u200b\u206d\u202c\u202b\u202d\u206a\u200c\u206f\u206a\u202e\u202d\u206f\u200f\u206b\u200f\u202e\u202d\u200c\u202a\u200f\u200b\u202d\u202a\u206c\u202c\u206c\u206b\u202a\u202e orig, object self, int P_2, bool P_3, bool P_4, int P_5, int P_6);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D orig_\u200f\u202a\u206e\u206e\u202d\u202c\u206d\u200d\u202b\u202b\u200c\u202b\u200e\u200b\u202b\u206b\u206e\u202d\u202c\u206e\u206f\u202a\u202c\u206f\u200b\u202e\u206c\u200e\u206c\u202a\u200c\u206c\u200e\u202d\u206d\u206e\u202c\u200c\u202d\u206c\u202e(object self, int P_1, bool P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D hook_\u200f\u202a\u206e\u206e\u202d\u202c\u206d\u200d\u202b\u202b\u200c\u202b\u200e\u200b\u202b\u206b\u206e\u202d\u202c\u206e\u206f\u202a\u202c\u206f\u200b\u202e\u206c\u200e\u206c\u202a\u200c\u206c\u200e\u202d\u206d\u206e\u202c\u200c\u202d\u206c\u202e(orig_\u200f\u202a\u206e\u206e\u202d\u202c\u206d\u200d\u202b\u202b\u200c\u202b\u200e\u200b\u202b\u206b\u206e\u202d\u202c\u206e\u206f\u202a\u202c\u206f\u200b\u202e\u206c\u200e\u206c\u202a\u200c\u206c\u200e\u202d\u206d\u206e\u202c\u200c\u202d\u206c\u202e orig, object self, int P_2, bool P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D orig_\u200d\u200b\u206a\u202b\u200f\u202b\u202c\u200c\u200e\u206d\u206c\u206d\u206b\u202a\u202d\u202b\u202d\u200d\u202a\u206c\u200d\u206d\u206a\u202d\u202e\u202b\u206c\u200b\u206f\u202e\u206e\u202e\u200d\u206a\u202b\u202a\u202d\u206a\u202e\u206a\u202e(object self, int P_1, bool P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D hook_\u200d\u200b\u206a\u202b\u200f\u202b\u202c\u200c\u200e\u206d\u206c\u206d\u206b\u202a\u202d\u202b\u202d\u200d\u202a\u206c\u200d\u206d\u206a\u202d\u202e\u202b\u206c\u200b\u206f\u202e\u206e\u202e\u200d\u206a\u202b\u202a\u202d\u206a\u202e\u206a\u202e(orig_\u200d\u200b\u206a\u202b\u200f\u202b\u202c\u200c\u200e\u206d\u206c\u206d\u206b\u202a\u202d\u202b\u202d\u200d\u202a\u206c\u200d\u206d\u206a\u202d\u202e\u202b\u206c\u200b\u206f\u202e\u206e\u202e\u200d\u206a\u202b\u202a\u202d\u206a\u202e\u206a\u202e orig, object self, int P_2, bool P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D orig_\u202e\u202e\u202c\u206e\u206c\u202d\u200e\u206e\u200c\u202c\u206b\u206a\u202a\u200f\u200d\u202c\u206c\u206c\u202d\u200e\u200e\u200f\u206a\u202c\u200f\u200b\u206b\u200d\u202d\u200c\u206d\u202e\u200c\u200d\u206a\u200e\u206b\u202d\u200d\u200e\u202e(object self, int P_1, bool P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D hook_\u202e\u202e\u202c\u206e\u206c\u202d\u200e\u206e\u200c\u202c\u206b\u206a\u202a\u200f\u200d\u202c\u206c\u206c\u202d\u200e\u200e\u200f\u206a\u202c\u200f\u200b\u206b\u200d\u202d\u200c\u206d\u202e\u200c\u200d\u206a\u200e\u206b\u202d\u200d\u200e\u202e(orig_\u202e\u202e\u202c\u206e\u206c\u202d\u200e\u206e\u200c\u202c\u206b\u206a\u202a\u200f\u200d\u202c\u206c\u206c\u202d\u200e\u200e\u200f\u206a\u202c\u200f\u200b\u206b\u200d\u202d\u200c\u206d\u202e\u200c\u200d\u206a\u200e\u206b\u202d\u200d\u200e\u202e orig, object self, int P_2, bool P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D orig_\u202e\u206e\u202d\u206e\u200b\u200e\u202b\u206c\u206f\u200c\u202c\u200d\u200c\u200f\u202a\u200c\u200c\u200f\u200b\u202e\u206e\u206e\u202e\u202b\u200d\u200c\u206e\u206a\u206a\u200c\u202c\u200b\u200b\u206f\u206f\u206b\u206c\u202b\u206e\u206c\u202e(object self, int P_1, bool P_2, int P_3, int P_4, int P_5, int P_6);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D hook_\u202e\u206e\u202d\u206e\u200b\u200e\u202b\u206c\u206f\u200c\u202c\u200d\u200c\u200f\u202a\u200c\u200c\u200f\u200b\u202e\u206e\u206e\u202e\u202b\u200d\u200c\u206e\u206a\u206a\u200c\u202c\u200b\u200b\u206f\u206f\u206b\u206c\u202b\u206e\u206c\u202e(orig_\u202e\u206e\u202d\u206e\u200b\u200e\u202b\u206c\u206f\u200c\u202c\u200d\u200c\u200f\u202a\u200c\u200c\u200f\u200b\u202e\u206e\u206e\u202e\u202b\u200d\u200c\u206e\u206a\u206a\u200c\u202c\u200b\u200b\u206f\u206f\u206b\u206c\u202b\u206e\u206c\u202e orig, object self, int P_2, bool P_3, int P_4, int P_5, int P_6, int P_7);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] orig_\u200f\u200c\u202e\u202c\u202c\u206c\u202c\u206e\u202e\u200d\u200b\u200d\u200f\u200f\u202b\u200e\u202e\u200e\u200f\u202d\u202d\u200f\u202a\u206d\u202a\u200b\u206c\u200b\u206c\u206c\u206e\u200e\u202e\u206a\u202d\u200b\u202c\u206a\u200f\u200d\u202e(object self, int P_1, bool P_2, int P_3, int P_4);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] hook_\u200f\u200c\u202e\u202c\u202c\u206c\u202c\u206e\u202e\u200d\u200b\u200d\u200f\u200f\u202b\u200e\u202e\u200e\u200f\u202d\u202d\u200f\u202a\u206d\u202a\u200b\u206c\u200b\u206c\u206c\u206e\u200e\u202e\u206a\u202d\u200b\u202c\u206a\u200f\u200d\u202e(orig_\u200f\u200c\u202e\u202c\u202c\u206c\u202c\u206e\u202e\u200d\u200b\u200d\u200f\u200f\u202b\u200e\u202e\u200e\u200f\u202d\u202d\u200f\u202a\u206d\u202a\u200b\u206c\u200b\u206c\u206c\u206e\u200e\u202e\u206a\u202d\u200b\u202c\u206a\u200f\u200d\u202e orig, object self, int P_2, bool P_3, int P_4, int P_5);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D orig_\u206b\u206e\u200b\u202c\u202a\u202b\u202d\u202a\u200d\u200f\u206b\u200f\u206b\u200f\u202b\u202d\u202a\u200f\u200e\u206a\u202c\u202e\u202a\u206c\u200d\u202a\u202a\u200f\u200d\u200f\u200c\u206a\u206e\u206e\u202b\u206e\u206b\u200f\u206d\u200c\u202e(object self, int P_1, bool P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D hook_\u206b\u206e\u200b\u202c\u202a\u202b\u202d\u202a\u200d\u200f\u206b\u200f\u206b\u200f\u202b\u202d\u202a\u200f\u200e\u206a\u202c\u202e\u202a\u206c\u200d\u202a\u202a\u200f\u200d\u200f\u200c\u206a\u206e\u206e\u202b\u206e\u206b\u200f\u206d\u200c\u202e(orig_\u206b\u206e\u200b\u202c\u202a\u202b\u202d\u202a\u200d\u200f\u206b\u200f\u206b\u200f\u202b\u202d\u202a\u200f\u200e\u206a\u202c\u202e\u202a\u206c\u200d\u202a\u202a\u200f\u200d\u200f\u200c\u206a\u206e\u206e\u202b\u206e\u206b\u200f\u206d\u200c\u202e orig, object self, int P_2, bool P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D orig_\u200c\u206e\u200e\u200d\u200b\u202e\u200f\u206e\u202c\u206a\u206f\u206c\u202b\u206d\u202c\u202e\u206e\u206e\u206a\u202d\u200f\u202d\u200f\u202d\u202a\u200d\u202d\u200e\u200b\u206a\u202c\u206d\u200c\u206d\u206e\u200c\u200d\u200c\u202d\u200f\u202e(object self, int P_1, bool P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D hook_\u200c\u206e\u200e\u200d\u200b\u202e\u200f\u206e\u202c\u206a\u206f\u206c\u202b\u206d\u202c\u202e\u206e\u206e\u206a\u202d\u200f\u202d\u200f\u202d\u202a\u200d\u202d\u200e\u200b\u206a\u202c\u206d\u200c\u206d\u206e\u200c\u200d\u200c\u202d\u200f\u202e(orig_\u200c\u206e\u200e\u200d\u200b\u202e\u200f\u206e\u202c\u206a\u206f\u206c\u202b\u206d\u202c\u202e\u206e\u206e\u206a\u202d\u200f\u202d\u200f\u202d\u202a\u200d\u202d\u200e\u200b\u206a\u202c\u206d\u200c\u206d\u206e\u200c\u200d\u200c\u202d\u200f\u202e orig, object self, int P_2, bool P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D orig_\u200d\u202c\u206b\u200e\u202b\u200b\u202d\u206c\u206f\u202c\u202d\u206a\u202e\u200b\u202b\u202e\u202a\u200f\u206a\u202a\u200c\u206a\u202d\u200c\u206b\u202b\u206c\u206c\u200b\u206c\u200f\u202e\u200f\u200e\u200f\u206e\u200e\u206d\u200f\u200e\u202e(object self, int P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D hook_\u200d\u202c\u206b\u200e\u202b\u200b\u202d\u206c\u206f\u202c\u202d\u206a\u202e\u200b\u202b\u202e\u202a\u200f\u206a\u202a\u200c\u206a\u202d\u200c\u206b\u202b\u206c\u206c\u200b\u206c\u200f\u202e\u200f\u200e\u200f\u206e\u200e\u206d\u200f\u200e\u202e(orig_\u200d\u202c\u206b\u200e\u202b\u200b\u202d\u206c\u206f\u202c\u202d\u206a\u202e\u200b\u202b\u202e\u202a\u200f\u206a\u202a\u200c\u206a\u202d\u200c\u206b\u202b\u206c\u206c\u200b\u206c\u200f\u202e\u200f\u200e\u200f\u206e\u200e\u206d\u200f\u200e\u202e orig, object self, int P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D orig_\u200c\u202c\u206d\u200e\u206f\u206a\u202d\u206a\u206e\u202c\u202b\u206d\u200c\u206f\u202c\u200c\u200f\u200c\u202d\u200f\u200b\u206b\u200f\u206b\u202a\u200d\u200e\u202c\u202b\u200e\u200e\u202b\u206e\u200b\u200e\u206c\u202a\u200f\u200d\u206a\u202e(object self, int P_1, int P_2, int P_3, int P_4, int P_5);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D hook_\u200c\u202c\u206d\u200e\u206f\u206a\u202d\u206a\u206e\u202c\u202b\u206d\u200c\u206f\u202c\u200c\u200f\u200c\u202d\u200f\u200b\u206b\u200f\u206b\u202a\u200d\u200e\u202c\u202b\u200e\u200e\u202b\u206e\u200b\u200e\u206c\u202a\u200f\u200d\u206a\u202e(orig_\u200c\u202c\u206d\u200e\u206f\u206a\u202d\u206a\u206e\u202c\u202b\u206d\u200c\u206f\u202c\u200c\u200f\u200c\u202d\u200f\u200b\u206b\u200f\u206b\u202a\u200d\u200e\u202c\u202b\u200e\u200e\u202b\u206e\u200b\u200e\u206c\u202a\u200f\u200d\u206a\u202e orig, object self, int P_2, int P_3, int P_4, int P_5, int P_6);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] orig_\u200e\u200f\u206f\u202d\u202e\u200d\u202b\u202d\u206d\u206b\u200b\u202d\u200e\u202a\u200b\u200b\u206d\u200e\u200b\u200c\u202e\u202c\u202d\u202a\u202c\u202e\u200e\u206a\u206d\u202e\u206f\u200d\u200e\u206c\u200c\u202c\u202b\u202c\u202c\u202b\u202e(object self, int P_1, int P_2, int P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] hook_\u200e\u200f\u206f\u202d\u202e\u200d\u202b\u202d\u206d\u206b\u200b\u202d\u200e\u202a\u200b\u200b\u206d\u200e\u200b\u200c\u202e\u202c\u202d\u202a\u202c\u202e\u200e\u206a\u206d\u202e\u206f\u200d\u200e\u206c\u200c\u202c\u202b\u202c\u202c\u202b\u202e(orig_\u200e\u200f\u206f\u202d\u202e\u200d\u202b\u202d\u206d\u206b\u200b\u202d\u200e\u202a\u200b\u200b\u206d\u200e\u200b\u200c\u202e\u202c\u202d\u202a\u202c\u202e\u200e\u206a\u206d\u202e\u206f\u200d\u200e\u206c\u200c\u202c\u202b\u202c\u202c\u202b\u202e orig, object self, int P_2, int P_3, int P_4);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Vector2 orig_\u200b\u206a\u206b\u206c\u206b\u200d\u200f\u206d\u206d\u202a\u206f\u200b\u206c\u206f\u202b\u200c\u200b\u200c\u206e\u206a\u202d\u206d\u200d\u200c\u202a\u202b\u200b\u206e\u200d\u202d\u202c\u206a\u200d\u202e\u202b\u206f\u206d\u200b\u206c\u202e\u202e(object self);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Vector2 hook_\u200b\u206a\u206b\u206c\u206b\u200d\u200f\u206d\u206d\u202a\u206f\u200b\u206c\u206f\u202b\u200c\u200b\u200c\u206e\u206a\u202d\u206d\u200d\u200c\u202a\u202b\u200b\u206e\u200d\u202d\u202c\u206a\u200d\u202e\u202b\u206f\u206d\u200b\u206c\u202e\u202e(orig_\u200b\u206a\u206b\u206c\u206b\u200d\u200f\u206d\u206d\u202a\u206f\u200b\u206c\u206f\u202b\u200c\u200b\u200c\u206e\u206a\u202d\u206d\u200d\u200c\u202a\u202b\u200b\u206e\u200d\u202d\u202c\u206a\u200d\u202e\u202b\u206f\u206d\u200b\u206c\u202e\u202e orig, object self);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool orig_\u200c\u202a\u206b\u200d\u200f\u206e\u200c\u200c\u206e\u202a\u200b\u206b\u206a\u206d\u200c\u200c\u200b\u202b\u202e\u200f\u200f\u206f\u206b\u200d\u200b\u202d\u206c\u206d\u200f\u206a\u206f\u200f\u206b\u200c\u206f\u202e\u200d\u206f\u206d\u206d\u202e(Object P_0, Object P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool hook_\u200c\u202a\u206b\u200d\u200f\u206e\u200c\u200c\u206e\u202a\u200b\u206b\u206a\u206d\u200c\u200c\u200b\u202b\u202e\u200f\u200f\u206f\u206b\u200d\u200b\u202d\u206c\u206d\u200f\u206a\u206f\u200f\u206b\u200c\u206f\u202e\u200d\u206f\u206d\u206d\u202e(orig_\u200c\u202a\u206b\u200d\u200f\u206e\u200c\u200c\u206e\u202a\u200b\u206b\u206a\u206d\u200c\u200c\u200b\u202b\u202e\u200f\u200f\u206f\u206b\u200d\u200b\u202d\u206c\u206d\u200f\u206a\u206f\u200f\u206b\u200c\u206f\u202e\u200d\u206f\u206d\u206d\u202e orig, Object P_1, Object P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] orig_\u202c\u206c\u200c\u206f\u206f\u206e\u200b\u200d\u206b\u202b\u206c\u200c\u202b\u206b\u206e\u202b\u202d\u206c\u206a\u206d\u206b\u202b\u200d\u206d\u202d\u206c\u200f\u206f\u202c\u202d\u206d\u202a\u206e\u200e\u200b\u202e\u202b\u200b\u200b\u206c\u202e(TerrainData P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture2D[] hook_\u202c\u206c\u200c\u206f\u206f\u206e\u200b\u200d\u206b\u202b\u206c\u200c\u202b\u206b\u206e\u202b\u202d\u206c\u206a\u206d\u206b\u202b\u200d\u206d\u202d\u206c\u200f\u206f\u202c\u202d\u206d\u202a\u206e\u200e\u200b\u202e\u202b\u200b\u200b\u206c\u202e(orig_\u202c\u206c\u200c\u206f\u206f\u206e\u200b\u200d\u206b\u202b\u206c\u200c\u202b\u206b\u206e\u202b\u202d\u206c\u206a\u206d\u206b\u202b\u200d\u206d\u202d\u206c\u200f\u206f\u202c\u202d\u206d\u202a\u206e\u200e\u200b\u202e\u202b\u200b\u200b\u206c\u202e orig, TerrainData P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate string orig_\u200d\u202d\u206b\u206f\u206d\u200b\u202b\u202e\u206f\u200f\u200f\u202e\u200d\u200b\u200f\u202d\u206f\u206f\u206f\u206c\u206f\u206e\u200b\u202a\u200f\u206f\u206e\u206c\u200f\u206a\u200d\u202c\u202d\u202b\u206a\u200e\u200b\u206e\u206c\u202e\u202e(Object P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate string hook_\u200d\u202d\u206b\u206f\u206d\u200b\u202b\u202e\u206f\u200f\u200f\u202e\u200d\u200b\u200f\u202d\u206f\u206f\u206f\u206c\u206f\u206e\u200b\u202a\u200f\u206f\u206e\u206c\u200f\u206a\u200d\u202c\u202d\u202b\u206a\u200e\u200b\u206e\u206c\u202e\u202e(orig_\u200d\u202d\u206b\u206f\u206d\u200b\u202b\u202e\u206f\u200f\u200f\u202e\u200d\u200b\u200f\u202d\u206f\u206f\u206f\u206c\u206f\u206e\u200b\u202a\u200f\u206f\u206e\u206c\u200f\u206a\u200d\u202c\u202d\u202b\u206a\u200e\u200b\u206e\u206c\u202e\u202e orig, Object P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool orig_\u206b\u202c\u206e\u206c\u206f\u206d\u200d\u202c\u200e\u206b\u202a\u202d\u206b\u202c\u206d\u206b\u206a\u206a\u206a\u202b\u202c\u206a\u206a\u206d\u206d\u202c\u202d\u206f\u202c\u200b\u206c\u200f\u206a\u200e\u202b\u200c\u200e\u202c\u202c\u206e\u202e(string P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool hook_\u206b\u202c\u206e\u206c\u206f\u206d\u200d\u202c\u200e\u206b\u202a\u202d\u206b\u202c\u206d\u206b\u206a\u206a\u206a\u202b\u202c\u206a\u206a\u206d\u206d\u202c\u202d\u206f\u202c\u200b\u206c\u200f\u206a\u200e\u202b\u200c\u200e\u202c\u202c\u206e\u202e(orig_\u206b\u202c\u206e\u206c\u206f\u206d\u200d\u202c\u200e\u206b\u202a\u202d\u206b\u202c\u206d\u206b\u206a\u206a\u206a\u202b\u202c\u206a\u206a\u206d\u206d\u202c\u202d\u206f\u202c\u200b\u206c\u200f\u206a\u200e\u202b\u200c\u200e\u202c\u202c\u206e\u202e orig, string P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate string orig_\u200e\u206c\u202d\u202a\u206a\u202a\u202e\u206c\u202e\u206d\u200c\u206a\u200f\u206a\u206c\u202e\u200b\u202e\u200f\u200f\u200b\u202e\u200b\u202e\u202a\u200e\u200c\u202a\u200d\u202d\u206f\u206c\u200b\u200f\u200f\u206e\u206d\u200e\u206b\u206d\u202e(string P_0, string P_1, string P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate string hook_\u200e\u206c\u202d\u202a\u206a\u202a\u202e\u206c\u202e\u206d\u200c\u206a\u200f\u206a\u206c\u202e\u200b\u202e\u200f\u200f\u200b\u202e\u200b\u202e\u202a\u200e\u200c\u202a\u200d\u202d\u206f\u206c\u200b\u200f\u200f\u206e\u206d\u200e\u206b\u206d\u202e(orig_\u200e\u206c\u202d\u202a\u206a\u202a\u202e\u206c\u202e\u206d\u200c\u206a\u200f\u206a\u206c\u202e\u200b\u202e\u200f\u200f\u200b\u202e\u200b\u202e\u202a\u200e\u200c\u202a\u200d\u202d\u206f\u206c\u200b\u200f\u200f\u206e\u206d\u200e\u206b\u206d\u202e orig, string P_1, string P_2, string P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Shader orig_\u202b\u202b\u202e\u202c\u206e\u202c\u206e\u200e\u202b\u200c\u206d\u206d\u200c\u206d\u200b\u206a\u200f\u202a\u200f\u200e\u200e\u206e\u200e\u206d\u206a\u200d\u200e\u202d\u206f\u202a\u202e\u200b\u200e\u200e\u206c\u206b\u200e\u202b\u200f\u202d\u202e(string P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Shader hook_\u202b\u202b\u202e\u202c\u206e\u202c\u206e\u200e\u202b\u200c\u206d\u206d\u200c\u206d\u200b\u206a\u200f\u202a\u200f\u200e\u200e\u206e\u200e\u206d\u206a\u200d\u200e\u202d\u206f\u202a\u202e\u200b\u200e\u200e\u206c\u206b\u200e\u202b\u200f\u202d\u202e(orig_\u202b\u202b\u202e\u202c\u206e\u202c\u206e\u200e\u202b\u200c\u206d\u206d\u200c\u206d\u200b\u206a\u200f\u202a\u200f\u200e\u200e\u206e\u200e\u206d\u206a\u200d\u200e\u202d\u206f\u202a\u202e\u200b\u200e\u200e\u206c\u206b\u200e\u202b\u200f\u202d\u202e orig, string P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Material orig_\u206d\u206f\u202b\u206d\u202e\u206d\u202d\u202a\u200f\u202c\u200e\u206d\u200d\u202e\u200f\u206f\u200c\u202b\u202d\u206e\u202c\u206d\u200d\u206d\u202d\u200f\u202c\u206f\u202c\u202a\u206b\u206b\u206b\u202b\u202a\u206c\u200f\u206a\u206b\u206e\u202e(Shader P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Material hook_\u206d\u206f\u202b\u206d\u202e\u206d\u202d\u202a\u200f\u202c\u200e\u206d\u200d\u202e\u200f\u206f\u200c\u202b\u202d\u206e\u202c\u206d\u200d\u206d\u202d\u200f\u202c\u206f\u202c\u202a\u206b\u206b\u206b\u202b\u202a\u206c\u200f\u206a\u206b\u206e\u202e(orig_\u206d\u206f\u202b\u206d\u202e\u206d\u202d\u202a\u200f\u202c\u200e\u206d\u200d\u202e\u200f\u206f\u200c\u202b\u202d\u206e\u202c\u206d\u200d\u206d\u202d\u200f\u202c\u206f\u202c\u202a\u206b\u206b\u206b\u202b\u202a\u206c\u200f\u206a\u206b\u206e\u202e orig, Shader P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_\u200f\u202c\u202c\u200b\u200f\u202b\u202c\u202c\u202b\u200d\u202c\u202d\u206b\u202e\u206e\u200f\u202c\u200e\u200f\u206d\u206e\u202b\u200c\u202d\u200c\u206b\u202d\u202d\u202b\u206f\u206f\u202c\u206b\u202d\u202b\u200c\u206d\u206b\u206f\u206c\u202e(Material P_0, string P_1, float P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_\u200f\u202c\u202c\u200b\u200f\u202b\u202c\u202c\u202b\u200d\u202c\u202d\u206b\u202e\u206e\u200f\u202c\u200e\u200f\u206d\u206e\u202b\u200c\u202d\u200c\u206b\u202d\u202d\u202b\u206f\u206f\u202c\u206b\u202d\u202b\u200c\u206d\u206b\u206f\u206c\u202e(orig_\u200f\u202c\u202c\u200b\u200f\u202b\u202c\u202c\u202b\u200d\u202c\u202d\u206b\u202e\u206e\u200f\u202c\u200e\u200f\u206d\u206e\u202b\u200c\u202d\u200c\u206b\u202d\u202d\u202b\u206f\u206f\u202c\u206b\u202d\u202b\u200c\u206d\u206b\u206f\u206c\u202e orig, Material P_1, string P_2, float P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate int orig_\u206a\u206b\u202e\u206a\u200d\u200e\u200b\u202a\u206a\u206c\u202c\u200f\u202d\u206d\u202e\u202c\u202a\u202b\u200f\u202d\u206e\u206a\u206c\u206e\u206e\u202c\u202e\u206c\u200d\u200b\u202e\u202c\u206a\u202d\u200b\u200c\u206c\u206a\u202d\u202e(TerrainData P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate int hook_\u206a\u206b\u202e\u206a\u200d\u200e\u200b\u202a\u206a\u206c\u202c\u200f\u202d\u206d\u202e\u202c\u202a\u202b\u200f\u202d\u206e\u206a\u206c\u206e\u206e\u202c\u202e\u206c\u200d\u200b\u202e\u202c\u206a\u202d\u200b\u200c\u206c\u206a\u202d\u202e(orig_\u206a\u206b\u202e\u206a\u200d\u200e\u200b\u202a\u206a\u206c\u202c\u200f\u202d\u206d\u202e\u202c\u202a\u202b\u200f\u202d\u206e\u206a\u206c\u206e\u206e\u202c\u202e\u206c\u200d\u200b\u202e\u202c\u206a\u202d\u200b\u200c\u206c\u206a\u202d\u202e orig, TerrainData P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate RenderTexture orig_\u202b\u200c\u202c\u206c\u206a\u202a\u206c\u202b\u202d\u200c\u206d\u206f\u206b\u200e\u200b\u202b\u206e\u206b\u200d\u200c\u200f\u200b\u206d\u202d\u200d\u202a\u202d\u200f\u206c\u206b\u200d\u202b\u202a\u206d\u200d\u206b\u206d\u200f\u202a\u206b\u202e(int P_0, int P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate RenderTexture hook_\u202b\u200c\u202c\u206c\u206a\u202a\u206c\u202b\u202d\u200c\u206d\u206f\u206b\u200e\u200b\u202b\u206e\u206b\u200d\u200c\u200f\u200b\u206d\u202d\u200d\u202a\u202d\u200f\u206c\u206b\u200d\u202b\u202a\u206d\u200d\u206b\u206d\u200f\u202a\u206b\u202e(orig_\u202b\u200c\u202c\u206c\u206a\u202a\u206c\u202b\u202d\u200c\u206d\u206f\u206b\u200e\u200b\u202b\u206e\u206b\u200d\u200c\u200f\u200b\u206d\u202d\u200d\u202a\u202d\u200f\u206c\u206b\u200d\u202b\u202a\u206d\u200d\u206b\u206d\u200f\u202a\u206b\u202e orig, int P_1, int P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool orig_\u200c\u200b\u202e\u202c\u202c\u206e\u202c\u200c\u202e\u202a\u202d\u200d\u206e\u206a\u200e\u206b\u202b\u202a\u206b\u202c\u202e\u206d\u200d\u200c\u200d\u200f\u206c\u200c\u206d\u200b\u200c\u202e\u206b\u206b\u206f\u200e\u202c\u202a\u200e\u202e\u202e(RenderTexture P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool hook_\u200c\u200b\u202e\u202c\u202c\u206e\u202c\u200c\u202e\u202a\u202d\u200d\u206e\u206a\u200e\u206b\u202b\u202a\u206b\u202c\u202e\u206d\u200d\u200c\u200d\u200f\u206c\u200c\u206d\u200b\u200c\u202e\u206b\u206b\u206f\u200e\u202c\u202a\u200e\u202e\u202e(orig_\u200c\u200b\u202e\u202c\u202c\u206e\u202c\u200c\u202e\u202a\u202d\u200d\u206e\u206a\u200e\u206b\u202b\u202a\u206b\u202c\u202e\u206d\u200d\u200c\u200d\u200f\u206c\u200c\u206d\u200b\u200c\u202e\u206b\u206b\u206f\u200e\u202c\u202a\u200e\u202e\u202e orig, RenderTexture P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate TextureFormat orig_\u206e\u202e\u206c\u206a\u202e\u206f\u206f\u206a\u206e\u200c\u206b\u206b\u206c\u202a\u200f\u202e\u206f\u200f\u200d\u200e\u206e\u202c\u206d\u206f\u200d\u200e\u206c\u202c\u206b\u206a\u206d\u202e\u202e\u200f\u202b\u206c\u202a\u206f\u200b\u206e\u202e(Texture2D P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate TextureFormat hook_\u206e\u202e\u206c\u206a\u202e\u206f\u206f\u206a\u206e\u200c\u206b\u206b\u206c\u202a\u200f\u202e\u206f\u200f\u200d\u200e\u206e\u202c\u206d\u206f\u200d\u200e\u206c\u202c\u206b\u206a\u206d\u202e\u202e\u200f\u202b\u206c\u202a\u206f\u200b\u206e\u202e(orig_\u206e\u202e\u206c\u206a\u202e\u206f\u206f\u206a\u206e\u200c\u206b\u206b\u206c\u202a\u200f\u202e\u206f\u200f\u200d\u200e\u206e\u202c\u206d\u206f\u200d\u200e\u206c\u202c\u206b\u206a\u206d\u202e\u202e\u200f\u202b\u206c\u202a\u206f\u200b\u206e\u202e orig, Texture2D P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_\u206a\u200f\u200f\u202a\u206e\u202d\u202e\u206f\u200e\u200b\u200d\u200f\u206c\u202d\u206e\u206c\u202a\u202e\u206b\u200c\u206b\u206d\u202b\u202c\u206b\u200b\u202d\u206c\u200f\u202d\u202c\u202c\u202a\u206f\u200f\u206f\u202a\u200c\u202b\u200d\u202e(Texture P_0, TextureWrapMode P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_\u206a\u200f\u200f\u202a\u206e\u202d\u202e\u206f\u200e\u200b\u200d\u200f\u206c\u202d\u206e\u206c\u202a\u202e\u206b\u200c\u206b\u206d\u202b\u202c\u206b\u200b\u202d\u206c\u200f\u202d\u202c\u202c\u202a\u206f\u200f\u206f\u202a\u200c\u202b\u200d\u202e(orig_\u206a\u200f\u200f\u202a\u206e\u202d\u202e\u206f\u200e\u200b\u200d\u200f\u206c\u202d\u206e\u206c\u202a\u202e\u206b\u200c\u206b\u206d\u202b\u202c\u206b\u200b\u202d\u206c\u200f\u202d\u202c\u202c\u202a\u206f\u200f\u206f\u202a\u200c\u202b\u200d\u202e orig, Texture P_1, TextureWrapMode P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate string orig_\u200b\u206e\u202c\u200d\u200d\u200b\u206d\u200d\u202b\u200f\u202a\u200e\u206b\u206d\u206b\u202b\u200e\u206a\u200b\u200c\u202e\u202c\u206a\u200f\u200d\u206c\u200d\u206d\u202b\u200d\u202d\u206a\u202e\u206a\u206d\u206b\u200f\u200e\u200f\u206c\u202e(string P_0, string P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate string hook_\u200b\u206e\u202c\u200d\u200d\u200b\u206d\u200d\u202b\u200f\u202a\u200e\u206b\u206d\u206b\u202b\u200e\u206a\u200b\u200c\u202e\u202c\u206a\u200f\u200d\u206c\u200d\u206d\u202b\u200d\u202d\u206a\u202e\u206a\u206d\u206b\u200f\u200e\u200f\u206c\u202e(orig_\u200b\u206e\u202c\u200d\u200d\u200b\u206d\u200d\u202b\u200f\u202a\u200e\u206b\u206d\u206b\u202b\u200e\u206a\u200b\u200c\u202e\u202c\u206a\u200f\u200d\u206c\u200d\u206d\u202b\u200d\u202d\u206a\u202e\u206a\u206d\u206b\u200f\u200e\u200f\u206c\u202e orig, string P_1, string P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_\u202d\u206e\u200d\u200f\u202c\u200e\u206e\u200f\u206b\u202d\u200e\u202a\u200f\u202a\u202c\u202c\u206c\u200b\u200f\u206f\u206a\u206a\u206a\u202b\u206b\u206e\u206d\u200c\u202c\u200b\u200d\u206e\u202c\u200c\u200e\u200b\u202b\u200d\u206f\u200c\u202e(Object P_0, string P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_\u202d\u206e\u200d\u200f\u202c\u200e\u206e\u200f\u206b\u202d\u200e\u202a\u200f\u202a\u202c\u202c\u206c\u200b\u200f\u206f\u206a\u206a\u206a\u202b\u206b\u206e\u206d\u200c\u202c\u200b\u200d\u206e\u202c\u200c\u200e\u200b\u202b\u200d\u206f\u200c\u202e(orig_\u202d\u206e\u200d\u200f\u202c\u200e\u206e\u200f\u206b\u202d\u200e\u202a\u200f\u202a\u202c\u202c\u206c\u200b\u200f\u206f\u206a\u206a\u206a\u202b\u206b\u206e\u206d\u200c\u202c\u200b\u200d\u206e\u202c\u200c\u200e\u200b\u202b\u200d\u206f\u200c\u202e orig, Object P_1, string P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_\u200b\u206b\u202a\u206c\u206e\u202c\u200c\u202d\u206e\u206c\u200e\u200f\u200d\u202d\u200e\u206a\u202b\u206a\u202b\u202b\u206c\u200d\u206c\u206a\u200b\u202a\u202c\u206b\u206b\u200e\u200d\u206e\u206e\u206d\u202b\u206e\u206c\u206f\u200b\u202d\u202e(RenderTexture P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_\u200b\u206b\u202a\u206c\u206e\u202c\u200c\u202d\u206e\u206c\u200e\u200f\u200d\u202d\u200e\u206a\u202b\u206a\u202b\u202b\u206c\u200d\u206c\u206a\u200b\u202a\u202c\u206b\u206b\u200e\u200d\u206e\u206e\u206d\u202b\u206e\u206c\u206f\u200b\u202d\u202e(orig_\u200b\u206b\u202a\u206c\u206e\u202c\u200c\u202d\u206e\u206c\u200e\u200f\u200d\u202d\u200e\u206a\u202b\u206a\u202b\u202b\u206c\u200d\u206c\u206a\u200b\u202a\u202c\u206b\u206b\u200e\u200d\u206e\u206e\u206d\u202b\u206e\u206c\u206f\u200b\u202d\u202e orig, RenderTexture P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool orig_\u202e\u202d\u200e\u202e\u200b\u202b\u202a\u200c\u202b\u202a\u206d\u206a\u206b\u206d\u206a\u206a\u202c\u202c\u206d\u206b\u206e\u206e\u206f\u200d\u206a\u200d\u206c\u202c\u206a\u206f\u206c\u206a\u200e\u206d\u200f\u206f\u206a\u202a\u200f\u200e\u202e();

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool hook_\u202e\u202d\u200e\u202e\u200b\u202b\u202a\u200c\u202b\u202a\u206d\u206a\u206b\u206d\u206a\u206a\u202c\u202c\u206d\u206b\u206e\u206e\u206f\u200d\u206a\u200d\u206c\u202c\u206a\u206f\u206c\u206a\u200e\u206d\u200f\u206f\u206a\u202a\u200f\u200e\u202e(orig_\u202e\u202d\u200e\u202e\u200b\u202b\u202a\u200c\u202b\u202a\u206d\u206a\u206b\u206d\u206a\u206a\u202c\u202c\u206d\u206b\u206e\u206e\u206f\u200d\u206a\u200d\u206c\u202c\u206a\u206f\u206c\u206a\u200e\u206d\u200f\u206f\u206a\u202a\u200f\u200e\u202e orig);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_\u206b\u206f\u200e\u206e\u202c\u200d\u206a\u206d\u206c\u206e\u206e\u206d\u206a\u206f\u202a\u202c\u200f\u206a\u200d\u206f\u206e\u202a\u200d\u206d\u206b\u200e\u200d\u206b\u202c\u202e\u200e\u200d\u206f\u200e\u202d\u200e\u206f\u200c\u206d\u202d\u202e(Object P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_\u206b\u206f\u200e\u206e\u202c\u200d\u206a\u206d\u206c\u206e\u206e\u206d\u206a\u206f\u202a\u202c\u200f\u206a\u200d\u206f\u206e\u202a\u200d\u206d\u206b\u200e\u200d\u206b\u202c\u202e\u200e\u200d\u206f\u200e\u202d\u200e\u206f\u200c\u206d\u202d\u202e(orig_\u206b\u206f\u200e\u206e\u202c\u200d\u206a\u206d\u206c\u206e\u206e\u206d\u206a\u206f\u202a\u202c\u200f\u206a\u200d\u206f\u206e\u202a\u200d\u206d\u206b\u200e\u200d\u206b\u202c\u202e\u200e\u200d\u206f\u200e\u202d\u200e\u206f\u200c\u206d\u202d\u202e orig, Object P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_\u206b\u206e\u200e\u202a\u206f\u202e\u206f\u200e\u200f\u206c\u202e\u206d\u206c\u206c\u202b\u200c\u202b\u202e\u206b\u202d\u206a\u202a\u202b\u200b\u202d\u200d\u206e\u206f\u206b\u200f\u202e\u206d\u202e\u200f\u200b\u206e\u202c\u202c\u202a\u202c\u202e(Object P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_\u206b\u206e\u200e\u202a\u206f\u202e\u206f\u200e\u200f\u206c\u202e\u206d\u206c\u206c\u202b\u200c\u202b\u202e\u206b\u202d\u206a\u202a\u202b\u200b\u202d\u200d\u206e\u206f\u206b\u200f\u202e\u206d\u202e\u200f\u200b\u206e\u202c\u202c\u202a\u202c\u202e(orig_\u206b\u206e\u200e\u202a\u206f\u202e\u206f\u200e\u200f\u206c\u202e\u206d\u206c\u206c\u202b\u200c\u202b\u202e\u206b\u202d\u206a\u202a\u202b\u200b\u202d\u200d\u206e\u206f\u206b\u200f\u202e\u206d\u202e\u200f\u200b\u206e\u202c\u202c\u202a\u202c\u202e orig, Object P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate ColorSpace orig_\u206a\u202b\u202c\u200b\u206f\u202e\u200c\u206b\u200f\u202b\u206e\u206e\u200b\u202b\u202a\u206f\u202a\u202c\u206f\u200b\u206c\u200d\u206e\u200c\u202b\u202a\u206f\u206e\u200b\u200d\u202e\u200e\u202c\u206b\u200e\u206e\u202d\u206a\u202b\u200e\u202e();

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate ColorSpace hook_\u206a\u202b\u202c\u200b\u206f\u202e\u200c\u206b\u200f\u202b\u206e\u206e\u200b\u202b\u202a\u206f\u202a\u202c\u206f\u200b\u206c\u200d\u206e\u200c\u202b\u202a\u206f\u206e\u200b\u200d\u202e\u200e\u202c\u206b\u200e\u206e\u202d\u206a\u202b\u200e\u202e(orig_\u206a\u202b\u202c\u200b\u206f\u202e\u200c\u206b\u200f\u202b\u206e\u206e\u200b\u202b\u202a\u206f\u202a\u202c\u206f\u200b\u206c\u200d\u206e\u200c\u202b\u202a\u206f\u206e\u200b\u200d\u202e\u200e\u202c\u206b\u200e\u206e\u202d\u206a\u202b\u200e\u202e orig);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate RenderTexture orig_\u202d\u206b\u202d\u202d\u202c\u200f\u200c\u200e\u202d\u200b\u202c\u200b\u206e\u206c\u206d\u206c\u202e\u206b\u206a\u206e\u206a\u200d\u202c\u202b\u200d\u206d\u206f\u206c\u206b\u202b\u206c\u202e\u206e\u200b\u206a\u200f\u200f\u206f\u206a\u202a\u202e(TerrainData P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate RenderTexture hook_\u202d\u206b\u202d\u202d\u202c\u200f\u200c\u200e\u202d\u200b\u202c\u200b\u206e\u206c\u206d\u206c\u202e\u206b\u206a\u206e\u206a\u200d\u202c\u202b\u200d\u206d\u206f\u206c\u206b\u202b\u206c\u202e\u206e\u200b\u206a\u200f\u200f\u206f\u206a\u202a\u202e(orig_\u202d\u206b\u202d\u202d\u202c\u200f\u200c\u200e\u202d\u200b\u202c\u200b\u206e\u206c\u206d\u206c\u202e\u206b\u206a\u206e\u206a\u200d\u202c\u202b\u200d\u206d\u206f\u206c\u206b\u202b\u206c\u202e\u206e\u200b\u206a\u200f\u200f\u206f\u206a\u202a\u202e orig, TerrainData P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_\u206f\u200f\u206f\u200b\u206e\u202b\u202c\u206a\u200e\u200b\u200f\u206d\u206b\u200e\u200f\u200e\u206c\u202d\u206a\u206f\u200b\u200d\u206a\u206b\u206d\u202a\u202d\u206c\u206b\u206f\u202d\u200b\u200c\u202d\u202a\u206d\u206e\u206c\u202b\u202d\u202e(Material P_0, string P_1, Vector4 P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_\u206f\u200f\u206f\u200b\u206e\u202b\u202c\u206a\u200e\u200b\u200f\u206d\u206b\u200e\u200f\u200e\u206c\u202d\u206a\u206f\u200b\u200d\u206a\u206b\u206d\u202a\u202d\u206c\u206b\u206f\u202d\u200b\u200c\u202d\u202a\u206d\u206e\u206c\u202b\u202d\u202e(orig_\u206f\u200f\u206f\u200b\u206e\u202b\u202c\u206a\u200e\u200b\u200f\u206d\u206b\u200e\u200f\u200e\u206c\u202d\u206a\u206f\u200b\u200d\u206a\u206b\u206d\u202a\u202d\u206c\u206b\u206f\u202d\u200b\u200c\u202d\u202a\u206d\u206e\u206c\u202b\u202d\u202e orig, Material P_1, string P_2, Vector4 P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate int orig_\u206b\u206a\u200e\u202d\u206b\u202d\u200b\u202a\u206f\u200e\u200d\u202e\u206d\u200b\u206a\u202a\u200f\u202d\u206f\u202b\u202a\u200b\u206b\u200b\u200d\u200b\u202e\u202d\u206c\u206e\u202b\u202e\u202a\u200e\u202b\u200c\u202a\u200b\u200c\u206b\u202e(Texture P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate int hook_\u206b\u206a\u200e\u202d\u206b\u202d\u200b\u202a\u206f\u200e\u200d\u202e\u206d\u200b\u206a\u202a\u200f\u202d\u206f\u202b\u202a\u200b\u206b\u200b\u200d\u200b\u202e\u202d\u206c\u206e\u202b\u202e\u202a\u200e\u202b\u200c\u202a\u200b\u200c\u206b\u202e(orig_\u206b\u206a\u200e\u202d\u206b\u202d\u200b\u202a\u206f\u200e\u200d\u202e\u206d\u200b\u206a\u202a\u200f\u202d\u206f\u202b\u202a\u200b\u206b\u200b\u200d\u200b\u202e\u202d\u206c\u206e\u202b\u202e\u202a\u200e\u202b\u200c\u202a\u200b\u200c\u206b\u202e orig, Texture P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate RenderTextureFormat orig_\u206c\u206c\u200e\u202a\u202d\u202b\u206d\u202b\u202b\u200b\u200e\u202b\u202e\u200d\u200d\u202e\u206b\u206a\u206d\u206d\u206e\u200b\u200d\u206b\u202c\u200c\u202b\u202e\u202d\u202d\u206c\u200d\u200c\u202c\u202b\u200c\u200b\u206a\u202d\u202a\u202e(RenderTexture P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate RenderTextureFormat hook_\u206c\u206c\u200e\u202a\u202d\u202b\u206d\u202b\u202b\u200b\u200e\u202b\u202e\u200d\u200d\u202e\u206b\u206a\u206d\u206d\u206e\u200b\u200d\u206b\u202c\u200c\u202b\u202e\u202d\u202d\u206c\u200d\u200c\u202c\u202b\u200c\u200b\u206a\u202d\u202a\u202e(orig_\u206c\u206c\u200e\u202a\u202d\u202b\u206d\u202b\u202b\u200b\u200e\u202b\u202e\u200d\u200d\u202e\u206b\u206a\u206d\u206d\u206e\u200b\u200d\u206b\u202c\u200c\u202b\u202e\u202d\u202d\u206c\u200d\u200c\u202c\u202b\u200c\u200b\u206a\u202d\u202a\u202e orig, RenderTexture P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool orig_\u202e\u206b\u206b\u206c\u202c\u206b\u206e\u200f\u206f\u200c\u206b\u206a\u202d\u206c\u200c\u200f\u200f\u200f\u202a\u200b\u202c\u206f\u206d\u200d\u202a\u200f\u206a\u202e\u202e\u200f\u206b\u202e\u206a\u202d\u206d\u202b\u200e\u206a\u206d\u202b\u202e(RenderTextureFormat P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool hook_\u202e\u206b\u206b\u206c\u202c\u206b\u206e\u200f\u206f\u200c\u206b\u206a\u202d\u206c\u200c\u200f\u200f\u200f\u202a\u200b\u202c\u206f\u206d\u200d\u202a\u200f\u206a\u202e\u202e\u200f\u206b\u202e\u206a\u202d\u206d\u202b\u200e\u206a\u206d\u202b\u202e(orig_\u202e\u206b\u206b\u206c\u202c\u206b\u206e\u200f\u206f\u200c\u206b\u206a\u202d\u206c\u200c\u200f\u200f\u200f\u202a\u200b\u202c\u206f\u206d\u200d\u202a\u200f\u206a\u202e\u202e\u200f\u206b\u202e\u206a\u202d\u206d\u202b\u200e\u206a\u206d\u202b\u202e orig, RenderTextureFormat P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool orig_\u200b\u202d\u200c\u206c\u202e\u200f\u200e\u200d\u202b\u202d\u206c\u200f\u206b\u202c\u200d\u200f\u202c\u206f\u202c\u200d\u202a\u206f\u202b\u202d\u200e\u202e\u206e\u202c\u206f\u200d\u200f\u206e\u206c\u206d\u202d\u206a\u206f\u206e\u202c\u202d\u202e(TextureFormat P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool hook_\u200b\u202d\u200c\u206c\u202e\u200f\u200e\u200d\u202b\u202d\u206c\u200f\u206b\u202c\u200d\u200f\u202c\u206f\u202c\u200d\u202a\u206f\u202b\u202d\u200e\u202e\u206e\u202c\u206f\u200d\u200f\u206e\u206c\u206d\u202d\u206a\u206f\u206e\u202c\u202d\u202e(orig_\u200b\u202d\u200c\u206c\u202e\u200f\u200e\u200d\u202b\u202d\u206c\u200f\u206b\u202c\u200d\u200f\u202c\u206f\u202c\u200d\u202a\u206f\u202b\u202d\u200e\u202e\u206e\u202c\u206f\u200d\u200f\u206e\u206c\u206d\u202d\u206a\u206f\u206e\u202c\u202d\u202e orig, TextureFormat P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate RenderTexture orig_\u206b\u200b\u202c\u206a\u200b\u200d\u200e\u206c\u206c\u202c\u200e\u206d\u202a\u202c\u202a\u206a\u202d\u206b\u202d\u202c\u206b\u206d\u206c\u202d\u202c\u200e\u206e\u206b\u206e\u206b\u202a\u202a\u202a\u202e\u202d\u202c\u206f\u206f\u206f\u200d\u202e(int P_0, int P_1, int P_2, RenderTextureFormat P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate RenderTexture hook_\u206b\u200b\u202c\u206a\u200b\u200d\u200e\u206c\u206c\u202c\u200e\u206d\u202a\u202c\u202a\u206a\u202d\u206b\u202d\u202c\u206b\u206d\u206c\u202d\u202c\u200e\u206e\u206b\u206e\u206b\u202a\u202a\u202a\u202e\u202d\u202c\u206f\u206f\u206f\u200d\u202e(orig_\u206b\u200b\u202c\u206a\u200b\u200d\u200e\u206c\u206c\u202c\u200e\u206d\u202a\u202c\u202a\u206a\u202d\u206b\u202d\u202c\u206b\u206d\u206c\u202d\u202c\u200e\u206e\u206b\u206e\u206b\u202a\u202a\u202a\u202e\u202d\u202c\u206f\u206f\u206f\u200d\u202e orig, int P_1, int P_2, int P_3, RenderTextureFormat P_4);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture orig_\u200b\u206a\u200e\u206d\u206f\u200f\u200c\u202c\u206a\u206f\u206c\u206f\u200f\u206e\u206c\u200d\u200c\u202c\u202b\u200d\u202a\u206c\u206c\u200c\u206c\u206c\u200b\u200f\u202a\u202d\u206c\u200d\u202e\u200e\u200d\u206e\u202c\u200d\u206b\u202e(TerrainData P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Texture hook_\u200b\u206a\u200e\u206d\u206f\u200f\u200c\u202c\u206a\u206f\u206c\u206f\u200f\u206e\u206c\u200d\u200c\u202c\u202b\u200d\u202a\u206c\u206c\u200c\u206c\u206c\u200b\u200f\u202a\u202d\u206c\u200d\u202e\u200e\u200d\u206e\u202c\u200d\u206b\u202e(orig_\u200b\u206a\u200e\u206d\u206f\u200f\u200c\u202c\u206a\u206f\u206c\u206f\u200f\u206e\u206c\u200d\u200c\u202c\u202b\u200d\u202a\u206c\u206c\u200c\u206c\u206c\u200b\u200f\u202a\u202d\u206c\u200d\u202e\u200e\u200d\u206e\u202c\u200d\u206b\u202e orig, TerrainData P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool orig_\u202c\u202d\u202c\u200f\u200e\u206f\u206c\u200f\u206d\u200d\u200d\u202b\u202d\u206d\u200f\u200d\u200d\u202e\u200b\u206d\u200c\u202c\u200e\u200c\u200d\u200e\u200e\u206d\u200f\u200d\u200d\u206c\u206d\u206c\u200c\u206e\u206e\u200f\u202c\u202a\u202e(TerrainData P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool hook_\u202c\u202d\u202c\u200f\u200e\u206f\u206c\u200f\u206d\u200d\u200d\u202b\u202d\u206d\u200f\u200d\u200d\u202e\u200b\u206d\u200c\u202c\u200e\u200c\u200d\u200e\u200e\u206d\u200f\u200d\u200d\u206c\u206d\u206c\u200c\u206e\u206e\u200f\u202c\u202a\u202e(orig_\u202c\u202d\u202c\u200f\u200e\u206f\u206c\u200f\u206d\u200d\u200d\u202b\u202d\u206d\u200f\u200d\u200d\u202e\u200b\u206d\u200c\u202c\u200e\u200c\u200d\u200e\u200e\u206d\u200f\u200d\u200d\u206c\u206d\u206c\u200c\u206e\u206e\u200f\u202c\u202a\u202e orig, TerrainData P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_\u200f\u206a\u200c\u206b\u200c\u202d\u200f\u206c\u200d\u200b\u206d\u200f\u202c\u200c\u200b\u202c\u206b\u206a\u206a\u202d\u202a\u200d\u206e\u202b\u206c\u206b\u202e\u206a\u202b\u206d\u200d\u200d\u206d\u206e\u206c\u200f\u202e\u200f\u200d\u206e\u202e(TerrainData P_0, bool P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_\u200f\u206a\u200c\u206b\u200c\u202d\u200f\u206c\u200d\u200b\u206d\u200f\u202c\u200c\u200b\u202c\u206b\u206a\u206a\u202d\u202a\u200d\u206e\u202b\u206c\u206b\u202e\u206a\u202b\u206d\u200d\u200d\u206d\u206e\u206c\u200f\u202e\u200f\u200d\u206e\u202e(orig_\u200f\u206a\u200c\u206b\u200c\u202d\u200f\u206c\u200d\u200b\u206d\u200f\u202c\u200c\u200b\u202c\u206b\u206a\u206a\u202d\u202a\u200d\u206e\u202b\u206c\u206b\u202e\u206a\u202b\u206d\u200d\u200d\u206d\u206e\u206c\u200f\u202e\u200f\u200d\u206e\u202e orig, TerrainData P_1, bool P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate RenderTexture orig_\u206b\u206d\u206b\u206d\u206c\u206d\u206d\u206d\u206e\u202a\u202b\u200b\u202d\u206e\u206e\u202e\u202c\u206e\u200b\u206f\u200b\u202d\u206a\u200f\u206b\u200c\u200c\u200e\u202c\u206f\u202e\u202d\u202c\u206d\u206a\u206a\u206e\u202e\u200c\u200f\u202e(int P_0, int P_1, int P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate RenderTexture hook_\u206b\u206d\u206b\u206d\u206c\u206d\u206d\u206d\u206e\u202a\u202b\u200b\u202d\u206e\u206e\u202e\u202c\u206e\u200b\u206f\u200b\u202d\u206a\u200f\u206b\u200c\u200c\u200e\u202c\u206f\u202e\u202d\u202c\u206d\u206a\u206a\u206e\u202e\u200c\u200f\u202e(orig_\u206b\u206d\u206b\u206d\u206c\u206d\u206d\u206d\u206e\u202a\u202b\u200b\u202d\u206e\u206e\u202e\u202c\u206e\u200b\u206f\u200b\u202d\u206a\u200f\u206b\u200c\u200c\u200e\u202c\u206f\u202e\u202d\u202c\u206d\u206a\u206a\u206e\u202e\u200c\u200f\u202e orig, int P_1, int P_2, int P_3);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_\u202a\u200f\u202c\u206a\u206a\u200d\u206b\u200c\u202b\u206c\u206c\u200b\u200c\u206a\u200b\u202a\u202e\u202e\u200d\u206b\u202e\u206e\u202a\u202a\u202e\u200f\u202e\u200d\u206e\u202e\u200d\u202c\u200d\u202c\u202a\u200c\u202a\u202e\u200e\u200c\u202e(Texture P_0, RenderTexture P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_\u202a\u200f\u202c\u206a\u206a\u200d\u206b\u200c\u202b\u206c\u206c\u200b\u200c\u206a\u200b\u202a\u202e\u202e\u200d\u206b\u202e\u206e\u202a\u202a\u202e\u200f\u202e\u200d\u206e\u202e\u200d\u202c\u200d\u202c\u202a\u200c\u202a\u202e\u200e\u200c\u202e(orig_\u202a\u200f\u202c\u206a\u206a\u200d\u206b\u200c\u202b\u206c\u206c\u200b\u200c\u206a\u200b\u202a\u202e\u202e\u200d\u206b\u202e\u206e\u202a\u202a\u202e\u200f\u202e\u200d\u206e\u202e\u200d\u202c\u200d\u202c\u202a\u200c\u202a\u202e\u200e\u200c\u202e orig, Texture P_1, RenderTexture P_2);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Color[] orig_\u200f\u206a\u206e\u202c\u202b\u206e\u200d\u206a\u200e\u202a\u206e\u200c\u206c\u206e\u200b\u200b\u200e\u202d\u206e\u200c\u206d\u202d\u200e\u200b\u202b\u200d\u202a\u200b\u202c\u202a\u200f\u206e\u202d\u206b\u200f\u206e\u206b\u202b\u202b\u206c\u202e(Texture2D P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate Color[] hook_\u200f\u206a\u206e\u202c\u202b\u206e\u200d\u206a\u200e\u202a\u206e\u200c\u206c\u206e\u200b\u200b\u200e\u202d\u206e\u200c\u206d\u202d\u200e\u200b\u202b\u200d\u202a\u200b\u202c\u202a\u200f\u206e\u202d\u206b\u200f\u206e\u206b\u202b\u202b\u206c\u202e(orig_\u200f\u206a\u206e\u202c\u202b\u206e\u200d\u206a\u200e\u202a\u206e\u200c\u206c\u206e\u200b\u200b\u200e\u202d\u206e\u200c\u206d\u202d\u200e\u200b\u202b\u200d\u202a\u200b\u202c\u202a\u200f\u206e\u202d\u206b\u200f\u206e\u206b\u202b\u202b\u206c\u202e orig, Texture2D P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate float orig_\u202e\u206d\u206c\u206a\u200c\u202b\u206c\u202a\u200f\u202c\u206c\u202b\u200b\u202e\u206f\u202d\u200b\u200f\u202a\u202b\u200f\u206c\u206c\u202c\u200b\u202d\u200c\u202d\u206d\u206b\u202d\u200c\u200b\u202c\u202d\u200e\u202e\u206e\u200e\u202d\u202e(IEnumerable<float> P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate float hook_\u202e\u206d\u206c\u206a\u200c\u202b\u206c\u202a\u200f\u202c\u206c\u202b\u200b\u202e\u206f\u202d\u200b\u200f\u202a\u202b\u200f\u206c\u206c\u202c\u200b\u202d\u200c\u202d\u206d\u206b\u202d\u200c\u200b\u202c\u202d\u200e\u202e\u206e\u200e\u202d\u202e(orig_\u202e\u206d\u206c\u206a\u200c\u202b\u206c\u202a\u200f\u202c\u206c\u202b\u200b\u202e\u206f\u202d\u200b\u200f\u202a\u202b\u200f\u206c\u206c\u202c\u200b\u202d\u200c\u202d\u206d\u206b\u202d\u200c\u200b\u202c\u202d\u200e\u202e\u206e\u200e\u202d\u202e orig, IEnumerable<float> P_1);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate float orig_\u206c\u206b\u206c\u202a\u206e\u206a\u202e\u200f\u202d\u202e\u202b\u202e\u200c\u202e\u206d\u206c\u200d\u202b\u206a\u200b\u202a\u206b\u206a\u206c\u202c\u202d\u200d\u206b\u206d\u206f\u200d\u206b\u202e\u200c\u206f\u200f\u200f\u202d\u206d\u206e\u202e(IEnumerable<float> P_0);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate float hook_\u206c\u206b\u206c\u202a\u206e\u206a\u202e\u200f\u202d\u202e\u202b\u202e\u200c\u202e\u206d\u206c\u200d\u202b\u206a\u200b\u202a\u206b\u206a\u206c\u202c\u202d\u200d\u206b\u206d\u206f\u200d\u206b\u202e\u200c\u206f\u200f\u200f\u202d\u206d\u206e\u202e(orig_\u206c\u206b\u206c\u202a\u206e\u206a\u202e\u200f\u202d\u202e\u202b\u202e\u200c\u202e\u206d\u206c\u200d\u202b\u206a\u200b\u202a\u206b\u206a\u206c\u202c\u202d\u200d\u206b\u206d\u206f\u200d\u206b\u202e\u200c\u206f\u200f\u200f\u202d\u206d\u206e\u202e orig, IEnumerable<float> P_1);

			public static class \u206f\u202d\u200c\u206d\u200c\u200f\u206d\u206e\u202b\u200b\u202d\u206f\u206e\u200e\u206d\u206d\u206b\u206c\u206d\u200d\u202d\u202c\u200b\u206f\u200e\u202e\u206c\u206f\u202b\u202d\u206a\u200c\u202a\u200b\u200e\u206a\u200f\u200b\u200c\u202c\u202e
			{
				[EditorBrowsable(EditorBrowsableState.Never)]
				public delegate void orig_cctor();

				[EditorBrowsable(EditorBrowsableState.Never)]
				public delegate void hook_cctor(orig_cctor orig);

				[EditorBrowsable(EditorBrowsableState.Never)]
				public delegate void orig_ctor(object self);

				[EditorBrowsable(EditorBrowsableState.Never)]
				public delegate void hook_ctor(orig_ctor orig, object self);

				[EditorBrowsable(EditorBrowsableState.Never)]
				public delegate float orig_\u206b\u200e\u200d\u206f\u206e\u206f\u206a\u202a\u200b\u200d\u200e\u206f\u202c\u202e\u202e\u206d\u202e\u200e\u200c\u202a\u200c\u200d\u202d\u200f\u202d\u200b\u202d\u202d\u202e\u206b\u206f\u206d\u200d\u202a\u202d\u200f\u202d\u202c\u202d\u206b\u202e(object self, Color P_1);

				[EditorBrowsable(EditorBrowsableState.Never)]
				public delegate float hook_\u206b\u200e\u200d\u206f\u206e\u206f\u206a\u202a\u200b\u200d\u200e\u206f\u202c\u202e\u202e\u206d\u202e\u200e\u200c\u202a\u200c\u200d\u202d\u200f\u202d\u200b\u202d\u202d\u202e\u206b\u206f\u206d\u200d\u202a\u202d\u200f\u202d\u202c\u202d\u206b\u202e(orig_\u206b\u200e\u200d\u206f\u206e\u206f\u206a\u202a\u200b\u200d\u200e\u206f\u202c\u202e\u202e\u206d\u202e\u200e\u200c\u202a\u200c\u200d\u202d\u200f\u202d\u200b\u202d\u202d\u202e\u206b\u206f\u206d\u200d\u202a\u202d\u200f\u202d\u202c\u202d\u206b\u202e orig, object self, Color P_2);

				[EditorBrowsable(EditorBrowsableState.Never)]
				public delegate float orig_\u206d\u202d\u200c\u202e\u200c\u206b\u202d\u200c\u202a\u206b\u202d\u206c\u200e\u206b\u200b\u206c\u200e\u200c\u200f\u206c\u200d\u200d\u200b\u206a\u202d\u202d\u202

MMHOOK/MMHOOK_Assembly-CSharp.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using DigitalRuby.ThunderAndLightning;
using Dissonance;
using Dissonance.Integrations.Unity_NFGO;
using DunGen;
using DunGen.Adapters;
using DunGen.Analysis;
using DunGen.Editor;
using DunGen.Graph;
using DunGen.Tags;
using GameNetcodeStuff;
using MonoMod.Cil;
using MonoMod.RuntimeDetour.HookGen;
using On;
using On.DigitalRuby.ThunderAndLightning;
using On.Dissonance.Integrations.Unity_NFGO;
using On.DunGen;
using On.DunGen.Adapters;
using On.DunGen.Analysis;
using On.DunGen.Editor;
using On.DunGen.Graph;
using On.DunGen.Tags;
using On.GameNetcodeStuff;
using On.__GEN;
using Steamworks;
using Steamworks.Data;
using TMPro;
using Unity.AI.Navigation;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;

[assembly: AssemblyVersion("0.0.0.0")]
namespace On
{
	public static class AlarmButton
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_PushAlarmButton(AlarmButton self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_PushAlarmButton(orig_PushAlarmButton orig, AlarmButton self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Update(AlarmButton self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Update(orig_Update orig, AlarmButton self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(AlarmButton self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, AlarmButton self);

		public static event hook_PushAlarmButton PushAlarmButton
		{
			add
			{
				HookEndpointManager.Add<hook_PushAlarmButton>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_PushAlarmButton>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Update Update
		{
			add
			{
				HookEndpointManager.Add<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL
{
	public static class AlarmButton
	{
		public static event Manipulator PushAlarmButton
		{
			add
			{
				HookEndpointManager.Modify<On.AlarmButton.hook_PushAlarmButton>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AlarmButton.hook_PushAlarmButton>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Update
		{
			add
			{
				HookEndpointManager.Modify<On.AlarmButton.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AlarmButton.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.AlarmButton.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AlarmButton.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On
{
	public static class AnimatedItem
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Start(AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Start(orig_Start orig, AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_EquipItem(AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_EquipItem(orig_EquipItem orig, AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_DiscardItem(AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_DiscardItem(orig_DiscardItem orig, AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_PocketItem(AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_PocketItem(orig_PocketItem orig, AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Update(AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Update(orig_Update orig, AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___initializeVariables(AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___initializeVariables(orig___initializeVariables orig, AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig___getTypeName(AnimatedItem self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook___getTypeName(orig___getTypeName orig, AnimatedItem self);

		public static event hook_Start Start
		{
			add
			{
				HookEndpointManager.Add<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_EquipItem EquipItem
		{
			add
			{
				HookEndpointManager.Add<hook_EquipItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_EquipItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_DiscardItem DiscardItem
		{
			add
			{
				HookEndpointManager.Add<hook_DiscardItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_DiscardItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_PocketItem PocketItem
		{
			add
			{
				HookEndpointManager.Add<hook_PocketItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_PocketItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Update Update
		{
			add
			{
				HookEndpointManager.Add<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___initializeVariables __initializeVariables
		{
			add
			{
				HookEndpointManager.Add<hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___getTypeName __getTypeName
		{
			add
			{
				HookEndpointManager.Add<hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL
{
	public static class AnimatedItem
	{
		public static event Manipulator Start
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedItem.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedItem.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator EquipItem
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedItem.hook_EquipItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedItem.hook_EquipItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator DiscardItem
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedItem.hook_DiscardItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedItem.hook_DiscardItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator PocketItem
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedItem.hook_PocketItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedItem.hook_PocketItem>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Update
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedItem.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedItem.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedItem.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedItem.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator __initializeVariables
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedItem.hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedItem.hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator __getTypeName
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedItem.hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedItem.hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On
{
	public static class AnimatedTextureUV
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnEnable(AnimatedTextureUV self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnEnable(orig_OnEnable orig, AnimatedTextureUV self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnDisable(AnimatedTextureUV self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnDisable(orig_OnDisable orig, AnimatedTextureUV self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IEnumerator orig_AnimateUV(AnimatedTextureUV self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IEnumerator hook_AnimateUV(orig_AnimateUV orig, AnimatedTextureUV self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(AnimatedTextureUV self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, AnimatedTextureUV self);

		public static event hook_OnEnable OnEnable
		{
			add
			{
				HookEndpointManager.Add<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnDisable OnDisable
		{
			add
			{
				HookEndpointManager.Add<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_AnimateUV AnimateUV
		{
			add
			{
				HookEndpointManager.Add<hook_AnimateUV>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_AnimateUV>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL
{
	public static class AnimatedTextureUV
	{
		public static event Manipulator OnEnable
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedTextureUV.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedTextureUV.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator OnDisable
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedTextureUV.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedTextureUV.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator AnimateUV
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedTextureUV.hook_AnimateUV>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedTextureUV.hook_AnimateUV>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.AnimatedTextureUV.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimatedTextureUV.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On
{
	public static class AnimationStopPoints
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetAnimationStopPosition1(AnimationStopPoints self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetAnimationStopPosition1(orig_SetAnimationStopPosition1 orig, AnimationStopPoints self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetAnimationGo(AnimationStopPoints self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetAnimationGo(orig_SetAnimationGo orig, AnimationStopPoints self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetAnimationStopPosition2(AnimationStopPoints self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetAnimationStopPosition2(orig_SetAnimationStopPosition2 orig, AnimationStopPoints self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(AnimationStopPoints self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, AnimationStopPoints self);

		public static event hook_SetAnimationStopPosition1 SetAnimationStopPosition1
		{
			add
			{
				HookEndpointManager.Add<hook_SetAnimationStopPosition1>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetAnimationStopPosition1>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetAnimationGo SetAnimationGo
		{
			add
			{
				HookEndpointManager.Add<hook_SetAnimationGo>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetAnimationGo>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetAnimationStopPosition2 SetAnimationStopPosition2
		{
			add
			{
				HookEndpointManager.Add<hook_SetAnimationStopPosition2>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetAnimationStopPosition2>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL
{
	public static class AnimationStopPoints
	{
		public static event Manipulator SetAnimationStopPosition1
		{
			add
			{
				HookEndpointManager.Modify<On.AnimationStopPoints.hook_SetAnimationStopPosition1>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimationStopPoints.hook_SetAnimationStopPosition1>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SetAnimationGo
		{
			add
			{
				HookEndpointManager.Modify<On.AnimationStopPoints.hook_SetAnimationGo>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimationStopPoints.hook_SetAnimationGo>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SetAnimationStopPosition2
		{
			add
			{
				HookEndpointManager.Modify<On.AnimationStopPoints.hook_SetAnimationStopPosition2>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimationStopPoints.hook_SetAnimationStopPosition2>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.AnimationStopPoints.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AnimationStopPoints.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On
{
	public static class AudioReverbPresets
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(AudioReverbPresets self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, AudioReverbPresets self);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL
{
	public static class AudioReverbPresets
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.AudioReverbPresets.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AudioReverbPresets.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On
{
	public static class AutoParentToShip
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Awake(AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Awake(orig_Awake orig, AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_LateUpdate(AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_LateUpdate(orig_LateUpdate orig, AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StartSuckingOutOfShip(AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StartSuckingOutOfShip(orig_StartSuckingOutOfShip orig, AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IEnumerator orig_SuckObjectOutOfShip(AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IEnumerator hook_SuckObjectOutOfShip(orig_SuckObjectOutOfShip orig, AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_MoveToOffset(AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_MoveToOffset(orig_MoveToOffset orig, AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___initializeVariables(AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___initializeVariables(orig___initializeVariables orig, AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig___getTypeName(AutoParentToShip self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook___getTypeName(orig___getTypeName orig, AutoParentToShip self);

		public static event hook_Awake Awake
		{
			add
			{
				HookEndpointManager.Add<hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_LateUpdate LateUpdate
		{
			add
			{
				HookEndpointManager.Add<hook_LateUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_LateUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartSuckingOutOfShip StartSuckingOutOfShip
		{
			add
			{
				HookEndpointManager.Add<hook_StartSuckingOutOfShip>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartSuckingOutOfShip>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SuckObjectOutOfShip SuckObjectOutOfShip
		{
			add
			{
				HookEndpointManager.Add<hook_SuckObjectOutOfShip>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SuckObjectOutOfShip>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_MoveToOffset MoveToOffset
		{
			add
			{
				HookEndpointManager.Add<hook_MoveToOffset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_MoveToOffset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___initializeVariables __initializeVariables
		{
			add
			{
				HookEndpointManager.Add<hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___getTypeName __getTypeName
		{
			add
			{
				HookEndpointManager.Add<hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL
{
	public static class AutoParentToShip
	{
		public static event Manipulator Awake
		{
			add
			{
				HookEndpointManager.Modify<On.AutoParentToShip.hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AutoParentToShip.hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator LateUpdate
		{
			add
			{
				HookEndpointManager.Modify<On.AutoParentToShip.hook_LateUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AutoParentToShip.hook_LateUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator StartSuckingOutOfShip
		{
			add
			{
				HookEndpointManager.Modify<On.AutoParentToShip.hook_StartSuckingOutOfShip>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AutoParentToShip.hook_StartSuckingOutOfShip>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SuckObjectOutOfShip
		{
			add
			{
				HookEndpointManager.Modify<On.AutoParentToShip.hook_SuckObjectOutOfShip>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AutoParentToShip.hook_SuckObjectOutOfShip>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator MoveToOffset
		{
			add
			{
				HookEndpointManager.Modify<On.AutoParentToShip.hook_MoveToOffset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AutoParentToShip.hook_MoveToOffset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.AutoParentToShip.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AutoParentToShip.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator __initializeVariables
		{
			add
			{
				HookEndpointManager.Modify<On.AutoParentToShip.hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AutoParentToShip.hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator __getTypeName
		{
			add
			{
				HookEndpointManager.Modify<On.AutoParentToShip.hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.AutoParentToShip.hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On
{
	public static class BaboonBirdAI
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Start(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Start(orig_Start orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SyncInitialValuesServerRpc(BaboonBirdAI self, int syncLeadershipLevel, Vector3 campPosition);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SyncInitialValuesServerRpc(orig_SyncInitialValuesServerRpc orig, BaboonBirdAI self, int syncLeadershipLevel, Vector3 campPosition);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SyncInitialValuesClientRpc(BaboonBirdAI self, int syncLeadershipLevel, Vector3 campPosition);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SyncInitialValuesClientRpc(orig_SyncInitialValuesClientRpc orig, BaboonBirdAI self, int syncLeadershipLevel, Vector3 campPosition);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_LateUpdate(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_LateUpdate(orig_LateUpdate orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnCollideWithPlayer(BaboonBirdAI self, Collider other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnCollideWithPlayer(orig_OnCollideWithPlayer orig, BaboonBirdAI self, Collider other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnCollideWithEnemy(BaboonBirdAI self, Collider other, EnemyAI enemyScript);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnCollideWithEnemy(orig_OnCollideWithEnemy orig, BaboonBirdAI self, Collider other, EnemyAI enemyScript);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_HitEnemy(BaboonBirdAI self, int force, PlayerControllerB playerWhoHit, bool playHitSFX);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_HitEnemy(orig_HitEnemy orig, BaboonBirdAI self, int force, PlayerControllerB playerWhoHit, bool playHitSFX);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_KillEnemy(BaboonBirdAI self, bool destroy);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_KillEnemy(orig_KillEnemy orig, BaboonBirdAI self, bool destroy);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StopKillAnimation(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StopKillAnimation(orig_StopKillAnimation orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StabPlayerDeathAnimServerRpc(BaboonBirdAI self, int playerObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StabPlayerDeathAnimServerRpc(orig_StabPlayerDeathAnimServerRpc orig, BaboonBirdAI self, int playerObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StabPlayerDeathAnimClientRpc(BaboonBirdAI self, int playerObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StabPlayerDeathAnimClientRpc(orig_StabPlayerDeathAnimClientRpc orig, BaboonBirdAI self, int playerObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IEnumerator orig_killPlayerAnimation(BaboonBirdAI self, int playerObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IEnumerator hook_killPlayerAnimation(orig_killPlayerAnimation orig, BaboonBirdAI self, int playerObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_InteractWithScrap(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_InteractWithScrap(orig_InteractWithScrap orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_CanGrabScrap(BaboonBirdAI self, GrabbableObject scrap);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_CanGrabScrap(orig_CanGrabScrap orig, BaboonBirdAI self, GrabbableObject scrap);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_DropHeldItemAndSync(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_DropHeldItemAndSync(orig_DropHeldItemAndSync orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_DropScrapServerRpc(BaboonBirdAI self, NetworkObjectReference item, Vector3 targetFloorPosition, int clientWhoSentRPC);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_DropScrapServerRpc(orig_DropScrapServerRpc orig, BaboonBirdAI self, NetworkObjectReference item, Vector3 targetFloorPosition, int clientWhoSentRPC);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_DropScrapClientRpc(BaboonBirdAI self, NetworkObjectReference item, Vector3 targetFloorPosition, int clientWhoSentRPC);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_DropScrapClientRpc(orig_DropScrapClientRpc orig, BaboonBirdAI self, NetworkObjectReference item, Vector3 targetFloorPosition, int clientWhoSentRPC);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_DropScrap(BaboonBirdAI self, NetworkObject item, Vector3 targetFloorPosition);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_DropScrap(orig_DropScrap orig, BaboonBirdAI self, NetworkObject item, Vector3 targetFloorPosition);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_GrabItemAndSync(BaboonBirdAI self, NetworkObject item);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_GrabItemAndSync(orig_GrabItemAndSync orig, BaboonBirdAI self, NetworkObject item);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_GrabScrapServerRpc(BaboonBirdAI self, NetworkObjectReference item, int clientWhoSentRPC);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_GrabScrapServerRpc(orig_GrabScrapServerRpc orig, BaboonBirdAI self, NetworkObjectReference item, int clientWhoSentRPC);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_GrabScrapClientRpc(BaboonBirdAI self, NetworkObjectReference item, int clientWhoSentRPC);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_GrabScrapClientRpc(orig_GrabScrapClientRpc orig, BaboonBirdAI self, NetworkObjectReference item, int clientWhoSentRPC);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_GrabScrap(BaboonBirdAI self, NetworkObject item);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_GrabScrap(orig_GrabScrap orig, BaboonBirdAI self, NetworkObject item);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ReachedNodeInSearch(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ReachedNodeInSearch(orig_ReachedNodeInSearch orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_DoAIInterval(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_DoAIInterval(orig_DoAIInterval orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StopFocusingThreat(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StopFocusingThreat(orig_StopFocusingThreat orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StopFocusingThreatServerRpc(BaboonBirdAI self, bool enterScoutingMode);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StopFocusingThreatServerRpc(orig_StopFocusingThreatServerRpc orig, BaboonBirdAI self, bool enterScoutingMode);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StopFocusingThreatClientRpc(BaboonBirdAI self, bool enterScoutingMode);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StopFocusingThreatClientRpc(orig_StopFocusingThreatClientRpc orig, BaboonBirdAI self, bool enterScoutingMode);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetAggressiveMode(BaboonBirdAI self, int mode);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetAggressiveMode(orig_SetAggressiveMode orig, BaboonBirdAI self, int mode);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetAggressiveModeServerRpc(BaboonBirdAI self, int mode);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetAggressiveModeServerRpc(orig_SetAggressiveModeServerRpc orig, BaboonBirdAI self, int mode);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetAggressiveModeClientRpc(BaboonBirdAI self, int mode);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetAggressiveModeClientRpc(orig_SetAggressiveModeClientRpc orig, BaboonBirdAI self, int mode);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetThreatInView(BaboonBirdAI self, bool inView);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetThreatInView(orig_SetThreatInView orig, BaboonBirdAI self, bool inView);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetThreatInViewServerRpc(BaboonBirdAI self, bool inView);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetThreatInViewServerRpc(orig_SetThreatInViewServerRpc orig, BaboonBirdAI self, bool inView);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetThreatInViewClientRpc(BaboonBirdAI self, bool inView);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetThreatInViewClientRpc(orig_SetThreatInViewClientRpc orig, BaboonBirdAI self, bool inView);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_EnemyEnterRestModeServerRpc(BaboonBirdAI self, bool sleep, bool atCamp);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_EnemyEnterRestModeServerRpc(orig_EnemyEnterRestModeServerRpc orig, BaboonBirdAI self, bool sleep, bool atCamp);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_EnemyEnterRestModeClientRpc(BaboonBirdAI self, bool sleep, bool atCamp);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_EnemyEnterRestModeClientRpc(orig_EnemyEnterRestModeClientRpc orig, BaboonBirdAI self, bool sleep, bool atCamp);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_EnemyGetUpServerRpc(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_EnemyGetUpServerRpc(orig_EnemyGetUpServerRpc orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_EnemyGetUpClientRpc(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_EnemyGetUpClientRpc(orig_EnemyGetUpClientRpc orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnDrawGizmos(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnDrawGizmos(orig_OnDrawGizmos orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_DetectNoise(BaboonBirdAI self, Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_DetectNoise(orig_DetectNoise orig, BaboonBirdAI self, Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_AnimateLooking(BaboonBirdAI self, Vector3 lookAtPosition);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_AnimateLooking(orig_AnimateLooking orig, BaboonBirdAI self, Vector3 lookAtPosition);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Update(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Update(orig_Update orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate float orig_GetComfortableDistanceToThreat(BaboonBirdAI self, Threat focusedThreat);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate float hook_GetComfortableDistanceToThreat(orig_GetComfortableDistanceToThreat orig, BaboonBirdAI self, Threat focusedThreat);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ReactToThreat(BaboonBirdAI self, Threat closestThreat);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ReactToThreat(orig_ReactToThreat orig, BaboonBirdAI self, Threat closestThreat);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StartFocusOnThreatServerRpc(BaboonBirdAI self, NetworkObjectReference netObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StartFocusOnThreatServerRpc(orig_StartFocusOnThreatServerRpc orig, BaboonBirdAI self, NetworkObjectReference netObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StartFocusOnThreatClientRpc(BaboonBirdAI self, NetworkObjectReference netObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StartFocusOnThreatClientRpc(orig_StartFocusOnThreatClientRpc orig, BaboonBirdAI self, NetworkObjectReference netObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate float orig_ReactToOtherBaboonSighted(BaboonBirdAI self, BaboonBirdAI otherBaboon);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate float hook_ReactToOtherBaboonSighted(orig_ReactToOtherBaboonSighted orig, BaboonBirdAI self, BaboonBirdAI otherBaboon);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_DoLOSCheck(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_DoLOSCheck(orig_DoLOSCheck orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_PingBaboonInterest(BaboonBirdAI self, Vector3 interestPosition, int pingImportance);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_PingBaboonInterest(orig_PingBaboonInterest orig, BaboonBirdAI self, Vector3 interestPosition, int pingImportance);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_PingBirdInterestServerRpc(BaboonBirdAI self, Vector3 lookPosition, float timeToPeek);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_PingBirdInterestServerRpc(orig_PingBirdInterestServerRpc orig, BaboonBirdAI self, Vector3 lookPosition, float timeToPeek);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_PingBirdInterestClientRpc(BaboonBirdAI self, Vector3 lookPosition, float timeToPeek);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_PingBirdInterestClientRpc(orig_PingBirdInterestClientRpc orig, BaboonBirdAI self, Vector3 lookPosition, float timeToPeek);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_JoinScoutingGroup(BaboonBirdAI self, BaboonBirdAI otherBaboon);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_JoinScoutingGroup(orig_JoinScoutingGroup orig, BaboonBirdAI self, BaboonBirdAI otherBaboon);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StartScoutingGroup(BaboonBirdAI self, BaboonBirdAI firstMember, bool syncWithClients);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StartScoutingGroup(orig_StartScoutingGroup orig, BaboonBirdAI self, BaboonBirdAI firstMember, bool syncWithClients);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_LeaveCurrentScoutingGroup(BaboonBirdAI self, bool sync);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_LeaveCurrentScoutingGroup(orig_LeaveCurrentScoutingGroup orig, BaboonBirdAI self, bool sync);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_LeaveScoutingGroupServerRpc(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_LeaveScoutingGroupServerRpc(orig_LeaveScoutingGroupServerRpc orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_LeaveScoutingGroupClientRpc(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_LeaveScoutingGroupClientRpc(orig_LeaveScoutingGroupClientRpc orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StartScoutingGroupServerRpc(BaboonBirdAI self, NetworkObjectReference leaderNetworkObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StartScoutingGroupServerRpc(orig_StartScoutingGroupServerRpc orig, BaboonBirdAI self, NetworkObjectReference leaderNetworkObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StartScoutingGroupClientRpc(BaboonBirdAI self, NetworkObjectReference leaderNetworkObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StartScoutingGroupClientRpc(orig_StartScoutingGroupClientRpc orig, BaboonBirdAI self, NetworkObjectReference leaderNetworkObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_JoinScoutingGroupServerRpc(BaboonBirdAI self, NetworkObjectReference otherBaboonNetworkObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_JoinScoutingGroupServerRpc(orig_JoinScoutingGroupServerRpc orig, BaboonBirdAI self, NetworkObjectReference otherBaboonNetworkObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_JoinScoutingGroupClientRpc(BaboonBirdAI self, NetworkObjectReference otherBaboonNetworkObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_JoinScoutingGroupClientRpc(orig_JoinScoutingGroupClientRpc orig, BaboonBirdAI self, NetworkObjectReference otherBaboonNetworkObject);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_CallToOtherBaboon(BaboonBirdAI self, BaboonBirdAI otherBaboon);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_CallToOtherBaboon(orig_CallToOtherBaboon orig, BaboonBirdAI self, BaboonBirdAI otherBaboon);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StartMiscAnimation(BaboonBirdAI self, int anim);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StartMiscAnimation(orig_StartMiscAnimation orig, BaboonBirdAI self, int anim);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StartMiscAnimationServerRpc(BaboonBirdAI self, int miscAnimationId);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StartMiscAnimationServerRpc(orig_StartMiscAnimationServerRpc orig, BaboonBirdAI self, int miscAnimationId);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_StartMiscAnimationClientRpc(BaboonBirdAI self, int miscAnimationId);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_StartMiscAnimationClientRpc(orig_StartMiscAnimationClientRpc orig, BaboonBirdAI self, int miscAnimationId);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_CalculateAnimationDirection(BaboonBirdAI self, float maxSpeed);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_CalculateAnimationDirection(orig_CalculateAnimationDirection orig, BaboonBirdAI self, float maxSpeed);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___initializeVariables(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___initializeVariables(orig___initializeVariables orig, BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_InitializeRPCS_BaboonBirdAI();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_InitializeRPCS_BaboonBirdAI(orig_InitializeRPCS_BaboonBirdAI orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_3452382367(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_3452382367(orig___rpc_handler_3452382367 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_3856685904(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_3856685904(orig___rpc_handler_3856685904 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_2476579270(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_2476579270(orig___rpc_handler_2476579270 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_3749667856(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_3749667856(orig___rpc_handler_3749667856 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1418775270(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1418775270(orig___rpc_handler_1418775270 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1865475504(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1865475504(orig___rpc_handler_1865475504 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_869682226(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_869682226(orig___rpc_handler_869682226 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1564051222(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1564051222(orig___rpc_handler_1564051222 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1546030380(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1546030380(orig___rpc_handler_1546030380 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_3360048400(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_3360048400(orig___rpc_handler_3360048400 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_443869275(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_443869275(orig___rpc_handler_443869275 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1782649174(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1782649174(orig___rpc_handler_1782649174 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_3428942850(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_3428942850(orig___rpc_handler_3428942850 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_2073937320(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_2073937320(orig___rpc_handler_2073937320 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1806580287(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1806580287(orig___rpc_handler_1806580287 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1567928363(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1567928363(orig___rpc_handler_1567928363 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_3614203845(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_3614203845(orig___rpc_handler_3614203845 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1155909339(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1155909339(orig___rpc_handler_1155909339 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_3933590138(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_3933590138(orig___rpc_handler_3933590138 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_991811456(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_991811456(orig___rpc_handler_991811456 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1670979535(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1670979535(orig___rpc_handler_1670979535 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_2348332192(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_2348332192(orig___rpc_handler_2348332192 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_2459653399(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_2459653399(orig___rpc_handler_2459653399 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_696889160(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_696889160(orig___rpc_handler_696889160 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_3367846835(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_3367846835(orig___rpc_handler_3367846835 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1737299197(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1737299197(orig___rpc_handler_1737299197 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1775372234(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1775372234(orig___rpc_handler_1775372234 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1078565091(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1078565091(orig___rpc_handler_1078565091 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_1580405641(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_1580405641(orig___rpc_handler_1580405641 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___rpc_handler_3995026000(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___rpc_handler_3995026000(orig___rpc_handler_3995026000 orig, NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig___getTypeName(BaboonBirdAI self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook___getTypeName(orig___getTypeName orig, BaboonBirdAI self);

		public static event hook_Start Start
		{
			add
			{
				HookEndpointManager.Add<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SyncInitialValuesServerRpc SyncInitialValuesServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_SyncInitialValuesServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SyncInitialValuesServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SyncInitialValuesClientRpc SyncInitialValuesClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_SyncInitialValuesClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SyncInitialValuesClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_LateUpdate LateUpdate
		{
			add
			{
				HookEndpointManager.Add<hook_LateUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_LateUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnCollideWithPlayer OnCollideWithPlayer
		{
			add
			{
				HookEndpointManager.Add<hook_OnCollideWithPlayer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnCollideWithPlayer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnCollideWithEnemy OnCollideWithEnemy
		{
			add
			{
				HookEndpointManager.Add<hook_OnCollideWithEnemy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnCollideWithEnemy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_HitEnemy HitEnemy
		{
			add
			{
				HookEndpointManager.Add<hook_HitEnemy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_HitEnemy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_KillEnemy KillEnemy
		{
			add
			{
				HookEndpointManager.Add<hook_KillEnemy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_KillEnemy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StopKillAnimation StopKillAnimation
		{
			add
			{
				HookEndpointManager.Add<hook_StopKillAnimation>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StopKillAnimation>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StabPlayerDeathAnimServerRpc StabPlayerDeathAnimServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_StabPlayerDeathAnimServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StabPlayerDeathAnimServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StabPlayerDeathAnimClientRpc StabPlayerDeathAnimClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_StabPlayerDeathAnimClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StabPlayerDeathAnimClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_killPlayerAnimation killPlayerAnimation
		{
			add
			{
				HookEndpointManager.Add<hook_killPlayerAnimation>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_killPlayerAnimation>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_InteractWithScrap InteractWithScrap
		{
			add
			{
				HookEndpointManager.Add<hook_InteractWithScrap>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_InteractWithScrap>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_CanGrabScrap CanGrabScrap
		{
			add
			{
				HookEndpointManager.Add<hook_CanGrabScrap>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_CanGrabScrap>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_DropHeldItemAndSync DropHeldItemAndSync
		{
			add
			{
				HookEndpointManager.Add<hook_DropHeldItemAndSync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_DropHeldItemAndSync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_DropScrapServerRpc DropScrapServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_DropScrapServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_DropScrapServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_DropScrapClientRpc DropScrapClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_DropScrapClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_DropScrapClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_DropScrap DropScrap
		{
			add
			{
				HookEndpointManager.Add<hook_DropScrap>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_DropScrap>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GrabItemAndSync GrabItemAndSync
		{
			add
			{
				HookEndpointManager.Add<hook_GrabItemAndSync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GrabItemAndSync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GrabScrapServerRpc GrabScrapServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_GrabScrapServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GrabScrapServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GrabScrapClientRpc GrabScrapClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_GrabScrapClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GrabScrapClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GrabScrap GrabScrap
		{
			add
			{
				HookEndpointManager.Add<hook_GrabScrap>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GrabScrap>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ReachedNodeInSearch ReachedNodeInSearch
		{
			add
			{
				HookEndpointManager.Add<hook_ReachedNodeInSearch>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ReachedNodeInSearch>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_DoAIInterval DoAIInterval
		{
			add
			{
				HookEndpointManager.Add<hook_DoAIInterval>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_DoAIInterval>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StopFocusingThreat StopFocusingThreat
		{
			add
			{
				HookEndpointManager.Add<hook_StopFocusingThreat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StopFocusingThreat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StopFocusingThreatServerRpc StopFocusingThreatServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_StopFocusingThreatServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StopFocusingThreatServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StopFocusingThreatClientRpc StopFocusingThreatClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_StopFocusingThreatClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StopFocusingThreatClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetAggressiveMode SetAggressiveMode
		{
			add
			{
				HookEndpointManager.Add<hook_SetAggressiveMode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetAggressiveMode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetAggressiveModeServerRpc SetAggressiveModeServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_SetAggressiveModeServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetAggressiveModeServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetAggressiveModeClientRpc SetAggressiveModeClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_SetAggressiveModeClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetAggressiveModeClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetThreatInView SetThreatInView
		{
			add
			{
				HookEndpointManager.Add<hook_SetThreatInView>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetThreatInView>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetThreatInViewServerRpc SetThreatInViewServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_SetThreatInViewServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetThreatInViewServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetThreatInViewClientRpc SetThreatInViewClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_SetThreatInViewClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetThreatInViewClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_EnemyEnterRestModeServerRpc EnemyEnterRestModeServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_EnemyEnterRestModeServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_EnemyEnterRestModeServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_EnemyEnterRestModeClientRpc EnemyEnterRestModeClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_EnemyEnterRestModeClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_EnemyEnterRestModeClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_EnemyGetUpServerRpc EnemyGetUpServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_EnemyGetUpServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_EnemyGetUpServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_EnemyGetUpClientRpc EnemyGetUpClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_EnemyGetUpClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_EnemyGetUpClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnDrawGizmos OnDrawGizmos
		{
			add
			{
				HookEndpointManager.Add<hook_OnDrawGizmos>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnDrawGizmos>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_DetectNoise DetectNoise
		{
			add
			{
				HookEndpointManager.Add<hook_DetectNoise>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_DetectNoise>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_AnimateLooking AnimateLooking
		{
			add
			{
				HookEndpointManager.Add<hook_AnimateLooking>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_AnimateLooking>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Update Update
		{
			add
			{
				HookEndpointManager.Add<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetComfortableDistanceToThreat GetComfortableDistanceToThreat
		{
			add
			{
				HookEndpointManager.Add<hook_GetComfortableDistanceToThreat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetComfortableDistanceToThreat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ReactToThreat ReactToThreat
		{
			add
			{
				HookEndpointManager.Add<hook_ReactToThreat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ReactToThreat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartFocusOnThreatServerRpc StartFocusOnThreatServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_StartFocusOnThreatServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartFocusOnThreatServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartFocusOnThreatClientRpc StartFocusOnThreatClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_StartFocusOnThreatClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartFocusOnThreatClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ReactToOtherBaboonSighted ReactToOtherBaboonSighted
		{
			add
			{
				HookEndpointManager.Add<hook_ReactToOtherBaboonSighted>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ReactToOtherBaboonSighted>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_DoLOSCheck DoLOSCheck
		{
			add
			{
				HookEndpointManager.Add<hook_DoLOSCheck>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_DoLOSCheck>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_PingBaboonInterest PingBaboonInterest
		{
			add
			{
				HookEndpointManager.Add<hook_PingBaboonInterest>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_PingBaboonInterest>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_PingBirdInterestServerRpc PingBirdInterestServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_PingBirdInterestServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_PingBirdInterestServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_PingBirdInterestClientRpc PingBirdInterestClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_PingBirdInterestClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_PingBirdInterestClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_JoinScoutingGroup JoinScoutingGroup
		{
			add
			{
				HookEndpointManager.Add<hook_JoinScoutingGroup>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_JoinScoutingGroup>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartScoutingGroup StartScoutingGroup
		{
			add
			{
				HookEndpointManager.Add<hook_StartScoutingGroup>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartScoutingGroup>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_LeaveCurrentScoutingGroup LeaveCurrentScoutingGroup
		{
			add
			{
				HookEndpointManager.Add<hook_LeaveCurrentScoutingGroup>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_LeaveCurrentScoutingGroup>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_LeaveScoutingGroupServerRpc LeaveScoutingGroupServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_LeaveScoutingGroupServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_LeaveScoutingGroupServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_LeaveScoutingGroupClientRpc LeaveScoutingGroupClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_LeaveScoutingGroupClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_LeaveScoutingGroupClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartScoutingGroupServerRpc StartScoutingGroupServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_StartScoutingGroupServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartScoutingGroupServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartScoutingGroupClientRpc StartScoutingGroupClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_StartScoutingGroupClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartScoutingGroupClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_JoinScoutingGroupServerRpc JoinScoutingGroupServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_JoinScoutingGroupServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_JoinScoutingGroupServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_JoinScoutingGroupClientRpc JoinScoutingGroupClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_JoinScoutingGroupClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_JoinScoutingGroupClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_CallToOtherBaboon CallToOtherBaboon
		{
			add
			{
				HookEndpointManager.Add<hook_CallToOtherBaboon>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_CallToOtherBaboon>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartMiscAnimation StartMiscAnimation
		{
			add
			{
				HookEndpointManager.Add<hook_StartMiscAnimation>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartMiscAnimation>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartMiscAnimationServerRpc StartMiscAnimationServerRpc
		{
			add
			{
				HookEndpointManager.Add<hook_StartMiscAnimationServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartMiscAnimationServerRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartMiscAnimationClientRpc StartMiscAnimationClientRpc
		{
			add
			{
				HookEndpointManager.Add<hook_StartMiscAnimationClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartMiscAnimationClientRpc>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_CalculateAnimationDirection CalculateAnimationDirection
		{
			add
			{
				HookEndpointManager.Add<hook_CalculateAnimationDirection>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_CalculateAnimationDirection>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___initializeVariables __initializeVariables
		{
			add
			{
				HookEndpointManager.Add<hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_InitializeRPCS_BaboonBirdAI InitializeRPCS_BaboonBirdAI
		{
			add
			{
				HookEndpointManager.Add<hook_InitializeRPCS_BaboonBirdAI>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_InitializeRPCS_BaboonBirdAI>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_3452382367 __rpc_handler_3452382367
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_3452382367>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_3452382367>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_3856685904 __rpc_handler_3856685904
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_3856685904>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_3856685904>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_2476579270 __rpc_handler_2476579270
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_2476579270>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_2476579270>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_3749667856 __rpc_handler_3749667856
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_3749667856>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_3749667856>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_1418775270 __rpc_handler_1418775270
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_1418775270>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_1418775270>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_1865475504 __rpc_handler_1865475504
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_1865475504>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_1865475504>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_869682226 __rpc_handler_869682226
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_869682226>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_869682226>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_1564051222 __rpc_handler_1564051222
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_1564051222>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_1564051222>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_1546030380 __rpc_handler_1546030380
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_1546030380>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_1546030380>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_3360048400 __rpc_handler_3360048400
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_3360048400>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_3360048400>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_443869275 __rpc_handler_443869275
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_443869275>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_443869275>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_1782649174 __rpc_handler_1782649174
		{
			add
			{
				HookEndpointManager.Add<hook___rpc_handler_1782649174>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___rpc_handler_1782649174>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___rpc_handler_3428942850 __rpc_handler_3428942850
		{
			add
			

MMHOOK/MMHOOK_ClientNetworkTransform.dll

Decompiled 6 months ago
using System;
using System.ComponentModel;
using System.Reflection;
using MonoMod.Cil;
using MonoMod.RuntimeDetour.HookGen;
using On;
using On.Unity.Netcode.Samples;
using On.__GEN;
using Unity.Netcode.Samples;

[assembly: AssemblyVersion("0.0.0.0")]
namespace On
{
	public static class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType orig_Get();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType hook_Get(orig_Get orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, object self);

		public static event hook_Get Get
		{
			add
			{
				HookEndpointManager.Add<hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL
{
	public static class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
	{
		public static event Manipulator Get
		{
			add
			{
				HookEndpointManager.Modify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Unity.Netcode.Samples
{
	public static class ClientNetworkTransform
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnNetworkSpawn(ClientNetworkTransform self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnNetworkSpawn(orig_OnNetworkSpawn orig, ClientNetworkTransform self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Update(ClientNetworkTransform self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Update(orig_Update orig, ClientNetworkTransform self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(ClientNetworkTransform self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, ClientNetworkTransform self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig___initializeVariables(ClientNetworkTransform self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook___initializeVariables(orig___initializeVariables orig, ClientNetworkTransform self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig___getTypeName(ClientNetworkTransform self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook___getTypeName(orig___getTypeName orig, ClientNetworkTransform self);

		public static event hook_OnNetworkSpawn OnNetworkSpawn
		{
			add
			{
				HookEndpointManager.Add<hook_OnNetworkSpawn>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnNetworkSpawn>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Update Update
		{
			add
			{
				HookEndpointManager.Add<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___initializeVariables __initializeVariables
		{
			add
			{
				HookEndpointManager.Add<hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook___getTypeName __getTypeName
		{
			add
			{
				HookEndpointManager.Add<hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Unity.Netcode.Samples
{
	public static class ClientNetworkTransform
	{
		public static event Manipulator OnNetworkSpawn
		{
			add
			{
				HookEndpointManager.Modify<On.Unity.Netcode.Samples.ClientNetworkTransform.hook_OnNetworkSpawn>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Unity.Netcode.Samples.ClientNetworkTransform.hook_OnNetworkSpawn>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Update
		{
			add
			{
				HookEndpointManager.Modify<On.Unity.Netcode.Samples.ClientNetworkTransform.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Unity.Netcode.Samples.ClientNetworkTransform.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Unity.Netcode.Samples.ClientNetworkTransform.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Unity.Netcode.Samples.ClientNetworkTransform.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator __initializeVariables
		{
			add
			{
				HookEndpointManager.Modify<On.Unity.Netcode.Samples.ClientNetworkTransform.hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Unity.Netcode.Samples.ClientNetworkTransform.hook___initializeVariables>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator __getTypeName
		{
			add
			{
				HookEndpointManager.Modify<On.Unity.Netcode.Samples.ClientNetworkTransform.hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Unity.Netcode.Samples.ClientNetworkTransform.hook___getTypeName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.__GEN
{
	public static class NetworkVariableSerializationHelper
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_InitializeSerialization();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_InitializeSerialization(orig_InitializeSerialization orig);

		public static event hook_InitializeSerialization InitializeSerialization
		{
			add
			{
				HookEndpointManager.Add<hook_InitializeSerialization>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_InitializeSerialization>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.__GEN
{
	public static class NetworkVariableSerializationHelper
	{
		public static event Manipulator InitializeSerialization
		{
			add
			{
				HookEndpointManager.Modify<On.__GEN.NetworkVariableSerializationHelper.hook_InitializeSerialization>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.__GEN.NetworkVariableSerializationHelper.hook_InitializeSerialization>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace BepHookGen
{
	public class size6144
	{
	}
}

MMHOOK/MMHOOK_DissonanceVoip.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using Dissonance;
using Dissonance.Audio;
using Dissonance.Audio.Capture;
using Dissonance.Audio.Codecs;
using Dissonance.Audio.Playback;
using Dissonance.Config;
using Dissonance.Datastructures;
using Dissonance.Networking;
using Dissonance.VAD;
using MonoMod.Cil;
using MonoMod.RuntimeDetour.HookGen;
using NAudio.Wave;
using On;
using On.Dissonance;
using On.Dissonance.Audio;
using On.Dissonance.Audio.Capture;
using On.Dissonance.Audio.Codecs;
using On.Dissonance.Audio.Codecs.Identity;
using On.Dissonance.Audio.Codecs.Opus;
using On.Dissonance.Audio.Codecs.Silence;
using On.Dissonance.Audio.Playback;
using On.Dissonance.Config;
using On.Dissonance.Datastructures;
using On.Dissonance.Extensions;
using On.Dissonance.Networking;
using On.Dissonance.Networking.Client;
using On.Dissonance.Threading;
using On.NAudio.Dsp;
using On.NAudio.Wave;
using UnityEngine;

[assembly: AssemblyVersion("0.0.0.0")]
namespace On
{
	public static class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType orig_Get();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType hook_Get(orig_Get orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, object self);

		public static event hook_Get Get
		{
			add
			{
				HookEndpointManager.Add<hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL
{
	public static class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
	{
		public static event Manipulator Get
		{
			add
			{
				HookEndpointManager.Modify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.NAudio.Dsp
{
	public static class WdlResampler
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetMode(object self, bool interp, int filtercnt, bool sinc, int sinc_size, int sinc_interpsize);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetMode(orig_SetMode orig, object self, bool interp, int filtercnt, bool sinc, int sinc_size, int sinc_interpsize);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetFilterParms(object self, float filterpos, float filterq);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetFilterParms(orig_SetFilterParms orig, object self, float filterpos, float filterq);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetFeedMode(object self, bool wantInputDriven);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetFeedMode(orig_SetFeedMode orig, object self, bool wantInputDriven);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Reset(object self, double fracpos);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Reset(orig_Reset orig, object self, double fracpos);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetRates(object self, double rate_in, double rate_out);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetRates(orig_SetRates orig, object self, double rate_in, double rate_out);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate double orig_GetCurrentLatency(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate double hook_GetCurrentLatency(orig_GetCurrentLatency orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_ResamplePrepare(object self, int out_samples, int nch, out float[] inbuffer, out int inbufferOffset);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_ResamplePrepare(orig_ResamplePrepare orig, object self, int out_samples, int nch, out float[] inbuffer, out int inbufferOffset);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_ResampleOut(object self, float[] outBuffer, int outBufferIndex, int nsamples_in, int nsamples_out, int nch);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_ResampleOut(orig_ResampleOut orig, object self, float[] outBuffer, int outBufferIndex, int nsamples_in, int nsamples_out, int nch);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_BuildLowPass(object self, double filtpos);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_BuildLowPass(orig_BuildLowPass orig, object self, double filtpos);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SincSample(object self, float[] outBuffer, int outBufferIndex, float[] inBuffer, int inBufferIndex, double fracpos, int nch, float[] filter, int filterIndex, int filtsz);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SincSample(orig_SincSample orig, object self, float[] outBuffer, int outBufferIndex, float[] inBuffer, int inBufferIndex, double fracpos, int nch, float[] filter, int filterIndex, int filtsz);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SincSample1(object self, float[] outBuffer, int outBufferIndex, float[] inBuffer, int inBufferIndex, double fracpos, float[] filter, int filterIndex, int filtsz);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SincSample1(orig_SincSample1 orig, object self, float[] outBuffer, int outBufferIndex, float[] inBuffer, int inBufferIndex, double fracpos, float[] filter, int filterIndex, int filtsz);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SincSample2(object self, float[] outptr, int outBufferIndex, float[] inBuffer, int inBufferIndex, double fracpos, float[] filter, int filterIndex, int filtsz);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SincSample2(orig_SincSample2 orig, object self, float[] outptr, int outBufferIndex, float[] inBuffer, int inBufferIndex, double fracpos, float[] filter, int filterIndex, int filtsz);

		public static class WDL_Resampler_IIRFilter
		{
			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_ctor(object self);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_ctor(orig_ctor orig, object self);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_Reset(object self);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_Reset(orig_Reset orig, object self);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_setParms(object self, double fpos, double Q);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_setParms(orig_setParms orig, object self, double fpos, double Q);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_Apply(object self, float[] inBuffer, int inIndex, float[] outBuffer, int outIndex, int ns, int span, int w);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_Apply(orig_Apply orig, object self, float[] inBuffer, int inIndex, float[] outBuffer, int outIndex, int ns, int span, int w);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate double orig_denormal_filter_float(object self, float x);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate double hook_denormal_filter_float(orig_denormal_filter_float orig, object self, float x);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate double orig_denormal_filter_double(object self, double x);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate double hook_denormal_filter_double(orig_denormal_filter_double orig, object self, double x);

			public static event hook_ctor ctor
			{
				add
				{
					HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}

			public static event hook_Reset Reset
			{
				add
				{
					HookEndpointManager.Add<hook_Reset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_Reset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}

			public static event hook_setParms setParms
			{
				add
				{
					HookEndpointManager.Add<hook_setParms>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_setParms>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}

			public static event hook_Apply Apply
			{
				add
				{
					HookEndpointManager.Add<hook_Apply>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_Apply>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}

			public static event hook_denormal_filter_float denormal_filter_float
			{
				add
				{
					HookEndpointManager.Add<hook_denormal_filter_float>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_denormal_filter_float>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}

			public static event hook_denormal_filter_double denormal_filter_double
			{
				add
				{
					HookEndpointManager.Add<hook_denormal_filter_double>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_denormal_filter_double>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetMode SetMode
		{
			add
			{
				HookEndpointManager.Add<hook_SetMode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetMode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetFilterParms SetFilterParms
		{
			add
			{
				HookEndpointManager.Add<hook_SetFilterParms>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetFilterParms>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetFeedMode SetFeedMode
		{
			add
			{
				HookEndpointManager.Add<hook_SetFeedMode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetFeedMode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Reset Reset
		{
			add
			{
				HookEndpointManager.Add<hook_Reset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Reset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetRates SetRates
		{
			add
			{
				HookEndpointManager.Add<hook_SetRates>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetRates>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetCurrentLatency GetCurrentLatency
		{
			add
			{
				HookEndpointManager.Add<hook_GetCurrentLatency>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetCurrentLatency>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ResamplePrepare ResamplePrepare
		{
			add
			{
				HookEndpointManager.Add<hook_ResamplePrepare>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ResamplePrepare>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ResampleOut ResampleOut
		{
			add
			{
				HookEndpointManager.Add<hook_ResampleOut>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ResampleOut>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_BuildLowPass BuildLowPass
		{
			add
			{
				HookEndpointManager.Add<hook_BuildLowPass>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_BuildLowPass>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SincSample SincSample
		{
			add
			{
				HookEndpointManager.Add<hook_SincSample>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SincSample>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SincSample1 SincSample1
		{
			add
			{
				HookEndpointManager.Add<hook_SincSample1>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SincSample1>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SincSample2 SincSample2
		{
			add
			{
				HookEndpointManager.Add<hook_SincSample2>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SincSample2>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.NAudio.Dsp
{
	public static class WdlResampler
	{
		public static class WDL_Resampler_IIRFilter
		{
			public static event Manipulator ctor
			{
				add
				{
					HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}

			public static event Manipulator Reset
			{
				add
				{
					HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_Reset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_Reset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}

			public static event Manipulator setParms
			{
				add
				{
					HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_setParms>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_setParms>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}

			public static event Manipulator Apply
			{
				add
				{
					HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_Apply>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_Apply>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}

			public static event Manipulator denormal_filter_float
			{
				add
				{
					HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_denormal_filter_float>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_denormal_filter_float>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}

			public static event Manipulator denormal_filter_double
			{
				add
				{
					HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_denormal_filter_double>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.WDL_Resampler_IIRFilter.hook_denormal_filter_double>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SetMode
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_SetMode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_SetMode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SetFilterParms
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_SetFilterParms>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_SetFilterParms>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SetFeedMode
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_SetFeedMode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_SetFeedMode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Reset
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_Reset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_Reset>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SetRates
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_SetRates>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_SetRates>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator GetCurrentLatency
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_GetCurrentLatency>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_GetCurrentLatency>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ResamplePrepare
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_ResamplePrepare>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_ResamplePrepare>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ResampleOut
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_ResampleOut>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_ResampleOut>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator BuildLowPass
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_BuildLowPass>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_BuildLowPass>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SincSample
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_SincSample>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_SincSample>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SincSample1
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_SincSample1>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_SincSample1>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SincSample2
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Dsp.WdlResampler.hook_SincSample2>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Dsp.WdlResampler.hook_SincSample2>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.NAudio.Wave
{
	public static class WaveFileWriter
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor_Stream_WaveFormat(Stream self, Stream outStream, WaveFormat format);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor_Stream_WaveFormat(orig_ctor_Stream_WaveFormat orig, Stream self, Stream outStream, WaveFormat format);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor_string_WaveFormat(Stream self, string filename, WaveFormat format);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor_string_WaveFormat(orig_ctor_string_WaveFormat orig, Stream self, string filename, WaveFormat format);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_WriteDataChunkHeader(Stream self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_WriteDataChunkHeader(orig_WriteDataChunkHeader orig, Stream self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_CreateFactChunk(Stream self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_CreateFactChunk(orig_CreateFactChunk orig, Stream self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_HasFactChunk(Stream self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_HasFactChunk(orig_HasFactChunk orig, Stream self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_Read(Stream self, byte[] buffer, int offset, int count);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_Read(orig_Read orig, Stream self, byte[] buffer, int offset, int count);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate long orig_Seek(Stream self, long offset, SeekOrigin origin);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate long hook_Seek(orig_Seek orig, Stream self, long offset, SeekOrigin origin);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SetLength(Stream self, long value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SetLength(orig_SetLength orig, Stream self, long value);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Write(Stream self, byte[] data, int offset, int count);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Write(orig_Write orig, Stream self, byte[] data, int offset, int count);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_WriteSample(Stream self, float sample);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_WriteSample(orig_WriteSample orig, Stream self, float sample);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_WriteSamples(Stream self, float[] samples, int offset, int count);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_WriteSamples(orig_WriteSamples orig, Stream self, float[] samples, int offset, int count);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Flush(Stream self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Flush(orig_Flush orig, Stream self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Dispose(Stream self, bool disposing);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Dispose(orig_Dispose orig, Stream self, bool disposing);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_UpdateHeader(Stream self, BinaryWriter writer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_UpdateHeader(orig_UpdateHeader orig, Stream self, BinaryWriter writer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_UpdateDataChunk(Stream self, BinaryWriter writer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_UpdateDataChunk(orig_UpdateDataChunk orig, Stream self, BinaryWriter writer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_UpdateRiffChunk(Stream self, BinaryWriter writer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_UpdateRiffChunk(orig_UpdateRiffChunk orig, Stream self, BinaryWriter writer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_UpdateFactChunk(Stream self, BinaryWriter writer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_UpdateFactChunk(orig_UpdateFactChunk orig, Stream self, BinaryWriter writer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Finalize(Stream self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Finalize(orig_Finalize orig, Stream self);

		public static event hook_ctor_Stream_WaveFormat ctor_Stream_WaveFormat
		{
			add
			{
				HookEndpointManager.Add<hook_ctor_Stream_WaveFormat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor_Stream_WaveFormat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor_string_WaveFormat ctor_string_WaveFormat
		{
			add
			{
				HookEndpointManager.Add<hook_ctor_string_WaveFormat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor_string_WaveFormat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_WriteDataChunkHeader WriteDataChunkHeader
		{
			add
			{
				HookEndpointManager.Add<hook_WriteDataChunkHeader>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_WriteDataChunkHeader>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_CreateFactChunk CreateFactChunk
		{
			add
			{
				HookEndpointManager.Add<hook_CreateFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_CreateFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_HasFactChunk HasFactChunk
		{
			add
			{
				HookEndpointManager.Add<hook_HasFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_HasFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Read Read
		{
			add
			{
				HookEndpointManager.Add<hook_Read>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Read>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Seek Seek
		{
			add
			{
				HookEndpointManager.Add<hook_Seek>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Seek>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SetLength SetLength
		{
			add
			{
				HookEndpointManager.Add<hook_SetLength>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SetLength>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Write Write
		{
			add
			{
				HookEndpointManager.Add<hook_Write>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Write>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_WriteSample WriteSample
		{
			add
			{
				HookEndpointManager.Add<hook_WriteSample>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_WriteSample>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_WriteSamples WriteSamples
		{
			add
			{
				HookEndpointManager.Add<hook_WriteSamples>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_WriteSamples>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Flush Flush
		{
			add
			{
				HookEndpointManager.Add<hook_Flush>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Flush>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Dispose Dispose
		{
			add
			{
				HookEndpointManager.Add<hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_UpdateHeader UpdateHeader
		{
			add
			{
				HookEndpointManager.Add<hook_UpdateHeader>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_UpdateHeader>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_UpdateDataChunk UpdateDataChunk
		{
			add
			{
				HookEndpointManager.Add<hook_UpdateDataChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_UpdateDataChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_UpdateRiffChunk UpdateRiffChunk
		{
			add
			{
				HookEndpointManager.Add<hook_UpdateRiffChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_UpdateRiffChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_UpdateFactChunk UpdateFactChunk
		{
			add
			{
				HookEndpointManager.Add<hook_UpdateFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_UpdateFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public new static event hook_Finalize Finalize
		{
			add
			{
				HookEndpointManager.Add<hook_Finalize>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Finalize>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.NAudio.Wave
{
	public static class WaveFileWriter
	{
		public static event Manipulator ctor_Stream_WaveFormat
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_ctor_Stream_WaveFormat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_ctor_Stream_WaveFormat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor_string_WaveFormat
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_ctor_string_WaveFormat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_ctor_string_WaveFormat>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator WriteDataChunkHeader
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_WriteDataChunkHeader>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_WriteDataChunkHeader>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator CreateFactChunk
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_CreateFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_CreateFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator HasFactChunk
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_HasFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_HasFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Read
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_Read>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_Read>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Seek
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_Seek>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_Seek>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SetLength
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_SetLength>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_SetLength>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Write
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_Write>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_Write>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator WriteSample
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_WriteSample>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_WriteSample>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator WriteSamples
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_WriteSamples>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_WriteSamples>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Flush
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_Flush>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_Flush>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Dispose
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator UpdateHeader
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_UpdateHeader>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_UpdateHeader>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator UpdateDataChunk
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_UpdateDataChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_UpdateDataChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator UpdateRiffChunk
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_UpdateRiffChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_UpdateRiffChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator UpdateFactChunk
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_UpdateFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_UpdateFactChunk>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public new static event Manipulator Finalize
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFileWriter.hook_Finalize>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFileWriter.hook_Finalize>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.NAudio.Wave
{
	public static class WaveFormat
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(WaveFormat self, int sampleRate, int channels);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, WaveFormat self, int sampleRate, int channels);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_Equals(WaveFormat self, WaveFormat other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_Equals(orig_Equals orig, WaveFormat self, WaveFormat other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_GetHashCode(WaveFormat self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_GetHashCode(orig_GetHashCode orig, WaveFormat self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig_ToString(WaveFormat self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook_ToString(orig_ToString orig, WaveFormat self);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public new static event hook_Equals Equals
		{
			add
			{
				HookEndpointManager.Add<hook_Equals>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Equals>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public new static event hook_GetHashCode GetHashCode
		{
			add
			{
				HookEndpointManager.Add<hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public new static event hook_ToString ToString
		{
			add
			{
				HookEndpointManager.Add<hook_ToString>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ToString>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.NAudio.Wave
{
	public static class WaveFormat
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFormat.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFormat.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public new static event Manipulator Equals
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFormat.hook_Equals>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFormat.hook_Equals>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public new static event Manipulator GetHashCode
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFormat.hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFormat.hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public new static event Manipulator ToString
		{
			add
			{
				HookEndpointManager.Modify<On.NAudio.Wave.WaveFormat.hook_ToString>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.NAudio.Wave.WaveFormat.hook_ToString>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Dissonance
{
	public static class BaseCommsTrigger
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Awake(BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Awake(orig_Awake orig, BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Start(BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Start(orig_Start orig, BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnEnable(BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnEnable(orig_OnEnable orig, BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Update(BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Update(orig_Update orig, BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnDisable(BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnDisable(orig_OnDisable orig, BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnDestroy(BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnDestroy(orig_OnDestroy orig, BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_TokensModified(BaseCommsTrigger self, string token);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_TokensModified(orig_TokensModified orig, BaseCommsTrigger self, string token);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_ContainsToken(BaseCommsTrigger self, string token);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_ContainsToken(orig_ContainsToken orig, BaseCommsTrigger self, string token);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_AddToken(BaseCommsTrigger self, string token);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_AddToken(orig_AddToken orig, BaseCommsTrigger self, string token);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_RemoveToken(BaseCommsTrigger self, string token);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_RemoveToken(orig_RemoveToken orig, BaseCommsTrigger self, string token);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ColliderTriggerChanged(BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ColliderTriggerChanged(orig_ColliderTriggerChanged orig, BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnTriggerEnter2D(BaseCommsTrigger self, Collider2D other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnTriggerEnter2D(orig_OnTriggerEnter2D orig, BaseCommsTrigger self, Collider2D other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnTriggerExit2D(BaseCommsTrigger self, Collider2D other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnTriggerExit2D(orig_OnTriggerExit2D orig, BaseCommsTrigger self, Collider2D other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnTriggerEnter(BaseCommsTrigger self, Collider other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnTriggerEnter(orig_OnTriggerEnter orig, BaseCommsTrigger self, Collider other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnTriggerExit(BaseCommsTrigger self, Collider other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnTriggerExit(orig_OnTriggerExit orig, BaseCommsTrigger self, Collider other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_ColliderTriggerFilter(BaseCommsTrigger self, Collider other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_ColliderTriggerFilter(orig_ColliderTriggerFilter orig, BaseCommsTrigger self, Collider other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_ColliderTriggerFilter2D(BaseCommsTrigger self, Collider2D other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_ColliderTriggerFilter2D(orig_ColliderTriggerFilter2D orig, BaseCommsTrigger self, Collider2D other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate DissonanceComms orig_FindLocalVoiceComm(BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate DissonanceComms hook_FindLocalVoiceComm(orig_FindLocalVoiceComm orig, BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_CheckVoiceComm(BaseCommsTrigger self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_CheckVoiceComm(orig_CheckVoiceComm orig, BaseCommsTrigger self);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Awake Awake
		{
			add
			{
				HookEndpointManager.Add<hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Start Start
		{
			add
			{
				HookEndpointManager.Add<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnEnable OnEnable
		{
			add
			{
				HookEndpointManager.Add<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Update Update
		{
			add
			{
				HookEndpointManager.Add<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnDisable OnDisable
		{
			add
			{
				HookEndpointManager.Add<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnDestroy OnDestroy
		{
			add
			{
				HookEndpointManager.Add<hook_OnDestroy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnDestroy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_TokensModified TokensModified
		{
			add
			{
				HookEndpointManager.Add<hook_TokensModified>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_TokensModified>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ContainsToken ContainsToken
		{
			add
			{
				HookEndpointManager.Add<hook_ContainsToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ContainsToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_AddToken AddToken
		{
			add
			{
				HookEndpointManager.Add<hook_AddToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_AddToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_RemoveToken RemoveToken
		{
			add
			{
				HookEndpointManager.Add<hook_RemoveToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_RemoveToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ColliderTriggerChanged ColliderTriggerChanged
		{
			add
			{
				HookEndpointManager.Add<hook_ColliderTriggerChanged>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ColliderTriggerChanged>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnTriggerEnter2D OnTriggerEnter2D
		{
			add
			{
				HookEndpointManager.Add<hook_OnTriggerEnter2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnTriggerEnter2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnTriggerExit2D OnTriggerExit2D
		{
			add
			{
				HookEndpointManager.Add<hook_OnTriggerExit2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnTriggerExit2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnTriggerEnter OnTriggerEnter
		{
			add
			{
				HookEndpointManager.Add<hook_OnTriggerEnter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnTriggerEnter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnTriggerExit OnTriggerExit
		{
			add
			{
				HookEndpointManager.Add<hook_OnTriggerExit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnTriggerExit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ColliderTriggerFilter ColliderTriggerFilter
		{
			add
			{
				HookEndpointManager.Add<hook_ColliderTriggerFilter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ColliderTriggerFilter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ColliderTriggerFilter2D ColliderTriggerFilter2D
		{
			add
			{
				HookEndpointManager.Add<hook_ColliderTriggerFilter2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ColliderTriggerFilter2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_FindLocalVoiceComm FindLocalVoiceComm
		{
			add
			{
				HookEndpointManager.Add<hook_FindLocalVoiceComm>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_FindLocalVoiceComm>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_CheckVoiceComm CheckVoiceComm
		{
			add
			{
				HookEndpointManager.Add<hook_CheckVoiceComm>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_CheckVoiceComm>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Dissonance
{
	public static class BaseCommsTrigger
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Awake
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Start
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator OnEnable
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Update
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator OnDisable
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator OnDestroy
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_OnDestroy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_OnDestroy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator TokensModified
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_TokensModified>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_TokensModified>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ContainsToken
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_ContainsToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_ContainsToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator AddToken
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_AddToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_AddToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator RemoveToken
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_RemoveToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_RemoveToken>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ColliderTriggerChanged
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_ColliderTriggerChanged>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_ColliderTriggerChanged>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator OnTriggerEnter2D
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_OnTriggerEnter2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_OnTriggerEnter2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator OnTriggerExit2D
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_OnTriggerExit2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_OnTriggerExit2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator OnTriggerEnter
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_OnTriggerEnter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_OnTriggerEnter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator OnTriggerExit
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_OnTriggerExit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_OnTriggerExit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ColliderTriggerFilter
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_ColliderTriggerFilter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_ColliderTriggerFilter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ColliderTriggerFilter2D
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_ColliderTriggerFilter2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_ColliderTriggerFilter2D>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator FindLocalVoiceComm
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_FindLocalVoiceComm>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_FindLocalVoiceComm>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator CheckVoiceComm
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.BaseCommsTrigger.hook_CheckVoiceComm>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.BaseCommsTrigger.hook_CheckVoiceComm>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Dissonance
{
	public static class ChannelProperties
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(ChannelProperties self, object defaultPriority);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, ChannelProperties self, object defaultPriority);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Dissonance
{
	public static class ChannelProperties
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.ChannelProperties.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.ChannelProperties.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Dissonance
{
	public static class PlayerChannel
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(ref PlayerChannel self, ushort subscriptionId, string playerId, PlayerChannels channels, ChannelProperties properties);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, ref PlayerChannel self, ushort subscriptionId, string playerId, PlayerChannels channels, ChannelProperties properties);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Dispose(ref PlayerChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Dispose(orig_Dispose orig, ref PlayerChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_CheckValidProperties(ref PlayerChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_CheckValidProperties(orig_CheckValidProperties orig, ref PlayerChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_Equals_PlayerChannel(ref PlayerChannel self, PlayerChannel other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_Equals_PlayerChannel(orig_Equals_PlayerChannel orig, ref PlayerChannel self, PlayerChannel other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_Equals_object(ref PlayerChannel self, object obj);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_Equals_object(orig_Equals_object orig, ref PlayerChannel self, object obj);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_GetHashCode(ref PlayerChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_GetHashCode(orig_GetHashCode orig, ref PlayerChannel self);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Dispose Dispose
		{
			add
			{
				HookEndpointManager.Add<hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_CheckValidProperties CheckValidProperties
		{
			add
			{
				HookEndpointManager.Add<hook_CheckValidProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_CheckValidProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Equals_PlayerChannel Equals_PlayerChannel
		{
			add
			{
				HookEndpointManager.Add<hook_Equals_PlayerChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Equals_PlayerChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Equals_object Equals_object
		{
			add
			{
				HookEndpointManager.Add<hook_Equals_object>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Equals_object>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public new static event hook_GetHashCode GetHashCode
		{
			add
			{
				HookEndpointManager.Add<hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Dissonance
{
	public static class PlayerChannel
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.PlayerChannel.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.PlayerChannel.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Dispose
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.PlayerChannel.hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.PlayerChannel.hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator CheckValidProperties
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.PlayerChannel.hook_CheckValidProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.PlayerChannel.hook_CheckValidProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Equals_PlayerChannel
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.PlayerChannel.hook_Equals_PlayerChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.PlayerChannel.hook_Equals_PlayerChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Equals_object
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.PlayerChannel.hook_Equals_object>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.PlayerChannel.hook_Equals_object>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public new static event Manipulator GetHashCode
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.PlayerChannel.hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.PlayerChannel.hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Dissonance
{
	public static class PlayerChannels
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(PlayerChannels self, object priorityProvider);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, PlayerChannels self, object priorityProvider);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate PlayerChannel orig_CreateChannel(PlayerChannels self, ushort subscriptionId, string channelId, ChannelProperties properties);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate PlayerChannel hook_CreateChannel(orig_CreateChannel orig, PlayerChannels self, ushort subscriptionId, string channelId, ChannelProperties properties);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_CreateChannel CreateChannel
		{
			add
			{
				HookEndpointManager.Add<hook_CreateChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_CreateChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Dissonance
{
	public static class PlayerChannels
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.PlayerChannels.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.PlayerChannels.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator CreateChannel
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.PlayerChannels.hook_CreateChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.PlayerChannels.hook_CreateChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Dissonance
{
	public static class RemoteChannel
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(ref RemoteChannel self, string targetName, ChannelType type, PlaybackOptions options);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, ref RemoteChannel self, string targetName, ChannelType type, PlaybackOptions options);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Dissonance
{
	public static class RemoteChannel
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.RemoteChannel.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.RemoteChannel.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Dissonance
{
	public static class RoomChannel
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(ref RoomChannel self, ushort subscriptionId, string roomId, RoomChannels channels, ChannelProperties properties);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, ref RoomChannel self, ushort subscriptionId, string roomId, RoomChannels channels, ChannelProperties properties);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Dispose(ref RoomChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Dispose(orig_Dispose orig, ref RoomChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_CheckValidProperties(ref RoomChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_CheckValidProperties(orig_CheckValidProperties orig, ref RoomChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_Equals_RoomChannel(ref RoomChannel self, RoomChannel other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_Equals_RoomChannel(orig_Equals_RoomChannel orig, ref RoomChannel self, RoomChannel other);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_Equals_object(ref RoomChannel self, object obj);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_Equals_object(orig_Equals_object orig, ref RoomChannel self, object obj);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_GetHashCode(ref RoomChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_GetHashCode(orig_GetHashCode orig, ref RoomChannel self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_cctor();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_cctor(orig_cctor orig);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Dispose Dispose
		{
			add
			{
				HookEndpointManager.Add<hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_CheckValidProperties CheckValidProperties
		{
			add
			{
				HookEndpointManager.Add<hook_CheckValidProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_CheckValidProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Equals_RoomChannel Equals_RoomChannel
		{
			add
			{
				HookEndpointManager.Add<hook_Equals_RoomChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Equals_RoomChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Equals_object Equals_object
		{
			add
			{
				HookEndpointManager.Add<hook_Equals_object>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Equals_object>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public new static event hook_GetHashCode GetHashCode
		{
			add
			{
				HookEndpointManager.Add<hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_cctor cctor
		{
			add
			{
				HookEndpointManager.Add<hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Dissonance
{
	public static class RoomChannel
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.RoomChannel.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.RoomChannel.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Dispose
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.RoomChannel.hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.RoomChannel.hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator CheckValidProperties
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.RoomChannel.hook_CheckValidProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.RoomChannel.hook_CheckValidProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Equals_RoomChannel
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.RoomChannel.hook_Equals_RoomChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.RoomChannel.hook_Equals_RoomChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Equals_object
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.RoomChannel.hook_Equals_object>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.RoomChannel.hook_Equals_object>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public new static event Manipulator GetHashCode
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.RoomChannel.hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.RoomChannel.hook_GetHashCode>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator cctor
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.RoomChannel.hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.RoomChannel.hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Dissonance
{
	public static class RoomChannels
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(RoomChannels self, object priorityProvider);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, RoomChannels self, object priorityProvider);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate RoomChannel orig_CreateChannel(RoomChannels self, ushort subscriptionId, string channelId, ChannelProperties properties);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate RoomChannel hook_CreateChannel(orig_CreateChannel orig, RoomChannels self, ushort subscriptionId, string channelId, ChannelProperties properties);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_CreateChannel CreateChannel
		{
			add
			{
				HookEndpointManager.Add<hook_CreateChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_CreateChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Dissonance
{
	public static class RoomChannels
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.RoomChannels.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.RoomChannels.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator CreateChannel
		{
			add
			{
				HookEndpointManager.Modify<On.Dissonance.RoomChannels.hook_CreateChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Dissonance.RoomChannels.hook_CreateChannel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Dissonance
{
	public static class CodecSettings
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(ref CodecSettings self, Codec codec, uint frameSize, int sampleRate);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, ref CodecSettings self, Codec codec, uint frameSize, int sampleRate);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig_ToString(ref CodecSettings self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook_ToString(orig_ToString orig, ref CodecSettings self);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public new static event hook_ToString ToString
		{
			add
			{
				HookEndpointManager.Add<hook_ToString>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ToString>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)

MMHOOK/MMHOOK_Facepunch Transport for Netcode for GameObjects.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.ComponentModel;
using System.Reflection;
using MonoMod.Cil;
using MonoMod.RuntimeDetour.HookGen;
using Netcode.Transports.Facepunch;
using On;
using On.Netcode.Transports.Facepunch;
using On.__GEN;
using Steamworks.Data;
using Unity.Netcode;

[assembly: AssemblyVersion("0.0.0.0")]
namespace On
{
	public static class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType orig_Get();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType hook_Get(orig_Get orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, object self);

		public static event hook_Get Get
		{
			add
			{
				HookEndpointManager.Add<hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL
{
	public static class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
	{
		public static event Manipulator Get
		{
			add
			{
				HookEndpointManager.Modify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_Get>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.UnitySourceGeneratedAssemblyMonoScriptTypes_v1.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Netcode.Transports.Facepunch
{
	public static class FacepunchTransport
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Awake(FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Awake(orig_Awake orig, FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Update(FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Update(orig_Update orig, FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_OnDestroy(FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_OnDestroy(orig_OnDestroy orig, FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_DisconnectLocalClient(FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_DisconnectLocalClient(orig_DisconnectLocalClient orig, FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_DisconnectRemoteClient(FacepunchTransport self, ulong clientId);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_DisconnectRemoteClient(orig_DisconnectRemoteClient orig, FacepunchTransport self, ulong clientId);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ulong orig_GetCurrentRtt(FacepunchTransport self, ulong clientId);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ulong hook_GetCurrentRtt(orig_GetCurrentRtt orig, FacepunchTransport self, ulong clientId);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Initialize(FacepunchTransport self, NetworkManager networkManager);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Initialize(orig_Initialize orig, FacepunchTransport self, NetworkManager networkManager);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate SendType orig_NetworkDeliveryToSendType(FacepunchTransport self, NetworkDelivery delivery);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate SendType hook_NetworkDeliveryToSendType(orig_NetworkDeliveryToSendType orig, FacepunchTransport self, NetworkDelivery delivery);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Shutdown(FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Shutdown(orig_Shutdown orig, FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Send(FacepunchTransport self, ulong clientId, ArraySegment<byte> data, NetworkDelivery delivery);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Send(orig_Send orig, FacepunchTransport self, ulong clientId, ArraySegment<byte> data, NetworkDelivery delivery);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate NetworkEvent orig_PollEvent(FacepunchTransport self, out ulong clientId, out ArraySegment<byte> payload, out float receiveTime);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate NetworkEvent hook_PollEvent(orig_PollEvent orig, FacepunchTransport self, out ulong clientId, out ArraySegment<byte> payload, out float receiveTime);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_StartClient(FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_StartClient(orig_StartClient orig, FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_StartServer(FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_StartServer(orig_StartServer orig, FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_EnsurePayloadCapacity(FacepunchTransport self, int size);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_EnsurePayloadCapacity(orig_EnsurePayloadCapacity orig, FacepunchTransport self, int size);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Steamworks_IConnectionManager_OnConnecting(FacepunchTransport self, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Steamworks_IConnectionManager_OnConnecting(orig_Steamworks_IConnectionManager_OnConnecting orig, FacepunchTransport self, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Steamworks_IConnectionManager_OnConnected(FacepunchTransport self, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Steamworks_IConnectionManager_OnConnected(orig_Steamworks_IConnectionManager_OnConnected orig, FacepunchTransport self, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Steamworks_IConnectionManager_OnDisconnected(FacepunchTransport self, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Steamworks_IConnectionManager_OnDisconnected(orig_Steamworks_IConnectionManager_OnDisconnected orig, FacepunchTransport self, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Steamworks_IConnectionManager_OnMessage(FacepunchTransport self, IntPtr data, int size, long messageNum, long recvTime, int channel);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Steamworks_IConnectionManager_OnMessage(orig_Steamworks_IConnectionManager_OnMessage orig, FacepunchTransport self, IntPtr data, int size, long messageNum, long recvTime, int channel);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Steamworks_ISocketManager_OnConnecting(FacepunchTransport self, Connection connection, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Steamworks_ISocketManager_OnConnecting(orig_Steamworks_ISocketManager_OnConnecting orig, FacepunchTransport self, Connection connection, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Steamworks_ISocketManager_OnConnected(FacepunchTransport self, Connection connection, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Steamworks_ISocketManager_OnConnected(orig_Steamworks_ISocketManager_OnConnected orig, FacepunchTransport self, Connection connection, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Steamworks_ISocketManager_OnDisconnected(FacepunchTransport self, Connection connection, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Steamworks_ISocketManager_OnDisconnected(orig_Steamworks_ISocketManager_OnDisconnected orig, FacepunchTransport self, Connection connection, ConnectionInfo info);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Steamworks_ISocketManager_OnMessage(FacepunchTransport self, Connection connection, NetIdentity identity, IntPtr data, int size, long messageNum, long recvTime, int channel);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Steamworks_ISocketManager_OnMessage(orig_Steamworks_ISocketManager_OnMessage orig, FacepunchTransport self, Connection connection, NetIdentity identity, IntPtr data, int size, long messageNum, long recvTime, int channel);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IEnumerator orig_InitSteamworks(FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IEnumerator hook_InitSteamworks(orig_InitSteamworks orig, FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(FacepunchTransport self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, FacepunchTransport self);

		public static class Client
		{
			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_ctor(object self);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_ctor(orig_ctor orig, object self);

			public static event hook_ctor ctor
			{
				add
				{
					HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}
		}

		public static event hook_Awake Awake
		{
			add
			{
				HookEndpointManager.Add<hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Update Update
		{
			add
			{
				HookEndpointManager.Add<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_OnDestroy OnDestroy
		{
			add
			{
				HookEndpointManager.Add<hook_OnDestroy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_OnDestroy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_DisconnectLocalClient DisconnectLocalClient
		{
			add
			{
				HookEndpointManager.Add<hook_DisconnectLocalClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_DisconnectLocalClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_DisconnectRemoteClient DisconnectRemoteClient
		{
			add
			{
				HookEndpointManager.Add<hook_DisconnectRemoteClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_DisconnectRemoteClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetCurrentRtt GetCurrentRtt
		{
			add
			{
				HookEndpointManager.Add<hook_GetCurrentRtt>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetCurrentRtt>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Initialize Initialize
		{
			add
			{
				HookEndpointManager.Add<hook_Initialize>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Initialize>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_NetworkDeliveryToSendType NetworkDeliveryToSendType
		{
			add
			{
				HookEndpointManager.Add<hook_NetworkDeliveryToSendType>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_NetworkDeliveryToSendType>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Shutdown Shutdown
		{
			add
			{
				HookEndpointManager.Add<hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Send Send
		{
			add
			{
				HookEndpointManager.Add<hook_Send>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Send>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_PollEvent PollEvent
		{
			add
			{
				HookEndpointManager.Add<hook_PollEvent>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_PollEvent>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartClient StartClient
		{
			add
			{
				HookEndpointManager.Add<hook_StartClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_StartServer StartServer
		{
			add
			{
				HookEndpointManager.Add<hook_StartServer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_StartServer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_EnsurePayloadCapacity EnsurePayloadCapacity
		{
			add
			{
				HookEndpointManager.Add<hook_EnsurePayloadCapacity>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_EnsurePayloadCapacity>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Steamworks_IConnectionManager_OnConnecting Steamworks_IConnectionManager_OnConnecting
		{
			add
			{
				HookEndpointManager.Add<hook_Steamworks_IConnectionManager_OnConnecting>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Steamworks_IConnectionManager_OnConnecting>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Steamworks_IConnectionManager_OnConnected Steamworks_IConnectionManager_OnConnected
		{
			add
			{
				HookEndpointManager.Add<hook_Steamworks_IConnectionManager_OnConnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Steamworks_IConnectionManager_OnConnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Steamworks_IConnectionManager_OnDisconnected Steamworks_IConnectionManager_OnDisconnected
		{
			add
			{
				HookEndpointManager.Add<hook_Steamworks_IConnectionManager_OnDisconnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Steamworks_IConnectionManager_OnDisconnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Steamworks_IConnectionManager_OnMessage Steamworks_IConnectionManager_OnMessage
		{
			add
			{
				HookEndpointManager.Add<hook_Steamworks_IConnectionManager_OnMessage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Steamworks_IConnectionManager_OnMessage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Steamworks_ISocketManager_OnConnecting Steamworks_ISocketManager_OnConnecting
		{
			add
			{
				HookEndpointManager.Add<hook_Steamworks_ISocketManager_OnConnecting>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Steamworks_ISocketManager_OnConnecting>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Steamworks_ISocketManager_OnConnected Steamworks_ISocketManager_OnConnected
		{
			add
			{
				HookEndpointManager.Add<hook_Steamworks_ISocketManager_OnConnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Steamworks_ISocketManager_OnConnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Steamworks_ISocketManager_OnDisconnected Steamworks_ISocketManager_OnDisconnected
		{
			add
			{
				HookEndpointManager.Add<hook_Steamworks_ISocketManager_OnDisconnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Steamworks_ISocketManager_OnDisconnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Steamworks_ISocketManager_OnMessage Steamworks_ISocketManager_OnMessage
		{
			add
			{
				HookEndpointManager.Add<hook_Steamworks_ISocketManager_OnMessage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Steamworks_ISocketManager_OnMessage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_InitSteamworks InitSteamworks
		{
			add
			{
				HookEndpointManager.Add<hook_InitSteamworks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_InitSteamworks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Netcode.Transports.Facepunch
{
	public static class FacepunchTransport
	{
		public static class Client
		{
			public static event Manipulator ctor
			{
				add
				{
					HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.Client.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.Client.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}
		}

		public static event Manipulator Awake
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Awake>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Update
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator OnDestroy
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_OnDestroy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_OnDestroy>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator DisconnectLocalClient
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_DisconnectLocalClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_DisconnectLocalClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator DisconnectRemoteClient
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_DisconnectRemoteClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_DisconnectRemoteClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator GetCurrentRtt
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_GetCurrentRtt>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_GetCurrentRtt>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Initialize
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Initialize>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Initialize>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator NetworkDeliveryToSendType
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_NetworkDeliveryToSendType>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_NetworkDeliveryToSendType>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Shutdown
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Send
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Send>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Send>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator PollEvent
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_PollEvent>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_PollEvent>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator StartClient
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_StartClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_StartClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator StartServer
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_StartServer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_StartServer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator EnsurePayloadCapacity
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_EnsurePayloadCapacity>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_EnsurePayloadCapacity>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Steamworks_IConnectionManager_OnConnecting
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_IConnectionManager_OnConnecting>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_IConnectionManager_OnConnecting>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Steamworks_IConnectionManager_OnConnected
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_IConnectionManager_OnConnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_IConnectionManager_OnConnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Steamworks_IConnectionManager_OnDisconnected
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_IConnectionManager_OnDisconnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_IConnectionManager_OnDisconnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Steamworks_IConnectionManager_OnMessage
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_IConnectionManager_OnMessage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_IConnectionManager_OnMessage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Steamworks_ISocketManager_OnConnecting
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_ISocketManager_OnConnecting>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_ISocketManager_OnConnecting>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Steamworks_ISocketManager_OnConnected
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_ISocketManager_OnConnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_ISocketManager_OnConnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Steamworks_ISocketManager_OnDisconnected
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_ISocketManager_OnDisconnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_ISocketManager_OnDisconnected>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Steamworks_ISocketManager_OnMessage
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_ISocketManager_OnMessage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_Steamworks_ISocketManager_OnMessage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator InitSteamworks
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_InitSteamworks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_InitSteamworks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.FacepunchTransport.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Netcode.Transports.Facepunch
{
	public static class ReadOnlyAttribute
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(ReadOnlyAttribute self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, ReadOnlyAttribute self);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Netcode.Transports.Facepunch
{
	public static class ReadOnlyAttribute
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Netcode.Transports.Facepunch.ReadOnlyAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Netcode.Transports.Facepunch.ReadOnlyAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.__GEN
{
	public static class NetworkVariableSerializationHelper
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_InitializeSerialization();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_InitializeSerialization(orig_InitializeSerialization orig);

		public static event hook_InitializeSerialization InitializeSerialization
		{
			add
			{
				HookEndpointManager.Add<hook_InitializeSerialization>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_InitializeSerialization>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.__GEN
{
	public static class NetworkVariableSerializationHelper
	{
		public static event Manipulator InitializeSerialization
		{
			add
			{
				HookEndpointManager.Modify<On.__GEN.NetworkVariableSerializationHelper.hook_InitializeSerialization>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.__GEN.NetworkVariableSerializationHelper.hook_InitializeSerialization>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace BepHookGen
{
	public class size14848
	{
	}
}

MMHOOK/MMHOOK_Facepunch.Steamworks.Win64.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using MonoMod.Cil;
using MonoMod.RuntimeDetour.HookGen;
using On.Microsoft.CodeAnalysis;
using On.Steamworks;
using On.Steamworks.Data;
using On.Steamworks.ServerList;
using On.Steamworks.Ugc;
using On.System.Runtime.CompilerServices;
using Steamworks;
using Steamworks.Data;
using Steamworks.ServerList;
using Steamworks.Ugc;

[assembly: AssemblyVersion("0.0.0.0")]
namespace On.Microsoft.CodeAnalysis
{
	public static class EmbeddedAttribute
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(Attribute self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, Attribute self);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Microsoft.CodeAnalysis
{
	public static class EmbeddedAttribute
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Microsoft.CodeAnalysis.EmbeddedAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Microsoft.CodeAnalysis.EmbeddedAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.System.Runtime.CompilerServices
{
	public static class IsReadOnlyAttribute
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(Attribute self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, Attribute self);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.System.Runtime.CompilerServices
{
	public static class IsReadOnlyAttribute
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.System.Runtime.CompilerServices.IsReadOnlyAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.System.Runtime.CompilerServices.IsReadOnlyAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Steamworks
{
	public static class AuthTicket
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Cancel(AuthTicket self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Cancel(orig_Cancel orig, AuthTicket self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Dispose(AuthTicket self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Dispose(orig_Dispose orig, AuthTicket self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(AuthTicket self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, AuthTicket self);

		public static event hook_Cancel Cancel
		{
			add
			{
				HookEndpointManager.Add<hook_Cancel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Cancel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Dispose Dispose
		{
			add
			{
				HookEndpointManager.Add<hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Steamworks
{
	public static class AuthTicket
	{
		public static event Manipulator Cancel
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.AuthTicket.hook_Cancel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.AuthTicket.hook_Cancel>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Dispose
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.AuthTicket.hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.AuthTicket.hook_Dispose>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.AuthTicket.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.AuthTicket.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Steamworks
{
	public static class Dispatch
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SteamAPI_ManualDispatch_Init();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SteamAPI_ManualDispatch_Init(orig_SteamAPI_ManualDispatch_Init orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_SteamAPI_ManualDispatch_RunFrame(ValueType pipe);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_SteamAPI_ManualDispatch_RunFrame(orig_SteamAPI_ManualDispatch_RunFrame orig, ValueType pipe);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_SteamAPI_ManualDispatch_GetNextCallback(ValueType pipe, [In][Out] ValueType msg);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_SteamAPI_ManualDispatch_GetNextCallback(orig_SteamAPI_ManualDispatch_GetNextCallback orig, ValueType pipe, [In][Out] ValueType msg);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_SteamAPI_ManualDispatch_FreeLastCallback(ValueType pipe);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_SteamAPI_ManualDispatch_FreeLastCallback(orig_SteamAPI_ManualDispatch_FreeLastCallback orig, ValueType pipe);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Init();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Init(orig_Init orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Frame(ValueType pipe);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Frame(orig_Frame orig, ValueType pipe);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ProcessCallback(ValueType msg, bool isServer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ProcessCallback(orig_ProcessCallback orig, ValueType msg, bool isServer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig_CallbackToString(CallbackType type, IntPtr data, int expectedsize);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook_CallbackToString(orig_CallbackToString orig, CallbackType type, IntPtr data, int expectedsize);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ProcessResult(ValueType msg);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ProcessResult(orig_ProcessResult orig, ValueType msg);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_LoopClientAsync();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_LoopClientAsync(orig_LoopClientAsync orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_LoopServerAsync();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_LoopServerAsync(orig_LoopServerAsync orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ShutdownServer();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ShutdownServer(orig_ShutdownServer orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ShutdownClient();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ShutdownClient(orig_ShutdownClient orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_cctor();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_cctor(orig_cctor orig);

		public static event hook_SteamAPI_ManualDispatch_Init SteamAPI_ManualDispatch_Init
		{
			add
			{
				HookEndpointManager.Add<hook_SteamAPI_ManualDispatch_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SteamAPI_ManualDispatch_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SteamAPI_ManualDispatch_RunFrame SteamAPI_ManualDispatch_RunFrame
		{
			add
			{
				HookEndpointManager.Add<hook_SteamAPI_ManualDispatch_RunFrame>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SteamAPI_ManualDispatch_RunFrame>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SteamAPI_ManualDispatch_GetNextCallback SteamAPI_ManualDispatch_GetNextCallback
		{
			add
			{
				HookEndpointManager.Add<hook_SteamAPI_ManualDispatch_GetNextCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SteamAPI_ManualDispatch_GetNextCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SteamAPI_ManualDispatch_FreeLastCallback SteamAPI_ManualDispatch_FreeLastCallback
		{
			add
			{
				HookEndpointManager.Add<hook_SteamAPI_ManualDispatch_FreeLastCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SteamAPI_ManualDispatch_FreeLastCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Init Init
		{
			add
			{
				HookEndpointManager.Add<hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Frame Frame
		{
			add
			{
				HookEndpointManager.Add<hook_Frame>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Frame>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ProcessCallback ProcessCallback
		{
			add
			{
				HookEndpointManager.Add<hook_ProcessCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ProcessCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_CallbackToString CallbackToString
		{
			add
			{
				HookEndpointManager.Add<hook_CallbackToString>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_CallbackToString>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ProcessResult ProcessResult
		{
			add
			{
				HookEndpointManager.Add<hook_ProcessResult>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ProcessResult>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_LoopClientAsync LoopClientAsync
		{
			add
			{
				HookEndpointManager.Add<hook_LoopClientAsync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_LoopClientAsync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_LoopServerAsync LoopServerAsync
		{
			add
			{
				HookEndpointManager.Add<hook_LoopServerAsync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_LoopServerAsync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ShutdownServer ShutdownServer
		{
			add
			{
				HookEndpointManager.Add<hook_ShutdownServer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ShutdownServer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_ShutdownClient ShutdownClient
		{
			add
			{
				HookEndpointManager.Add<hook_ShutdownClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ShutdownClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_cctor cctor
		{
			add
			{
				HookEndpointManager.Add<hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Steamworks
{
	public static class Dispatch
	{
		public static event Manipulator SteamAPI_ManualDispatch_Init
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_SteamAPI_ManualDispatch_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_SteamAPI_ManualDispatch_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SteamAPI_ManualDispatch_RunFrame
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_SteamAPI_ManualDispatch_RunFrame>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_SteamAPI_ManualDispatch_RunFrame>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SteamAPI_ManualDispatch_GetNextCallback
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_SteamAPI_ManualDispatch_GetNextCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_SteamAPI_ManualDispatch_GetNextCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SteamAPI_ManualDispatch_FreeLastCallback
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_SteamAPI_ManualDispatch_FreeLastCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_SteamAPI_ManualDispatch_FreeLastCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Init
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Frame
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_Frame>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_Frame>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ProcessCallback
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_ProcessCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_ProcessCallback>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator CallbackToString
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_CallbackToString>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_CallbackToString>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ProcessResult
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_ProcessResult>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_ProcessResult>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator LoopClientAsync
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_LoopClientAsync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_LoopClientAsync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator LoopServerAsync
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_LoopServerAsync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_LoopServerAsync>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ShutdownServer
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_ShutdownServer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_ShutdownServer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator ShutdownClient
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_ShutdownClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_ShutdownClient>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator cctor
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.Dispatch.hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.Dispatch.hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Steamworks
{
	public static class SteamAPI
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_Init();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_Init(orig_Init orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Shutdown();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Shutdown(orig_Shutdown orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType orig_GetHSteamPipe();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType hook_GetHSteamPipe(orig_GetHSteamPipe orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_RestartAppIfNecessary(uint unOwnAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_RestartAppIfNecessary(orig_RestartAppIfNecessary orig, uint unOwnAppID);

		public static class Native
		{
			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool orig_SteamAPI_Init();

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool hook_SteamAPI_Init(orig_SteamAPI_Init orig);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_SteamAPI_Shutdown();

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_SteamAPI_Shutdown(orig_SteamAPI_Shutdown orig);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate ValueType orig_SteamAPI_GetHSteamPipe();

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate ValueType hook_SteamAPI_GetHSteamPipe(orig_SteamAPI_GetHSteamPipe orig);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool orig_SteamAPI_RestartAppIfNecessary(uint unOwnAppID);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool hook_SteamAPI_RestartAppIfNecessary(orig_SteamAPI_RestartAppIfNecessary orig, uint unOwnAppID);

			public static event hook_SteamAPI_Init SteamAPI_Init
			{
				add
				{
					HookEndpointManager.Add<hook_SteamAPI_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_SteamAPI_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}

			public static event hook_SteamAPI_Shutdown SteamAPI_Shutdown
			{
				add
				{
					HookEndpointManager.Add<hook_SteamAPI_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_SteamAPI_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}

			public static event hook_SteamAPI_GetHSteamPipe SteamAPI_GetHSteamPipe
			{
				add
				{
					HookEndpointManager.Add<hook_SteamAPI_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_SteamAPI_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}

			public static event hook_SteamAPI_RestartAppIfNecessary SteamAPI_RestartAppIfNecessary
			{
				add
				{
					HookEndpointManager.Add<hook_SteamAPI_RestartAppIfNecessary>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_SteamAPI_RestartAppIfNecessary>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}
		}

		public static event hook_Init Init
		{
			add
			{
				HookEndpointManager.Add<hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Shutdown Shutdown
		{
			add
			{
				HookEndpointManager.Add<hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetHSteamPipe GetHSteamPipe
		{
			add
			{
				HookEndpointManager.Add<hook_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_RestartAppIfNecessary RestartAppIfNecessary
		{
			add
			{
				HookEndpointManager.Add<hook_RestartAppIfNecessary>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_RestartAppIfNecessary>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Steamworks
{
	public static class SteamAPI
	{
		public static class Native
		{
			public static event Manipulator SteamAPI_Init
			{
				add
				{
					HookEndpointManager.Modify<On.Steamworks.SteamAPI.Native.hook_SteamAPI_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.Steamworks.SteamAPI.Native.hook_SteamAPI_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}

			public static event Manipulator SteamAPI_Shutdown
			{
				add
				{
					HookEndpointManager.Modify<On.Steamworks.SteamAPI.Native.hook_SteamAPI_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.Steamworks.SteamAPI.Native.hook_SteamAPI_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}

			public static event Manipulator SteamAPI_GetHSteamPipe
			{
				add
				{
					HookEndpointManager.Modify<On.Steamworks.SteamAPI.Native.hook_SteamAPI_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.Steamworks.SteamAPI.Native.hook_SteamAPI_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}

			public static event Manipulator SteamAPI_RestartAppIfNecessary
			{
				add
				{
					HookEndpointManager.Modify<On.Steamworks.SteamAPI.Native.hook_SteamAPI_RestartAppIfNecessary>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.Steamworks.SteamAPI.Native.hook_SteamAPI_RestartAppIfNecessary>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}
		}

		public static event Manipulator Init
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.SteamAPI.hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.SteamAPI.hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Shutdown
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.SteamAPI.hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.SteamAPI.hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator GetHSteamPipe
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.SteamAPI.hook_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.SteamAPI.hook_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator RestartAppIfNecessary
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.SteamAPI.hook_RestartAppIfNecessary>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.SteamAPI.hook_RestartAppIfNecessary>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Steamworks
{
	public static class SteamGameServer
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_RunCallbacks();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_RunCallbacks(orig_RunCallbacks orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_Shutdown();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_Shutdown(orig_Shutdown orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType orig_GetHSteamPipe();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType hook_GetHSteamPipe(orig_GetHSteamPipe orig);

		public static class Native
		{
			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_SteamGameServer_RunCallbacks();

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_SteamGameServer_RunCallbacks(orig_SteamGameServer_RunCallbacks orig);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void orig_SteamGameServer_Shutdown();

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate void hook_SteamGameServer_Shutdown(orig_SteamGameServer_Shutdown orig);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate ValueType orig_SteamGameServer_GetHSteamPipe();

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate ValueType hook_SteamGameServer_GetHSteamPipe(orig_SteamGameServer_GetHSteamPipe orig);

			public static event hook_SteamGameServer_RunCallbacks SteamGameServer_RunCallbacks
			{
				add
				{
					HookEndpointManager.Add<hook_SteamGameServer_RunCallbacks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_SteamGameServer_RunCallbacks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}

			public static event hook_SteamGameServer_Shutdown SteamGameServer_Shutdown
			{
				add
				{
					HookEndpointManager.Add<hook_SteamGameServer_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_SteamGameServer_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}

			public static event hook_SteamGameServer_GetHSteamPipe SteamGameServer_GetHSteamPipe
			{
				add
				{
					HookEndpointManager.Add<hook_SteamGameServer_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_SteamGameServer_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}
		}

		public static event hook_RunCallbacks RunCallbacks
		{
			add
			{
				HookEndpointManager.Add<hook_RunCallbacks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_RunCallbacks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_Shutdown Shutdown
		{
			add
			{
				HookEndpointManager.Add<hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetHSteamPipe GetHSteamPipe
		{
			add
			{
				HookEndpointManager.Add<hook_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Steamworks
{
	public static class SteamGameServer
	{
		public static class Native
		{
			public static event Manipulator SteamGameServer_RunCallbacks
			{
				add
				{
					HookEndpointManager.Modify<On.Steamworks.SteamGameServer.Native.hook_SteamGameServer_RunCallbacks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.Steamworks.SteamGameServer.Native.hook_SteamGameServer_RunCallbacks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}

			public static event Manipulator SteamGameServer_Shutdown
			{
				add
				{
					HookEndpointManager.Modify<On.Steamworks.SteamGameServer.Native.hook_SteamGameServer_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.Steamworks.SteamGameServer.Native.hook_SteamGameServer_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}

			public static event Manipulator SteamGameServer_GetHSteamPipe
			{
				add
				{
					HookEndpointManager.Modify<On.Steamworks.SteamGameServer.Native.hook_SteamGameServer_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.Steamworks.SteamGameServer.Native.hook_SteamGameServer_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}
		}

		public static event Manipulator RunCallbacks
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.SteamGameServer.hook_RunCallbacks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.SteamGameServer.hook_RunCallbacks>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator Shutdown
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.SteamGameServer.hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.SteamGameServer.hook_Shutdown>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator GetHSteamPipe
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.SteamGameServer.hook_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.SteamGameServer.hook_GetHSteamPipe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Steamworks
{
	public static class SteamInternal
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_GameServer_Init(uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, string pchVersionString);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_GameServer_Init(orig_GameServer_Init orig, uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, string pchVersionString);

		public static class Native
		{
			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool orig_SteamInternal_GameServer_Init(uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, string pchVersionString);

			[EditorBrowsable(EditorBrowsableState.Never)]
			public delegate bool hook_SteamInternal_GameServer_Init(orig_SteamInternal_GameServer_Init orig, uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, string pchVersionString);

			public static event hook_SteamInternal_GameServer_Init SteamInternal_GameServer_Init
			{
				add
				{
					HookEndpointManager.Add<hook_SteamInternal_GameServer_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
				remove
				{
					HookEndpointManager.Remove<hook_SteamInternal_GameServer_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
				}
			}
		}

		public static event hook_GameServer_Init GameServer_Init
		{
			add
			{
				HookEndpointManager.Add<hook_GameServer_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GameServer_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Steamworks
{
	public static class SteamInternal
	{
		public static class Native
		{
			public static event Manipulator SteamInternal_GameServer_Init
			{
				add
				{
					HookEndpointManager.Modify<On.Steamworks.SteamInternal.Native.hook_SteamInternal_GameServer_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
				remove
				{
					HookEndpointManager.Unmodify<On.Steamworks.SteamInternal.Native.hook_SteamInternal_GameServer_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
				}
			}
		}

		public static event Manipulator GameServer_Init
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.SteamInternal.hook_GameServer_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.SteamInternal.hook_GameServer_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Steamworks
{
	public static class CallbackTypeFactory
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_cctor();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_cctor(orig_cctor orig);

		public static event hook_cctor cctor
		{
			add
			{
				HookEndpointManager.Add<hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Steamworks
{
	public static class CallbackTypeFactory
	{
		public static event Manipulator cctor
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.CallbackTypeFactory.hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.CallbackTypeFactory.hook_cctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Steamworks
{
	public static class ISteamAppList
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(object self, bool IsGameServer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, object self, bool IsGameServer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr orig_SteamAPI_SteamAppList_v001();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr hook_SteamAPI_SteamAppList_v001(orig_SteamAPI_SteamAppList_v001 orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr orig_GetUserInterfacePointer(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr hook_GetUserInterfacePointer(orig_GetUserInterfacePointer orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint orig__GetNumInstalledApps(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint hook__GetNumInstalledApps(orig__GetNumInstalledApps orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint orig_GetNumInstalledApps(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint hook_GetNumInstalledApps(orig_GetNumInstalledApps orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint orig__GetInstalledApps(IntPtr self, [In][Out] AppId[] pvecAppID, uint unMaxAppIDs);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint hook__GetInstalledApps(orig__GetInstalledApps orig, IntPtr self, [In][Out] AppId[] pvecAppID, uint unMaxAppIDs);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint orig_GetInstalledApps(object self, [In][Out] AppId[] pvecAppID, uint unMaxAppIDs);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint hook_GetInstalledApps(orig_GetInstalledApps orig, object self, [In][Out] AppId[] pvecAppID, uint unMaxAppIDs);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig__GetAppName(IntPtr self, AppId nAppID, IntPtr pchName, int cchNameMax);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook__GetAppName(orig__GetAppName orig, IntPtr self, AppId nAppID, IntPtr pchName, int cchNameMax);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_GetAppName(object self, AppId nAppID, out string pchName);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_GetAppName(orig_GetAppName orig, object self, AppId nAppID, out string pchName);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig__GetAppInstallDir(IntPtr self, AppId nAppID, IntPtr pchDirectory, int cchNameMax);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook__GetAppInstallDir(orig__GetAppInstallDir orig, IntPtr self, AppId nAppID, IntPtr pchDirectory, int cchNameMax);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_GetAppInstallDir(object self, AppId nAppID, out string pchDirectory);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_GetAppInstallDir(orig_GetAppInstallDir orig, object self, AppId nAppID, out string pchDirectory);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig__GetAppBuildId(IntPtr self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook__GetAppBuildId(orig__GetAppBuildId orig, IntPtr self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_GetAppBuildId(object self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_GetAppBuildId(orig_GetAppBuildId orig, object self, AppId nAppID);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SteamAPI_SteamAppList_v001 SteamAPI_SteamAppList_v001
		{
			add
			{
				HookEndpointManager.Add<hook_SteamAPI_SteamAppList_v001>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SteamAPI_SteamAppList_v001>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetUserInterfacePointer GetUserInterfacePointer
		{
			add
			{
				HookEndpointManager.Add<hook_GetUserInterfacePointer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetUserInterfacePointer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetNumInstalledApps _GetNumInstalledApps
		{
			add
			{
				HookEndpointManager.Add<hook__GetNumInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetNumInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetNumInstalledApps GetNumInstalledApps
		{
			add
			{
				HookEndpointManager.Add<hook_GetNumInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetNumInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetInstalledApps _GetInstalledApps
		{
			add
			{
				HookEndpointManager.Add<hook__GetInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetInstalledApps GetInstalledApps
		{
			add
			{
				HookEndpointManager.Add<hook_GetInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetAppName _GetAppName
		{
			add
			{
				HookEndpointManager.Add<hook__GetAppName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetAppName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetAppName GetAppName
		{
			add
			{
				HookEndpointManager.Add<hook_GetAppName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetAppName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetAppInstallDir _GetAppInstallDir
		{
			add
			{
				HookEndpointManager.Add<hook__GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetAppInstallDir GetAppInstallDir
		{
			add
			{
				HookEndpointManager.Add<hook_GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetAppBuildId _GetAppBuildId
		{
			add
			{
				HookEndpointManager.Add<hook__GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetAppBuildId GetAppBuildId
		{
			add
			{
				HookEndpointManager.Add<hook_GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}
	}
}
namespace IL.Steamworks
{
	public static class ISteamAppList
	{
		public static event Manipulator ctor
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator SteamAPI_SteamAppList_v001
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook_SteamAPI_SteamAppList_v001>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook_SteamAPI_SteamAppList_v001>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator GetUserInterfacePointer
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook_GetUserInterfacePointer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook_GetUserInterfacePointer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator _GetNumInstalledApps
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook__GetNumInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook__GetNumInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator GetNumInstalledApps
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook_GetNumInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook_GetNumInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator _GetInstalledApps
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook__GetInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook__GetInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator GetInstalledApps
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook_GetInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook_GetInstalledApps>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator _GetAppName
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook__GetAppName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook__GetAppName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator GetAppName
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook_GetAppName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook_GetAppName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator _GetAppInstallDir
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook__GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook__GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator GetAppInstallDir
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook_GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook_GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator _GetAppBuildId
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook__GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook__GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}

		public static event Manipulator GetAppBuildId
		{
			add
			{
				HookEndpointManager.Modify<On.Steamworks.ISteamAppList.hook_GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
			remove
			{
				HookEndpointManager.Unmodify<On.Steamworks.ISteamAppList.hook_GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value);
			}
		}
	}
}
namespace On.Steamworks
{
	public static class ISteamApps
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_ctor(object self, bool IsGameServer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_ctor(orig_ctor orig, object self, bool IsGameServer);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr orig_SteamAPI_SteamApps_v008();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr hook_SteamAPI_SteamApps_v008(orig_SteamAPI_SteamApps_v008 orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr orig_GetUserInterfacePointer(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr hook_GetUserInterfacePointer(orig_GetUserInterfacePointer orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr orig_SteamAPI_SteamGameServerApps_v008();

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr hook_SteamAPI_SteamGameServerApps_v008(orig_SteamAPI_SteamGameServerApps_v008 orig);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr orig_GetServerInterfacePointer(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate IntPtr hook_GetServerInterfacePointer(orig_GetServerInterfacePointer orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__BIsSubscribed(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__BIsSubscribed(orig__BIsSubscribed orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_BIsSubscribed(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_BIsSubscribed(orig_BIsSubscribed orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__BIsLowViolence(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__BIsLowViolence(orig__BIsLowViolence orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_BIsLowViolence(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_BIsLowViolence(orig_BIsLowViolence orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__BIsCybercafe(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__BIsCybercafe(orig__BIsCybercafe orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_BIsCybercafe(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_BIsCybercafe(orig_BIsCybercafe orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__BIsVACBanned(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__BIsVACBanned(orig__BIsVACBanned orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_BIsVACBanned(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_BIsVACBanned(orig_BIsVACBanned orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType orig__GetCurrentGameLanguage(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType hook__GetCurrentGameLanguage(orig__GetCurrentGameLanguage orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig_GetCurrentGameLanguage(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook_GetCurrentGameLanguage(orig_GetCurrentGameLanguage orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType orig__GetAvailableGameLanguages(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType hook__GetAvailableGameLanguages(orig__GetAvailableGameLanguages orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig_GetAvailableGameLanguages(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook_GetAvailableGameLanguages(orig_GetAvailableGameLanguages orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__BIsSubscribedApp(IntPtr self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__BIsSubscribedApp(orig__BIsSubscribedApp orig, IntPtr self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_BIsSubscribedApp(object self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_BIsSubscribedApp(orig_BIsSubscribedApp orig, object self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__BIsDlcInstalled(IntPtr self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__BIsDlcInstalled(orig__BIsDlcInstalled orig, IntPtr self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_BIsDlcInstalled(object self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_BIsDlcInstalled(orig_BIsDlcInstalled orig, object self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint orig__GetEarliestPurchaseUnixTime(IntPtr self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint hook__GetEarliestPurchaseUnixTime(orig__GetEarliestPurchaseUnixTime orig, IntPtr self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint orig_GetEarliestPurchaseUnixTime(object self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint hook_GetEarliestPurchaseUnixTime(orig_GetEarliestPurchaseUnixTime orig, object self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__BIsSubscribedFromFreeWeekend(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__BIsSubscribedFromFreeWeekend(orig__BIsSubscribedFromFreeWeekend orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_BIsSubscribedFromFreeWeekend(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_BIsSubscribedFromFreeWeekend(orig_BIsSubscribedFromFreeWeekend orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig__GetDLCCount(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook__GetDLCCount(orig__GetDLCCount orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_GetDLCCount(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_GetDLCCount(orig_GetDLCCount orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__BGetDLCDataByIndex(IntPtr self, int iDLC, ref AppId pAppID, ref bool pbAvailable, IntPtr pchName, int cchNameBufferSize);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__BGetDLCDataByIndex(orig__BGetDLCDataByIndex orig, IntPtr self, int iDLC, ref AppId pAppID, ref bool pbAvailable, IntPtr pchName, int cchNameBufferSize);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_BGetDLCDataByIndex(object self, int iDLC, ref AppId pAppID, ref bool pbAvailable, out string pchName);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_BGetDLCDataByIndex(orig_BGetDLCDataByIndex orig, object self, int iDLC, ref AppId pAppID, ref bool pbAvailable, out string pchName);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig__InstallDLC(IntPtr self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook__InstallDLC(orig__InstallDLC orig, IntPtr self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_InstallDLC(object self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_InstallDLC(orig_InstallDLC orig, object self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig__UninstallDLC(IntPtr self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook__UninstallDLC(orig__UninstallDLC orig, IntPtr self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_UninstallDLC(object self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_UninstallDLC(orig_UninstallDLC orig, object self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig__RequestAppProofOfPurchaseKey(IntPtr self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook__RequestAppProofOfPurchaseKey(orig__RequestAppProofOfPurchaseKey orig, IntPtr self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_RequestAppProofOfPurchaseKey(object self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_RequestAppProofOfPurchaseKey(orig_RequestAppProofOfPurchaseKey orig, object self, AppId nAppID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__GetCurrentBetaName(IntPtr self, IntPtr pchName, int cchNameBufferSize);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__GetCurrentBetaName(orig__GetCurrentBetaName orig, IntPtr self, IntPtr pchName, int cchNameBufferSize);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_GetCurrentBetaName(object self, out string pchName);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_GetCurrentBetaName(orig_GetCurrentBetaName orig, object self, out string pchName);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__MarkContentCorrupt(IntPtr self, bool bMissingFilesOnly);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__MarkContentCorrupt(orig__MarkContentCorrupt orig, IntPtr self, bool bMissingFilesOnly);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_MarkContentCorrupt(object self, bool bMissingFilesOnly);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_MarkContentCorrupt(orig_MarkContentCorrupt orig, object self, bool bMissingFilesOnly);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint orig__GetInstalledDepots(IntPtr self, AppId appID, [In][Out] ValueType pvecDepots, uint cMaxDepots);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint hook__GetInstalledDepots(orig__GetInstalledDepots orig, IntPtr self, AppId appID, [In][Out] ValueType pvecDepots, uint cMaxDepots);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint orig_GetInstalledDepots(object self, AppId appID, [In][Out] ValueType pvecDepots, uint cMaxDepots);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint hook_GetInstalledDepots(orig_GetInstalledDepots orig, object self, AppId appID, [In][Out] ValueType pvecDepots, uint cMaxDepots);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint orig__GetAppInstallDir(IntPtr self, AppId appID, IntPtr pchFolder, uint cchFolderBufferSize);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint hook__GetAppInstallDir(orig__GetAppInstallDir orig, IntPtr self, AppId appID, IntPtr pchFolder, uint cchFolderBufferSize);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint orig_GetAppInstallDir(object self, AppId appID, out string pchFolder);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate uint hook_GetAppInstallDir(orig_GetAppInstallDir orig, object self, AppId appID, out string pchFolder);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__BIsAppInstalled(IntPtr self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__BIsAppInstalled(orig__BIsAppInstalled orig, IntPtr self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_BIsAppInstalled(object self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_BIsAppInstalled(orig_BIsAppInstalled orig, object self, AppId appID);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate SteamId orig__GetAppOwner(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate SteamId hook__GetAppOwner(orig__GetAppOwner orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate SteamId orig_GetAppOwner(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate SteamId hook_GetAppOwner(orig_GetAppOwner orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType orig__GetLaunchQueryParam(IntPtr self, string pchKey);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType hook__GetLaunchQueryParam(orig__GetLaunchQueryParam orig, IntPtr self, string pchKey);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string orig_GetLaunchQueryParam(object self, string pchKey);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate string hook_GetLaunchQueryParam(orig_GetLaunchQueryParam orig, object self, string pchKey);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__GetDlcDownloadProgress(IntPtr self, AppId nAppID, ref ulong punBytesDownloaded, ref ulong punBytesTotal);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__GetDlcDownloadProgress(orig__GetDlcDownloadProgress orig, IntPtr self, AppId nAppID, ref ulong punBytesDownloaded, ref ulong punBytesTotal);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_GetDlcDownloadProgress(object self, AppId nAppID, ref ulong punBytesDownloaded, ref ulong punBytesTotal);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_GetDlcDownloadProgress(orig_GetDlcDownloadProgress orig, object self, AppId nAppID, ref ulong punBytesDownloaded, ref ulong punBytesTotal);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig__GetAppBuildId(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook__GetAppBuildId(orig__GetAppBuildId orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_GetAppBuildId(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_GetAppBuildId(orig_GetAppBuildId orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig__RequestAllProofOfPurchaseKeys(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook__RequestAllProofOfPurchaseKeys(orig__RequestAllProofOfPurchaseKeys orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void orig_RequestAllProofOfPurchaseKeys(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate void hook_RequestAllProofOfPurchaseKeys(orig_RequestAllProofOfPurchaseKeys orig, object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType orig__GetFileDetails(IntPtr self, string pszFileName);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType hook__GetFileDetails(orig__GetFileDetails orig, IntPtr self, string pszFileName);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType orig_GetFileDetails(object self, string pszFileName);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate ValueType hook_GetFileDetails(orig_GetFileDetails orig, object self, string pszFileName);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig__GetLaunchCommandLine(IntPtr self, IntPtr pszCommandLine, int cubCommandLine);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook__GetLaunchCommandLine(orig__GetLaunchCommandLine orig, IntPtr self, IntPtr pszCommandLine, int cubCommandLine);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int orig_GetLaunchCommandLine(object self, out string pszCommandLine);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate int hook_GetLaunchCommandLine(orig_GetLaunchCommandLine orig, object self, out string pszCommandLine);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig__BIsSubscribedFromFamilySharing(IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook__BIsSubscribedFromFamilySharing(orig__BIsSubscribedFromFamilySharing orig, IntPtr self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool orig_BIsSubscribedFromFamilySharing(object self);

		[EditorBrowsable(EditorBrowsableState.Never)]
		public delegate bool hook_BIsSubscribedFromFamilySharing(orig_BIsSubscribedFromFamilySharing orig, object self);

		public static event hook_ctor ctor
		{
			add
			{
				HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SteamAPI_SteamApps_v008 SteamAPI_SteamApps_v008
		{
			add
			{
				HookEndpointManager.Add<hook_SteamAPI_SteamApps_v008>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SteamAPI_SteamApps_v008>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetUserInterfacePointer GetUserInterfacePointer
		{
			add
			{
				HookEndpointManager.Add<hook_GetUserInterfacePointer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetUserInterfacePointer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_SteamAPI_SteamGameServerApps_v008 SteamAPI_SteamGameServerApps_v008
		{
			add
			{
				HookEndpointManager.Add<hook_SteamAPI_SteamGameServerApps_v008>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_SteamAPI_SteamGameServerApps_v008>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetServerInterfacePointer GetServerInterfacePointer
		{
			add
			{
				HookEndpointManager.Add<hook_GetServerInterfacePointer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetServerInterfacePointer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__BIsSubscribed _BIsSubscribed
		{
			add
			{
				HookEndpointManager.Add<hook__BIsSubscribed>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__BIsSubscribed>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_BIsSubscribed BIsSubscribed
		{
			add
			{
				HookEndpointManager.Add<hook_BIsSubscribed>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_BIsSubscribed>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__BIsLowViolence _BIsLowViolence
		{
			add
			{
				HookEndpointManager.Add<hook__BIsLowViolence>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__BIsLowViolence>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_BIsLowViolence BIsLowViolence
		{
			add
			{
				HookEndpointManager.Add<hook_BIsLowViolence>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_BIsLowViolence>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__BIsCybercafe _BIsCybercafe
		{
			add
			{
				HookEndpointManager.Add<hook__BIsCybercafe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__BIsCybercafe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_BIsCybercafe BIsCybercafe
		{
			add
			{
				HookEndpointManager.Add<hook_BIsCybercafe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_BIsCybercafe>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__BIsVACBanned _BIsVACBanned
		{
			add
			{
				HookEndpointManager.Add<hook__BIsVACBanned>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__BIsVACBanned>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_BIsVACBanned BIsVACBanned
		{
			add
			{
				HookEndpointManager.Add<hook_BIsVACBanned>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_BIsVACBanned>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetCurrentGameLanguage _GetCurrentGameLanguage
		{
			add
			{
				HookEndpointManager.Add<hook__GetCurrentGameLanguage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetCurrentGameLanguage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetCurrentGameLanguage GetCurrentGameLanguage
		{
			add
			{
				HookEndpointManager.Add<hook_GetCurrentGameLanguage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetCurrentGameLanguage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetAvailableGameLanguages _GetAvailableGameLanguages
		{
			add
			{
				HookEndpointManager.Add<hook__GetAvailableGameLanguages>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetAvailableGameLanguages>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetAvailableGameLanguages GetAvailableGameLanguages
		{
			add
			{
				HookEndpointManager.Add<hook_GetAvailableGameLanguages>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetAvailableGameLanguages>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__BIsSubscribedApp _BIsSubscribedApp
		{
			add
			{
				HookEndpointManager.Add<hook__BIsSubscribedApp>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__BIsSubscribedApp>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_BIsSubscribedApp BIsSubscribedApp
		{
			add
			{
				HookEndpointManager.Add<hook_BIsSubscribedApp>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_BIsSubscribedApp>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__BIsDlcInstalled _BIsDlcInstalled
		{
			add
			{
				HookEndpointManager.Add<hook__BIsDlcInstalled>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__BIsDlcInstalled>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_BIsDlcInstalled BIsDlcInstalled
		{
			add
			{
				HookEndpointManager.Add<hook_BIsDlcInstalled>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_BIsDlcInstalled>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetEarliestPurchaseUnixTime _GetEarliestPurchaseUnixTime
		{
			add
			{
				HookEndpointManager.Add<hook__GetEarliestPurchaseUnixTime>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetEarliestPurchaseUnixTime>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetEarliestPurchaseUnixTime GetEarliestPurchaseUnixTime
		{
			add
			{
				HookEndpointManager.Add<hook_GetEarliestPurchaseUnixTime>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetEarliestPurchaseUnixTime>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__BIsSubscribedFromFreeWeekend _BIsSubscribedFromFreeWeekend
		{
			add
			{
				HookEndpointManager.Add<hook__BIsSubscribedFromFreeWeekend>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__BIsSubscribedFromFreeWeekend>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_BIsSubscribedFromFreeWeekend BIsSubscribedFromFreeWeekend
		{
			add
			{
				HookEndpointManager.Add<hook_BIsSubscribedFromFreeWeekend>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_BIsSubscribedFromFreeWeekend>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetDLCCount _GetDLCCount
		{
			add
			{
				HookEndpointManager.Add<hook__GetDLCCount>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetDLCCount>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetDLCCount GetDLCCount
		{
			add
			{
				HookEndpointManager.Add<hook_GetDLCCount>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetDLCCount>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__BGetDLCDataByIndex _BGetDLCDataByIndex
		{
			add
			{
				HookEndpointManager.Add<hook__BGetDLCDataByIndex>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__BGetDLCDataByIndex>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_BGetDLCDataByIndex BGetDLCDataByIndex
		{
			add
			{
				HookEndpointManager.Add<hook_BGetDLCDataByIndex>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_BGetDLCDataByIndex>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__InstallDLC _InstallDLC
		{
			add
			{
				HookEndpointManager.Add<hook__InstallDLC>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__InstallDLC>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_InstallDLC InstallDLC
		{
			add
			{
				HookEndpointManager.Add<hook_InstallDLC>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_InstallDLC>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__UninstallDLC _UninstallDLC
		{
			add
			{
				HookEndpointManager.Add<hook__UninstallDLC>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__UninstallDLC>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_UninstallDLC UninstallDLC
		{
			add
			{
				HookEndpointManager.Add<hook_UninstallDLC>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_UninstallDLC>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__RequestAppProofOfPurchaseKey _RequestAppProofOfPurchaseKey
		{
			add
			{
				HookEndpointManager.Add<hook__RequestAppProofOfPurchaseKey>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__RequestAppProofOfPurchaseKey>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_RequestAppProofOfPurchaseKey RequestAppProofOfPurchaseKey
		{
			add
			{
				HookEndpointManager.Add<hook_RequestAppProofOfPurchaseKey>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_RequestAppProofOfPurchaseKey>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetCurrentBetaName _GetCurrentBetaName
		{
			add
			{
				HookEndpointManager.Add<hook__GetCurrentBetaName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetCurrentBetaName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetCurrentBetaName GetCurrentBetaName
		{
			add
			{
				HookEndpointManager.Add<hook_GetCurrentBetaName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetCurrentBetaName>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__MarkContentCorrupt _MarkContentCorrupt
		{
			add
			{
				HookEndpointManager.Add<hook__MarkContentCorrupt>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__MarkContentCorrupt>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_MarkContentCorrupt MarkContentCorrupt
		{
			add
			{
				HookEndpointManager.Add<hook_MarkContentCorrupt>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_MarkContentCorrupt>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetInstalledDepots _GetInstalledDepots
		{
			add
			{
				HookEndpointManager.Add<hook__GetInstalledDepots>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetInstalledDepots>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetInstalledDepots GetInstalledDepots
		{
			add
			{
				HookEndpointManager.Add<hook_GetInstalledDepots>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetInstalledDepots>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetAppInstallDir _GetAppInstallDir
		{
			add
			{
				HookEndpointManager.Add<hook__GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetAppInstallDir GetAppInstallDir
		{
			add
			{
				HookEndpointManager.Add<hook_GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetAppInstallDir>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__BIsAppInstalled _BIsAppInstalled
		{
			add
			{
				HookEndpointManager.Add<hook__BIsAppInstalled>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__BIsAppInstalled>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_BIsAppInstalled BIsAppInstalled
		{
			add
			{
				HookEndpointManager.Add<hook_BIsAppInstalled>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_BIsAppInstalled>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetAppOwner _GetAppOwner
		{
			add
			{
				HookEndpointManager.Add<hook__GetAppOwner>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetAppOwner>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetAppOwner GetAppOwner
		{
			add
			{
				HookEndpointManager.Add<hook_GetAppOwner>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetAppOwner>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetLaunchQueryParam _GetLaunchQueryParam
		{
			add
			{
				HookEndpointManager.Add<hook__GetLaunchQueryParam>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetLaunchQueryParam>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetLaunchQueryParam GetLaunchQueryParam
		{
			add
			{
				HookEndpointManager.Add<hook_GetLaunchQueryParam>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetLaunchQueryParam>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetDlcDownloadProgress _GetDlcDownloadProgress
		{
			add
			{
				HookEndpointManager.Add<hook__GetDlcDownloadProgress>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetDlcDownloadProgress>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetDlcDownloadProgress GetDlcDownloadProgress
		{
			add
			{
				HookEndpointManager.Add<hook_GetDlcDownloadProgress>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetDlcDownloadProgress>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__GetAppBuildId _GetAppBuildId
		{
			add
			{
				HookEndpointManager.Add<hook__GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook_GetAppBuildId GetAppBuildId
		{
			add
			{
				HookEndpointManager.Add<hook_GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook_GetAppBuildId>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
		}

		public static event hook__RequestAllProofOfPurchaseKeys _RequestAllProofOfPurchaseKeys
		{
			add
			{
				HookEndpointManager.Add<hook__RequestAllProofOfPurchaseKeys>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
			}
			remove
			{
				HookEndpointManager.Remove<hook__RequestAllProofOfPurchaseKeys>(MethodBase.GetMethodFromHandle((Runt

notnotnotswipez-MoreCompany/MoreCompany.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using MoreCompany.Cosmetics;
using MoreCompany.Utils;
using Steamworks;
using Steamworks.Data;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreCompany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreCompany")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("511a1e5e-0611-49f1-b60f-cec69c668fd8")]
[assembly: AssemblyFileVersion("1.5.1")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.5.1.0")]
namespace MoreCompany
{
	[HarmonyPatch(typeof(AudioMixer), "SetFloat")]
	public static class AudioMixerSetFloatPatch
	{
		public static bool Prefix(string name, float value)
		{
			if (name.StartsWith("PlayerVolume") || name.StartsWith("PlayerPitch"))
			{
				string s = name.Replace("PlayerVolume", "").Replace("PlayerPitch", "");
				int num = int.Parse(s);
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[num];
				AudioSource currentVoiceChatAudioSource = val.currentVoiceChatAudioSource;
				if ((Object)(object)val != (Object)null && Object.op_Implicit((Object)(object)currentVoiceChatAudioSource))
				{
					if (name.StartsWith("PlayerVolume"))
					{
						currentVoiceChatAudioSource.volume = value / 16f;
					}
					else if (name.StartsWith("PlayerPitch"))
					{
						currentVoiceChatAudioSource.pitch = value;
					}
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(HUDManager), "AddTextToChatOnServer")]
	public static class SendChatToServerPatch
	{
		public static bool Prefix(HUDManager __instance, string chatMessage, int playerId = -1)
		{
			if (chatMessage.StartsWith("[morecompanycosmetics]"))
			{
				ReflectionUtils.InvokeMethod(__instance, "AddPlayerChatMessageServerRpc", new object[2] { chatMessage, 99 });
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageServerRpc")]
	public static class ServerReceiveMessagePatch
	{
		public static string previousDataMessage = "";

		public static bool Prefix(HUDManager __instance, ref string chatMessage, int playerId)
		{
			NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager;
			if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
			{
				return false;
			}
			if (chatMessage.StartsWith("[morecompanycosmetics]") && networkManager.IsServer)
			{
				previousDataMessage = chatMessage;
				chatMessage = "[replacewithdata]";
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
	public static class ConnectClientToPlayerObjectPatch
	{
		public static void Postfix(PlayerControllerB __instance)
		{
			string text = "[morecompanycosmetics]";
			text = text + ";" + __instance.playerClientId;
			foreach (string locallySelectedCosmetic in CosmeticRegistry.locallySelectedCosmetics)
			{
				text = text + ";" + locallySelectedCosmetic;
			}
			HUDManager.Instance.AddTextToChatOnServer(text, -1);
		}
	}
	[HarmonyPatch(typeof(HUDManager), "AddChatMessage")]
	public static class AddChatMessagePatch
	{
		public static bool Prefix(HUDManager __instance, string chatMessage, string nameOfUserWhoTyped = "")
		{
			if (chatMessage.StartsWith("[replacewithdata]") || chatMessage.StartsWith("[morecompanycosmetics]"))
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageClientRpc")]
	public static class ClientReceiveMessagePatch
	{
		public static bool ignoreSample;

		public static bool Prefix(HUDManager __instance, ref string chatMessage, int playerId)
		{
			NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager;
			if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
			{
				return false;
			}
			if (networkManager.IsServer)
			{
				if (chatMessage.StartsWith("[replacewithdata]"))
				{
					chatMessage = ServerReceiveMessagePatch.previousDataMessage;
					HandleDataMessage(chatMessage);
				}
				else if (chatMessage.StartsWith("[morecompanycosmetics]"))
				{
					return false;
				}
			}
			else if (chatMessage.StartsWith("[morecompanycosmetics]"))
			{
				HandleDataMessage(chatMessage);
			}
			return true;
		}

		private static void HandleDataMessage(string chatMessage)
		{
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			if (ignoreSample)
			{
				return;
			}
			chatMessage = chatMessage.Replace("[morecompanycosmetics]", "");
			string[] array = chatMessage.Split(new char[1] { ';' });
			string text = array[1];
			int num = int.Parse(text);
			CosmeticApplication component = ((Component)((Component)StartOfRound.Instance.allPlayerScripts[num]).transform.Find("ScavengerModel").Find("metarig")).gameObject.GetComponent<CosmeticApplication>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.ClearCosmetics();
				Object.Destroy((Object)(object)component);
			}
			CosmeticApplication cosmeticApplication = ((Component)((Component)StartOfRound.Instance.allPlayerScripts[num]).transform.Find("ScavengerModel").Find("metarig")).gameObject.AddComponent<CosmeticApplication>();
			cosmeticApplication.ClearCosmetics();
			List<string> list = new List<string>();
			string[] array2 = array;
			foreach (string text2 in array2)
			{
				if (!(text2 == text))
				{
					list.Add(text2);
					if (MainClass.showCosmetics)
					{
						cosmeticApplication.ApplyCosmetic(text2, startEnabled: true);
					}
				}
			}
			if (num == StartOfRound.Instance.thisClientPlayerId)
			{
				cosmeticApplication.ClearCosmetics();
			}
			foreach (CosmeticInstance spawnedCosmetic in cosmeticApplication.spawnedCosmetics)
			{
				Transform transform = ((Component)spawnedCosmetic).transform;
				transform.localScale *= 0.38f;
			}
			MainClass.playerIdsAndCosmetics.Remove(num);
			MainClass.playerIdsAndCosmetics.Add(num, list);
			if (!GameNetworkManager.Instance.isHostingGame || num == 0)
			{
				return;
			}
			ignoreSample = true;
			foreach (KeyValuePair<int, List<string>> playerIdsAndCosmetic in MainClass.playerIdsAndCosmetics)
			{
				string text3 = "[morecompanycosmetics]";
				text3 = text3 + ";" + playerIdsAndCosmetic.Key;
				foreach (string item in playerIdsAndCosmetic.Value)
				{
					text3 = text3 + ";" + item;
				}
				HUDManager.Instance.AddTextToChatOnServer(text3, -1);
			}
			ignoreSample = false;
		}
	}
	[HarmonyPatch(typeof(ForestGiantAI), "LookForPlayers")]
	public static class LookForPlayersForestGiantPatch
	{
		public static void Prefix(ForestGiantAI __instance)
		{
			if (__instance.playerStealthMeters.Length != MainClass.newPlayerCount)
			{
				__instance.playerStealthMeters = new float[MainClass.newPlayerCount];
				for (int i = 0; i < MainClass.newPlayerCount; i++)
				{
					__instance.playerStealthMeters[i] = 0f;
				}
			}
		}
	}
	[HarmonyPatch(typeof(SpringManAI), "Update")]
	public static class SpringManAIUpdatePatch
	{
		public static bool Prefix(SpringManAI __instance, ref float ___timeSinceHittingPlayer, ref float ___stopAndGoMinimumInterval, ref bool ___wasOwnerLastFrame, ref bool ___stoppingMovement, ref float ___currentChaseSpeed, ref bool ___hasStopped, ref float ___currentAnimSpeed, ref float ___updateDestinationInterval, ref Vector3 ___tempVelocity, ref float ___targetYRotation, ref float ___setDestinationToPlayerInterval, ref float ___previousYRotation)
		{
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			UpdateBase((EnemyAI)(object)__instance, ref ___updateDestinationInterval, ref ___tempVelocity, ref ___targetYRotation, ref ___setDestinationToPlayerInterval, ref ___previousYRotation);
			if (((EnemyAI)__instance).isEnemyDead)
			{
				return false;
			}
			int currentBehaviourStateIndex = ((EnemyAI)__instance).currentBehaviourStateIndex;
			if (currentBehaviourStateIndex != 0 && currentBehaviourStateIndex == 1)
			{
				if (___timeSinceHittingPlayer >= 0f)
				{
					___timeSinceHittingPlayer -= Time.deltaTime;
				}
				if (((NetworkBehaviour)__instance).IsOwner)
				{
					if (___stopAndGoMinimumInterval > 0f)
					{
						___stopAndGoMinimumInterval -= Time.deltaTime;
					}
					if (!___wasOwnerLastFrame)
					{
						___wasOwnerLastFrame = true;
						if (!___stoppingMovement && ___timeSinceHittingPlayer < 0.12f)
						{
							((EnemyAI)__instance).agent.speed = ___currentChaseSpeed;
						}
						else
						{
							((EnemyAI)__instance).agent.speed = 0f;
						}
					}
					bool flag = false;
					for (int i = 0; i < MainClass.newPlayerCount; i++)
					{
						if (((EnemyAI)__instance).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(((Component)__instance).transform.position + Vector3.up * 1.6f, 68f, 60, -1f) && Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, ((EnemyAI)__instance).eye.position) > 0.3f)
						{
							flag = true;
						}
					}
					if (((EnemyAI)__instance).stunNormalizedTimer > 0f)
					{
						flag = true;
					}
					if (flag != ___stoppingMovement && ___stopAndGoMinimumInterval <= 0f)
					{
						___stopAndGoMinimumInterval = 0.15f;
						if (flag)
						{
							__instance.SetAnimationStopServerRpc();
						}
						else
						{
							__instance.SetAnimationGoServerRpc();
						}
						___stoppingMovement = flag;
					}
				}
				if (___stoppingMovement)
				{
					if (__instance.animStopPoints.canAnimationStop)
					{
						if (!___hasStopped)
						{
							___hasStopped = true;
							__instance.mainCollider.isTrigger = false;
							if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)__instance).transform.position, 70f, 25, -1f))
							{
								float num = Vector3.Distance(((Component)__instance).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position);
								if (num < 4f)
								{
									GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.9f, true);
								}
								else if (num < 9f)
								{
									GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.4f, true);
								}
							}
							if (___currentAnimSpeed > 2f)
							{
								RoundManager.PlayRandomClip(((EnemyAI)__instance).creatureVoice, __instance.springNoises, false, 1f, 0);
								if (__instance.animStopPoints.animationPosition == 1)
								{
									((EnemyAI)__instance).creatureAnimator.SetTrigger("springBoing");
								}
								else
								{
									((EnemyAI)__instance).creatureAnimator.SetTrigger("springBoingPosition2");
								}
							}
						}
						((EnemyAI)__instance).creatureAnimator.SetFloat("walkSpeed", 0f);
						___currentAnimSpeed = 0f;
						if (((NetworkBehaviour)__instance).IsOwner)
						{
							((EnemyAI)__instance).agent.speed = 0f;
							return false;
						}
					}
				}
				else
				{
					if (___hasStopped)
					{
						___hasStopped = false;
						__instance.mainCollider.isTrigger = true;
					}
					___currentAnimSpeed = Mathf.Lerp(___currentAnimSpeed, 6f, 5f * Time.deltaTime);
					((EnemyAI)__instance).creatureAnimator.SetFloat("walkSpeed", ___currentAnimSpeed);
					if (((NetworkBehaviour)__instance).IsOwner)
					{
						((EnemyAI)__instance).agent.speed = Mathf.Lerp(((EnemyAI)__instance).agent.speed, ___currentChaseSpeed, 4.5f * Time.deltaTime);
					}
				}
			}
			return false;
		}

		private static void UpdateBase(EnemyAI __instance, ref float updateDestinationInterval, ref Vector3 tempVelocity, ref float targetYRotation, ref float setDestinationToPlayerInterval, ref float previousYRotation)
		{
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.enemyType.isDaytimeEnemy && !__instance.daytimeEnemyLeaving)
			{
				ReflectionUtils.InvokeMethod(__instance, typeof(EnemyAI), "CheckTimeOfDayToLeave", null);
			}
			if (__instance.stunnedIndefinitely <= 0)
			{
				if ((double)__instance.stunNormalizedTimer >= 0.0)
				{
					__instance.stunNormalizedTimer -= Time.deltaTime / __instance.enemyType.stunTimeMultiplier;
				}
				else
				{
					__instance.stunnedByPlayer = null;
					if ((double)__instance.postStunInvincibilityTimer >= 0.0)
					{
						__instance.postStunInvincibilityTimer -= Time.deltaTime * 5f;
					}
				}
			}
			if (!__instance.ventAnimationFinished && (double)__instance.timeSinceSpawn < (double)__instance.exitVentAnimationTime + 0.004999999888241291 * (double)RoundManager.Instance.numberOfEnemiesInScene)
			{
				__instance.timeSinceSpawn += Time.deltaTime;
				if (!((NetworkBehaviour)__instance).IsOwner)
				{
					Vector3 serverPosition = __instance.serverPosition;
					if (__instance.serverPosition != Vector3.zero)
					{
						((Component)__instance).transform.position = __instance.serverPosition;
						((Component)__instance).transform.eulerAngles = new Vector3(((Component)__instance).transform.eulerAngles.x, targetYRotation, ((Component)__instance).transform.eulerAngles.z);
					}
				}
				else if ((double)updateDestinationInterval >= 0.0)
				{
					updateDestinationInterval -= Time.deltaTime;
				}
				else
				{
					__instance.SyncPositionToClients();
					updateDestinationInterval = 0.1f;
				}
				return;
			}
			if (!__instance.ventAnimationFinished)
			{
				__instance.ventAnimationFinished = true;
				if ((Object)(object)__instance.creatureAnimator != (Object)null)
				{
					__instance.creatureAnimator.SetBool("inSpawningAnimation", false);
				}
			}
			if (!((NetworkBehaviour)__instance).IsOwner)
			{
				if (__instance.currentSearch.inProgress)
				{
					__instance.StopSearch(__instance.currentSearch, true);
				}
				__instance.SetClientCalculatingAI(false);
				if (!__instance.inSpecialAnimation)
				{
					((Component)__instance).transform.position = Vector3.SmoothDamp(((Component)__instance).transform.position, __instance.serverPosition, ref tempVelocity, __instance.syncMovementSpeed);
					((Component)__instance).transform.eulerAngles = new Vector3(((Component)__instance).transform.eulerAngles.x, Mathf.LerpAngle(((Component)__instance).transform.eulerAngles.y, targetYRotation, 15f * Time.deltaTime), ((Component)__instance).transform.eulerAngles.z);
				}
				__instance.timeSinceSpawn += Time.deltaTime;
				return;
			}
			if (__instance.isEnemyDead)
			{
				__instance.SetClientCalculatingAI(false);
				return;
			}
			if (!__instance.inSpecialAnimation)
			{
				__instance.SetClientCalculatingAI(true);
			}
			if (__instance.movingTowardsTargetPlayer && (Object)(object)__instance.targetPlayer != (Object)null)
			{
				if ((double)setDestinationToPlayerInterval <= 0.0)
				{
					setDestinationToPlayerInterval = 0.25f;
					__instance.destination = RoundManager.Instance.GetNavMeshPosition(((Component)__instance.targetPlayer).transform.position, RoundManager.Instance.navHit, 2.7f, -1);
				}
				else
				{
					__instance.destination = new Vector3(((Component)__instance.targetPlayer).transform.position.x, __instance.destination.y, ((Component)__instance.targetPlayer).transform.position.z);
					setDestinationToPlayerInterval -= Time.deltaTime;
				}
			}
			if (__instance.inSpecialAnimation)
			{
				return;
			}
			if ((double)updateDestinationInterval >= 0.0)
			{
				updateDestinationInterval -= Time.deltaTime;
			}
			else
			{
				__instance.DoAIInterval();
				updateDestinationInterval = __instance.AIIntervalTime;
			}
			if (!((double)Mathf.Abs(previousYRotation - ((Component)__instance).transform.eulerAngles.y) <= 6.0))
			{
				previousYRotation = ((Component)__instance).transform.eulerAngles.y;
				targetYRotation = previousYRotation;
				if (((NetworkBehaviour)__instance).IsServer)
				{
					ReflectionUtils.InvokeMethod(__instance, typeof(EnemyAI), "UpdateEnemyRotationClientRpc", new object[1] { (short)previousYRotation });
				}
				else
				{
					ReflectionUtils.InvokeMethod(__instance, typeof(EnemyAI), "UpdateEnemyRotationServerRpc", new object[1] { (short)previousYRotation });
				}
			}
		}
	}
	[HarmonyPatch(typeof(EnemyAI), "GetClosestPlayer")]
	public static class GetClosestPlayerPatch
	{
		public static bool Prefix(EnemyAI __instance, ref PlayerControllerB __result, bool requireLineOfSight = false, bool cannotBeInShip = false, bool cannotBeNearShip = false)
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = null;
			__instance.mostOptimalDistance = 2000f;
			for (int i = 0; i < 4; i++)
			{
				if (!__instance.PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], cannotBeInShip, false))
				{
					continue;
				}
				if (cannotBeNearShip)
				{
					if (StartOfRound.Instance.allPlayerScripts[i].isInElevator)
					{
						continue;
					}
					bool flag = false;
					for (int j = 0; j < RoundManager.Instance.spawnDenialPoints.Length; j++)
					{
						if (Vector3.Distance(RoundManager.Instance.spawnDenialPoints[j].transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position) < 10f)
						{
							flag = true;
							break;
						}
					}
					if (flag)
					{
						continue;
					}
				}
				if (!requireLineOfSight || !Physics.Linecast(((Component)__instance).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position, 256))
				{
					__instance.tempDist = Vector3.Distance(((Component)__instance).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
					if (__instance.tempDist < __instance.mostOptimalDistance)
					{
						__instance.mostOptimalDistance = __instance.tempDist;
						val = StartOfRound.Instance.allPlayerScripts[i];
					}
				}
			}
			__result = val;
			return false;
		}
	}
	[HarmonyPatch(typeof(EnemyAI), "GetAllPlayersInLineOfSight")]
	public static class GetAllPlayersInLineOfSightPatch
	{
		public static bool Prefix(EnemyAI __instance, ref PlayerControllerB[] __result, float width = 45f, int range = 60, Transform eyeObject = null, float proximityCheck = -1f, int layerMask = -1)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Invalid comparison between Unknown and I4
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (layerMask == -1)
			{
				layerMask = StartOfRound.Instance.collidersAndRoomMaskAndDefault;
			}
			if ((Object)(object)eyeObject == (Object)null)
			{
				eyeObject = __instance.eye;
			}
			if (__instance.enemyType.isOutsideEnemy && !__instance.enemyType.canSeeThroughFog && (int)TimeOfDay.Instance.currentLevelWeather == 3)
			{
				range = Mathf.Clamp(range, 0, 30);
			}
			List<PlayerControllerB> list = new List<PlayerControllerB>(MainClass.newPlayerCount);
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				if (!__instance.PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false))
				{
					continue;
				}
				Vector3 position = ((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position;
				if (Vector3.Distance(__instance.eye.position, position) < (float)range && !Physics.Linecast(eyeObject.position, position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
				{
					Vector3 val = position - eyeObject.position;
					if (Vector3.Angle(eyeObject.forward, val) < width || Vector3.Distance(((Component)__instance).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position) < proximityCheck)
					{
						list.Add(StartOfRound.Instance.allPlayerScripts[i]);
					}
				}
			}
			if (list.Count == MainClass.newPlayerCount)
			{
				__result = StartOfRound.Instance.allPlayerScripts;
				return false;
			}
			if (list.Count > 0)
			{
				__result = list.ToArray();
				return false;
			}
			__result = null;
			return false;
		}
	}
	[HarmonyPatch(typeof(DressGirlAI), "ChoosePlayerToHaunt")]
	public static class DressGirlHauntPatch
	{
		public static bool Prefix(DressGirlAI __instance)
		{
			ReflectionUtils.SetFieldValue(__instance, "timesChoosingAPlayer", ReflectionUtils.GetFieldValue<int>(__instance, "timesChoosingAPlayer") + 1);
			if (ReflectionUtils.GetFieldValue<int>(__instance, "timesChoosingAPlayer") > 1)
			{
				__instance.timer = __instance.hauntInterval - 1f;
			}
			__instance.SFXVolumeLerpTo = 0f;
			((EnemyAI)__instance).creatureVoice.Stop();
			__instance.heartbeatMusic.volume = 0f;
			if (!ReflectionUtils.GetFieldValue<bool>(__instance, "initializedRandomSeed"))
			{
				ReflectionUtils.SetFieldValue(__instance, "ghostGirlRandom", new Random(StartOfRound.Instance.randomMapSeed + 158));
			}
			float num = 0f;
			float num2 = 0f;
			int num3 = 0;
			int num4 = 0;
			for (int i = 0; i < MainClass.newPlayerCount; i++)
			{
				if (StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount > num3)
				{
					num3 = StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount;
					num4 = i;
				}
				if (StartOfRound.Instance.allPlayerScripts[i].insanityLevel > num)
				{
					num = StartOfRound.Instance.allPlayerScripts[i].insanityLevel;
					num2 = i;
				}
			}
			int[] array = new int[MainClass.newPlayerCount];
			for (int j = 0; j < MainClass.newPlayerCount; j++)
			{
				if (!StartOfRound.Instance.allPlayerScripts[j].isPlayerControlled)
				{
					array[j] = 0;
					continue;
				}
				array[j] += 80;
				if (num2 == (float)j && num > 1f)
				{
					array[j] += 50;
				}
				if (num4 == j)
				{
					array[j] += 30;
				}
				if (!StartOfRound.Instance.allPlayerScripts[j].hasBeenCriticallyInjured)
				{
					array[j] += 10;
				}
				if ((Object)(object)StartOfRound.Instance.allPlayerScripts[j].currentlyHeldObjectServer != (Object)null && StartOfRound.Instance.allPlayerScripts[j].currentlyHeldObjectServer.scrapValue > 150)
				{
					array[j] += 30;
				}
			}
			__instance.hauntingPlayer = StartOfRound.Instance.allPlayerScripts[RoundManager.Instance.GetRandomWeightedIndex(array, ReflectionUtils.GetFieldValue<Random>(__instance, "ghostGirlRandom"))];
			if (__instance.hauntingPlayer.isPlayerDead)
			{
				for (int k = 0; k < StartOfRound.Instance.allPlayerScripts.Length; k++)
				{
					if (!StartOfRound.Instance.allPlayerScripts[k].isPlayerDead)
					{
						__instance.hauntingPlayer = StartOfRound.Instance.allPlayerScripts[k];
						break;
					}
				}
			}
			Debug.Log((object)$"Little girl: Haunting player with playerClientId: {__instance.hauntingPlayer.playerClientId}; actualClientId: {__instance.hauntingPlayer.actualClientId}");
			((EnemyAI)__instance).ChangeOwnershipOfEnemy(__instance.hauntingPlayer.actualClientId);
			__instance.hauntingLocalPlayer = (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)__instance.hauntingPlayer;
			if (ReflectionUtils.GetFieldValue<Coroutine>(__instance, "switchHauntedPlayerCoroutine") != null)
			{
				((MonoBehaviour)__instance).StopCoroutine(ReflectionUtils.GetFieldValue<Coroutine>(__instance, "switchHauntedPlayerCoroutine"));
			}
			ReflectionUtils.SetFieldValue(__instance, "switchHauntedPlayerCoroutine", ((MonoBehaviour)__instance).StartCoroutine(ReflectionUtils.InvokeMethod<IEnumerator>(__instance, "setSwitchingHauntingPlayer", null)));
			return false;
		}
	}
	[HarmonyPatch(typeof(HUDManager), "AddChatMessage")]
	public static class HudChatPatch
	{
		public static void Prefix(HUDManager __instance, ref string chatMessage, string nameOfUserWhoTyped = "")
		{
			if (!(__instance.lastChatMessage == chatMessage))
			{
				StringBuilder stringBuilder = new StringBuilder(chatMessage);
				for (int i = 0; i < MainClass.newPlayerCount; i++)
				{
					string oldValue = $"[playerNum{i}]";
					string playerUsername = StartOfRound.Instance.allPlayerScripts[i].playerUsername;
					stringBuilder.Replace(oldValue, playerUsername);
				}
				chatMessage = stringBuilder.ToString();
			}
		}
	}
	[HarmonyPatch(typeof(MenuManager), "Awake")]
	public static class MenuManagerLogoOverridePatch
	{
		public static void Postfix(MenuManager __instance)
		{
			//IL_0076: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject gameObject = ((Component)((Component)__instance).transform.parent).gameObject;
				GameObject gameObject2 = ((Component)gameObject.transform.Find("MenuContainer").Find("MainButtons").Find("HeaderImage")).gameObject;
				Image component = gameObject2.GetComponent<Image>();
				MainClass.ReadSettingsFromFile();
				component.sprite = Sprite.Create(MainClass.mainLogo, new Rect(0f, 0f, (float)((Texture)MainClass.mainLogo).width, (float)((Texture)MainClass.mainLogo).height), new Vector2(0.5f, 0.5f));
				CosmeticRegistry.SpawnCosmeticGUI();
				Transform val = gameObject.transform.Find("MenuContainer").Find("LobbyHostSettings").Find("Panel")
					.Find("LobbyHostOptions")
					.Find("OptionsNormal");
				GameObject val2 = Object.Instantiate<GameObject>(MainClass.crewCountUI, val);
				RectTransform component2 = val2.GetComponent<RectTransform>();
				((Transform)component2).localPosition = new Vector3(96.9f, -70f, -6.7f);
				TMP_InputField inputField = ((Component)val2.transform.Find("InputField (TMP)")).GetComponent<TMP_InputField>();
				inputField.characterLimit = 3;
				inputField.text = MainClass.newPlayerCount.ToString();
				((UnityEvent<string>)(object)inputField.onValueChanged).AddListener((UnityAction<string>)delegate(string s)
				{
					if (int.TryParse(s, out var result))
					{
						MainClass.newPlayerCount = result;
						MainClass.newPlayerCount = Mathf.Clamp(MainClass.newPlayerCount, 1, MainClass.maxPlayerCount);
						inputField.text = MainClass.newPlayerCount.ToString();
						MainClass.SaveSettingsToFile();
					}
					else if (s.Length != 0)
					{
						inputField.text = MainClass.newPlayerCount.ToString();
						inputField.caretPosition = 1;
					}
				});
			}
			catch (Exception)
			{
			}
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager), "AddUserToPlayerList")]
	public static class AddUserPlayerListPatch
	{
		public static bool Prefix(QuickMenuManager __instance, ulong steamId, string playerName, int playerObjectId)
		{
			QuickmenuVisualInjectPatch.PopulateQuickMenu(__instance);
			MainClass.EnablePlayerObjectsBasedOnConnected();
			return false;
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager), "RemoveUserFromPlayerList")]
	public static class RemoveUserPlayerListPatch
	{
		public static bool Prefix(QuickMenuManager __instance)
		{
			QuickmenuVisualInjectPatch.PopulateQuickMenu(__instance);
			return false;
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager), "Update")]
	public static class QuickMenuUpdatePatch
	{
		public static bool Prefix(QuickMenuManager __instance)
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager), "NonHostPlayerSlotsEnabled")]
	public static class QuickMenuDisplayPatch
	{
		public static bool Prefix(QuickMenuManager __instance, ref bool __result)
		{
			__result = true;
			return false;
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager), "Start")]
	public static class QuickmenuVisualInjectPatch
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__2_2;

			internal void <PopulateQuickMenu>b__2_2()
			{
				if (!GameNetworkManager.Instance.disableSteam)
				{
				}
			}
		}

		public static GameObject quickMenuScrollInstance;

		public static void Postfix(QuickMenuManager __instance)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)__instance.playerListPanel.transform.Find("Image")).gameObject;
			GameObject val = Object.Instantiate<GameObject>(MainClass.quickMenuScrollParent);
			val.transform.SetParent(gameObject.transform);
			RectTransform component = val.GetComponent<RectTransform>();
			((Transform)component).localPosition = new Vector3(0f, -31.2f, 0f);
			((Transform)component).localScale = Vector3.one;
			quickMenuScrollInstance = val;
		}

		public static void PopulateQuickMenu(QuickMenuManager __instance)
		{
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Expected O, but got Unknown
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Expected O, but got Unknown
			int childCount = quickMenuScrollInstance.transform.Find("Holder").childCount;
			List<GameObject> list = new List<GameObject>();
			for (int i = 0; i < childCount; i++)
			{
				list.Add(((Component)quickMenuScrollInstance.transform.Find("Holder").GetChild(i)).gameObject);
			}
			foreach (GameObject item in list)
			{
				Object.Destroy((Object)(object)item);
			}
			if (!Object.op_Implicit((Object)(object)StartOfRound.Instance))
			{
				return;
			}
			for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++)
			{
				PlayerControllerB playerScript = StartOfRound.Instance.allPlayerScripts[j];
				if (!playerScript.isPlayerControlled && !playerScript.isPlayerDead)
				{
					continue;
				}
				GameObject val = Object.Instantiate<GameObject>(MainClass.playerEntry, quickMenuScrollInstance.transform.Find("Holder"));
				RectTransform component = val.GetComponent<RectTransform>();
				((Transform)component).localScale = Vector3.one;
				((Transform)component).localPosition = new Vector3(0f, 0f - ((Transform)component).localPosition.y, 0f);
				TextMeshProUGUI component2 = ((Component)val.transform.Find("PlayerNameButton").Find("PName")).GetComponent<TextMeshProUGUI>();
				((TMP_Text)component2).text = playerScript.playerUsername;
				Slider playerVolume = ((Component)val.transform.Find("PlayerVolumeSlider")).GetComponent<Slider>();
				int finalIndex = j;
				((UnityEvent<float>)(object)playerVolume.onValueChanged).AddListener((UnityAction<float>)delegate(float f)
				{
					if (playerScript.isPlayerControlled || playerScript.isPlayerDead)
					{
						float num = f / playerVolume.maxValue + 1f;
						if (num <= -1f)
						{
							SoundManager.Instance.playerVoiceVolumes[finalIndex] = -70f;
						}
						else
						{
							SoundManager.Instance.playerVoiceVolumes[finalIndex] = num;
						}
					}
				});
				if (StartOfRound.Instance.localPlayerController.playerClientId == playerScript.playerClientId)
				{
					((Component)playerVolume).gameObject.SetActive(false);
					((Component)val.transform.Find("Text (1)")).gameObject.SetActive(false);
				}
				Button component3 = ((Component)val.transform.Find("KickButton")).GetComponent<Button>();
				((UnityEvent)component3.onClick).AddListener((UnityAction)delegate
				{
					__instance.KickUserFromServer(finalIndex);
				});
				if (!GameNetworkManager.Instance.isHostingGame)
				{
					((Component)component3).gameObject.SetActive(false);
				}
				Button component4 = ((Component)val.transform.Find("ProfileIcon")).GetComponent<Button>();
				ButtonClickedEvent onClick = component4.onClick;
				object obj = <>c.<>9__2_2;
				if (obj == null)
				{
					UnityAction val2 = delegate
					{
						if (!GameNetworkManager.Instance.disableSteam)
						{
						}
					};
					<>c.<>9__2_2 = val2;
					obj = (object)val2;
				}
				((UnityEvent)onClick).AddListener((UnityAction)obj);
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager), "UpdateBoxesSpectateUI")]
	public static class SpectatorBoxUpdatePatch
	{
		public static void Postfix(HUDManager __instance)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<Animator, PlayerControllerB> fieldValue = ReflectionUtils.GetFieldValue<Dictionary<Animator, PlayerControllerB>>(__instance, "spectatingPlayerBoxes");
			int num = -64;
			int num2 = 0;
			int num3 = 0;
			int num4 = -70;
			int num5 = 230;
			int num6 = 4;
			foreach (KeyValuePair<Animator, PlayerControllerB> item in fieldValue)
			{
				if (((Component)item.Key).gameObject.activeInHierarchy)
				{
					GameObject gameObject = ((Component)item.Key).gameObject;
					RectTransform component = gameObject.GetComponent<RectTransform>();
					int num7 = (int)Math.Floor((double)num3 / (double)num6);
					int num8 = num3 % num6;
					int num9 = num8 * num4;
					int num10 = num7 * num5;
					component.anchoredPosition = Vector2.op_Implicit(new Vector3((float)(num + num10), (float)(num2 + num9), 0f));
					num3++;
				}
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager), "FillEndGameStats")]
	public static class HudFillEndGameFix
	{
		public static bool Prefix(HUDManager __instance, EndOfGameStats stats)
		{
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Invalid comparison between Unknown and I4
			int num = 0;
			int num2 = 0;
			for (int i = 0; i < __instance.statsUIElements.playerNamesText.Length; i++)
			{
				PlayerControllerB val = __instance.playersManager.allPlayerScripts[i];
				((TMP_Text)__instance.statsUIElements.playerNamesText[i]).text = "";
				((Behaviour)__instance.statsUIElements.playerStates[i]).enabled = false;
				((TMP_Text)__instance.statsUIElements.playerNotesText[i]).text = "Notes: \n";
				if (val.disconnectedMidGame || val.isPlayerDead || val.isPlayerControlled)
				{
					if (val.isPlayerDead)
					{
						num++;
					}
					else if (val.isPlayerControlled)
					{
						num2++;
					}
					((TMP_Text)__instance.statsUIElements.playerNamesText[i]).text = __instance.playersManager.allPlayerScripts[i].playerUsername;
					((Behaviour)__instance.statsUIElements.playerStates[i]).enabled = true;
					if (__instance.playersManager.allPlayerScripts[i].isPlayerDead)
					{
						if ((int)__instance.playersManager.allPlayerScripts[i].causeOfDeath == 10)
						{
							__instance.statsUIElements.playerStates[i].sprite = __instance.statsUIElements.missingIcon;
						}
						else
						{
							__instance.statsUIElements.playerStates[i].sprite = __instance.statsUIElements.deceasedIcon;
						}
					}
					else
					{
						__instance.statsUIElements.playerStates[i].sprite = __instance.statsUIElements.aliveIcon;
					}
					for (int j = 0; j < 3 && j < stats.allPlayerStats[i].playerNotes.Count; j++)
					{
						TextMeshProUGUI val2 = __instance.statsUIElements.playerNotesText[i];
						((TMP_Text)val2).text = ((TMP_Text)val2).text + "* " + stats.allPlayerStats[i].playerNotes[j] + "\n";
					}
				}
				else
				{
					((TMP_Text)__instance.statsUIElements.playerNotesText[i]).text = "";
				}
			}
			((TMP_Text)__instance.statsUIElements.quotaNumerator).text = RoundManager.Instance.scrapCollectedInLevel.ToString();
			((TMP_Text)__instance.statsUIElements.quotaDenominator).text = RoundManager.Instance.totalScrapValueInLevel.ToString();
			if (StartOfRound.Instance.allPlayersDead)
			{
				((Behaviour)__instance.statsUIElements.allPlayersDeadOverlay).enabled = true;
				((TMP_Text)__instance.statsUIElements.gradeLetter).text = "F";
				return false;
			}
			((Behaviour)__instance.statsUIElements.allPlayersDeadOverlay).enabled = false;
			int num3 = 0;
			float num4 = (float)RoundManager.Instance.scrapCollectedInLevel / RoundManager.Instance.totalScrapValueInLevel;
			if (num2 == StartOfRound.Instance.connectedPlayersAmount + 1)
			{
				num3++;
			}
			else if (num > 1)
			{
				num3--;
			}
			if (num4 >= 0.99f)
			{
				num3 += 2;
			}
			else if (num4 >= 0.6f)
			{
				num3++;
			}
			else if (num4 <= 0.25f)
			{
				num3--;
			}
			switch (num3)
			{
			case -1:
				((TMP_Text)__instance.statsUIElements.gradeLetter).text = "D";
				return false;
			case 0:
				((TMP_Text)__instance.statsUIElements.gradeLetter).text = "C";
				return false;
			case 1:
				((TMP_Text)__instance.statsUIElements.gradeLetter).text = "B";
				return false;
			case 2:
				((TMP_Text)__instance.statsUIElements.gradeLetter).text = "A";
				return false;
			case 3:
				((TMP_Text)__instance.statsUIElements.gradeLetter).text = "S";
				return false;
			default:
				return false;
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager), "Start")]
	public static class HudStartPatch
	{
		public static void Postfix(HUDManager __instance)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			EndOfGameStatUIElements statsUIElements = __instance.statsUIElements;
			GameObject gameObject = ((Component)((Component)statsUIElements.playerNamesText[0]).gameObject.transform.parent).gameObject;
			GameObject gameObject2 = ((Component)gameObject.transform.parent.parent).gameObject;
			GameObject gameObject3 = ((Component)gameObject2.transform.Find("BGBoxes")).gameObject;
			gameObject2.transform.parent.Find("DeathScreen").SetSiblingIndex(3);
			gameObject3.transform.localScale = new Vector3(2.5f, 1f, 1f);
			MakePlayerHolder(4, gameObject, statsUIElements, new Vector3(426.9556f, -0.7932f, 0f));
			MakePlayerHolder(5, gameObject, statsUIElements, new Vector3(426.9556f, -115.4483f, 0f));
			MakePlayerHolder(6, gameObject, statsUIElements, new Vector3(-253.6783f, -115.4483f, 0f));
			MakePlayerHolder(7, gameObject, statsUIElements, new Vector3(-253.6783f, -0.7932f, 0f));
			for (int i = 8; i < MainClass.newPlayerCount; i++)
			{
				MakePlayerHolder(i, gameObject, statsUIElements, new Vector3(10000f, 10000f, 0f));
			}
		}

		public static void MakePlayerHolder(int index, GameObject original, EndOfGameStatUIElements uiElements, Vector3 localPosition)
		{
			//IL_0049: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			if (index + 1 <= MainClass.newPlayerCount)
			{
				GameObject val = Object.Instantiate<GameObject>(original);
				RectTransform component = val.GetComponent<RectTransform>();
				RectTransform component2 = original.GetComponent<RectTransform>();
				((Transform)component).SetParent(((Transform)component2).parent);
				((Transform)component).localScale = new Vector3(1f, 1f, 1f);
				((Transform)component).localPosition = localPosition;
				GameObject gameObject = ((Component)val.transform.Find("PlayerName1")).gameObject;
				GameObject gameObject2 = ((Component)val.transform.Find("Notes")).gameObject;
				((Transform)gameObject2.GetComponent<RectTransform>()).localPosition = new Vector3(-95.7222f, 43.3303f, 0f);
				GameObject gameObject3 = ((Component)val.transform.Find("Symbol")).gameObject;
				if (index >= uiElements.playerNamesText.Length)
				{
					Array.Resize(ref uiElements.playerNamesText, index + 1);
					Array.Resize(ref uiElements.playerStates, index + 1);
					Array.Resize(ref uiElements.playerNotesText, index + 1);
				}
				uiElements.playerNamesText[index] = gameObject.GetComponent<TextMeshProUGUI>();
				uiElements.playerNotesText[index] = gameObject2.GetComponent<TextMeshProUGUI>();
				uiElements.playerStates[index] = gameObject3.GetComponent<Image>();
			}
		}
	}
	public static class PluginInformation
	{
		public const string PLUGIN_NAME = "MoreCompany";

		public const string PLUGIN_VERSION = "1.5.1";

		public const string PLUGIN_GUID = "me.swipez.melonloader.morecompany";
	}
	[BepInPlugin("me.swipez.melonloader.morecompany", "MoreCompany", "1.5.1")]
	public class MainClass : BaseUnityPlugin
	{
		public static int newPlayerCount = 32;

		public static int maxPlayerCount = 50;

		public static bool showCosmetics = true;

		public static List<PlayerControllerB> notSupposedToExistPlayers = new List<PlayerControllerB>();

		public static Texture2D mainLogo;

		public static GameObject quickMenuScrollParent;

		public static GameObject playerEntry;

		public static GameObject crewCountUI;

		public static GameObject cosmeticGUIInstance;

		public static GameObject cosmeticButton;

		public static ManualLogSource StaticLogger;

		public static Dictionary<int, List<string>> playerIdsAndCosmetics = new Dictionary<int, List<string>>();

		public static string cosmeticSavePath = Application.persistentDataPath + "/morecompanycosmetics.txt";

		public static string moreCompanySave = Application.persistentDataPath + "/morecompanysave.txt";

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			StaticLogger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("me.swipez.melonloader.morecompany");
			val.PatchAll();
			StaticLogger.LogInfo((object)"Loaded MoreCompany FULLY");
			ReadSettingsFromFile();
			ReadCosmeticsFromFile();
			StaticLogger.LogInfo((object)"Read settings and cosmetics");
			AssetBundle bundle = BundleUtilities.LoadBundleFromInternalAssembly("morecompany.assets", Assembly.GetExecutingAssembly());
			AssetBundle val2 = BundleUtilities.LoadBundleFromInternalAssembly("morecompany.cosmetics", Assembly.GetExecutingAssembly());
			CosmeticRegistry.LoadCosmeticsFromAssembly(Assembly.GetExecutingAssembly(), val2);
			val2.Unload(false);
			SteamFriends.OnGameLobbyJoinRequested += delegate(Lobby lobby, SteamId steamId)
			{
				newPlayerCount = ((Lobby)(ref lobby)).MaxMembers;
			};
			SteamMatchmaking.OnLobbyEntered += delegate(Lobby lobby)
			{
				newPlayerCount = ((Lobby)(ref lobby)).MaxMembers;
			};
			LoadAssets(bundle);
		}

		private void ReadCosmeticsFromFile()
		{
			if (File.Exists(cosmeticSavePath))
			{
				string[] array = File.ReadAllLines(cosmeticSavePath);
				string[] array2 = array;
				foreach (string item in array2)
				{
					CosmeticRegistry.locallySelectedCosmetics.Add(item);
				}
			}
		}

		public static void WriteCosmeticsToFile()
		{
			string text = "";
			foreach (string locallySelectedCosmetic in CosmeticRegistry.locallySelectedCosmetics)
			{
				text = text + locallySelectedCosmetic + "\n";
			}
			File.WriteAllText(cosmeticSavePath, text);
		}

		public static void SaveSettingsToFile()
		{
			string text = "";
			text = text + newPlayerCount + "\n";
			text = text + showCosmetics + "\n";
			File.WriteAllText(moreCompanySave, text);
		}

		public static void ReadSettingsFromFile()
		{
			if (File.Exists(moreCompanySave))
			{
				string[] array = File.ReadAllLines(moreCompanySave);
				try
				{
					newPlayerCount = int.Parse(array[0]);
					showCosmetics = bool.Parse(array[1]);
				}
				catch (Exception)
				{
					StaticLogger.LogError((object)"Failed to read settings from file, resetting to default");
					newPlayerCount = 32;
					showCosmetics = true;
				}
			}
		}

		private static void LoadAssets(AssetBundle bundle)
		{
			if (Object.op_Implicit((Object)(object)bundle))
			{
				mainLogo = bundle.LoadPersistentAsset<Texture2D>("assets/morecompanyassets/morecompanytransparentred.png");
				quickMenuScrollParent = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/quickmenuoverride.prefab");
				playerEntry = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/playerlistslot.prefab");
				cosmeticGUIInstance = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/testoverlay.prefab");
				cosmeticButton = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/cosmeticinstance.prefab");
				crewCountUI = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/crewcountfield.prefab");
				bundle.Unload(false);
			}
		}

		public static void ResizePlayerCache(Dictionary<uint, Dictionary<int, NetworkObject>> ScenePlacedObjects)
		{
			//IL_0091: 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_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Expected O, but got Unknown
			StartOfRound instance = StartOfRound.Instance;
			if (instance.allPlayerObjects.Length == newPlayerCount)
			{
				return;
			}
			playerIdsAndCosmetics.Clear();
			uint num = 10000u;
			int num2 = newPlayerCount - instance.allPlayerObjects.Length;
			int num3 = instance.allPlayerObjects.Length;
			GameObject val = instance.allPlayerObjects[3];
			for (int i = 0; i < num2; i++)
			{
				uint num4 = num + (uint)i;
				GameObject val2 = Object.Instantiate<GameObject>(val);
				NetworkObject component = val2.GetComponent<NetworkObject>();
				ReflectionUtils.SetFieldValue(component, "GlobalObjectIdHash", num4);
				Scene scene = ((Component)component).gameObject.scene;
				int handle = ((Scene)(ref scene)).handle;
				uint num5 = num4;
				if (!ScenePlacedObjects.ContainsKey(num5))
				{
					ScenePlacedObjects.Add(num5, new Dictionary<int, NetworkObject>());
				}
				if (ScenePlacedObjects[num5].ContainsKey(handle))
				{
					string arg = (((Object)(object)ScenePlacedObjects[num5][handle] != (Object)null) ? ((Object)ScenePlacedObjects[num5][handle]).name : "Null Entry");
					throw new Exception(((Object)component).name + " tried to registered with ScenePlacedObjects which already contains " + string.Format("the same {0} value {1} for {2}!", "GlobalObjectIdHash", num5, arg));
				}
				ScenePlacedObjects[num5].Add(handle, component);
				((Object)val2).name = $"Player ({4 + i})";
				val2.transform.parent = null;
				PlayerControllerB componentInChildren = val2.GetComponentInChildren<PlayerControllerB>();
				notSupposedToExistPlayers.Add(componentInChildren);
				componentInChildren.playerClientId = (ulong)(4 + i);
				componentInChildren.isPlayerControlled = false;
				componentInChildren.isPlayerDead = false;
				componentInChildren.DropAllHeldItems(false, false);
				componentInChildren.TeleportPlayer(instance.notSpawnedPosition.position, false, 0f, false, true);
				UnlockableSuit.SwitchSuitForPlayer(componentInChildren, 0, false);
				Array.Resize(ref instance.allPlayerObjects, instance.allPlayerObjects.Length + 1);
				Array.Resize(ref instance.allPlayerScripts, instance.allPlayerScripts.Length + 1);
				Array.Resize(ref instance.gameStats.allPlayerStats, instance.gameStats.allPlayerStats.Length + 1);
				Array.Resize(ref instance.playerSpawnPositions, instance.playerSpawnPositions.Length + 1);
				instance.allPlayerObjects[num3 + i] = val2;
				instance.gameStats.allPlayerStats[num3 + i] = new PlayerStats();
				instance.allPlayerScripts[num3 + i] = componentInChildren;
				instance.playerSpawnPositions[num3 + i] = instance.playerSpawnPositions[3];
			}
		}

		public static void EnablePlayerObjectsBasedOnConnected()
		{
			int connectedPlayersAmount = StartOfRound.Instance.connectedPlayersAmount;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				for (int j = 0; j < connectedPlayersAmount + 1; j++)
				{
					if (!val.isPlayerControlled)
					{
						((Component)val).gameObject.SetActive(false);
					}
					else
					{
						((Component)val).gameObject.SetActive(true);
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesServerRpc")]
	public static class SendNewPlayerValuesServerRpcPatch
	{
		public static ulong lastId;

		public static void Prefix(PlayerControllerB __instance, ulong newPlayerSteamId)
		{
			NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager;
			if (!((Object)(object)networkManager == (Object)null) && networkManager.IsListening && networkManager.IsServer)
			{
				lastId = newPlayerSteamId;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesClientRpc")]
	public static class SendNewPlayerValuesClientRpcPatch
	{
		public static void Prefix(PlayerControllerB __instance, ref ulong[] playerSteamIds)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager;
			if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
			{
				return;
			}
			if (StartOfRound.Instance.mapScreen.radarTargets.Count != MainClass.newPlayerCount)
			{
				List<PlayerControllerB> useless = new List<PlayerControllerB>();
				foreach (PlayerControllerB notSupposedToExistPlayer in MainClass.notSupposedToExistPlayers)
				{
					if (Object.op_Implicit((Object)(object)notSupposedToExistPlayer))
					{
						StartOfRound.Instance.mapScreen.radarTargets.Add(new TransformAndName(((Component)notSupposedToExistPlayer).transform, notSupposedToExistPlayer.playerUsername, false));
					}
					else
					{
						useless.Add(notSupposedToExistPlayer);
					}
				}
				MainClass.notSupposedToExistPlayers.RemoveAll((PlayerControllerB x) => useless.Contains(x));
			}
			if (!networkManager.IsServer)
			{
				return;
			}
			List<ulong> list = new List<ulong>();
			for (int i = 0; i < MainClass.newPlayerCount; i++)
			{
				if (i == (int)__instance.playerClientId)
				{
					list.Add(SendNewPlayerValuesServerRpcPatch.lastId);
				}
				else
				{
					list.Add(__instance.playersManager.allPlayerScripts[i].playerSteamId);
				}
			}
			playerSteamIds = list.ToArray();
		}
	}
	[HarmonyPatch(typeof(HUDManager), "SyncAllPlayerLevelsServerRpc")]
	public static class HUDManagerBullshitPatch
	{
		public static bool Prefix(HUDManager __instance)
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")]
	public static class SyncShipUnlockablePatch
	{
		public static void Prefix(StartOfRound __instance, ref int[] playerSuitIDs, bool shipLightsOn, Vector3[] placeableObjectPositions, Vector3[] placeableObjectRotations, int[] placeableObjects, int[] storedItems, int[] scrapValues, int[] itemSaveData)
		{
			NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager;
			if (!((Object)(object)networkManager == (Object)null) && networkManager.IsListening && networkManager.IsServer)
			{
				int[] array = new int[MainClass.newPlayerCount];
				for (int i = 0; i < MainClass.newPlayerCount; i++)
				{
					array[i] = __instance.allPlayerScripts[i].currentSuitID;
				}
				playerSuitIDs = array;
			}
		}
	}
	[HarmonyPatch(typeof(NetworkSceneManager), "PopulateScenePlacedObjects")]
	public static class ScenePlacedObjectsInitPatch
	{
		public static void Postfix(ref Dictionary<uint, Dictionary<int, NetworkObject>> ___ScenePlacedObjects)
		{
			MainClass.ResizePlayerCache(___ScenePlacedObjects);
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager), "LobbyDataIsJoinable")]
	public static class LobbyDataJoinablePatch
	{
		public static bool Prefix(ref bool __result)
		{
			__result = true;
			return false;
		}
	}
	[HarmonyPatch(typeof(NetworkConnectionManager), "HandleConnectionApproval")]
	public static class ConnectionApprovalTest
	{
		public static void Prefix(ulong ownerClientId, ConnectionApprovalResponse response)
		{
			if (Object.op_Implicit((Object)(object)StartOfRound.Instance))
			{
				if (StartOfRound.Instance.connectedPlayersAmount >= MainClass.newPlayerCount)
				{
					response.Approved = false;
					response.Reason = "Server is full";
				}
				else
				{
					response.Approved = true;
				}
			}
		}
	}
	[HarmonyPatch(typeof(SteamMatchmaking), "CreateLobbyAsync")]
	public static class LobbyThingPatch
	{
		public static void Prefix(ref int maxMembers)
		{
			MainClass.ReadSettingsFromFile();
			maxMembers = MainClass.newPlayerCount;
		}
	}
	public class ReflectionUtils
	{
		public static void InvokeMethod(object obj, string methodName, object[] parameters)
		{
			Type type = obj.GetType();
			MethodInfo method = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			method.Invoke(obj, parameters);
		}

		public static void InvokeMethod(object obj, Type forceType, string methodName, object[] parameters)
		{
			MethodInfo method = forceType.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			method.Invoke(obj, parameters);
		}

		public static void SetPropertyValue(object obj, string propertyName, object value)
		{
			Type type = obj.GetType();
			PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			property.SetValue(obj, value);
		}

		public static T InvokeMethod<T>(object obj, string methodName, object[] parameters)
		{
			Type type = obj.GetType();
			MethodInfo method = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			return (T)method.Invoke(obj, parameters);
		}

		public static T GetFieldValue<T>(object obj, string fieldName)
		{
			Type type = obj.GetType();
			FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			return (T)field.GetValue(obj);
		}

		public static void SetFieldValue(object obj, string fieldName, object value)
		{
			Type type = obj.GetType();
			FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			field.SetValue(obj, value);
		}
	}
	[HarmonyPatch(typeof(ShipTeleporter), "Awake")]
	public static class ShipTeleporterAwakePatch
	{
		public static void Postfix(ShipTeleporter __instance)
		{
			int[] array = new int[MainClass.newPlayerCount];
			for (int i = 0; i < MainClass.newPlayerCount; i++)
			{
				array[i] = -1;
			}
			ReflectionUtils.SetFieldValue(__instance, "playersBeingTeleported", array);
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "SpectateNextPlayer")]
	public static class SpectatePatches
	{
		public static bool Prefix(PlayerControllerB __instance)
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			if ((Object)(object)__instance.spectatedPlayerScript != (Object)null)
			{
				num = (int)__instance.spectatedPlayerScript.playerClientId;
			}
			for (int i = 0; i < MainClass.newPlayerCount; i++)
			{
				num = (num + 1) % MainClass.newPlayerCount;
				if (!__instance.playersManager.allPlayerScripts[num].isPlayerDead && __instance.playersManager.allPlayerScripts[num].isPlayerControlled && (Object)(object)__instance.playersManager.allPlayerScripts[num] != (Object)(object)__instance)
				{
					__instance.spectatedPlayerScript = __instance.playersManager.allPlayerScripts[num];
					__instance.SetSpectatedPlayerEffects(false);
					return false;
				}
			}
			if ((Object)(object)__instance.deadBody != (Object)null && ((Component)__instance.deadBody).gameObject.activeSelf)
			{
				__instance.spectateCameraPivot.position = __instance.deadBody.bodyParts[0].position;
				ReflectionUtils.InvokeMethod(__instance, "RaycastSpectateCameraAroundPivot", null);
			}
			StartOfRound.Instance.SetPlayerSafeInShip();
			return false;
		}
	}
	[HarmonyPatch(typeof(SoundManager), "Start")]
	public static class SoundManagerStartPatch
	{
		public static void Postfix()
		{
			int num = MainClass.newPlayerCount - 4;
			int num2 = 4;
			for (int i = 0; i < num; i++)
			{
				Array.Resize(ref SoundManager.Instance.playerVoicePitches, SoundManager.Instance.playerVoicePitches.Length + 1);
				Array.Resize(ref SoundManager.Instance.playerVoicePitchTargets, SoundManager.Instance.playerVoicePitchTargets.Length + 1);
				Array.Resize(ref SoundManager.Instance.playerVoiceVolumes, SoundManager.Instance.playerVoiceVolumes.Length + 1);
				Array.Resize(ref SoundManager.Instance.playerVoicePitchLerpSpeed, SoundManager.Instance.playerVoicePitchLerpSpeed.Length + 1);
				Array.Resize(ref SoundManager.Instance.playerVoiceMixers, SoundManager.Instance.playerVoiceMixers.Length + 1);
				AudioMixerGroup val = ((IEnumerable<AudioMixerGroup>)Resources.FindObjectsOfTypeAll<AudioMixerGroup>()).FirstOrDefault((Func<AudioMixerGroup, bool>)((AudioMixerGroup x) => ((Object)x).name.Contains("Voice")));
				SoundManager.Instance.playerVoicePitches[num2 + i] = 1f;
				SoundManager.Instance.playerVoicePitchTargets[num2 + i] = 1f;
				SoundManager.Instance.playerVoiceVolumes[num2 + i] = 0.5f;
				SoundManager.Instance.playerVoicePitchLerpSpeed[num2 + i] = 3f;
				SoundManager.Instance.playerVoiceMixers[num2 + i] = val;
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "GetPlayerSpawnPosition")]
	public static class SpawnPositionClampPatch
	{
		public static void Prefix(ref int playerNum, bool simpleTeleport = false)
		{
			if (playerNum > 3)
			{
				playerNum = 3;
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "OnClientConnect")]
	public static class OnClientConnectedPatch
	{
		public static bool Prefix(StartOfRound __instance, ulong clientId)
		{
			if (!((NetworkBehaviour)__instance).IsServer)
			{
				return false;
			}
			Debug.Log((object)"player connected");
			Debug.Log((object)$"connected players #: {__instance.connectedPlayersAmount}");
			try
			{
				List<int> list = __instance.ClientPlayerList.Values.ToList();
				Debug.Log((object)$"Connecting new player on host; clientId: {clientId}");
				int num = 0;
				for (int i = 1; i < MainClass.newPlayerCount; i++)
				{
					if (!list.Contains(i))
					{
						num = i;
						break;
					}
				}
				__instance.allPlayerScripts[num].actualClientId = clientId;
				__instance.allPlayerObjects[num].GetComponent<NetworkObject>().ChangeOwnership(clientId);
				Debug.Log((object)$"New player assigned object id: {__instance.allPlayerObjects[num]}");
				List<ulong> list2 = new List<ulong>();
				for (int j = 0; j < __instance.allPlayerObjects.Length; j++)
				{
					NetworkObject component = __instance.allPlayerObjects[j].GetComponent<NetworkObject>();
					if (!component.IsOwnedByServer)
					{
						list2.Add(component.OwnerClientId);
					}
					else if (j == 0)
					{
						list2.Add(NetworkManager.Singleton.LocalClientId);
					}
					else
					{
						list2.Add(999uL);
					}
				}
				int groupCredits = Object.FindObjectOfType<Terminal>().groupCredits;
				int profitQuota = TimeOfDay.Instance.profitQuota;
				int quotaFulfilled = TimeOfDay.Instance.quotaFulfilled;
				int num2 = (int)TimeOfDay.Instance.timeUntilDeadline;
				ReflectionUtils.InvokeMethod(__instance, "OnPlayerConnectedClientRpc", new object[10]
				{
					clientId,
					__instance.connectedPlayersAmount,
					list2.ToArray(),
					num,
					groupCredits,
					__instance.currentLevelID,
					profitQuota,
					num2,
					quotaFulfilled,
					__instance.randomMapSeed
				});
				__instance.ClientPlayerList.Add(clientId, num);
				Debug.Log((object)$"client id connecting: {clientId} ; their corresponding player object id: {num}");
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Error occured in OnClientConnected! Shutting server down. clientId: {clientId}. Error: {arg}");
				GameNetworkManager.Instance.disconnectionReasonMessage = "Error occured when a player attempted to join the server! Restart the application and please report the glitch!";
				GameNetworkManager.Instance.Disconnect();
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(SteamLobbyManager), "LoadServerList")]
	public static class LoadServerListPatch
	{
		public static bool Prefix(SteamLobbyManager __instance)
		{
			OverrideMethod(__instance);
			return false;
		}

		private static async void OverrideMethod(SteamLobbyManager __instance)
		{
			if (GameNetworkManager.Instance.waitingForLobbyDataRefresh)
			{
				return;
			}
			ReflectionUtils.SetFieldValue(__instance, "refreshServerListTimer", 0f);
			((TMP_Text)__instance.serverListBlankText).text = "Loading server list...";
			ReflectionUtils.GetFieldValue<Lobby[]>(__instance, "currentLobbyList");
			LobbySlot[] array = Object.FindObjectsOfType<LobbySlot>();
			for (int i = 0; i < array.Length; i++)
			{
				Object.Destroy((Object)(object)((Component)array[i]).gameObject);
			}
			LobbyQuery val;
			switch (__instance.sortByDistanceSetting)
			{
			case 0:
				val = SteamMatchmaking.LobbyList;
				((LobbyQuery)(ref val)).FilterDistanceClose();
				break;
			case 1:
				val = SteamMatchmaking.LobbyList;
				((LobbyQuery)(ref val)).FilterDistanceFar();
				break;
			case 2:
				val = SteamMatchmaking.LobbyList;
				((LobbyQuery)(ref val)).FilterDistanceWorldwide();
				break;
			}
			Debug.Log((object)"Requested server list");
			GameNetworkManager.Instance.waitingForLobbyDataRefresh = true;
			Lobby[] currentLobbyList;
			switch (__instance.sortByDistanceSetting)
			{
			case 0:
				val = SteamMatchmaking.LobbyList;
				val = ((LobbyQuery)(ref val)).FilterDistanceClose();
				val = ((LobbyQuery)(ref val)).WithSlotsAvailable(1);
				val = ((LobbyQuery)(ref val)).WithKeyValue("vers", GameNetworkManager.Instance.gameVersionNum.ToString());
				currentLobbyList = await ((LobbyQuery)(ref val)).RequestAsync();
				break;
			case 1:
				val = SteamMatchmaking.LobbyList;
				val = ((LobbyQuery)(ref val)).FilterDistanceFar();
				val = ((LobbyQuery)(ref val)).WithSlotsAvailable(1);
				val = ((LobbyQuery)(ref val)).WithKeyValue("vers", GameNetworkManager.Instance.gameVersionNum.ToString());
				currentLobbyList = await ((LobbyQuery)(ref val)).RequestAsync();
				break;
			default:
				val = SteamMatchmaking.LobbyList;
				val = ((LobbyQuery)(ref val)).FilterDistanceWorldwide();
				val = ((LobbyQuery)(ref val)).WithSlotsAvailable(1);
				val = ((LobbyQuery)(ref val)).WithKeyValue("vers", GameNetworkManager.Instance.gameVersionNum.ToString());
				currentLobbyList = await ((LobbyQuery)(ref val)).RequestAsync();
				break;
			}
			GameNetworkManager.Instance.waitingForLobbyDataRefresh = false;
			if (currentLobbyList != null)
			{
				Debug.Log((object)"Got lobby list!");
				ReflectionUtils.InvokeMethod(__instance, "DebugLogServerList", null);
				if (currentLobbyList.Length == 0)
				{
					((TMP_Text)__instance.serverListBlankText).text = "No available servers to join.";
				}
				else
				{
					((TMP_Text)__instance.serverListBlankText).text = "";
				}
				ReflectionUtils.SetFieldValue(__instance, "lobbySlotPositionOffset", 0f);
				for (int j = 0; j < currentLobbyList.Length; j++)
				{
					Friend[] array2 = SteamFriends.GetBlocked().ToArray();
					if (array2 != null)
					{
						for (int k = 0; k < array2.Length; k++)
						{
							Debug.Log((object)$"blocked user: {((Friend)(ref array2[k])).Name}; id: {array2[k].Id}");
							if (((Lobby)(ref currentLobbyList[j])).IsOwnedBy(array2[k].Id))
							{
								Debug.Log((object)("Hiding lobby by blocked user: " + ((Friend)(ref array2[k])).Name));
							}
						}
					}
					else
					{
						Debug.Log((object)"Blocked users list is null");
					}
					GameObject gameObject = Object.Instantiate<GameObject>(__instance.LobbySlotPrefab, __instance.levelListContainer);
					gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 0f + ReflectionUtils.GetFieldValue<float>(__instance, "lobbySlotPositionOffset"));
					ReflectionUtils.SetFieldValue(__instance, "lobbySlotPositionOffset", ReflectionUtils.GetFieldValue<float>(__instance, "lobbySlotPositionOffset") - 42f);
					LobbySlot componentInChildren = gameObject.GetComponentInChildren<LobbySlot>();
					((TMP_Text)componentInChildren.LobbyName).text = ((Lobby)(ref currentLobbyList[j])).GetData("name");
					((TMP_Text)componentInChildren.playerCount).text = $"{((Lobby)(ref currentLobbyList[j])).MemberCount} / {((Lobby)(ref currentLobbyList[j])).MaxMembers}";
					componentInChildren.lobbyId = ((Lobby)(ref currentLobbyList[j])).Id;
					componentInChildren.thisLobby = currentLobbyList[j];
					ReflectionUtils.SetFieldValue(__instance, "currentLobbyList", currentLobbyList);
				}
			}
			else
			{
				Debug.Log((object)"Lobby list is null after request.");
				((TMP_Text)__instance.serverListBlankText).text = "No available servers to join.";
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager), "Awake")]
	public static class GameNetworkAwakePatch
	{
		public static int originalVersion;

		public static void Postfix(GameNetworkManager __instance)
		{
			originalVersion = __instance.gameVersionNum;
			if (!AssemblyChecker.HasAssemblyLoaded("lc_api"))
			{
				__instance.gameVersionNum = 9999;
			}
		}
	}
	[HarmonyPatch(typeof(MenuManager), "Awake")]
	public static class MenuManagerVersionDisplayPatch
	{
		public static void Postfix(MenuManager __instance)
		{
			if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)__instance.versionNumberText != (Object)null)
			{
				((TMP_Text)__instance.versionNumberText).text = $"v{GameNetworkAwakePatch.originalVersion} (MC)";
			}
		}
	}
}
namespace MoreCompany.Utils
{
	public class AssemblyChecker
	{
		public static bool HasAssemblyLoaded(string name)
		{
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			Assembly[] array = assemblies;
			foreach (Assembly assembly in array)
			{
				if (assembly.GetName().Name.ToLower().Equals(name))
				{
					return true;
				}
			}
			return false;
		}
	}
	public class BundleUtilities
	{
		public static byte[] GetResourceBytes(string filename, Assembly assembly)
		{
			string[] manifestResourceNames = assembly.GetManifestResourceNames();
			foreach (string text in manifestResourceNames)
			{
				if (!text.Contains(filename))
				{
					continue;
				}
				using Stream stream = assembly.GetManifestResourceStream(text);
				if (stream == null)
				{
					return null;
				}
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
				return array;
			}
			return null;
		}

		public static AssetBundle LoadBundleFromInternalAssembly(string filename, Assembly assembly)
		{
			return AssetBundle.LoadFromMemory(GetResourceBytes(filename, assembly));
		}
	}
	public static class AssetBundleExtension
	{
		public static T LoadPersistentAsset<T>(this AssetBundle bundle, string name) where T : Object
		{
			Object val = bundle.LoadAsset(name);
			if (val != (Object)null)
			{
				val.hideFlags = (HideFlags)32;
				return (T)(object)val;
			}
			return default(T);
		}
	}
}
namespace MoreCompany.Cosmetics
{
	public class CosmeticApplication : MonoBehaviour
	{
		public Transform head;

		public Transform hip;

		public Transform lowerArmRight;

		public Transform shinLeft;

		public Transform shinRight;

		public List<CosmeticInstance> spawnedCosmetics = new List<CosmeticInstance>();

		public void Awake()
		{
			head = ((Component)this).transform.Find("spine").Find("spine.001").Find("spine.002")
				.Find("spine.003")
				.Find("spine.004");
			lowerArmRight = ((Component)this).transform.Find("spine").Find("spine.001").Find("spine.002")
				.Find("spine.003")
				.Find("shoulder.R")
				.Find("arm.R_upper")
				.Find("arm.R_lower");
			hip = ((Component)this).transform.Find("spine");
			shinLeft = ((Component)this).transform.Find("spine").Find("thigh.L").Find("shin.L");
			shinRight = ((Component)this).transform.Find("spine").Find("thigh.R").Find("shin.R");
		}

		private void Update()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics)
			{
				if (spawnedCosmetic.cosmeticType == CosmeticType.HAT)
				{
					((Component)spawnedCosmetic).transform.position = head.position;
					((Component)spawnedCosmetic).transform.rotation = head.rotation;
				}
				else if (spawnedCosmetic.cosmeticType == CosmeticType.R_LOWER_ARM)
				{
					((Component)spawnedCosmetic).transform.position = lowerArmRight.position;
					((Component)spawnedCosmetic).transform.rotation = lowerArmRight.rotation;
				}
				else if (spawnedCosmetic.cosmeticType == CosmeticType.HIP)
				{
					((Component)spawnedCosmetic).transform.position = hip.position;
					((Component)spawnedCosmetic).transform.rotation = hip.rotation;
				}
				else if (spawnedCosmetic.cosmeticType == CosmeticType.L_Shin)
				{
					((Component)spawnedCosmetic).transform.position = shinLeft.position;
					((Component)spawnedCosmetic).transform.rotation = shinLeft.rotation;
				}
				else if (spawnedCosmetic.cosmeticType == CosmeticType.R_Shin)
				{
					((Component)spawnedCosmetic).transform.position = shinRight.position;
					((Component)spawnedCosmetic).transform.rotation = shinRight.rotation;
				}
			}
		}

		private void OnDisable()
		{
			foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics)
			{
				((Component)spawnedCosmetic).gameObject.SetActive(false);
			}
		}

		private void OnEnable()
		{
			foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics)
			{
				((Component)spawnedCosmetic).gameObject.SetActive(true);
			}
		}

		public void ClearCosmetics()
		{
			foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics)
			{
				Object.Destroy((Object)(object)((Component)spawnedCosmetic).gameObject);
			}
			spawnedCosmetics.Clear();
		}

		public void ApplyCosmetic(string cosmeticId, bool startEnabled)
		{
			if (CosmeticRegistry.cosmeticInstances.ContainsKey(cosmeticId))
			{
				CosmeticInstance cosmeticInstance = CosmeticRegistry.cosmeticInstances[cosmeticId];
				GameObject val = Object.Instantiate<GameObject>(((Component)cosmeticInstance).gameObject);
				val.SetActive(startEnabled);
				CosmeticInstance component = val.GetComponent<CosmeticInstance>();
				spawnedCosmetics.Add(component);
			}
		}
	}
	public class CosmeticInstance : MonoBehaviour
	{
		public CosmeticType cosmeticType;

		public string cosmeticId;

		public Texture2D icon;
	}
	public class CosmeticGeneric
	{
		public virtual string gameObjectPath { get; }

		public virtual string cosmeticId { get; }

		public virtual string textureIconPath { get; }

		public virtual CosmeticType cosmeticType { get; }

		public void LoadFromBundle(AssetBundle bundle)
		{
			GameObject val = bundle.LoadPersistentAsset<GameObject>(gameObjectPath);
			Texture2D icon = bundle.LoadPersistentAsset<Texture2D>(textureIconPath);
			CosmeticInstance cosmeticInstance = val.AddComponent<CosmeticInstance>();
			cosmeticInstance.cosmeticId = cosmeticId;
			cosmeticInstance.icon = icon;
			cosmeticInstance.cosmeticType = cosmeticType;
			MainClass.StaticLogger.LogInfo((object)("Loaded cosmetic: " + cosmeticId + " from bundle: " + ((Object)bundle).name));
			CosmeticRegistry.cosmeticInstances.Add(cosmeticId, cosmeticInstance);
		}
	}
	public enum CosmeticType
	{
		HAT,
		WRIST,
		CHEST,
		R_LOWER_ARM,
		HIP,
		L_Shin,
		R_Shin
	}
	public class CosmeticRegistry
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__6_0;

			public static UnityAction <>9__6_1;

			internal void <SpawnCosmeticGUI>b__6_0()
			{
				MainClass.showCosmetics = true;
				MainClass.SaveSettingsToFile();
			}

			internal void <SpawnCosmeticGUI>b__6_1()
			{
				MainClass.showCosmetics = false;
				MainClass.SaveSettingsToFile();
			}
		}

		public static Dictionary<string, CosmeticInstance> cosmeticInstances = new Dictionary<string, CosmeticInstance>();

		public static GameObject cosmeticGUI;

		private static GameObject displayGuy;

		private static CosmeticApplication cosmeticApplication;

		public static List<string> locallySelectedCosmetics = new List<string>();

		public static void LoadCosmeticsFromAssembly(Assembly assembly, AssetBundle bundle)
		{
			Type[] types = assembly.GetTypes();
			foreach (Type type in types)
			{
				if (type.IsSubclassOf(typeof(CosmeticGeneric)))
				{
					CosmeticGeneric cosmeticGeneric = (CosmeticGeneric)type.GetConstructor(new Type[0]).Invoke(new object[0]);
					cosmeticGeneric.LoadFromBundle(bundle);
				}
			}
		}

		public static void SpawnCosmeticGUI()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Expected O, but got Unknown
			cosmeticGUI = Object.Instantiate<GameObject>(MainClass.cosmeticGUIInstance);
			((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale")).transform.localScale = new Vector3(2f, 2f, 2f);
			displayGuy = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen")
				.Find("ObjectHolder")
				.Find("ScavengerModel")
				.Find("metarig")).gameObject;
			cosmeticApplication = displayGuy.AddComponent<CosmeticApplication>();
			GameObject gameObject = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen")
				.Find("EnableButton")).gameObject;
			ButtonClickedEvent onClick = gameObject.GetComponent<Button>().onClick;
			object obj = <>c.<>9__6_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					MainClass.showCosmetics = true;
					MainClass.SaveSettingsToFile();
				};
				<>c.<>9__6_0 = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			GameObject gameObject2 = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen")
				.Find("DisableButton")).gameObject;
			ButtonClickedEvent onClick2 = gameObject2.GetComponent<Button>().onClick;
			object obj2 = <>c.<>9__6_1;
			if (obj2 == null)
			{
				UnityAction val2 = delegate
				{
					MainClass.showCosmetics = false;
					MainClass.SaveSettingsToFile();
				};
				<>c.<>9__6_1 = val2;
				obj2 = (object)val2;
			}
			((UnityEvent)onClick2).AddListener((UnityAction)obj2);
			if (MainClass.showCosmetics)
			{
				gameObject.SetActive(false);
				gameObject2.SetActive(true);
			}
			else
			{
				gameObject.SetActive(true);
				gameObject2.SetActive(false);
			}
			PopulateCosmetics();
			UpdateCosmeticsOnDisplayGuy(startEnabled: false);
		}

		public static void PopulateCosmetics()
		{
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Expected O, but got Unknown
			GameObject gameObject = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen")
				.Find("CosmeticsHolder")
				.Find("Content")).gameObject;
			List<Transform> list = new List<Transform>();
			for (int i = 0; i < gameObject.transform.childCount; i++)
			{
				list.Add(gameObject.transform.GetChild(i));
			}
			foreach (Transform item in list)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			foreach (KeyValuePair<string, CosmeticInstance> cosmeticInstance in cosmeticInstances)
			{
				GameObject val = Object.Instantiate<GameObject>(MainClass.cosmeticButton, gameObject.transform);
				val.transform.localScale = Vector3.one;
				GameObject disabledOverlay = ((Component)val.transform.Find("Deselected")).gameObject;
				disabledOverlay.SetActive(true);
				GameObject enabledOverlay = ((Component)val.transform.Find("Selected")).gameObject;
				enabledOverlay.SetActive(true);
				if (IsEquipped(cosmeticInstance.Value.cosmeticId))
				{
					enabledOverlay.SetActive(true);
					disabledOverlay.SetActive(false);
				}
				else
				{
					enabledOverlay.SetActive(false);
					disabledOverlay.SetActive(true);
				}
				RawImage component = ((Component)val.transform.Find("Icon")).GetComponent<RawImage>();
				component.texture = (Texture)(object)cosmeticInstance.Value.icon;
				Button component2 = val.GetComponent<Button>();
				((UnityEvent)component2.onClick).AddListener((UnityAction)delegate
				{
					ToggleCosmetic(cosmeticInstance.Value.cosmeticId);
					if (IsEquipped(cosmeticInstance.Value.cosmeticId))
					{
						enabledOverlay.SetActive(true);
						disabledOverlay.SetActive(false);
					}
					else
					{
						enabledOverlay.SetActive(false);
						disabledOverlay.SetActive(true);
					}
					MainClass.WriteCosmeticsToFile();
					UpdateCosmeticsOnDisplayGuy(startEnabled: true);
				});
			}
		}

		private static Color HexToColor(string hex)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Color result = default(Color);
			ColorUtility.TryParseHtmlString(hex, ref result);
			return result;
		}

		public static void UpdateCosmeticsOnDisplayGuy(bool startEnabled)
		{
			cosmeticApplication.ClearCosmetics();
			foreach (string locallySelectedCosmetic in locallySelectedCosmetics)
			{
				cosmeticApplication.ApplyCosmetic(locallySelectedCosmetic, startEnabled);
			}
			foreach (CosmeticInstance spawnedCosmetic in cosmeticApplication.spawnedCosmetics)
			{
				RecursiveLayerChange(((Component)spawnedCosmetic).transform, 5);
			}
		}

		private static void RecursiveLayerChange(Transform transform, int layer)
		{
			((Component)transform).gameObject.layer = layer;
			for (int i = 0; i < transform.childCount; i++)
			{
				RecursiveLayerChange(transform.GetChild(i), layer);
			}
		}

		public static bool IsEquipped(string cosmeticId)
		{
			return locallySelectedCosmetics.Contains(cosmeticId);
		}

		public static void ToggleCosmetic(string cosmeticId)
		{
			if (locallySelectedCosmetics.Contains(cosmeticId))
			{
				locallySelectedCosmetics.Remove(cosmeticId);
			}
			else
			{
				locallySelectedCosmetics.Add(cosmeticId);
			}
		}
	}
}
namespace MoreCompany.Cosmetics.BuiltIn
{
	public class BunnyEarsCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/bunnyearscosmetic.prefab";

		public override string cosmeticId => "builtin.bunnyears";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/bunnyearsicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class DenimHatCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/denimhatcosmetic.prefab";

		public override string cosmeticId => "builtin.denimhat";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/denimcapicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class FancyGlassesCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/fancyglassescosmetic.prefab";

		public override string cosmeticId => "builtin.fancyglasses";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/fancyglassesicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class FancyPantsCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/mustacheandmonocle.prefab";

		public override string cosmeticId => "builtin.fancypants";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/fancypantsicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class HardHatCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/hardhatcosmetic.prefab";

		public override string cosmeticId => "builtin.hardhat";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/hardhaticon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class JesterHatCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/jesterhatcosmetic.prefab";

		public override string cosmeticId => "builtin.jesterhat";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/jesterhaticon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class KittyEarsCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/kittyearscosmetic.prefab";

		public override string cosmeticId => "builtin.kittyears";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/kittyearsicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class PlagueMaskCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/plaguemaskcosmetic.prefab";

		public override string cosmeticId => "builtin.plaguemask";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/plaguemaskicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class RealisticEyeballsCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/realisticeyeballscosmetic.prefab";

		public override string cosmeticId => "builtin.eyeballs";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/eyecosmeticicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class RudolphCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/rudolphcosmetic.prefab";

		public override string cosmeticId => "builtin.rudolph";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/rudolphhatcosmetic.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class SantaHatCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/santahatcosmetic.prefab";

		public override string cosmeticId => "builtin.santahat";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/santahatcosmeticicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class SlimeThingCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/slimething.prefab";

		public override string cosmeticId => "builtin.slimething";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/slimethingicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class ThreeDGlassesCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/3dglassescosmetic.prefab";

		public override string cosmeticId => "builtin.3dglasses";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/3dglassesicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class GunHolsterCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/gunholstercosmetic.prefab";

		public override string cosmeticId => "builtin.gunholster";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/gunholstericon.png";

		public override CosmeticType cosmeticType => CosmeticType.HIP;
	}
	public class PartyGlassesCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/glassescosmetic.prefab";

		public override string cosmeticId => "builtin.partyglasses";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/glassesicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class PartyHatCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/partyhatcosmetic.prefab";

		public override string cosmeticId => "builtin.partyhat";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/party_hat_render.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class TopHatCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/tophatcosmetic.prefab";

		public override string cosmeticId => "builtin.tophat";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/tophatcosmeticicon.png";

		public override CosmeticType cosmeticType => CosmeticType.HAT;
	}
	public class WatchCosmetic : CosmeticGeneric
	{
		public override string gameObjectPath => "assets/morecompanyassets/cosmetics/watchcosmetic.prefab";

		public override string cosmeticId => "builtin.watch";

		public override string textureIconPath => "assets/morecompanyassets/cosmetics/watchicon.png";

		public override CosmeticType cosmeticType => CosmeticType.R_LOWER_ARM;
	}
}

Pooble-LCBetterSaves/LCBetterSaves.dll

Decompiled 6 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using LCBetterSaves;
using LCBetterSaves.Properties;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[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("LCBetterSaves")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Better save files for Lethal Company")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0+ba5d94d1882a218e15927394f84326c7e4375b48")]
[assembly: AssemblyProduct("LCBetterSaves")]
[assembly: AssemblyTitle("LCBetterSaves")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.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;
		}
	}
}
public class NewFileUISlot_BetterSaves : MonoBehaviour
{
	public Animator buttonAnimator;

	public Button button;

	public bool isSelected;

	public void Awake()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		buttonAnimator = ((Component)this).GetComponent<Animator>();
		button = ((Component)this).GetComponent<Button>();
		((UnityEvent)button.onClick).AddListener(new UnityAction(SetFileToThis));
	}

	public void SetFileToThis()
	{
		string currentSaveFileName = "LCSaveFile" + Plugin.newSaveFileNum;
		GameNetworkManager.Instance.currentSaveFileName = currentSaveFileName;
		GameNetworkManager.Instance.saveFileNum = Plugin.newSaveFileNum;
		SetButtonColorForAllFileSlots();
		isSelected = true;
		SetButtonColor();
	}

	public void SetButtonColorForAllFileSlots()
	{
		SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
		SaveFileUISlot_BetterSaves[] array2 = array;
		foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
		{
			saveFileUISlot_BetterSaves.SetButtonColor();
			saveFileUISlot_BetterSaves.deleteButton.SetActive(false);
			saveFileUISlot_BetterSaves.renameButton.SetActive(false);
		}
	}

	public void SetButtonColor()
	{
		buttonAnimator.SetBool("isPressed", isSelected);
	}
}
public class SaveFileUISlot_BetterSaves : MonoBehaviour
{
	public Animator buttonAnimator;

	public Button button;

	public TextMeshProUGUI fileStatsText;

	public int fileNum;

	public string fileString;

	public TextMeshProUGUI fileNotCompatibleAlert;

	public GameObject deleteButton;

	public GameObject renameButton;

	public void Awake()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		buttonAnimator = ((Component)this).GetComponent<Animator>();
		button = ((Component)this).GetComponent<Button>();
		((UnityEvent)button.onClick).AddListener(new UnityAction(SetFileToThis));
		fileStatsText = ((Component)((Component)this).transform.GetChild(2)).GetComponent<TextMeshProUGUI>();
		fileNotCompatibleAlert = ((Component)((Component)this).transform.GetChild(4)).GetComponent<TextMeshProUGUI>();
		deleteButton = ((Component)((Component)this).transform.GetChild(3)).gameObject;
	}

	public void Start()
	{
		UpdateStats();
	}

	private void OnEnable()
	{
		if (!Object.FindObjectOfType<MenuManager>().filesCompatible[fileNum])
		{
			((Behaviour)fileNotCompatibleAlert).enabled = true;
		}
	}

	public void UpdateStats()
	{
		try
		{
			if (ES3.FileExists(fileString))
			{
				int num = ES3.Load<int>("GroupCredits", fileString, 30);
				int num2 = ES3.Load<int>("Stats_DaysSpent", fileString, 0);
				((TMP_Text)fileStatsText).text = $"${num}\nDays: {num2}";
			}
			else
			{
				((TMP_Text)fileStatsText).text = "";
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("Error updating stats: " + ex.Message));
		}
	}

	public void SetButtonColor()
	{
		buttonAnimator.SetBool("isPressed", GameNetworkManager.Instance.currentSaveFileName == fileString);
	}

	public void SetFileToThis()
	{
		Plugin.fileToModify = fileNum;
		GameNetworkManager.Instance.currentSaveFileName = fileString;
		GameNetworkManager.Instance.saveFileNum = fileNum;
		SetButtonColorForAllFileSlots();
	}

	public void SetButtonColorForAllFileSlots()
	{
		SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
		SaveFileUISlot_BetterSaves[] array2 = array;
		foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
		{
			saveFileUISlot_BetterSaves.SetButtonColor();
			saveFileUISlot_BetterSaves.deleteButton.SetActive((Object)(object)saveFileUISlot_BetterSaves == (Object)(object)this);
			saveFileUISlot_BetterSaves.renameButton.SetActive((Object)(object)saveFileUISlot_BetterSaves == (Object)(object)this);
		}
		NewFileUISlot_BetterSaves newFileUISlot_BetterSaves = Object.FindObjectOfType<NewFileUISlot_BetterSaves>();
		newFileUISlot_BetterSaves.isSelected = false;
		newFileUISlot_BetterSaves.SetButtonColor();
	}
}
public class RenameFileButton_BetterSaves : MonoBehaviour
{
	public void RenameFile()
	{
		string text = $"LCSaveFile{Plugin.fileToModify}";
		string text2 = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/Panel/LobbyHostOptions/OptionsNormal/ServerNameField/Text Area/Text").GetComponent<TMP_Text>().text;
		if (ES3.FileExists(text))
		{
			ES3.Save<string>("Alias_BetterSaves", text2, text);
			Debug.Log((object)("Granted alias " + text2 + " to file " + text));
		}
		Plugin.RefreshNameFields();
	}
}
public class DeleteFileButton_BetterSaves : MonoBehaviour
{
	public int fileToDelete;

	public AudioClip deleteFileSFX;

	public TextMeshProUGUI deleteFileText;

	public void UpdateFileToDelete()
	{
		fileToDelete = Plugin.fileToModify;
		if (ES3.Load<string>("Alias_BetterSaves", $"LCSaveFile{fileToDelete}", "") != "")
		{
			((TMP_Text)deleteFileText).text = "Do you want to delete file (" + ES3.Load<string>("Alias_BetterSaves", $"LCSaveFile{fileToDelete}", "") + ")?";
		}
		else
		{
			((TMP_Text)deleteFileText).text = $"Do you want to delete File {fileToDelete + 1}?";
		}
	}

	public void DeleteFile()
	{
		string text = $"LCSaveFile{fileToDelete}";
		if (ES3.FileExists(text))
		{
			ES3.DeleteFile(text);
			Object.FindObjectOfType<MenuManager>().MenuAudio.PlayOneShot(deleteFileSFX);
		}
		SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>(true);
		SaveFileUISlot_BetterSaves[] array2 = array;
		foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
		{
			Debug.Log((object)$"Deleted {fileToDelete}");
			if (saveFileUISlot_BetterSaves.fileNum == fileToDelete)
			{
				((Behaviour)saveFileUISlot_BetterSaves.fileNotCompatibleAlert).enabled = false;
				Object.FindObjectOfType<MenuManager>().filesCompatible[fileToDelete] = true;
			}
		}
		Plugin.InitializeBetterSaves();
	}
}
namespace LCBetterSaves
{
	[BepInPlugin("LCBetterSaves", "LCBetterSaves", "1.4.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony = new Harmony("BetterSaves");

		public static int fileToModify = -1;

		public static int newSaveFileNum;

		public static Sprite renameSprite;

		public static MenuManager menuManager;

		public static AudioClip deleteFileSFX;

		public static TextMeshProUGUI deleteFileText;

		public static float buttonBaseY;

		public void Awake()
		{
			_harmony.PatchAll(typeof(Plugin));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LCBetterSaves is loaded!");
		}

		[HarmonyPatch(typeof(MenuManager), "Start")]
		public static void Postfix(MenuManager __instance)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			menuManager = __instance;
			if ((Object)(object)renameSprite == (Object)null)
			{
				AssetBundle val = AssetBundle.LoadFromMemory(Resources.lcbettersaves);
				Texture2D val2 = val.LoadAsset<Texture2D>("Assets/RenameSprite.png");
				renameSprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f));
			}
			InitializeBetterSaves();
		}

		public static void InitializeBetterSaves()
		{
			try
			{
				DestroyBetterSavesButtons();
				DestroyOriginalSaveButtons();
				UpdateTopText();
				CreateModdedDeleteFileButton();
				CreateBetterSaveButtons();
				UpdateFilesPanelRect(CountSaveFiles());
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("An error occurred during initialization: " + ex.Message));
			}
		}

		public static void DestroyBetterSavesButtons()
		{
			try
			{
				SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
				foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array)
				{
					Object.Destroy((Object)(object)((Component)saveFileUISlot_BetterSaves).gameObject);
				}
				NewFileUISlot_BetterSaves[] array2 = Object.FindObjectsOfType<NewFileUISlot_BetterSaves>();
				foreach (NewFileUISlot_BetterSaves newFileUISlot_BetterSaves in array2)
				{
					Object.Destroy((Object)(object)((Component)newFileUISlot_BetterSaves).gameObject);
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Error occurred while destroying better saves buttons: " + ex.Message));
			}
		}

		public static void UpdateTopText()
		{
			GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/EnterAName");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Panel label not found.");
			}
			else
			{
				((TMP_Text)val.GetComponent<TextMeshProUGUI>()).text = "BetterSaves";
			}
		}

		public static void CreateModdedDeleteFileButton()
		{
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			GameObject val = GameObject.Find("Canvas/MenuContainer/DeleteFileConfirmation/Panel/Delete");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Delete file game object not found.");
				return;
			}
			if ((Object)(object)val.GetComponent<DeleteFileButton_BetterSaves>() != (Object)null)
			{
				Debug.LogWarning((object)"DeleteFileButton_BetterSaves component already exists on deleteFileGO");
				return;
			}
			DeleteFileButton component = val.GetComponent<DeleteFileButton>();
			if ((Object)(object)component == (Object)null)
			{
				Debug.LogError((object)"DeleteFileButton component not found on deleteFileGO");
				return;
			}
			if ((Object)(object)deleteFileSFX == (Object)null)
			{
				deleteFileSFX = component.deleteFileSFX;
			}
			if ((Object)(object)deleteFileText == (Object)null)
			{
				deleteFileText = component.deleteFileText;
			}
			Object.Destroy((Object)(object)component);
			if ((Object)(object)val.GetComponent<DeleteFileButton_BetterSaves>() == (Object)null)
			{
				DeleteFileButton_BetterSaves deleteFileButton_BetterSaves = val.AddComponent<DeleteFileButton_BetterSaves>();
				deleteFileButton_BetterSaves.deleteFileSFX = deleteFileSFX;
				deleteFileButton_BetterSaves.deleteFileText = deleteFileText;
				Button component2 = val.GetComponent<Button>();
				if ((Object)(object)component2 != (Object)null)
				{
					((UnityEventBase)component2.onClick).RemoveAllListeners();
					((UnityEvent)component2.onClick).AddListener(new UnityAction(deleteFileButton_BetterSaves.DeleteFile));
				}
				else
				{
					Debug.LogError((object)"Button component not found on deleteFileGO");
				}
			}
			else
			{
				Debug.LogWarning((object)"DeleteFileButton_BetterSaves component already exists on deleteFileGO");
			}
		}

		public static void CreateBetterSaveButtons()
		{
			try
			{
				GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
				val.SetActive(true);
				int numSaves = CountSaveFiles();
				Debug.Log((object)("Positioning based on " + numSaves + " saves."));
				NewFileUISlot_BetterSaves newFileUISlot_BetterSaves = CreateNewFileNode(numSaves);
				List<string> list = NormalizeFileNames();
				newSaveFileNum = list.Count;
				menuManager.filesCompatible = new bool[16];
				for (int i = 0; i < menuManager.filesCompatible.Length; i++)
				{
					menuManager.filesCompatible[i] = true;
				}
				for (int j = 0; j < list.Count; j++)
				{
					CreateModdedSaveNode(int.Parse(list[j].Replace("LCSaveFile", "")), j, ((Component)newFileUISlot_BetterSaves).gameObject);
				}
				val.SetActive(false);
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Error occurred while refreshing save buttons: " + ex.Message));
			}
		}

		public static NewFileUISlot_BetterSaves CreateNewFileNode(int numSaves)
		{
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original GameObject not found.");
				return null;
			}
			Transform parent = val.transform.parent;
			SaveFileUISlot component = val.GetComponent<SaveFileUISlot>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			GameObject val2 = Object.Instantiate<GameObject>(val, parent);
			((Object)val2).name = "NewFile";
			TMP_Text component2 = ((Component)val2.transform.GetChild(1)).GetComponent<TMP_Text>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.text = "New File";
				NewFileUISlot_BetterSaves newFileUISlot_BetterSaves = val2.AddComponent<NewFileUISlot_BetterSaves>();
				if ((Object)(object)newFileUISlot_BetterSaves == (Object)null)
				{
					Debug.LogError((object)"Failed to add NewFileUISlot_BetterSaves component.");
					return null;
				}
				Transform child = val2.transform.GetChild(3);
				if ((Object)(object)child != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)child).gameObject);
					try
					{
						RectTransform component3 = val2.GetComponent<RectTransform>();
						if (!((Object)(object)component3 != (Object)null))
						{
							Debug.LogError((object)"RectTransform component not found.");
							return null;
						}
						float x = component3.anchoredPosition.x;
						if (buttonBaseY == 0f)
						{
							buttonBaseY = component3.anchoredPosition.y - component3.sizeDelta.y * 1.75f;
						}
						float num = buttonBaseY + component3.sizeDelta.y * (float)numSaves / 2f;
						component3.anchoredPosition = new Vector2(x, num);
					}
					catch (Exception ex)
					{
						Debug.LogError((object)("Error setting anchored position: " + ex.Message));
						return null;
					}
					return newFileUISlot_BetterSaves;
				}
				Debug.LogError((object)"Delete button not found.");
				return null;
			}
			Debug.LogError((object)"Text component not found.");
			return null;
		}

		private static int CountSaveFiles()
		{
			int num = 0;
			string[] files = ES3.GetFiles();
			foreach (string text in files)
			{
				if (ES3.FileExists(text) && text.StartsWith("LCSaveFile"))
				{
					num++;
				}
			}
			return num;
		}

		public static void DestroyOriginalSaveButtons()
		{
			Object.Destroy((Object)(object)GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File2"));
			Object.Destroy((Object)(object)GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File3"));
		}

		public static List<string> NormalizeFileNames()
		{
			List<string> list = new List<string>();
			string[] files = ES3.GetFiles();
			foreach (string text in files)
			{
				if (ES3.FileExists(text) && text.StartsWith("LCSaveFile"))
				{
					Debug.Log((object)("Found file: " + text));
					list.Add(text);
				}
			}
			int num = 0;
			foreach (string item in list)
			{
				string text2 = "TempFile" + num;
				ES3.RenameFile(item, text2);
				Debug.Log((object)("Renamed " + item + " to " + text2));
				num++;
			}
			int num2 = 0;
			List<string> list2 = new List<string>();
			foreach (string item2 in list)
			{
				string text3 = "TempFile" + num2;
				string text4 = "LCSaveFile" + num2;
				if (ES3.FileExists(text3))
				{
					ES3.RenameFile(text3, text4);
					list2.Add(text4);
					Debug.Log((object)("Renamed " + text3 + " to " + text4));
				}
				else
				{
					Debug.Log((object)("Temporary file " + text3 + " not found. It might have been moved or deleted."));
				}
				num2++;
			}
			return list2;
		}

		public static void CreateModdedSaveNode(int fileIndex, int listIndex, GameObject newFileButton)
		{
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			int num = fileIndex + 1;
			GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original GameObject not found.");
				return;
			}
			Transform parent = val.transform.parent;
			GameObject val2 = Object.Instantiate<GameObject>(val, parent);
			((Object)val2).name = "File" + num + "_BetterSaves";
			string text = ES3.Load<string>("Alias_BetterSaves", "LCSaveFile" + fileIndex, "");
			if (text == "")
			{
				((Component)val2.transform.GetChild(1)).GetComponent<TMP_Text>().text = "File " + num;
			}
			else
			{
				((Component)val2.transform.GetChild(1)).GetComponent<TMP_Text>().text = text;
			}
			val2.AddComponent<SaveFileUISlot_BetterSaves>();
			SaveFileUISlot_BetterSaves component = val2.GetComponent<SaveFileUISlot_BetterSaves>();
			if ((Object)(object)component != (Object)null)
			{
				component.fileNum = fileIndex;
				component.fileString = "LCSaveFile" + fileIndex;
				RectTransform component2 = val2.GetComponent<RectTransform>();
				if ((Object)(object)component2 != (Object)null)
				{
					float x = component2.anchoredPosition.x;
					float y = newFileButton.GetComponent<RectTransform>().anchoredPosition.y;
					float num2 = y - component2.sizeDelta.y * (float)num;
					component2.anchoredPosition = new Vector2(x, num2);
				}
				GameObject gameObject = ((Component)val2.transform.GetChild(3)).gameObject;
				DeleteFileButton_BetterSaves component3 = GameObject.Find("Canvas/MenuContainer/DeleteFileConfirmation/Panel/Delete").GetComponent<DeleteFileButton_BetterSaves>();
				((UnityEvent)gameObject.gameObject.GetComponent<Button>().onClick).AddListener(new UnityAction(component3.UpdateFileToDelete));
				gameObject.SetActive(false);
				component.renameButton = CreateRenameFileButton(val2);
			}
			else
			{
				Debug.LogError((object)"SaveFileUISlot_BetterSaves component not found on the cloned GameObject.");
				Object.Destroy((Object)(object)val2);
			}
		}

		public static GameObject CreateRenameFileButton(GameObject fileNode)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject gameObject = ((Component)fileNode.transform.GetChild(3)).gameObject;
				GameObject val = Object.Instantiate<GameObject>(gameObject, fileNode.transform);
				((Object)val).name = "RenameButton";
				val.GetComponent<Image>().sprite = renameSprite;
				Button component = val.GetComponent<Button>();
				component.onClick = new ButtonClickedEvent();
				val.AddComponent<RenameFileButton_BetterSaves>();
				RenameFileButton_BetterSaves component2 = val.GetComponent<RenameFileButton_BetterSaves>();
				if ((Object)(object)component2 != (Object)null)
				{
					((UnityEvent)component.onClick).AddListener(new UnityAction(component2.RenameFile));
				}
				else
				{
					Debug.LogError((object)"RenameFileButton_BetterSaves component not found on renameButton");
				}
				RectTransform component3 = val.GetComponent<RectTransform>();
				if ((Object)(object)component3 != (Object)null)
				{
					float num = ((Transform)component3).localPosition.x + 20f;
					float y = ((Transform)component3).localPosition.y;
					((Transform)component3).localPosition = Vector2.op_Implicit(new Vector2(num, y));
				}
				val.SetActive(false);
				return val;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Error occurred while creating rename file button: " + ex.Message));
				return null;
			}
		}

		public static void UpdateFilesPanelRect(int numSaves)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject obj = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel");
				RectTransform val = ((obj != null) ? obj.GetComponent<RectTransform>() : null);
				if ((Object)(object)val == (Object)null)
				{
					throw new Exception("Failed to find FilesPanel RectTransform.");
				}
				Vector2 sizeDelta = val.sizeDelta;
				GameObject obj2 = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
				RectTransform val2 = ((obj2 != null) ? obj2.GetComponent<RectTransform>() : null);
				if ((Object)(object)val2 == (Object)null)
				{
					throw new Exception("Failed to find File1 RectTransform.");
				}
				float y = val2.sizeDelta.y;
				sizeDelta.y = y * (float)(numSaves + 3);
				val.sizeDelta = sizeDelta;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Error occurred while updating files panel rect: " + ex.Message));
			}
		}

		public static void RefreshNameFields()
		{
			SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
			SaveFileUISlot_BetterSaves[] array2 = array;
			foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
			{
				string text = ES3.Load<string>("Alias_BetterSaves", saveFileUISlot_BetterSaves.fileString, "");
				if (text == "")
				{
					((Component)((Component)saveFileUISlot_BetterSaves).transform.GetChild(1)).GetComponent<TMP_Text>().text = "File " + (saveFileUISlot_BetterSaves.fileNum + 1);
				}
				else
				{
					((Component)((Component)saveFileUISlot_BetterSaves).transform.GetChild(1)).GetComponent<TMP_Text>().text = text;
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LCBetterSaves";

		public const string PLUGIN_NAME = "LCBetterSaves";

		public const string PLUGIN_VERSION = "1.4.0";
	}
}
namespace LCBetterSaves.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	public class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		public static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("LCBetterSaves.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		public static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		public static byte[] lcbettersaves
		{
			get
			{
				object @object = ResourceManager.GetObject("lcbettersaves", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resources()
		{
		}
	}
}

RickArg-Helmet_Cameras/HelmetCamera.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HelmetCamera")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HelmetCamera")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b99c4d46-5f13-47b3-a5af-5e3f37772e77")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HelmetCamera
{
	[BepInPlugin("RickArg.lethalcompany.helmetcameras", "Helmet_Cameras", "2.1.3")]
	public class PluginInit : BaseUnityPlugin
	{
		public static Harmony _harmony;

		public static ConfigEntry<int> config_isHighQuality;

		public static ConfigEntry<int> config_renderDistance;

		public static ConfigEntry<int> config_cameraFps;

		private void Awake()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			config_isHighQuality = ((BaseUnityPlugin)this).Config.Bind<int>("MONITOR QUALITY", "monitorResolution", 0, "Low FPS affection. High Quality mode. 0 - vanilla (48x48), 1 - vanilla+ (128x128), 2 - mid quality (256x256), 3 - high quality (512x512), 4 - Very High Quality (1024x1024)");
			config_renderDistance = ((BaseUnityPlugin)this).Config.Bind<int>("MONITOR QUALITY", "renderDistance", 20, "Low FPS affection. Render distance for helmet camera.");
			config_cameraFps = ((BaseUnityPlugin)this).Config.Bind<int>("MONITOR QUALITY", "cameraFps", 30, "Very high FPS affection. FPS for helmet camera. To increase YOUR fps, you should low cameraFps value.");
			_harmony = new Harmony("HelmetCamera");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Helmet_Cameras is loaded with version 2.1.3!");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"--------Helmet camera patch done.---------");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "RickArg.lethalcompany.helmetcameras";

		public const string PLUGIN_NAME = "Helmet_Cameras";

		public const string PLUGIN_VERSION = "2.1.3";
	}
	public class Plugin : MonoBehaviour
	{
		private RenderTexture renderTexture;

		private bool isMonitorChanged = false;

		private GameObject helmetCameraNew;

		private bool isSceneLoaded = false;

		private bool isCoroutineStarted = false;

		private int currentTransformIndex;

		private int resolution = 0;

		private int renderDistance = 50;

		private float cameraFps = 30f;

		private float elapsed;

		private void Awake()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			resolution = PluginInit.config_isHighQuality.Value;
			renderDistance = PluginInit.config_renderDistance.Value;
			cameraFps = PluginInit.config_cameraFps.Value;
			switch (resolution)
			{
			case 0:
				renderTexture = new RenderTexture(48, 48, 24);
				break;
			case 1:
				renderTexture = new RenderTexture(128, 128, 24);
				break;
			case 2:
				renderTexture = new RenderTexture(256, 256, 24);
				break;
			case 3:
				renderTexture = new RenderTexture(512, 512, 24);
				break;
			case 4:
				renderTexture = new RenderTexture(1024, 1024, 24);
				break;
			}
		}

		public void Start()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			isCoroutineStarted = false;
			while ((Object)(object)helmetCameraNew == (Object)null)
			{
				helmetCameraNew = new GameObject("HelmetCamera");
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "MainMenu")
			{
				activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name != "InitScene")
				{
					activeScene = SceneManager.GetActiveScene();
					if (((Scene)(ref activeScene)).name != "InitSceneLaunchOptions")
					{
						isSceneLoaded = true;
						Debug.Log((object)"[HELMET_CAMERAS] Starting coroutine...");
						((MonoBehaviour)this).StartCoroutine(LoadSceneEnter());
						return;
					}
				}
			}
			isSceneLoaded = false;
			isMonitorChanged = false;
		}

		private IEnumerator LoadSceneEnter()
		{
			Debug.Log((object)"[HELMET_CAMERAS] 5 seconds for init mode... Please wait...");
			yield return (object)new WaitForSeconds(5f);
			isCoroutineStarted = true;
			if ((Object)(object)GameObject.Find("Environment/HangarShip/Cameras/ShipCamera") != (Object)null)
			{
				Debug.Log((object)"[HELMET_CAMERAS] Ship camera founded...");
				if (!isMonitorChanged)
				{
					((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube").GetComponent<MeshRenderer>()).materials[2].mainTexture = ((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001").GetComponent<MeshRenderer>()).materials[2].mainTexture;
					((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001").GetComponent<MeshRenderer>()).materials[2].mainTexture = (Texture)(object)renderTexture;
					helmetCameraNew.AddComponent<Camera>();
					((Behaviour)helmetCameraNew.GetComponent<Camera>()).enabled = false;
					helmetCameraNew.GetComponent<Camera>().targetTexture = renderTexture;
					helmetCameraNew.GetComponent<Camera>().cullingMask = 20649983;
					helmetCameraNew.GetComponent<Camera>().farClipPlane = renderDistance;
					helmetCameraNew.GetComponent<Camera>().nearClipPlane = 0.55f;
					isMonitorChanged = true;
					Debug.Log((object)"[HELMET_CAMERAS] Monitors were changed...");
				}
			}
		}

		public void Update()
		{
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			if (!isSceneLoaded || !isCoroutineStarted || !StartOfRound.Instance.localPlayerController.isInHangarShipRoom)
			{
				return;
			}
			elapsed += Time.deltaTime;
			if (elapsed > 1f / cameraFps)
			{
				elapsed = 0f;
				((Behaviour)helmetCameraNew.GetComponent<Camera>()).enabled = true;
			}
			else
			{
				((Behaviour)helmetCameraNew.GetComponent<Camera>()).enabled = false;
			}
			GameObject val = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001/CameraMonitorScript");
			currentTransformIndex = val.GetComponent<ManualCameraRenderer>().targetTransformIndex;
			TransformAndName val2 = val.GetComponent<ManualCameraRenderer>().radarTargets[currentTransformIndex];
			if (!val2.isNonPlayer)
			{
				try
				{
					helmetCameraNew.transform.SetPositionAndRotation(val2.transform.Find("ScavengerModel/metarig/CameraContainer/MainCamera/HelmetLights").position + new Vector3(0f, 0f, 0f), val2.transform.Find("ScavengerModel/metarig/CameraContainer/MainCamera/HelmetLights").rotation * Quaternion.Euler(0f, 0f, 0f));
					DeadBodyInfo[] array = Object.FindObjectsOfType<DeadBodyInfo>();
					for (int i = 0; i < array.Length; i++)
					{
						if (array[i].playerScript.playerUsername == val2.name)
						{
							helmetCameraNew.transform.SetPositionAndRotation(((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003").position, ((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003").rotation * Quaternion.Euler(0f, 0f, 0f));
						}
					}
					return;
				}
				catch (NullReferenceException)
				{
					Debug.Log((object)"[HELMET_CAMERAS] ERROR NULL REFERENCE");
					return;
				}
			}
			helmetCameraNew.transform.SetPositionAndRotation(val2.transform.position + new Vector3(0f, 1.6f, 0f), val2.transform.rotation * Quaternion.Euler(0f, -90f, 0f));
		}
	}
}
namespace HelmetCamera.Patches
{
	[HarmonyPatch]
	internal class HelmetCamera
	{
		public static void InitCameras()
		{
			GameObject val = GameObject.Find("Environment/HangarShip/Cameras/ShipCamera");
			val.AddComponent<Plugin>();
		}

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPostfix]
		public static void InitCamera(ref ManualCameraRenderer __instance)
		{
			InitCameras();
		}
	}
}

Rozebud-FOV_Adjust/FovAdjust.dll.old

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FovAdjust")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FovAdjust")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("dfb6681a-9f25-4737-a7fe-10b3c23f65b3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FovAdjust;

[BepInPlugin("Rozebud.FovAdjust", "FOV Adjust", "1.1.1")]
public class FovAdjustBase : BaseUnityPlugin
{
	private const string modGUID = "Rozebud.FovAdjust";

	private const string modName = "FOV Adjust";

	private const string modVer = "1.1.1";

	private readonly Harmony harmony = new Harmony("Rozebud.FovAdjust");

	private static FovAdjustBase Instance;

	public static ManualLogSource log;

	public static ConfigEntry<float> configFov;

	public static ConfigEntry<bool> configHideVisor;

	public static bool inDebugMode;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		log = Logger.CreateLogSource("Rozebud.FovAdjust");
		log.LogInfo((object)"Starting.");
		configFov = ((BaseUnityPlugin)this).Config.Bind<float>("General", "fov", 66f, "Change the field of view of the camera. Clamped from 66 to 130 for my sanity. Also keep in mind that this is vertical FOV.");
		configHideVisor = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "hideVisor", false, "Changes whether the first person visor is visible.");
		PlayerControllerBPatches.newTargetFovBase = Mathf.Clamp(configFov.Value, 66f, 130f);
		PlayerControllerBPatches.hideVisor = configHideVisor.Value;
		log.LogInfo((object)"Configs DONE!");
		PlayerControllerBPatches.calculateVisorStuff();
		harmony.PatchAll(typeof(PlayerControllerBPatches));
		harmony.PatchAll(typeof(HUDManagerPatches));
		log.LogInfo((object)"All FOV Adjust patches have loaded successfully.");
	}
}
public class PlayerControllerBPatches
{
	public static float newTargetFovBase = 66f;

	private static float prefixCamFov = 0f;

	public static bool hideVisor = false;

	private static Vector3 visorScale;

	public static Vector3 visorScaleBottom = new Vector3(0.68f, 0.8f, 0.95f);

	public static Vector3 visorScaleTop = new Vector3(0.68f, 0.35f, 0.99f);

	public static float linToSinLerp = 0.6f;

	public static float visorScaleTopRefFOV = 130f;

	[HarmonyPatch(typeof(PlayerControllerB), "Awake")]
	[HarmonyPostfix]
	private static void Awake_Postfix(PlayerControllerB __instance)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		if (!filterPlayerControllers(__instance))
		{
			__instance.localVisor.localScale = visorScale;
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "Update")]
	[HarmonyPrefix]
	private static void Update_Prefix(PlayerControllerB __instance)
	{
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		if (filterPlayerControllers(__instance))
		{
			return;
		}
		prefixCamFov = __instance.gameplayCamera.fieldOfView;
		if (FovAdjustBase.inDebugMode)
		{
			if (((ButtonControl)Keyboard.current.minusKey).wasPressedThisFrame)
			{
				visorScale.x -= 0.00049999997f;
				FovAdjustBase.log.LogMessage((object)visorScale);
			}
			else if (((ButtonControl)Keyboard.current.equalsKey).wasPressedThisFrame)
			{
				visorScale.x += 0.00049999997f;
				FovAdjustBase.log.LogMessage((object)visorScale);
			}
			if (((ButtonControl)Keyboard.current.leftBracketKey).wasPressedThisFrame)
			{
				visorScale.y -= 0.00049999997f;
				FovAdjustBase.log.LogMessage((object)visorScale);
			}
			else if (((ButtonControl)Keyboard.current.rightBracketKey).wasPressedThisFrame)
			{
				visorScale.y += 0.00049999997f;
				FovAdjustBase.log.LogMessage((object)visorScale);
			}
			if (((ButtonControl)Keyboard.current.semicolonKey).wasPressedThisFrame)
			{
				visorScale.z -= 0.00049999997f;
				FovAdjustBase.log.LogMessage((object)visorScale);
			}
			else if (((ButtonControl)Keyboard.current.quoteKey).wasPressedThisFrame)
			{
				visorScale.z += 0.00049999997f;
				FovAdjustBase.log.LogMessage((object)visorScale);
			}
		}
		if (__instance.localVisor.localScale != visorScale)
		{
			__instance.localVisor.localScale = visorScale;
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "Update")]
	[HarmonyPostfix]
	private static void Update_Postfix(PlayerControllerB __instance)
	{
		if (!filterPlayerControllers(__instance))
		{
			float num = newTargetFovBase;
			if (__instance.inTerminalMenu)
			{
				num = 60f;
			}
			else if (__instance.IsInspectingItem)
			{
				num = 46f;
			}
			else if (__instance.isSprinting)
			{
				num *= 1.03f;
			}
			__instance.gameplayCamera.fieldOfView = Mathf.Lerp(prefixCamFov, num, 6f * Time.deltaTime);
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
	[HarmonyPostfix]
	private static void LateUpdate_Postfix(PlayerControllerB __instance)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		if (!filterPlayerControllers(__instance) && (newTargetFovBase > 66f || FovAdjustBase.inDebugMode))
		{
			__instance.localVisor.position = __instance.localVisor.position + __instance.localVisor.rotation * new Vector3(0f, 0f, -0.06f);
		}
	}

	private static float easeOutSine(float x)
	{
		return Mathf.Sin(x * (float)Math.PI / 2f);
	}

	public static void calculateVisorStuff()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: 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_007b: Unknown result type (might be due to invalid IL or missing references)
		if (hideVisor)
		{
			visorScale = new Vector3(0f, 0f, 0f);
		}
		else if (newTargetFovBase > 66f || FovAdjustBase.inDebugMode)
		{
			float num = (newTargetFovBase - 66f) / (visorScaleTopRefFOV - 66f);
			num = Mathf.Lerp(num, easeOutSine(num), linToSinLerp);
			visorScale = Vector3.LerpUnclamped(visorScaleBottom, visorScaleTop, num);
		}
		else
		{
			visorScale = new Vector3(0.36f, 0.49f, 0.49f);
		}
	}

	private static bool filterPlayerControllers(PlayerControllerB player)
	{
		return !((NetworkBehaviour)player).IsOwner || !player.isPlayerControlled || (((NetworkBehaviour)player).IsServer && !player.isHostPlayerObject && !player.isTestingPlayer);
	}
}
public class HUDManagerPatches
{
	[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
	[HarmonyPrefix]
	public static bool SubmitChat_performed_Prefix(HUDManager __instance)
	{
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0267: Unknown result type (might be due to invalid IL or missing references)
		string text = __instance.chatTextField.text;
		if (text.StartsWith("/fov"))
		{
			string[] array = text.Split(new char[1] { ' ' });
			if (array.Length > 1 && float.TryParse(array[1], out var result))
			{
				result = Mathf.Clamp(result, 66f, 130f);
				PlayerControllerBPatches.newTargetFovBase = result;
				if (!FovAdjustBase.inDebugMode)
				{
					PlayerControllerBPatches.calculateVisorStuff();
				}
			}
		}
		else if (text.StartsWith("/toggleVisor"))
		{
			PlayerControllerBPatches.hideVisor = !PlayerControllerBPatches.hideVisor;
			PlayerControllerBPatches.calculateVisorStuff();
		}
		else if (text.StartsWith("/recalcVisor") && FovAdjustBase.inDebugMode)
		{
			PlayerControllerBPatches.calculateVisorStuff();
		}
		else if (text.StartsWith("/setScaleBottom") && FovAdjustBase.inDebugMode)
		{
			string[] array2 = text.Split(new char[1] { ' ' });
			PlayerControllerBPatches.visorScaleBottom = new Vector3(float.Parse(array2[1]), float.Parse(array2[2]), float.Parse(array2[3]));
		}
		else if (text.StartsWith("/setScaleTop") && FovAdjustBase.inDebugMode)
		{
			string[] array3 = text.Split(new char[1] { ' ' });
			PlayerControllerBPatches.visorScaleTop = new Vector3(float.Parse(array3[1]), float.Parse(array3[2]), float.Parse(array3[3]));
		}
		else if (text.StartsWith("/setSinAmount") && FovAdjustBase.inDebugMode)
		{
			string[] array4 = text.Split(new char[1] { ' ' });
			PlayerControllerBPatches.linToSinLerp = float.Parse(array4[1]);
		}
		else if (text.StartsWith("/setTopRef") && FovAdjustBase.inDebugMode)
		{
			string[] array5 = text.Split(new char[1] { ' ' });
			PlayerControllerBPatches.visorScaleTopRefFOV = float.Parse(array5[1]);
		}
		else
		{
			if (!text.StartsWith("/gimmeMyValues") || !FovAdjustBase.inDebugMode)
			{
				return true;
			}
			ManualLogSource log = FovAdjustBase.log;
			Vector3 val = PlayerControllerBPatches.visorScaleBottom;
			log.LogMessage((object)("visorScaleBottom: " + ((object)(Vector3)(ref val)).ToString()));
			ManualLogSource log2 = FovAdjustBase.log;
			val = PlayerControllerBPatches.visorScaleTop;
			log2.LogMessage((object)("visorScaleTop: " + ((object)(Vector3)(ref val)).ToString()));
			FovAdjustBase.log.LogMessage((object)("linToSinLerp: " + PlayerControllerBPatches.linToSinLerp));
			FovAdjustBase.log.LogMessage((object)("visorScaleTopRefFOV: " + PlayerControllerBPatches.visorScaleTopRefFOV));
		}
		__instance.localPlayer = GameNetworkManager.Instance.localPlayerController;
		__instance.localPlayer.isTypingChat = false;
		__instance.chatTextField.text = "";
		EventSystem.current.SetSelectedGameObject((GameObject)null);
		((Behaviour)__instance.typingIndicator).enabled = false;
		return false;
	}
}

ScytherianStudios-GokuCosmetic/Goku.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
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.Logging;
using Goku.Cosmetics;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreCompany.Cosmetics;
using MoreCompany.Utils;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EliteMasterEric")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("New interesting cosmetics for Lethal Company")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("WackyCosmetics")]
[assembly: AssemblyTitle("WackyCosmetics")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 Goku
{
	public static class PluginInfo
	{
		public const string PLUGIN_ID = "Goku";

		public const string PLUGIN_NAME = "A Cosmetic that is Goku behind you";

		public const string PLUGIN_VERSION = "1.0.0";

		public const string PLUGIN_GUID = "com.decodinator.goku";
	}
	[BepInPlugin("com.decodinator.goku", "A Cosmetic that is Goku behind you", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public ManualLogSource PluginLogger;

		public PluginConfig PluginConfig;

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			Instance = this;
			PluginLogger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("com.decodinator.goku");
			val.PatchAll();
			PluginLogger.LogInfo((object)"Plugin A Cosmetic that is Goku behind you (com.decodinator.goku) is loaded!");
			LoadConfig();
			LoadCosmetics();
		}

		private void LoadConfig()
		{
			PluginConfig = new PluginConfig();
			PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
		}

		private void LoadCosmetics()
		{
			GokuCosmeticGeneric.LoadCosmeticsFromThisAssembly();
		}
	}
	internal class PluginAssets
	{
		public static AssetBundle LoadBundleFromThisAssembly(string filename)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			if (executingAssembly == null)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Failed to get assembly reference while loading bundle: " + filename));
				return null;
			}
			return BundleUtilities.LoadBundleFromInternalAssembly(filename, executingAssembly);
		}

		public static string[] ListEmbeddedResourcesInThisAssembly()
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			if (executingAssembly == null)
			{
				Plugin.Instance.PluginLogger.LogError((object)"Failed to get assembly reference while listing embedded resources.");
				return null;
			}
			return executingAssembly.GetManifestResourceNames();
		}
	}
	public class PluginConfig
	{
		public Dictionary<string, ConfigEntry<bool>> CosmeticConfigEntries;

		public PluginConfig()
		{
			CosmeticConfigEntries = new Dictionary<string, ConfigEntry<bool>>();
		}

		public void BindConfig(ConfigFile config)
		{
			GokuCosmeticGeneric.GenerateCosmeticConfigEntries(config);
		}

		internal void GenerateCosmeticConfigEntry(ConfigFile config, GokuCosmeticGeneric cosmetic)
		{
			ConfigEntry<bool> value = config.Bind<bool>("Cosmetics", "EnableCosmetic_" + ((CosmeticGeneric)cosmetic).cosmeticId, true, "Enable the " + cosmetic.cosmeticName + " cosmetic.");
			CosmeticConfigEntries.Add(((CosmeticGeneric)cosmetic).cosmeticId, value);
		}

		public bool IsCosmeticEnabled(GokuCosmeticGeneric cosmetic)
		{
			return CosmeticConfigEntries[((CosmeticGeneric)cosmetic).cosmeticId].Value;
		}
	}
}
namespace Goku.Cosmetics
{
	public class GOKU : GokuCosmeticGeneric
	{
		private string iconPath = "assets/decodinator/goku/goku_icon.png";

		public override string gameObjectPath => "assets/decodinator/goku/GOKU.prefab";

		public override string cosmeticId => "decodinator.goku";

		public override string textureIconPath => iconPath;

		public override string cosmeticName => "Goku";

		public override string assetBundlePath => "cosmetic_goku";

		public override CosmeticType cosmeticType => (CosmeticType)4;
	}
	public class GokuCosmeticGeneric : CosmeticGeneric
	{
		public virtual string cosmeticName { get; }

		public virtual string assetBundlePath { get; }

		public AssetBundle assetBundle { get; private set; }

		public void LoadFromAssetBundle()
		{
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.Instance.PluginConfig.IsCosmeticEnabled(this))
			{
				Plugin.Instance.PluginLogger.LogInfo((object)("Skipped Wacky cosmetic: " + ((CosmeticGeneric)this).cosmeticId));
				return;
			}
			assetBundle = PluginAssets.LoadBundleFromThisAssembly(assetBundlePath);
			if ((Object)(object)assetBundle == (Object)null)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Failed to load cosmetic asset bundle: " + assetBundlePath));
				return;
			}
			GameObject val = AssetBundleExtension.LoadPersistentAsset<GameObject>(assetBundle, ((CosmeticGeneric)this).gameObjectPath);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Failed to load cosmetic prefab: " + ((CosmeticGeneric)this).gameObjectPath));
				return;
			}
			Texture2D val2 = AssetBundleExtension.LoadPersistentAsset<Texture2D>(assetBundle, ((CosmeticGeneric)this).textureIconPath);
			if ((Object)(object)val2 == (Object)null)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Failed to load cosmetic icon: " + ((CosmeticGeneric)this).textureIconPath));
				return;
			}
			CosmeticInstance val3 = val.AddComponent<CosmeticInstance>();
			val3.cosmeticId = ((CosmeticGeneric)this).cosmeticId;
			val3.icon = val2;
			val3.cosmeticType = ((CosmeticGeneric)this).cosmeticType;
			CosmeticRegistry.cosmeticInstances.Add(((CosmeticGeneric)this).cosmeticId, val3);
			Plugin.Instance.PluginLogger.LogInfo((object)("Loaded Wacky cosmetic: " + ((CosmeticGeneric)this).cosmeticId));
		}

		public static void GenerateCosmeticConfigEntries(ConfigFile config)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			if (executingAssembly == null)
			{
				Plugin.Instance.PluginLogger.LogError((object)"Failed to get assembly reference while generating config entries.");
				return;
			}
			Plugin.Instance.PluginLogger.LogInfo((object)"Generating config entries for Wacky cosmetics.");
			Type[] types = executingAssembly.GetTypes();
			foreach (Type type in types)
			{
				if (!(type == null) && type.IsSubclassOf(typeof(GokuCosmeticGeneric)))
				{
					GokuCosmeticGeneric cosmetic = (GokuCosmeticGeneric)Activator.CreateInstance(type);
					Plugin.Instance.PluginConfig.GenerateCosmeticConfigEntry(config, cosmetic);
				}
			}
		}

		public static void LoadCosmeticsFromThisAssembly()
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			if (executingAssembly == null)
			{
				Plugin.Instance.PluginLogger.LogError((object)"Failed to get assembly reference while loading cosmetics.");
				return;
			}
			Plugin.Instance.PluginLogger.LogInfo((object)"Loading Wacky cosmetics.");
			Type[] types = executingAssembly.GetTypes();
			foreach (Type type in types)
			{
				if (!(type == null) && type.IsSubclassOf(typeof(GokuCosmeticGeneric)))
				{
					GokuCosmeticGeneric gokuCosmeticGeneric = (GokuCosmeticGeneric)Activator.CreateInstance(type);
					gokuCosmeticGeneric.LoadFromAssetBundle();
				}
			}
		}
	}
}

Sligili-HDLethalCompany/HDLethalCompany.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HDLethalCompany.Patch;
using HDLethalCompany.Tools;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HDLethalCompanyRemake")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HDLethalCompanyRemake")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7f379bc1-1fd4-4c72-9247-a181862eec6b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HDLethalCompany
{
	[BepInPlugin("HDLethalCompany", "HDLethalCompany-Sligili", "1.5.2")]
	public class HDLethalCompanyInitialization : BaseUnityPlugin
	{
		private static ConfigEntry<float> config_ResMult;

		private static ConfigEntry<bool> config_EnablePostProcessing;

		private static ConfigEntry<bool> config_EnableFog;

		private static ConfigEntry<bool> config_EnableAntialiasing;

		private static ConfigEntry<bool> config_EnableResolution;

		private static ConfigEntry<bool> config_EnableFoliage;

		private static ConfigEntry<int> config_FogQuality;

		private static ConfigEntry<int> config_TextureQuality;

		private static ConfigEntry<int> config_LOD;

		private static ConfigEntry<int> config_ShadowmapQuality;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"HDLethalCompany loaded");
			ConfigFile();
			GraphicsPatch.assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "HDLethalCompany/hdlethalcompany"));
			_harmony = new Harmony("HDLethalCompany");
			_harmony.PatchAll(typeof(GraphicsPatch));
		}

		private void ConfigFile()
		{
			config_ResMult = ((BaseUnityPlugin)this).Config.Bind<float>("RESOLUTION", "Value", 2.233f, "Resolution Scale Multiplier - <EXAMPLES -> | 1.000 = 860x520p | 2.233 =~ 1920x1080p | 2.977 = 2560x1440p | 4.465 = 3840x2060p > - The UI scanned elements have slightly incorrect offsets after 3.000");
			config_EnableResolution = ((BaseUnityPlugin)this).Config.Bind<bool>("RESOLUTION", "EnableRes", true, "Resolution Fix - In case you wanna use another resolution mod or apply any widescreen mod while keeping the graphics settings");
			config_EnableAntialiasing = ((BaseUnityPlugin)this).Config.Bind<bool>("EFFECTS", "EnableAA", false, "Anti-Aliasing (Unity's SMAA)");
			config_EnablePostProcessing = ((BaseUnityPlugin)this).Config.Bind<bool>("EFFECTS", "EnablePP", true, "Post-Processing (Color grading)");
			config_TextureQuality = ((BaseUnityPlugin)this).Config.Bind<int>("EFFECTS", "TextureQuality", 3, "Texture Resolution Quality - <PRESETS -> | 0 = VERY LOW (1/8) | 1 = LOW (1/4) | 2 = MEDIUM (1/2) | 3 = HIGH (1/1 VANILLA) >");
			config_FogQuality = ((BaseUnityPlugin)this).Config.Bind<int>("EFFECTS", "FogQuality", 1, "Volumetric Fog Quality - <PRESETS -> | 0 = VERY LOW | 1 = VANILLA FOG | 2 = MEDIUM | 3 = HIGH >");
			config_EnableFog = ((BaseUnityPlugin)this).Config.Bind<bool>("EFFECTS", "EnableFOG", true, "Volumetric Fog Toggle - Use this as a last resource in case lowering the fog quality is not enough to get decent performance");
			config_LOD = ((BaseUnityPlugin)this).Config.Bind<int>("EFFECTS", "LOD", 1, "Level Of Detail - <PRESETS -> | 0 = LOW (HALF DISTANCE) | 1 = VANILLA | 2 = HIGH (TWICE THE DISTANCE) >");
			config_ShadowmapQuality = ((BaseUnityPlugin)this).Config.Bind<int>("EFFECTS", "ShadowQuality", 2, "Shadows Resolution - <PRESETS -> 0 = VERY LOW (SHADOWS DISABLED)| 1 = LOW (256) | 2 = MEDIUM (1024) | 3 = VANILLA (2048) > - Shadowmap max resolution");
			config_EnableFoliage = ((BaseUnityPlugin)this).Config.Bind<bool>("EFFECTS", "EnableF", true, "Foliage Toggle - If the game camera should or not render bushes/grass (trees won't be affected)");
			GraphicsPatch.m_enableFoliage = config_EnableFoliage.Value;
			GraphicsPatch.m_enableResolutionFix = config_EnableResolution.Value;
			GraphicsPatch.m_setShadowQuality = config_ShadowmapQuality.Value;
			GraphicsPatch.m_setLOD = config_LOD.Value;
			GraphicsPatch.m_setTextureResolution = config_TextureQuality.Value;
			GraphicsPatch.m_setFogQuality = config_FogQuality.Value;
			GraphicsPatch.multiplier = config_ResMult.Value;
			GraphicsPatch.anchorOffsetZ = 0.123f * config_ResMult.Value + 0.877f;
			GraphicsPatch.m_widthResolution = 860f * config_ResMult.Value;
			GraphicsPatch.m_heightResolution = 520f * config_ResMult.Value;
			GraphicsPatch.m_enableAntiAliasing = config_EnableAntialiasing.Value;
			GraphicsPatch.m_enableFog = config_EnableFog.Value;
			GraphicsPatch.m_enablePostProcessing = config_EnablePostProcessing.Value;
		}
	}
	public static class PluginInfo
	{
		public const string Guid = "HDLethalCompany";

		public const string Name = "HDLethalCompany-Sligili";

		public const string Ver = "1.5.2";
	}
}
namespace HDLethalCompany.Tools
{
	public class Reflection
	{
		public static object GetInstanceField(Type type, object instance, string fieldName)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
			FieldInfo field = type.GetField(fieldName, bindingAttr);
			return field.GetValue(instance);
		}

		public static object CallMethod(object instance, string methodName, params object[] args)
		{
			MethodInfo method = instance.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic);
			if (method != null)
			{
				return method.Invoke(instance, args);
			}
			return null;
		}
	}
}
namespace HDLethalCompany.Patch
{
	internal class GraphicsPatch
	{
		public static bool m_enablePostProcessing;

		public static bool m_enableFog;

		public static bool m_enableAntiAliasing;

		public static bool m_enableResolutionFix;

		public static bool m_enableFoliage = true;

		public static int m_setFogQuality;

		public static int m_setTextureResolution;

		public static int m_setLOD;

		public static int m_setShadowQuality;

		private static HDRenderPipelineAsset myAsset;

		public static AssetBundle assetBundle;

		public static float anchorOffsetX = 439.48f;

		public static float anchorOffsetY = 244.8f;

		public static float anchorOffsetZ;

		public static float multiplier;

		public static float m_widthResolution;

		public static float m_heightResolution;

		[HarmonyPatch(typeof(PlayerControllerB), "Start")]
		[HarmonyPrefix]
		private static void StartPrefix(PlayerControllerB __instance)
		{
			//IL_006b: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"HDLethalCompany - Applying configs");
			Object[] array = Resources.FindObjectsOfTypeAll(typeof(HDAdditionalCameraData));
			foreach (Object obj in array)
			{
				HDAdditionalCameraData val = (HDAdditionalCameraData)(object)((obj is HDAdditionalCameraData) ? obj : null);
				val.customRenderingSettings = true;
				ToggleCustomPass(val, m_enablePostProcessing);
				SetLevelOfDetail(val);
				ToggleVolumetricFog(val, m_enableFog);
				if (!m_enableFoliage)
				{
					LayerMask val2 = LayerMask.op_Implicit(((Component)val).GetComponent<Camera>().cullingMask);
					val2 = LayerMask.op_Implicit(LayerMask.op_Implicit(val2) & -1025);
					((Component)val).GetComponent<Camera>().cullingMask = LayerMask.op_Implicit(val2);
				}
				SetShadowQuality(assetBundle, val);
				if (!(((Object)((Component)val).gameObject).name == "SecurityCamera") && !(((Object)((Component)val).gameObject).name == "ShipCamera"))
				{
					SetAntiAliasing(val);
				}
			}
			array = null;
			SetTextureQuality();
			SetFogQuality();
			Debug.Log((object)"Global quality settings applied");
			if (m_enableResolutionFix && multiplier != 1f)
			{
				int width = (int)Math.Round(m_widthResolution, 0);
				int height = (int)Math.Round(m_heightResolution, 0);
				((Texture)__instance.gameplayCamera.targetTexture).width = width;
				((Texture)__instance.gameplayCamera.targetTexture).height = height;
			}
		}

		[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
		[HarmonyPrefix]
		private static void RoundPostFix()
		{
			SetFogQuality();
			if (m_setLOD == 0)
			{
				RemoveLodFromGameObject("CatwalkStairs");
			}
		}

		[HarmonyPatch(typeof(HUDManager), "UpdateScanNodes")]
		[HarmonyPostfix]
		private static void UpdateScanNodesPostfix(PlayerControllerB playerScript, HUDManager __instance)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			if (anchorOffsetZ > 1.238f)
			{
				anchorOffsetZ = 1.238f;
			}
			if (!m_enableResolutionFix || multiplier == 1f)
			{
				return;
			}
			Vector3 zero = Vector3.zero;
			bool flag = false;
			for (int i = 0; i < __instance.scanElements.Length; i++)
			{
				if ((Traverse.Create((object)__instance).Field("scanNodes").GetValue() as Dictionary<RectTransform, ScanNodeProperties>).Count > 0 && (Traverse.Create((object)__instance).Field("scanNodes").GetValue() as Dictionary<RectTransform, ScanNodeProperties>).TryGetValue(__instance.scanElements[i], out var value) && (Object)(object)value != (Object)null)
				{
					try
					{
						if ((bool)Reflection.CallMethod(__instance, "NodeIsNotVisible", value, i))
						{
							continue;
						}
						if (!((Component)__instance.scanElements[i]).gameObject.activeSelf)
						{
							((Component)__instance.scanElements[i]).gameObject.SetActive(true);
							((Component)__instance.scanElements[i]).GetComponent<Animator>().SetInteger("colorNumber", value.nodeType);
							if (value.creatureScanID != -1)
							{
								Traverse.Create((object)__instance).Method("AttemptScanNewCreature", new object[1] { value.creatureScanID });
							}
						}
						goto IL_0186;
					}
					catch (Exception arg)
					{
						Debug.LogError((object)$"Error in updatescanNodes A: {arg}");
						goto IL_0186;
					}
				}
				(Traverse.Create((object)__instance).Field("scanNodes").GetValue() as Dictionary<RectTransform, ScanNodeProperties>).Remove(__instance.scanElements[i]);
				((Component)__instance.scanElements[i]).gameObject.SetActive(false);
				continue;
				IL_0186:
				try
				{
					Traverse.Create((object)__instance).Field("scanElementText").SetValue((object)((Component)__instance.scanElements[i]).gameObject.GetComponentsInChildren<TextMeshProUGUI>());
					if ((Traverse.Create((object)__instance).Field("scanElementText").GetValue() as TextMeshProUGUI[]).Length > 1)
					{
						((TMP_Text)(Traverse.Create((object)__instance).Field("scanElementText").GetValue() as TextMeshProUGUI[])[0]).text = value.headerText;
						((TMP_Text)(Traverse.Create((object)__instance).Field("scanElementText").GetValue() as TextMeshProUGUI[])[1]).text = value.subText;
					}
					if (value.nodeType == 2)
					{
						flag = true;
					}
					zero = playerScript.gameplayCamera.WorldToScreenPoint(((Component)value).transform.position);
					((Transform)__instance.scanElements[i]).position = new Vector3(((Transform)__instance.scanElements[i]).position.x, ((Transform)__instance.scanElements[i]).position.y, 12.17f * anchorOffsetZ);
					__instance.scanElements[i].anchoredPosition = Vector2.op_Implicit(new Vector3(zero.x - anchorOffsetX * multiplier, zero.y - anchorOffsetY * multiplier));
					if (!(multiplier > 3f))
					{
						((Transform)__instance.scanElements[i]).localScale = new Vector3(multiplier, multiplier, multiplier);
					}
					else
					{
						((Transform)__instance.scanElements[i]).localScale = new Vector3(3f, 3f, 3f);
					}
				}
				catch (Exception arg2)
				{
					Debug.LogError((object)$"Error in updatescannodes B: {arg2}");
				}
			}
			try
			{
				if (!flag)
				{
					__instance.totalScrapScanned = 0;
					Traverse.Create((object)__instance).Field("totalScrapScannedDisplayNum").SetValue((object)0);
					Traverse.Create((object)__instance).Field("addToDisplayTotalInterval").SetValue((object)0.35f);
				}
				__instance.scanInfoAnimator.SetBool("display", (int)Reflection.GetInstanceField(typeof(HUDManager), __instance, "scannedScrapNum") >= 2 && flag);
			}
			catch (Exception arg3)
			{
				Debug.LogError((object)$"Error in updatescannodes C: {arg3}");
			}
		}

		public static void SetShadowQuality(AssetBundle assetBundle, HDAdditionalCameraData cameraData)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)assetBundle == (Object)null)
			{
				Debug.LogError((object)"HDLETHALCOMPANY: Something is wrong with the Asset Bundle - Null");
				return;
			}
			((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[20u] = true;
			((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)20, (m_setShadowQuality != 0) ? true : false);
			myAsset = (HDRenderPipelineAsset)((m_setShadowQuality != 1) ? ((m_setShadowQuality != 2) ? ((object)(HDRenderPipelineAsset)QualitySettings.renderPipeline) : ((object)(myAsset = assetBundle.LoadAsset<HDRenderPipelineAsset>("Assets/HDLethalCompany/MediumShadowsAsset.asset")))) : (myAsset = assetBundle.LoadAsset<HDRenderPipelineAsset>("Assets/HDLethalCompany/VeryLowShadowsAsset.asset")));
			QualitySettings.renderPipeline = (RenderPipelineAsset)(object)myAsset;
		}

		public static void SetLevelOfDetail(HDAdditionalCameraData cameraData)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (m_setLOD != 1)
			{
				((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[60u] = true;
				((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[61u] = true;
				((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)60, true);
				((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)61, true);
				cameraData.renderingPathCustomFrameSettings.lodBiasMode = (LODBiasMode)2;
				cameraData.renderingPathCustomFrameSettings.lodBias = ((m_setLOD == 0) ? 0.6f : 2.3f);
			}
		}

		public static void SetTextureQuality()
		{
			if (m_setTextureResolution < 3)
			{
				int globalTextureMipmapLimit = 3 - m_setTextureResolution;
				QualitySettings.globalTextureMipmapLimit = globalTextureMipmapLimit;
			}
		}

		public static void SetAntiAliasing(HDAdditionalCameraData cameraData)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (m_enableAntiAliasing)
			{
				cameraData.antialiasing = (AntialiasingMode)3;
			}
		}

		public static void ToggleCustomPass(HDAdditionalCameraData cameraData, bool enable)
		{
			((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[6u] = true;
			((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)6, enable);
		}

		public static void ToggleVolumetricFog(HDAdditionalCameraData cameraData, bool enable)
		{
			((BitArray128)(ref cameraData.renderingPathCustomFrameSettingsOverrideMask.mask))[28u] = true;
			((FrameSettings)(ref cameraData.renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)28, enable);
		}

		public static void SetFogQuality()
		{
			Object[] array = Resources.FindObjectsOfTypeAll(typeof(Volume));
			Fog val2 = default(Fog);
			foreach (Object obj in array)
			{
				Volume val = (Volume)(object)((obj is Volume) ? obj : null);
				if (!val.sharedProfile.TryGet<Fog>(ref val2))
				{
					continue;
				}
				((VolumeParameter<int>)(object)((VolumeComponentWithQuality)val2).quality).Override(3);
				switch (m_setFogQuality)
				{
				case -1:
					if (val2.volumetricFogBudget > 0.05f)
					{
						val2.volumetricFogBudget = 0.05f;
					}
					if (val2.resolutionDepthRatio > 0.5f)
					{
						val2.resolutionDepthRatio = 0.5f;
					}
					break;
				case 0:
					if (val2.volumetricFogBudget > 0.05f)
					{
						val2.volumetricFogBudget = 0.05f;
					}
					if (val2.resolutionDepthRatio > 0.5f)
					{
						val2.resolutionDepthRatio = 0.5f;
					}
					break;
				case 2:
					if (val2.volumetricFogBudget > 0.333f)
					{
						val2.volumetricFogBudget = 0.333f;
					}
					if (val2.resolutionDepthRatio > 0.666f)
					{
						val2.resolutionDepthRatio = 0.666f;
					}
					break;
				case 3:
					if (val2.volumetricFogBudget > 0.666f)
					{
						val2.volumetricFogBudget = 0.666f;
					}
					if (val2.resolutionDepthRatio > 0.5f)
					{
						val2.resolutionDepthRatio = 0.5f;
					}
					break;
				}
			}
		}

		public static void RemoveLodFromGameObject(string name)
		{
			Object[] array = Resources.FindObjectsOfTypeAll(typeof(LODGroup));
			foreach (Object obj in array)
			{
				LODGroup val = (LODGroup)(object)((obj is LODGroup) ? obj : null);
				if (((Object)((Component)val).gameObject).name == name)
				{
					val.enabled = false;
				}
			}
		}
	}
}

squidypal-Discord_Rich_Presence/LethalCompanyPresence.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using Discord;
using LethalPresence;
using MelonLoader;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Lethal Presence")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("Lethal Presence")]
[assembly: AssemblyCopyright("Created by squidypal")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(global::LethalPresence.LethalPresence), "Lethal Presence", "1.0.0", "squidypal", null)]
[assembly: MelonGame(null, null)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalPresence
{
	public static class BuildInfo
	{
		public const string Name = "Lethal Presence";

		public const string Author = "squidypal";

		public const string Company = null;

		public const string Version = "1.0.0";

		public const string DownloadLink = null;
	}
	public class LethalPresence : MelonMod
	{
		public class EmbeddedResourceHelper
		{
			public static byte[] GetResourceBytes(string filename)
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
				foreach (string text in manifestResourceNames)
				{
					if (!text.Contains(filename))
					{
						continue;
					}
					using Stream stream = executingAssembly.GetManifestResourceStream(text);
					if (stream == null)
					{
						return null;
					}
					byte[] array = new byte[stream.Length];
					stream.Read(array, 0, array.Length);
					return array;
				}
				return null;
			}
		}

		public static class DllTools
		{
			[DllImport("kernel32.dll")]
			public static extern IntPtr LoadLibrary(string dllPath);
		}

		private static global::Discord.Discord _discord;

		private static ActivityManager _activityManager;

		private static long _clientId = 1174141549764935721L;

		private int quota = 0;

		public List<string> Moons;

		private bool inGame;

		public static Activity defaultActivity = new Activity
		{
			State = "Picking a launch mode",
			Details = "Ready to be a great great asset!",
			Assets = 
			{
				LargeImage = "lethalcompanylargeimage",
				LargeText = "Lethal Company",
				SmallImage = "faceicon",
				SmallText = "Lethal Company"
			}
		};

		public override void OnApplicationStart()
		{
			try
			{
				LoadEmbeddedDll();
				_discord = new global::Discord.Discord(_clientId, 0uL);
				_activityManager = _discord.GetActivityManager();
				_activityManager.RegisterSteam(1966720u);
				MelonLogger.Msg("RichPresence created.");
				SetActivity(defaultActivity);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error in OnApplicationStart: " + ex.Message);
			}
		}

		public override void OnUpdate()
		{
			_discord?.RunCallbacks();
			if (inGame)
			{
				SetActivity(defaultActivity);
				if (TimeOfDay.Instance.profitQuota > TimeOfDay.Instance.quotaFulfilled)
				{
					defaultActivity.Details = "Not meeting quota " + TimeOfDay.Instance.quotaFulfilled + "/" + TimeOfDay.Instance.profitQuota;
				}
				else
				{
					defaultActivity.Details = "Meeting quota " + TimeOfDay.Instance.quotaFulfilled + "/" + TimeOfDay.Instance.profitQuota;
				}
				defaultActivity.State = TimeOfDay.Instance.daysUntilDeadline + " days and " + TimeOfDay.Instance.hoursUntilDeadline + " hours until deadline";
				string text = ((object)TimeOfDay.Instance.currentLevel).ToString();
				string text2 = text;
			}
		}

		public static void LoadEmbeddedDll()
		{
			byte[] resourceBytes = EmbeddedResourceHelper.GetResourceBytes("discord_game_sdk.dll");
			if (resourceBytes == null)
			{
				throw new Exception("Failed to find embedded resource: discord_game_sdk.dll");
			}
			string text = Path.Combine(Path.GetTempPath(), "discord_game_sdk.dll");
			File.WriteAllBytes(text, resourceBytes);
			IntPtr intPtr = DllTools.LoadLibrary(text);
			if (intPtr == IntPtr.Zero)
			{
				int lastWin32Error = Marshal.GetLastWin32Error();
				throw new Exception($"Failed to load discord_game_sdk.dll. Error Code: {lastWin32Error}");
			}
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			if (!(sceneName == "SampleSceneRelay"))
			{
				if (sceneName == "MainMenu")
				{
					defaultActivity.Details = "In the Menu";
					SetActivity(defaultActivity);
					inGame = false;
				}
			}
			else
			{
				inGame = true;
			}
		}

		public static void SetActivity(Activity activity)
		{
			_activityManager.UpdateActivity(activity, delegate(Result result)
			{
				if (result != 0)
				{
					MelonLogger.Msg("Failed: " + result);
				}
			});
		}
	}
}
namespace Discord
{
	public class ActivityManager
	{
		internal struct FFIEvents
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ActivityJoinHandler(IntPtr ptr, [MarshalAs(UnmanagedType.LPStr)] string secret);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ActivitySpectateHandler(IntPtr ptr, [MarshalAs(UnmanagedType.LPStr)] string secret);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ActivityJoinRequestHandler(IntPtr ptr, ref User user);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ActivityInviteHandler(IntPtr ptr, ActivityActionType type, ref User user, ref Activity activity);

			internal ActivityJoinHandler OnActivityJoin;

			internal ActivitySpectateHandler OnActivitySpectate;

			internal ActivityJoinRequestHandler OnActivityJoinRequest;

			internal ActivityInviteHandler OnActivityInvite;
		}

		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result RegisterCommandMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string command);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result RegisterSteamMethod(IntPtr methodsPtr, uint steamId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void UpdateActivityCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void UpdateActivityMethod(IntPtr methodsPtr, ref Activity activity, IntPtr callbackData, UpdateActivityCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ClearActivityCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ClearActivityMethod(IntPtr methodsPtr, IntPtr callbackData, ClearActivityCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SendRequestReplyCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SendRequestReplyMethod(IntPtr methodsPtr, long userId, ActivityJoinRequestReply reply, IntPtr callbackData, SendRequestReplyCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SendInviteCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SendInviteMethod(IntPtr methodsPtr, long userId, ActivityActionType type, [MarshalAs(UnmanagedType.LPStr)] string content, IntPtr callbackData, SendInviteCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void AcceptInviteCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void AcceptInviteMethod(IntPtr methodsPtr, long userId, IntPtr callbackData, AcceptInviteCallback callback);

			internal RegisterCommandMethod RegisterCommand;

			internal RegisterSteamMethod RegisterSteam;

			internal UpdateActivityMethod UpdateActivity;

			internal ClearActivityMethod ClearActivity;

			internal SendRequestReplyMethod SendRequestReply;

			internal SendInviteMethod SendInvite;

			internal AcceptInviteMethod AcceptInvite;
		}

		public delegate void UpdateActivityHandler(Result result);

		public delegate void ClearActivityHandler(Result result);

		public delegate void SendRequestReplyHandler(Result result);

		public delegate void SendInviteHandler(Result result);

		public delegate void AcceptInviteHandler(Result result);

		public delegate void ActivityJoinHandler(string secret);

		public delegate void ActivitySpectateHandler(string secret);

		public delegate void ActivityJoinRequestHandler(ref User user);

		public delegate void ActivityInviteHandler(ActivityActionType type, ref User user, ref Activity activity);

		private IntPtr MethodsPtr;

		private object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		public event ActivityJoinHandler OnActivityJoin;

		public event ActivitySpectateHandler OnActivitySpectate;

		public event ActivityJoinRequestHandler OnActivityJoinRequest;

		public event ActivityInviteHandler OnActivityInvite;

		public void RegisterCommand()
		{
			RegisterCommand(null);
		}

		internal ActivityManager(IntPtr ptr, IntPtr eventsPtr, ref FFIEvents events)
		{
			if (eventsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
			InitEvents(eventsPtr, ref events);
			MethodsPtr = ptr;
			if (MethodsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
		}

		private void InitEvents(IntPtr eventsPtr, ref FFIEvents events)
		{
			events.OnActivityJoin = OnActivityJoinImpl;
			events.OnActivitySpectate = OnActivitySpectateImpl;
			events.OnActivityJoinRequest = OnActivityJoinRequestImpl;
			events.OnActivityInvite = OnActivityInviteImpl;
			Marshal.StructureToPtr(events, eventsPtr, fDeleteOld: false);
		}

		public void RegisterCommand(string command)
		{
			Result result = Methods.RegisterCommand(MethodsPtr, command);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void RegisterSteam(uint steamId)
		{
			Result result = Methods.RegisterSteam(MethodsPtr, steamId);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		[MonoPInvokeCallback]
		private static void UpdateActivityCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			UpdateActivityHandler updateActivityHandler = (UpdateActivityHandler)gCHandle.Target;
			gCHandle.Free();
			updateActivityHandler(result);
		}

		public void UpdateActivity(Activity activity, UpdateActivityHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.UpdateActivity(MethodsPtr, ref activity, GCHandle.ToIntPtr(value), UpdateActivityCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void ClearActivityCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			ClearActivityHandler clearActivityHandler = (ClearActivityHandler)gCHandle.Target;
			gCHandle.Free();
			clearActivityHandler(result);
		}

		public void ClearActivity(ClearActivityHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.ClearActivity(MethodsPtr, GCHandle.ToIntPtr(value), ClearActivityCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void SendRequestReplyCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			SendRequestReplyHandler sendRequestReplyHandler = (SendRequestReplyHandler)gCHandle.Target;
			gCHandle.Free();
			sendRequestReplyHandler(result);
		}

		public void SendRequestReply(long userId, ActivityJoinRequestReply reply, SendRequestReplyHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.SendRequestReply(MethodsPtr, userId, reply, GCHandle.ToIntPtr(value), SendRequestReplyCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void SendInviteCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			SendInviteHandler sendInviteHandler = (SendInviteHandler)gCHandle.Target;
			gCHandle.Free();
			sendInviteHandler(result);
		}

		public void SendInvite(long userId, ActivityActionType type, string content, SendInviteHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.SendInvite(MethodsPtr, userId, type, content, GCHandle.ToIntPtr(value), SendInviteCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void AcceptInviteCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			AcceptInviteHandler acceptInviteHandler = (AcceptInviteHandler)gCHandle.Target;
			gCHandle.Free();
			acceptInviteHandler(result);
		}

		public void AcceptInvite(long userId, AcceptInviteHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.AcceptInvite(MethodsPtr, userId, GCHandle.ToIntPtr(value), AcceptInviteCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void OnActivityJoinImpl(IntPtr ptr, string secret)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.ActivityManagerInstance.OnActivityJoin != null)
			{
				discord.ActivityManagerInstance.OnActivityJoin(secret);
			}
		}

		[MonoPInvokeCallback]
		private static void OnActivitySpectateImpl(IntPtr ptr, string secret)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.ActivityManagerInstance.OnActivitySpectate != null)
			{
				discord.ActivityManagerInstance.OnActivitySpectate(secret);
			}
		}

		[MonoPInvokeCallback]
		private static void OnActivityJoinRequestImpl(IntPtr ptr, ref User user)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.ActivityManagerInstance.OnActivityJoinRequest != null)
			{
				discord.ActivityManagerInstance.OnActivityJoinRequest(ref user);
			}
		}

		[MonoPInvokeCallback]
		private static void OnActivityInviteImpl(IntPtr ptr, ActivityActionType type, ref User user, ref Activity activity)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.ActivityManagerInstance.OnActivityInvite != null)
			{
				discord.ActivityManagerInstance.OnActivityInvite(type, ref user, ref activity);
			}
		}
	}
	internal static class Constants
	{
		public const string DllName = "discord_game_sdk";
	}
	public enum Result
	{
		Ok,
		ServiceUnavailable,
		InvalidVersion,
		LockFailed,
		InternalError,
		InvalidPayload,
		InvalidCommand,
		InvalidPermissions,
		NotFetched,
		NotFound,
		Conflict,
		InvalidSecret,
		InvalidJoinSecret,
		NoEligibleActivity,
		InvalidInvite,
		NotAuthenticated,
		InvalidAccessToken,
		ApplicationMismatch,
		InvalidDataUrl,
		InvalidBase64,
		NotFiltered,
		LobbyFull,
		InvalidLobbySecret,
		InvalidFilename,
		InvalidFileSize,
		InvalidEntitlement,
		NotInstalled,
		NotRunning,
		InsufficientBuffer,
		PurchaseCanceled,
		InvalidGuild,
		InvalidEvent,
		InvalidChannel,
		InvalidOrigin,
		RateLimited,
		OAuth2Error,
		SelectChannelTimeout,
		GetGuildTimeout,
		SelectVoiceForceRequired,
		CaptureShortcutAlreadyListening,
		UnauthorizedForAchievement,
		InvalidGiftCode,
		PurchaseError,
		TransactionAborted
	}
	public enum CreateFlags
	{
		Default,
		NoRequireDiscord
	}
	public enum LogLevel
	{
		Error = 1,
		Warn,
		Info,
		Debug
	}
	public enum UserFlag
	{
		Partner = 2,
		HypeSquadEvents = 4,
		HypeSquadHouse1 = 0x40,
		HypeSquadHouse2 = 0x80,
		HypeSquadHouse3 = 0x100
	}
	public enum PremiumType
	{
		None,
		Tier1,
		Tier2
	}
	public enum ImageType
	{
		User
	}
	public enum ActivityType
	{
		Playing,
		Streaming,
		Listening,
		Watching
	}
	public enum ActivityActionType
	{
		Join = 1,
		Spectate
	}
	public enum ActivityJoinRequestReply
	{
		No,
		Yes,
		Ignore
	}
	public enum Status
	{
		Offline,
		Online,
		Idle,
		DoNotDisturb
	}
	public enum RelationshipType
	{
		None,
		Friend,
		Blocked,
		PendingIncoming,
		PendingOutgoing,
		Implicit
	}
	public enum LobbyType
	{
		Private = 1,
		Public
	}
	public enum LobbySearchComparison
	{
		LessThanOrEqual = -2,
		LessThan,
		Equal,
		GreaterThan,
		GreaterThanOrEqual,
		NotEqual
	}
	public enum LobbySearchCast
	{
		String = 1,
		Number
	}
	public enum LobbySearchDistance
	{
		Local,
		Default,
		Extended,
		Global
	}
	public enum EntitlementType
	{
		Purchase = 1,
		PremiumSubscription,
		DeveloperGift,
		TestModePurchase,
		FreePurchase,
		UserGift,
		PremiumPurchase
	}
	public enum SkuType
	{
		Application = 1,
		DLC,
		Consumable,
		Bundle
	}
	public enum InputModeType
	{
		VoiceActivity,
		PushToTalk
	}
	public struct User
	{
		public long Id;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
		public string Username;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
		public string Discriminator;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string Avatar;

		public bool Bot;
	}
	public struct OAuth2Token
	{
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string AccessToken;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
		public string Scopes;

		public long Expires;
	}
	public struct ImageHandle
	{
		public ImageType Type;

		public long Id;

		public uint Size;

		public static ImageHandle User(long id)
		{
			return User(id, 128u);
		}

		public static ImageHandle User(long id, uint size)
		{
			ImageHandle result = default(ImageHandle);
			result.Type = ImageType.User;
			result.Id = id;
			result.Size = size;
			return result;
		}
	}
	public struct ImageDimensions
	{
		public uint Width;

		public uint Height;
	}
	public struct ActivityTimestamps
	{
		public long Start;

		public long End;
	}
	public struct ActivityAssets
	{
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string LargeImage;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string LargeText;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string SmallImage;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string SmallText;
	}
	public struct PartySize
	{
		public int CurrentSize;

		public int MaxSize;
	}
	public struct ActivityParty
	{
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string Id;

		public PartySize Size;
	}
	public struct ActivitySecrets
	{
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string Match;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string Join;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string Spectate;
	}
	public struct Activity
	{
		public ActivityType Type;

		public long ApplicationId;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string Name;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string State;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string Details;

		public ActivityTimestamps Timestamps;

		public ActivityAssets Assets;

		public ActivityParty Party;

		public ActivitySecrets Secrets;

		public bool Instance;
	}
	public struct Presence
	{
		public Status Status;

		public Activity Activity;
	}
	public struct Relationship
	{
		public RelationshipType Type;

		public User User;

		public Presence Presence;
	}
	public struct Lobby
	{
		public long Id;

		public LobbyType Type;

		public long OwnerId;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string Secret;

		public uint Capacity;

		public bool Locked;
	}
	public struct FileStat
	{
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
		public string Filename;

		public ulong Size;

		public ulong LastModified;
	}
	public struct Entitlement
	{
		public long Id;

		public EntitlementType Type;

		public long SkuId;
	}
	public struct SkuPrice
	{
		public uint Amount;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
		public string Currency;
	}
	public struct Sku
	{
		public long Id;

		public SkuType Type;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
		public string Name;

		public SkuPrice Price;
	}
	public struct InputMode
	{
		public InputModeType Type;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
		public string Shortcut;
	}
	public struct UserAchievement
	{
		public long UserId;

		public long AchievementId;

		public byte PercentComplete;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
		public string UnlockedAt;
	}
	public struct LobbyTransaction
	{
		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result SetTypeMethod(IntPtr methodsPtr, LobbyType type);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result SetOwnerMethod(IntPtr methodsPtr, long ownerId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result SetCapacityMethod(IntPtr methodsPtr, uint capacity);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result SetMetadataMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string value);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result DeleteMetadataMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string key);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result SetLockedMethod(IntPtr methodsPtr, bool locked);

			internal SetTypeMethod SetType;

			internal SetOwnerMethod SetOwner;

			internal SetCapacityMethod SetCapacity;

			internal SetMetadataMethod SetMetadata;

			internal DeleteMetadataMethod DeleteMetadata;

			internal SetLockedMethod SetLocked;
		}

		internal IntPtr MethodsPtr;

		internal object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		public void SetType(LobbyType type)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.SetType(MethodsPtr, type);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}

		public void SetOwner(long ownerId)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.SetOwner(MethodsPtr, ownerId);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}

		public void SetCapacity(uint capacity)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.SetCapacity(MethodsPtr, capacity);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}

		public void SetMetadata(string key, string value)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.SetMetadata(MethodsPtr, key, value);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}

		public void DeleteMetadata(string key)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.DeleteMetadata(MethodsPtr, key);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}

		public void SetLocked(bool locked)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.SetLocked(MethodsPtr, locked);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}
	}
	public struct LobbyMemberTransaction
	{
		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result SetMetadataMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string value);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result DeleteMetadataMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string key);

			internal SetMetadataMethod SetMetadata;

			internal DeleteMetadataMethod DeleteMetadata;
		}

		internal IntPtr MethodsPtr;

		internal object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		public void SetMetadata(string key, string value)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.SetMetadata(MethodsPtr, key, value);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}

		public void DeleteMetadata(string key)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.DeleteMetadata(MethodsPtr, key);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}
	}
	public struct LobbySearchQuery
	{
		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result FilterMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string key, LobbySearchComparison comparison, LobbySearchCast cast, [MarshalAs(UnmanagedType.LPStr)] string value);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result SortMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string key, LobbySearchCast cast, [MarshalAs(UnmanagedType.LPStr)] string value);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result LimitMethod(IntPtr methodsPtr, uint limit);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result DistanceMethod(IntPtr methodsPtr, LobbySearchDistance distance);

			internal FilterMethod Filter;

			internal SortMethod Sort;

			internal LimitMethod Limit;

			internal DistanceMethod Distance;
		}

		internal IntPtr MethodsPtr;

		internal object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		public void Filter(string key, LobbySearchComparison comparison, LobbySearchCast cast, string value)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.Filter(MethodsPtr, key, comparison, cast, value);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}

		public void Sort(string key, LobbySearchCast cast, string value)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.Sort(MethodsPtr, key, cast, value);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}

		public void Limit(uint limit)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.Limit(MethodsPtr, limit);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}

		public void Distance(LobbySearchDistance distance)
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Result result = Methods.Distance(MethodsPtr, distance);
				if (result != 0)
				{
					throw new ResultException(result);
				}
			}
		}
	}
	public class ResultException : Exception
	{
		public readonly Result Result;

		public ResultException(Result result)
			: base(result.ToString())
		{
		}
	}
	public class Discord : IDisposable
	{
		internal struct FFIEvents
		{
		}

		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void DestroyHandler(IntPtr MethodsPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result RunCallbacksMethod(IntPtr methodsPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SetLogHookCallback(IntPtr ptr, LogLevel level, [MarshalAs(UnmanagedType.LPStr)] string message);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SetLogHookMethod(IntPtr methodsPtr, LogLevel minLevel, IntPtr callbackData, SetLogHookCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetApplicationManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetUserManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetImageManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetActivityManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetRelationshipManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetLobbyManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetNetworkManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetOverlayManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetStorageManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetStoreManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetVoiceManagerMethod(IntPtr discordPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate IntPtr GetAchievementManagerMethod(IntPtr discordPtr);

			internal DestroyHandler Destroy;

			internal RunCallbacksMethod RunCallbacks;

			internal SetLogHookMethod SetLogHook;

			internal GetApplicationManagerMethod GetApplicationManager;

			internal GetUserManagerMethod GetUserManager;

			internal GetImageManagerMethod GetImageManager;

			internal GetActivityManagerMethod GetActivityManager;

			internal GetRelationshipManagerMethod GetRelationshipManager;

			internal GetLobbyManagerMethod GetLobbyManager;

			internal GetNetworkManagerMethod GetNetworkManager;

			internal GetOverlayManagerMethod GetOverlayManager;

			internal GetStorageManagerMethod GetStorageManager;

			internal GetStoreManagerMethod GetStoreManager;

			internal GetVoiceManagerMethod GetVoiceManager;

			internal GetAchievementManagerMethod GetAchievementManager;
		}

		internal struct FFICreateParams
		{
			internal long ClientId;

			internal ulong Flags;

			internal IntPtr Events;

			internal IntPtr EventData;

			internal IntPtr ApplicationEvents;

			internal uint ApplicationVersion;

			internal IntPtr UserEvents;

			internal uint UserVersion;

			internal IntPtr ImageEvents;

			internal uint ImageVersion;

			internal IntPtr ActivityEvents;

			internal uint ActivityVersion;

			internal IntPtr RelationshipEvents;

			internal uint RelationshipVersion;

			internal IntPtr LobbyEvents;

			internal uint LobbyVersion;

			internal IntPtr NetworkEvents;

			internal uint NetworkVersion;

			internal IntPtr OverlayEvents;

			internal uint OverlayVersion;

			internal IntPtr StorageEvents;

			internal uint StorageVersion;

			internal IntPtr StoreEvents;

			internal uint StoreVersion;

			internal IntPtr VoiceEvents;

			internal uint VoiceVersion;

			internal IntPtr AchievementEvents;

			internal uint AchievementVersion;
		}

		public delegate void SetLogHookHandler(LogLevel level, string message);

		private GCHandle SelfHandle;

		private IntPtr EventsPtr;

		private FFIEvents Events;

		private IntPtr ApplicationEventsPtr;

		private ApplicationManager.FFIEvents ApplicationEvents;

		internal ApplicationManager ApplicationManagerInstance;

		private IntPtr UserEventsPtr;

		private UserManager.FFIEvents UserEvents;

		internal UserManager UserManagerInstance;

		private IntPtr ImageEventsPtr;

		private ImageManager.FFIEvents ImageEvents;

		internal ImageManager ImageManagerInstance;

		private IntPtr ActivityEventsPtr;

		private ActivityManager.FFIEvents ActivityEvents;

		internal ActivityManager ActivityManagerInstance;

		private IntPtr RelationshipEventsPtr;

		private RelationshipManager.FFIEvents RelationshipEvents;

		internal RelationshipManager RelationshipManagerInstance;

		private IntPtr LobbyEventsPtr;

		private LobbyManager.FFIEvents LobbyEvents;

		internal LobbyManager LobbyManagerInstance;

		private IntPtr NetworkEventsPtr;

		private NetworkManager.FFIEvents NetworkEvents;

		internal NetworkManager NetworkManagerInstance;

		private IntPtr OverlayEventsPtr;

		private OverlayManager.FFIEvents OverlayEvents;

		internal OverlayManager OverlayManagerInstance;

		private IntPtr StorageEventsPtr;

		private StorageManager.FFIEvents StorageEvents;

		internal StorageManager StorageManagerInstance;

		private IntPtr StoreEventsPtr;

		private StoreManager.FFIEvents StoreEvents;

		internal StoreManager StoreManagerInstance;

		private IntPtr VoiceEventsPtr;

		private VoiceManager.FFIEvents VoiceEvents;

		internal VoiceManager VoiceManagerInstance;

		private IntPtr AchievementEventsPtr;

		private AchievementManager.FFIEvents AchievementEvents;

		internal AchievementManager AchievementManagerInstance;

		private IntPtr MethodsPtr;

		private object MethodsStructure;

		private GCHandle? setLogHook;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		[DllImport("discord_game_sdk", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		private static extern Result DiscordCreate(uint version, ref FFICreateParams createParams, out IntPtr manager);

		public Discord(long clientId, ulong flags)
		{
			FFICreateParams createParams = default(FFICreateParams);
			createParams.ClientId = clientId;
			createParams.Flags = flags;
			Events = default(FFIEvents);
			EventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(Events));
			createParams.Events = EventsPtr;
			SelfHandle = GCHandle.Alloc(this);
			createParams.EventData = GCHandle.ToIntPtr(SelfHandle);
			ApplicationEvents = default(ApplicationManager.FFIEvents);
			ApplicationEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(ApplicationEvents));
			createParams.ApplicationEvents = ApplicationEventsPtr;
			createParams.ApplicationVersion = 1u;
			UserEvents = default(UserManager.FFIEvents);
			UserEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(UserEvents));
			createParams.UserEvents = UserEventsPtr;
			createParams.UserVersion = 1u;
			ImageEvents = default(ImageManager.FFIEvents);
			ImageEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(ImageEvents));
			createParams.ImageEvents = ImageEventsPtr;
			createParams.ImageVersion = 1u;
			ActivityEvents = default(ActivityManager.FFIEvents);
			ActivityEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(ActivityEvents));
			createParams.ActivityEvents = ActivityEventsPtr;
			createParams.ActivityVersion = 1u;
			RelationshipEvents = default(RelationshipManager.FFIEvents);
			RelationshipEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(RelationshipEvents));
			createParams.RelationshipEvents = RelationshipEventsPtr;
			createParams.RelationshipVersion = 1u;
			LobbyEvents = default(LobbyManager.FFIEvents);
			LobbyEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(LobbyEvents));
			createParams.LobbyEvents = LobbyEventsPtr;
			createParams.LobbyVersion = 1u;
			NetworkEvents = default(NetworkManager.FFIEvents);
			NetworkEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(NetworkEvents));
			createParams.NetworkEvents = NetworkEventsPtr;
			createParams.NetworkVersion = 1u;
			OverlayEvents = default(OverlayManager.FFIEvents);
			OverlayEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(OverlayEvents));
			createParams.OverlayEvents = OverlayEventsPtr;
			createParams.OverlayVersion = 1u;
			StorageEvents = default(StorageManager.FFIEvents);
			StorageEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(StorageEvents));
			createParams.StorageEvents = StorageEventsPtr;
			createParams.StorageVersion = 1u;
			StoreEvents = default(StoreManager.FFIEvents);
			StoreEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(StoreEvents));
			createParams.StoreEvents = StoreEventsPtr;
			createParams.StoreVersion = 1u;
			VoiceEvents = default(VoiceManager.FFIEvents);
			VoiceEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(VoiceEvents));
			createParams.VoiceEvents = VoiceEventsPtr;
			createParams.VoiceVersion = 1u;
			AchievementEvents = default(AchievementManager.FFIEvents);
			AchievementEventsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(AchievementEvents));
			createParams.AchievementEvents = AchievementEventsPtr;
			createParams.AchievementVersion = 1u;
			InitEvents(EventsPtr, ref Events);
			Result result = DiscordCreate(2u, ref createParams, out MethodsPtr);
			if (result != 0)
			{
				Dispose();
				throw new ResultException(result);
			}
		}

		private void InitEvents(IntPtr eventsPtr, ref FFIEvents events)
		{
			Marshal.StructureToPtr(events, eventsPtr, fDeleteOld: false);
		}

		public void Dispose()
		{
			if (MethodsPtr != IntPtr.Zero)
			{
				Methods.Destroy(MethodsPtr);
			}
			SelfHandle.Free();
			Marshal.FreeHGlobal(EventsPtr);
			Marshal.FreeHGlobal(ApplicationEventsPtr);
			Marshal.FreeHGlobal(UserEventsPtr);
			Marshal.FreeHGlobal(ImageEventsPtr);
			Marshal.FreeHGlobal(ActivityEventsPtr);
			Marshal.FreeHGlobal(RelationshipEventsPtr);
			Marshal.FreeHGlobal(LobbyEventsPtr);
			Marshal.FreeHGlobal(NetworkEventsPtr);
			Marshal.FreeHGlobal(OverlayEventsPtr);
			Marshal.FreeHGlobal(StorageEventsPtr);
			Marshal.FreeHGlobal(StoreEventsPtr);
			Marshal.FreeHGlobal(VoiceEventsPtr);
			Marshal.FreeHGlobal(AchievementEventsPtr);
			if (setLogHook.HasValue)
			{
				setLogHook.Value.Free();
			}
		}

		public void RunCallbacks()
		{
			Result result = Methods.RunCallbacks(MethodsPtr);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		[MonoPInvokeCallback]
		private static void SetLogHookCallbackImpl(IntPtr ptr, LogLevel level, string message)
		{
			SetLogHookHandler setLogHookHandler = (SetLogHookHandler)GCHandle.FromIntPtr(ptr).Target;
			setLogHookHandler(level, message);
		}

		public void SetLogHook(LogLevel minLevel, SetLogHookHandler callback)
		{
			if (setLogHook.HasValue)
			{
				setLogHook.Value.Free();
			}
			setLogHook = GCHandle.Alloc(callback);
			Methods.SetLogHook(MethodsPtr, minLevel, GCHandle.ToIntPtr(setLogHook.Value), SetLogHookCallbackImpl);
		}

		public ApplicationManager GetApplicationManager()
		{
			if (ApplicationManagerInstance == null)
			{
				ApplicationManagerInstance = new ApplicationManager(Methods.GetApplicationManager(MethodsPtr), ApplicationEventsPtr, ref ApplicationEvents);
			}
			return ApplicationManagerInstance;
		}

		public UserManager GetUserManager()
		{
			if (UserManagerInstance == null)
			{
				UserManagerInstance = new UserManager(Methods.GetUserManager(MethodsPtr), UserEventsPtr, ref UserEvents);
			}
			return UserManagerInstance;
		}

		public ImageManager GetImageManager()
		{
			if (ImageManagerInstance == null)
			{
				ImageManagerInstance = new ImageManager(Methods.GetImageManager(MethodsPtr), ImageEventsPtr, ref ImageEvents);
			}
			return ImageManagerInstance;
		}

		public ActivityManager GetActivityManager()
		{
			if (ActivityManagerInstance == null)
			{
				ActivityManagerInstance = new ActivityManager(Methods.GetActivityManager(MethodsPtr), ActivityEventsPtr, ref ActivityEvents);
			}
			return ActivityManagerInstance;
		}

		public RelationshipManager GetRelationshipManager()
		{
			if (RelationshipManagerInstance == null)
			{
				RelationshipManagerInstance = new RelationshipManager(Methods.GetRelationshipManager(MethodsPtr), RelationshipEventsPtr, ref RelationshipEvents);
			}
			return RelationshipManagerInstance;
		}

		public LobbyManager GetLobbyManager()
		{
			if (LobbyManagerInstance == null)
			{
				LobbyManagerInstance = new LobbyManager(Methods.GetLobbyManager(MethodsPtr), LobbyEventsPtr, ref LobbyEvents);
			}
			return LobbyManagerInstance;
		}

		public NetworkManager GetNetworkManager()
		{
			if (NetworkManagerInstance == null)
			{
				NetworkManagerInstance = new NetworkManager(Methods.GetNetworkManager(MethodsPtr), NetworkEventsPtr, ref NetworkEvents);
			}
			return NetworkManagerInstance;
		}

		public OverlayManager GetOverlayManager()
		{
			if (OverlayManagerInstance == null)
			{
				OverlayManagerInstance = new OverlayManager(Methods.GetOverlayManager(MethodsPtr), OverlayEventsPtr, ref OverlayEvents);
			}
			return OverlayManagerInstance;
		}

		public StorageManager GetStorageManager()
		{
			if (StorageManagerInstance == null)
			{
				StorageManagerInstance = new StorageManager(Methods.GetStorageManager(MethodsPtr), StorageEventsPtr, ref StorageEvents);
			}
			return StorageManagerInstance;
		}

		public StoreManager GetStoreManager()
		{
			if (StoreManagerInstance == null)
			{
				StoreManagerInstance = new StoreManager(Methods.GetStoreManager(MethodsPtr), StoreEventsPtr, ref StoreEvents);
			}
			return StoreManagerInstance;
		}

		public VoiceManager GetVoiceManager()
		{
			if (VoiceManagerInstance == null)
			{
				VoiceManagerInstance = new VoiceManager(Methods.GetVoiceManager(MethodsPtr), VoiceEventsPtr, ref VoiceEvents);
			}
			return VoiceManagerInstance;
		}

		public AchievementManager GetAchievementManager()
		{
			if (AchievementManagerInstance == null)
			{
				AchievementManagerInstance = new AchievementManager(Methods.GetAchievementManager(MethodsPtr), AchievementEventsPtr, ref AchievementEvents);
			}
			return AchievementManagerInstance;
		}
	}
	internal class MonoPInvokeCallbackAttribute : Attribute
	{
	}
	public class ApplicationManager
	{
		internal struct FFIEvents
		{
		}

		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ValidateOrExitCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ValidateOrExitMethod(IntPtr methodsPtr, IntPtr callbackData, ValidateOrExitCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void GetCurrentLocaleMethod(IntPtr methodsPtr, StringBuilder locale);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void GetCurrentBranchMethod(IntPtr methodsPtr, StringBuilder branch);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void GetOAuth2TokenCallback(IntPtr ptr, Result result, ref OAuth2Token oauth2Token);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void GetOAuth2TokenMethod(IntPtr methodsPtr, IntPtr callbackData, GetOAuth2TokenCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void GetTicketCallback(IntPtr ptr, Result result, [MarshalAs(UnmanagedType.LPStr)] ref string data);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void GetTicketMethod(IntPtr methodsPtr, IntPtr callbackData, GetTicketCallback callback);

			internal ValidateOrExitMethod ValidateOrExit;

			internal GetCurrentLocaleMethod GetCurrentLocale;

			internal GetCurrentBranchMethod GetCurrentBranch;

			internal GetOAuth2TokenMethod GetOAuth2Token;

			internal GetTicketMethod GetTicket;
		}

		public delegate void ValidateOrExitHandler(Result result);

		public delegate void GetOAuth2TokenHandler(Result result, ref OAuth2Token oauth2Token);

		public delegate void GetTicketHandler(Result result, ref string data);

		private IntPtr MethodsPtr;

		private object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		internal ApplicationManager(IntPtr ptr, IntPtr eventsPtr, ref FFIEvents events)
		{
			if (eventsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
			InitEvents(eventsPtr, ref events);
			MethodsPtr = ptr;
			if (MethodsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
		}

		private void InitEvents(IntPtr eventsPtr, ref FFIEvents events)
		{
			Marshal.StructureToPtr(events, eventsPtr, fDeleteOld: false);
		}

		[MonoPInvokeCallback]
		private static void ValidateOrExitCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			ValidateOrExitHandler validateOrExitHandler = (ValidateOrExitHandler)gCHandle.Target;
			gCHandle.Free();
			validateOrExitHandler(result);
		}

		public void ValidateOrExit(ValidateOrExitHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.ValidateOrExit(MethodsPtr, GCHandle.ToIntPtr(value), ValidateOrExitCallbackImpl);
		}

		public string GetCurrentLocale()
		{
			StringBuilder stringBuilder = new StringBuilder(128);
			Methods.GetCurrentLocale(MethodsPtr, stringBuilder);
			return stringBuilder.ToString();
		}

		public string GetCurrentBranch()
		{
			StringBuilder stringBuilder = new StringBuilder(4096);
			Methods.GetCurrentBranch(MethodsPtr, stringBuilder);
			return stringBuilder.ToString();
		}

		[MonoPInvokeCallback]
		private static void GetOAuth2TokenCallbackImpl(IntPtr ptr, Result result, ref OAuth2Token oauth2Token)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			GetOAuth2TokenHandler getOAuth2TokenHandler = (GetOAuth2TokenHandler)gCHandle.Target;
			gCHandle.Free();
			getOAuth2TokenHandler(result, ref oauth2Token);
		}

		public void GetOAuth2Token(GetOAuth2TokenHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.GetOAuth2Token(MethodsPtr, GCHandle.ToIntPtr(value), GetOAuth2TokenCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void GetTicketCallbackImpl(IntPtr ptr, Result result, ref string data)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			GetTicketHandler getTicketHandler = (GetTicketHandler)gCHandle.Target;
			gCHandle.Free();
			getTicketHandler(result, ref data);
		}

		public void GetTicket(GetTicketHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.GetTicket(MethodsPtr, GCHandle.ToIntPtr(value), GetTicketCallbackImpl);
		}
	}
	public class UserManager
	{
		internal struct FFIEvents
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void CurrentUserUpdateHandler(IntPtr ptr);

			internal CurrentUserUpdateHandler OnCurrentUserUpdate;
		}

		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetCurrentUserMethod(IntPtr methodsPtr, ref User currentUser);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void GetUserCallback(IntPtr ptr, Result result, ref User user);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void GetUserMethod(IntPtr methodsPtr, long userId, IntPtr callbackData, GetUserCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetCurrentUserPremiumTypeMethod(IntPtr methodsPtr, ref PremiumType premiumType);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result CurrentUserHasFlagMethod(IntPtr methodsPtr, UserFlag flag, ref bool hasFlag);

			internal GetCurrentUserMethod GetCurrentUser;

			internal GetUserMethod GetUser;

			internal GetCurrentUserPremiumTypeMethod GetCurrentUserPremiumType;

			internal CurrentUserHasFlagMethod CurrentUserHasFlag;
		}

		public delegate void GetUserHandler(Result result, ref User user);

		public delegate void CurrentUserUpdateHandler();

		private IntPtr MethodsPtr;

		private object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		public event CurrentUserUpdateHandler OnCurrentUserUpdate;

		internal UserManager(IntPtr ptr, IntPtr eventsPtr, ref FFIEvents events)
		{
			if (eventsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
			InitEvents(eventsPtr, ref events);
			MethodsPtr = ptr;
			if (MethodsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
		}

		private void InitEvents(IntPtr eventsPtr, ref FFIEvents events)
		{
			events.OnCurrentUserUpdate = OnCurrentUserUpdateImpl;
			Marshal.StructureToPtr(events, eventsPtr, fDeleteOld: false);
		}

		public User GetCurrentUser()
		{
			User currentUser = default(User);
			Result result = Methods.GetCurrentUser(MethodsPtr, ref currentUser);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return currentUser;
		}

		[MonoPInvokeCallback]
		private static void GetUserCallbackImpl(IntPtr ptr, Result result, ref User user)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			GetUserHandler getUserHandler = (GetUserHandler)gCHandle.Target;
			gCHandle.Free();
			getUserHandler(result, ref user);
		}

		public void GetUser(long userId, GetUserHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.GetUser(MethodsPtr, userId, GCHandle.ToIntPtr(value), GetUserCallbackImpl);
		}

		public PremiumType GetCurrentUserPremiumType()
		{
			PremiumType premiumType = PremiumType.None;
			Result result = Methods.GetCurrentUserPremiumType(MethodsPtr, ref premiumType);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return premiumType;
		}

		public bool CurrentUserHasFlag(UserFlag flag)
		{
			bool hasFlag = false;
			Result result = Methods.CurrentUserHasFlag(MethodsPtr, flag, ref hasFlag);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return hasFlag;
		}

		[MonoPInvokeCallback]
		private static void OnCurrentUserUpdateImpl(IntPtr ptr)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.UserManagerInstance.OnCurrentUserUpdate != null)
			{
				discord.UserManagerInstance.OnCurrentUserUpdate();
			}
		}
	}
	public class ImageManager
	{
		internal struct FFIEvents
		{
		}

		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void FetchCallback(IntPtr ptr, Result result, ImageHandle handleResult);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void FetchMethod(IntPtr methodsPtr, ImageHandle handle, bool refresh, IntPtr callbackData, FetchCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetDimensionsMethod(IntPtr methodsPtr, ImageHandle handle, ref ImageDimensions dimensions);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetDataMethod(IntPtr methodsPtr, ImageHandle handle, byte[] data, int dataLen);

			internal FetchMethod Fetch;

			internal GetDimensionsMethod GetDimensions;

			internal GetDataMethod GetData;
		}

		public delegate void FetchHandler(Result result, ImageHandle handleResult);

		private IntPtr MethodsPtr;

		private object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		internal ImageManager(IntPtr ptr, IntPtr eventsPtr, ref FFIEvents events)
		{
			if (eventsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
			InitEvents(eventsPtr, ref events);
			MethodsPtr = ptr;
			if (MethodsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
		}

		private void InitEvents(IntPtr eventsPtr, ref FFIEvents events)
		{
			Marshal.StructureToPtr(events, eventsPtr, fDeleteOld: false);
		}

		[MonoPInvokeCallback]
		private static void FetchCallbackImpl(IntPtr ptr, Result result, ImageHandle handleResult)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			FetchHandler fetchHandler = (FetchHandler)gCHandle.Target;
			gCHandle.Free();
			fetchHandler(result, handleResult);
		}

		public void Fetch(ImageHandle handle, bool refresh, FetchHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.Fetch(MethodsPtr, handle, refresh, GCHandle.ToIntPtr(value), FetchCallbackImpl);
		}

		public ImageDimensions GetDimensions(ImageHandle handle)
		{
			ImageDimensions dimensions = default(ImageDimensions);
			Result result = Methods.GetDimensions(MethodsPtr, handle, ref dimensions);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return dimensions;
		}

		public void GetData(ImageHandle handle, byte[] data)
		{
			Result result = Methods.GetData(MethodsPtr, handle, data, data.Length);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void Fetch(ImageHandle handle, FetchHandler callback)
		{
			Fetch(handle, refresh: false, callback);
		}

		public byte[] GetData(ImageHandle handle)
		{
			ImageDimensions dimensions = GetDimensions(handle);
			byte[] array = new byte[dimensions.Width * dimensions.Height * 4];
			GetData(handle, array);
			return array;
		}
	}
	public class RelationshipManager
	{
		internal struct FFIEvents
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void RefreshHandler(IntPtr ptr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void RelationshipUpdateHandler(IntPtr ptr, ref Relationship relationship);

			internal RefreshHandler OnRefresh;

			internal RelationshipUpdateHandler OnRelationshipUpdate;
		}

		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate bool FilterCallback(IntPtr ptr, ref Relationship relationship);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void FilterMethod(IntPtr methodsPtr, IntPtr callbackData, FilterCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result CountMethod(IntPtr methodsPtr, ref int count);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetMethod(IntPtr methodsPtr, long userId, ref Relationship relationship);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetAtMethod(IntPtr methodsPtr, uint index, ref Relationship relationship);

			internal FilterMethod Filter;

			internal CountMethod Count;

			internal GetMethod Get;

			internal GetAtMethod GetAt;
		}

		public delegate bool FilterHandler(ref Relationship relationship);

		public delegate void RefreshHandler();

		public delegate void RelationshipUpdateHandler(ref Relationship relationship);

		private IntPtr MethodsPtr;

		private object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		public event RefreshHandler OnRefresh;

		public event RelationshipUpdateHandler OnRelationshipUpdate;

		internal RelationshipManager(IntPtr ptr, IntPtr eventsPtr, ref FFIEvents events)
		{
			if (eventsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
			InitEvents(eventsPtr, ref events);
			MethodsPtr = ptr;
			if (MethodsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
		}

		private void InitEvents(IntPtr eventsPtr, ref FFIEvents events)
		{
			events.OnRefresh = OnRefreshImpl;
			events.OnRelationshipUpdate = OnRelationshipUpdateImpl;
			Marshal.StructureToPtr(events, eventsPtr, fDeleteOld: false);
		}

		[MonoPInvokeCallback]
		private static bool FilterCallbackImpl(IntPtr ptr, ref Relationship relationship)
		{
			FilterHandler filterHandler = (FilterHandler)GCHandle.FromIntPtr(ptr).Target;
			return filterHandler(ref relationship);
		}

		public void Filter(FilterHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.Filter(MethodsPtr, GCHandle.ToIntPtr(value), FilterCallbackImpl);
			value.Free();
		}

		public int Count()
		{
			int count = 0;
			Result result = Methods.Count(MethodsPtr, ref count);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return count;
		}

		public Relationship Get(long userId)
		{
			Relationship relationship = default(Relationship);
			Result result = Methods.Get(MethodsPtr, userId, ref relationship);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return relationship;
		}

		public Relationship GetAt(uint index)
		{
			Relationship relationship = default(Relationship);
			Result result = Methods.GetAt(MethodsPtr, index, ref relationship);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return relationship;
		}

		[MonoPInvokeCallback]
		private static void OnRefreshImpl(IntPtr ptr)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.RelationshipManagerInstance.OnRefresh != null)
			{
				discord.RelationshipManagerInstance.OnRefresh();
			}
		}

		[MonoPInvokeCallback]
		private static void OnRelationshipUpdateImpl(IntPtr ptr, ref Relationship relationship)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.RelationshipManagerInstance.OnRelationshipUpdate != null)
			{
				discord.RelationshipManagerInstance.OnRelationshipUpdate(ref relationship);
			}
		}
	}
	public class LobbyManager
	{
		internal struct FFIEvents
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void LobbyUpdateHandler(IntPtr ptr, long lobbyId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void LobbyDeleteHandler(IntPtr ptr, long lobbyId, uint reason);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void MemberConnectHandler(IntPtr ptr, long lobbyId, long userId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void MemberUpdateHandler(IntPtr ptr, long lobbyId, long userId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void MemberDisconnectHandler(IntPtr ptr, long lobbyId, long userId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void LobbyMessageHandler(IntPtr ptr, long lobbyId, long userId, IntPtr dataPtr, int dataLen);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SpeakingHandler(IntPtr ptr, long lobbyId, long userId, bool speaking);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void NetworkMessageHandler(IntPtr ptr, long lobbyId, long userId, byte channelId, IntPtr dataPtr, int dataLen);

			internal LobbyUpdateHandler OnLobbyUpdate;

			internal LobbyDeleteHandler OnLobbyDelete;

			internal MemberConnectHandler OnMemberConnect;

			internal MemberUpdateHandler OnMemberUpdate;

			internal MemberDisconnectHandler OnMemberDisconnect;

			internal LobbyMessageHandler OnLobbyMessage;

			internal SpeakingHandler OnSpeaking;

			internal NetworkMessageHandler OnNetworkMessage;
		}

		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetLobbyCreateTransactionMethod(IntPtr methodsPtr, ref IntPtr transaction);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetLobbyUpdateTransactionMethod(IntPtr methodsPtr, long lobbyId, ref IntPtr transaction);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetMemberUpdateTransactionMethod(IntPtr methodsPtr, long lobbyId, long userId, ref IntPtr transaction);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void CreateLobbyCallback(IntPtr ptr, Result result, ref Lobby lobby);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void CreateLobbyMethod(IntPtr methodsPtr, IntPtr transaction, IntPtr callbackData, CreateLobbyCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void UpdateLobbyCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void UpdateLobbyMethod(IntPtr methodsPtr, long lobbyId, IntPtr transaction, IntPtr callbackData, UpdateLobbyCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void DeleteLobbyCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void DeleteLobbyMethod(IntPtr methodsPtr, long lobbyId, IntPtr callbackData, DeleteLobbyCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ConnectLobbyCallback(IntPtr ptr, Result result, ref Lobby lobby);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ConnectLobbyMethod(IntPtr methodsPtr, long lobbyId, [MarshalAs(UnmanagedType.LPStr)] string secret, IntPtr callbackData, ConnectLobbyCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ConnectLobbyWithActivitySecretCallback(IntPtr ptr, Result result, ref Lobby lobby);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ConnectLobbyWithActivitySecretMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string activitySecret, IntPtr callbackData, ConnectLobbyWithActivitySecretCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void DisconnectLobbyCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void DisconnectLobbyMethod(IntPtr methodsPtr, long lobbyId, IntPtr callbackData, DisconnectLobbyCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetLobbyMethod(IntPtr methodsPtr, long lobbyId, ref Lobby lobby);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetLobbyActivitySecretMethod(IntPtr methodsPtr, long lobbyId, StringBuilder secret);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetLobbyMetadataValueMethod(IntPtr methodsPtr, long lobbyId, [MarshalAs(UnmanagedType.LPStr)] string key, StringBuilder value);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetLobbyMetadataKeyMethod(IntPtr methodsPtr, long lobbyId, int index, StringBuilder key);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result LobbyMetadataCountMethod(IntPtr methodsPtr, long lobbyId, ref int count);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result MemberCountMethod(IntPtr methodsPtr, long lobbyId, ref int count);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetMemberUserIdMethod(IntPtr methodsPtr, long lobbyId, int index, ref long userId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetMemberUserMethod(IntPtr methodsPtr, long lobbyId, long userId, ref User user);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetMemberMetadataValueMethod(IntPtr methodsPtr, long lobbyId, long userId, [MarshalAs(UnmanagedType.LPStr)] string key, StringBuilder value);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetMemberMetadataKeyMethod(IntPtr methodsPtr, long lobbyId, long userId, int index, StringBuilder key);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result MemberMetadataCountMethod(IntPtr methodsPtr, long lobbyId, long userId, ref int count);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void UpdateMemberCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void UpdateMemberMethod(IntPtr methodsPtr, long lobbyId, long userId, IntPtr transaction, IntPtr callbackData, UpdateMemberCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SendLobbyMessageCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SendLobbyMessageMethod(IntPtr methodsPtr, long lobbyId, byte[] data, int dataLen, IntPtr callbackData, SendLobbyMessageCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetSearchQueryMethod(IntPtr methodsPtr, ref IntPtr query);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SearchCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SearchMethod(IntPtr methodsPtr, IntPtr query, IntPtr callbackData, SearchCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void LobbyCountMethod(IntPtr methodsPtr, ref int count);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetLobbyIdMethod(IntPtr methodsPtr, int index, ref long lobbyId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ConnectVoiceCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ConnectVoiceMethod(IntPtr methodsPtr, long lobbyId, IntPtr callbackData, ConnectVoiceCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void DisconnectVoiceCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void DisconnectVoiceMethod(IntPtr methodsPtr, long lobbyId, IntPtr callbackData, DisconnectVoiceCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result ConnectNetworkMethod(IntPtr methodsPtr, long lobbyId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result DisconnectNetworkMethod(IntPtr methodsPtr, long lobbyId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result FlushNetworkMethod(IntPtr methodsPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result OpenNetworkChannelMethod(IntPtr methodsPtr, long lobbyId, byte channelId, bool reliable);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result SendNetworkMessageMethod(IntPtr methodsPtr, long lobbyId, long userId, byte channelId, byte[] data, int dataLen);

			internal GetLobbyCreateTransactionMethod GetLobbyCreateTransaction;

			internal GetLobbyUpdateTransactionMethod GetLobbyUpdateTransaction;

			internal GetMemberUpdateTransactionMethod GetMemberUpdateTransaction;

			internal CreateLobbyMethod CreateLobby;

			internal UpdateLobbyMethod UpdateLobby;

			internal DeleteLobbyMethod DeleteLobby;

			internal ConnectLobbyMethod ConnectLobby;

			internal ConnectLobbyWithActivitySecretMethod ConnectLobbyWithActivitySecret;

			internal DisconnectLobbyMethod DisconnectLobby;

			internal GetLobbyMethod GetLobby;

			internal GetLobbyActivitySecretMethod GetLobbyActivitySecret;

			internal GetLobbyMetadataValueMethod GetLobbyMetadataValue;

			internal GetLobbyMetadataKeyMethod GetLobbyMetadataKey;

			internal LobbyMetadataCountMethod LobbyMetadataCount;

			internal MemberCountMethod MemberCount;

			internal GetMemberUserIdMethod GetMemberUserId;

			internal GetMemberUserMethod GetMemberUser;

			internal GetMemberMetadataValueMethod GetMemberMetadataValue;

			internal GetMemberMetadataKeyMethod GetMemberMetadataKey;

			internal MemberMetadataCountMethod MemberMetadataCount;

			internal UpdateMemberMethod UpdateMember;

			internal SendLobbyMessageMethod SendLobbyMessage;

			internal GetSearchQueryMethod GetSearchQuery;

			internal SearchMethod Search;

			internal LobbyCountMethod LobbyCount;

			internal GetLobbyIdMethod GetLobbyId;

			internal ConnectVoiceMethod ConnectVoice;

			internal DisconnectVoiceMethod DisconnectVoice;

			internal ConnectNetworkMethod ConnectNetwork;

			internal DisconnectNetworkMethod DisconnectNetwork;

			internal FlushNetworkMethod FlushNetwork;

			internal OpenNetworkChannelMethod OpenNetworkChannel;

			internal SendNetworkMessageMethod SendNetworkMessage;
		}

		public delegate void CreateLobbyHandler(Result result, ref Lobby lobby);

		public delegate void UpdateLobbyHandler(Result result);

		public delegate void DeleteLobbyHandler(Result result);

		public delegate void ConnectLobbyHandler(Result result, ref Lobby lobby);

		public delegate void ConnectLobbyWithActivitySecretHandler(Result result, ref Lobby lobby);

		public delegate void DisconnectLobbyHandler(Result result);

		public delegate void UpdateMemberHandler(Result result);

		public delegate void SendLobbyMessageHandler(Result result);

		public delegate void SearchHandler(Result result);

		public delegate void ConnectVoiceHandler(Result result);

		public delegate void DisconnectVoiceHandler(Result result);

		public delegate void LobbyUpdateHandler(long lobbyId);

		public delegate void LobbyDeleteHandler(long lobbyId, uint reason);

		public delegate void MemberConnectHandler(long lobbyId, long userId);

		public delegate void MemberUpdateHandler(long lobbyId, long userId);

		public delegate void MemberDisconnectHandler(long lobbyId, long userId);

		public delegate void LobbyMessageHandler(long lobbyId, long userId, byte[] data);

		public delegate void SpeakingHandler(long lobbyId, long userId, bool speaking);

		public delegate void NetworkMessageHandler(long lobbyId, long userId, byte channelId, byte[] data);

		private IntPtr MethodsPtr;

		private object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		public event LobbyUpdateHandler OnLobbyUpdate;

		public event LobbyDeleteHandler OnLobbyDelete;

		public event MemberConnectHandler OnMemberConnect;

		public event MemberUpdateHandler OnMemberUpdate;

		public event MemberDisconnectHandler OnMemberDisconnect;

		public event LobbyMessageHandler OnLobbyMessage;

		public event SpeakingHandler OnSpeaking;

		public event NetworkMessageHandler OnNetworkMessage;

		internal LobbyManager(IntPtr ptr, IntPtr eventsPtr, ref FFIEvents events)
		{
			if (eventsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
			InitEvents(eventsPtr, ref events);
			MethodsPtr = ptr;
			if (MethodsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
		}

		private void InitEvents(IntPtr eventsPtr, ref FFIEvents events)
		{
			events.OnLobbyUpdate = OnLobbyUpdateImpl;
			events.OnLobbyDelete = OnLobbyDeleteImpl;
			events.OnMemberConnect = OnMemberConnectImpl;
			events.OnMemberUpdate = OnMemberUpdateImpl;
			events.OnMemberDisconnect = OnMemberDisconnectImpl;
			events.OnLobbyMessage = OnLobbyMessageImpl;
			events.OnSpeaking = OnSpeakingImpl;
			events.OnNetworkMessage = OnNetworkMessageImpl;
			Marshal.StructureToPtr(events, eventsPtr, fDeleteOld: false);
		}

		public LobbyTransaction GetLobbyCreateTransaction()
		{
			LobbyTransaction result = default(LobbyTransaction);
			Result result2 = Methods.GetLobbyCreateTransaction(MethodsPtr, ref result.MethodsPtr);
			if (result2 != 0)
			{
				throw new ResultException(result2);
			}
			return result;
		}

		public LobbyTransaction GetLobbyUpdateTransaction(long lobbyId)
		{
			LobbyTransaction result = default(LobbyTransaction);
			Result result2 = Methods.GetLobbyUpdateTransaction(MethodsPtr, lobbyId, ref result.MethodsPtr);
			if (result2 != 0)
			{
				throw new ResultException(result2);
			}
			return result;
		}

		public LobbyMemberTransaction GetMemberUpdateTransaction(long lobbyId, long userId)
		{
			LobbyMemberTransaction result = default(LobbyMemberTransaction);
			Result result2 = Methods.GetMemberUpdateTransaction(MethodsPtr, lobbyId, userId, ref result.MethodsPtr);
			if (result2 != 0)
			{
				throw new ResultException(result2);
			}
			return result;
		}

		[MonoPInvokeCallback]
		private static void CreateLobbyCallbackImpl(IntPtr ptr, Result result, ref Lobby lobby)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			CreateLobbyHandler createLobbyHandler = (CreateLobbyHandler)gCHandle.Target;
			gCHandle.Free();
			createLobbyHandler(result, ref lobby);
		}

		public void CreateLobby(LobbyTransaction transaction, CreateLobbyHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.CreateLobby(MethodsPtr, transaction.MethodsPtr, GCHandle.ToIntPtr(value), CreateLobbyCallbackImpl);
			transaction.MethodsPtr = IntPtr.Zero;
		}

		[MonoPInvokeCallback]
		private static void UpdateLobbyCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			UpdateLobbyHandler updateLobbyHandler = (UpdateLobbyHandler)gCHandle.Target;
			gCHandle.Free();
			updateLobbyHandler(result);
		}

		public void UpdateLobby(long lobbyId, LobbyTransaction transaction, UpdateLobbyHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.UpdateLobby(MethodsPtr, lobbyId, transaction.MethodsPtr, GCHandle.ToIntPtr(value), UpdateLobbyCallbackImpl);
			transaction.MethodsPtr = IntPtr.Zero;
		}

		[MonoPInvokeCallback]
		private static void DeleteLobbyCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			DeleteLobbyHandler deleteLobbyHandler = (DeleteLobbyHandler)gCHandle.Target;
			gCHandle.Free();
			deleteLobbyHandler(result);
		}

		public void DeleteLobby(long lobbyId, DeleteLobbyHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.DeleteLobby(MethodsPtr, lobbyId, GCHandle.ToIntPtr(value), DeleteLobbyCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void ConnectLobbyCallbackImpl(IntPtr ptr, Result result, ref Lobby lobby)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			ConnectLobbyHandler connectLobbyHandler = (ConnectLobbyHandler)gCHandle.Target;
			gCHandle.Free();
			connectLobbyHandler(result, ref lobby);
		}

		public void ConnectLobby(long lobbyId, string secret, ConnectLobbyHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.ConnectLobby(MethodsPtr, lobbyId, secret, GCHandle.ToIntPtr(value), ConnectLobbyCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void ConnectLobbyWithActivitySecretCallbackImpl(IntPtr ptr, Result result, ref Lobby lobby)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			ConnectLobbyWithActivitySecretHandler connectLobbyWithActivitySecretHandler = (ConnectLobbyWithActivitySecretHandler)gCHandle.Target;
			gCHandle.Free();
			connectLobbyWithActivitySecretHandler(result, ref lobby);
		}

		public void ConnectLobbyWithActivitySecret(string activitySecret, ConnectLobbyWithActivitySecretHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.ConnectLobbyWithActivitySecret(MethodsPtr, activitySecret, GCHandle.ToIntPtr(value), ConnectLobbyWithActivitySecretCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void DisconnectLobbyCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			DisconnectLobbyHandler disconnectLobbyHandler = (DisconnectLobbyHandler)gCHandle.Target;
			gCHandle.Free();
			disconnectLobbyHandler(result);
		}

		public void DisconnectLobby(long lobbyId, DisconnectLobbyHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.DisconnectLobby(MethodsPtr, lobbyId, GCHandle.ToIntPtr(value), DisconnectLobbyCallbackImpl);
		}

		public Lobby GetLobby(long lobbyId)
		{
			Lobby lobby = default(Lobby);
			Result result = Methods.GetLobby(MethodsPtr, lobbyId, ref lobby);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return lobby;
		}

		public string GetLobbyActivitySecret(long lobbyId)
		{
			StringBuilder stringBuilder = new StringBuilder(128);
			Result result = Methods.GetLobbyActivitySecret(MethodsPtr, lobbyId, stringBuilder);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return stringBuilder.ToString();
		}

		public string GetLobbyMetadataValue(long lobbyId, string key)
		{
			StringBuilder stringBuilder = new StringBuilder(4096);
			Result result = Methods.GetLobbyMetadataValue(MethodsPtr, lobbyId, key, stringBuilder);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return stringBuilder.ToString();
		}

		public string GetLobbyMetadataKey(long lobbyId, int index)
		{
			StringBuilder stringBuilder = new StringBuilder(256);
			Result result = Methods.GetLobbyMetadataKey(MethodsPtr, lobbyId, index, stringBuilder);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return stringBuilder.ToString();
		}

		public int LobbyMetadataCount(long lobbyId)
		{
			int count = 0;
			Result result = Methods.LobbyMetadataCount(MethodsPtr, lobbyId, ref count);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return count;
		}

		public int MemberCount(long lobbyId)
		{
			int count = 0;
			Result result = Methods.MemberCount(MethodsPtr, lobbyId, ref count);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return count;
		}

		public long GetMemberUserId(long lobbyId, int index)
		{
			long userId = 0L;
			Result result = Methods.GetMemberUserId(MethodsPtr, lobbyId, index, ref userId);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return userId;
		}

		public User GetMemberUser(long lobbyId, long userId)
		{
			User user = default(User);
			Result result = Methods.GetMemberUser(MethodsPtr, lobbyId, userId, ref user);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return user;
		}

		public string GetMemberMetadataValue(long lobbyId, long userId, string key)
		{
			StringBuilder stringBuilder = new StringBuilder(4096);
			Result result = Methods.GetMemberMetadataValue(MethodsPtr, lobbyId, userId, key, stringBuilder);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return stringBuilder.ToString();
		}

		public string GetMemberMetadataKey(long lobbyId, long userId, int index)
		{
			StringBuilder stringBuilder = new StringBuilder(256);
			Result result = Methods.GetMemberMetadataKey(MethodsPtr, lobbyId, userId, index, stringBuilder);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return stringBuilder.ToString();
		}

		public int MemberMetadataCount(long lobbyId, long userId)
		{
			int count = 0;
			Result result = Methods.MemberMetadataCount(MethodsPtr, lobbyId, userId, ref count);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return count;
		}

		[MonoPInvokeCallback]
		private static void UpdateMemberCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			UpdateMemberHandler updateMemberHandler = (UpdateMemberHandler)gCHandle.Target;
			gCHandle.Free();
			updateMemberHandler(result);
		}

		public void UpdateMember(long lobbyId, long userId, LobbyMemberTransaction transaction, UpdateMemberHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.UpdateMember(MethodsPtr, lobbyId, userId, transaction.MethodsPtr, GCHandle.ToIntPtr(value), UpdateMemberCallbackImpl);
			transaction.MethodsPtr = IntPtr.Zero;
		}

		[MonoPInvokeCallback]
		private static void SendLobbyMessageCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			SendLobbyMessageHandler sendLobbyMessageHandler = (SendLobbyMessageHandler)gCHandle.Target;
			gCHandle.Free();
			sendLobbyMessageHandler(result);
		}

		public void SendLobbyMessage(long lobbyId, byte[] data, SendLobbyMessageHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.SendLobbyMessage(MethodsPtr, lobbyId, data, data.Length, GCHandle.ToIntPtr(value), SendLobbyMessageCallbackImpl);
		}

		public LobbySearchQuery GetSearchQuery()
		{
			LobbySearchQuery result = default(LobbySearchQuery);
			Result result2 = Methods.GetSearchQuery(MethodsPtr, ref result.MethodsPtr);
			if (result2 != 0)
			{
				throw new ResultException(result2);
			}
			return result;
		}

		[MonoPInvokeCallback]
		private static void SearchCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			SearchHandler searchHandler = (SearchHandler)gCHandle.Target;
			gCHandle.Free();
			searchHandler(result);
		}

		public void Search(LobbySearchQuery query, SearchHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.Search(MethodsPtr, query.MethodsPtr, GCHandle.ToIntPtr(value), SearchCallbackImpl);
			query.MethodsPtr = IntPtr.Zero;
		}

		public int LobbyCount()
		{
			int count = 0;
			Methods.LobbyCount(MethodsPtr, ref count);
			return count;
		}

		public long GetLobbyId(int index)
		{
			long lobbyId = 0L;
			Result result = Methods.GetLobbyId(MethodsPtr, index, ref lobbyId);
			if (result != 0)
			{
				throw new ResultException(result);
			}
			return lobbyId;
		}

		[MonoPInvokeCallback]
		private static void ConnectVoiceCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			ConnectVoiceHandler connectVoiceHandler = (ConnectVoiceHandler)gCHandle.Target;
			gCHandle.Free();
			connectVoiceHandler(result);
		}

		public void ConnectVoice(long lobbyId, ConnectVoiceHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.ConnectVoice(MethodsPtr, lobbyId, GCHandle.ToIntPtr(value), ConnectVoiceCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void DisconnectVoiceCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			DisconnectVoiceHandler disconnectVoiceHandler = (DisconnectVoiceHandler)gCHandle.Target;
			gCHandle.Free();
			disconnectVoiceHandler(result);
		}

		public void DisconnectVoice(long lobbyId, DisconnectVoiceHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.DisconnectVoice(MethodsPtr, lobbyId, GCHandle.ToIntPtr(value), DisconnectVoiceCallbackImpl);
		}

		public void ConnectNetwork(long lobbyId)
		{
			Result result = Methods.ConnectNetwork(MethodsPtr, lobbyId);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void DisconnectNetwork(long lobbyId)
		{
			Result result = Methods.DisconnectNetwork(MethodsPtr, lobbyId);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void FlushNetwork()
		{
			Result result = Methods.FlushNetwork(MethodsPtr);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void OpenNetworkChannel(long lobbyId, byte channelId, bool reliable)
		{
			Result result = Methods.OpenNetworkChannel(MethodsPtr, lobbyId, channelId, reliable);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void SendNetworkMessage(long lobbyId, long userId, byte channelId, byte[] data)
		{
			Result result = Methods.SendNetworkMessage(MethodsPtr, lobbyId, userId, channelId, data, data.Length);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		[MonoPInvokeCallback]
		private static void OnLobbyUpdateImpl(IntPtr ptr, long lobbyId)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.LobbyManagerInstance.OnLobbyUpdate != null)
			{
				discord.LobbyManagerInstance.OnLobbyUpdate(lobbyId);
			}
		}

		[MonoPInvokeCallback]
		private static void OnLobbyDeleteImpl(IntPtr ptr, long lobbyId, uint reason)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.LobbyManagerInstance.OnLobbyDelete != null)
			{
				discord.LobbyManagerInstance.OnLobbyDelete(lobbyId, reason);
			}
		}

		[MonoPInvokeCallback]
		private static void OnMemberConnectImpl(IntPtr ptr, long lobbyId, long userId)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.LobbyManagerInstance.OnMemberConnect != null)
			{
				discord.LobbyManagerInstance.OnMemberConnect(lobbyId, userId);
			}
		}

		[MonoPInvokeCallback]
		private static void OnMemberUpdateImpl(IntPtr ptr, long lobbyId, long userId)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.LobbyManagerInstance.OnMemberUpdate != null)
			{
				discord.LobbyManagerInstance.OnMemberUpdate(lobbyId, userId);
			}
		}

		[MonoPInvokeCallback]
		private static void OnMemberDisconnectImpl(IntPtr ptr, long lobbyId, long userId)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.LobbyManagerInstance.OnMemberDisconnect != null)
			{
				discord.LobbyManagerInstance.OnMemberDisconnect(lobbyId, userId);
			}
		}

		[MonoPInvokeCallback]
		private static void OnLobbyMessageImpl(IntPtr ptr, long lobbyId, long userId, IntPtr dataPtr, int dataLen)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.LobbyManagerInstance.OnLobbyMessage != null)
			{
				byte[] array = new byte[dataLen];
				Marshal.Copy(dataPtr, array, 0, dataLen);
				discord.LobbyManagerInstance.OnLobbyMessage(lobbyId, userId, array);
			}
		}

		[MonoPInvokeCallback]
		private static void OnSpeakingImpl(IntPtr ptr, long lobbyId, long userId, bool speaking)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.LobbyManagerInstance.OnSpeaking != null)
			{
				discord.LobbyManagerInstance.OnSpeaking(lobbyId, userId, speaking);
			}
		}

		[MonoPInvokeCallback]
		private static void OnNetworkMessageImpl(IntPtr ptr, long lobbyId, long userId, byte channelId, IntPtr dataPtr, int dataLen)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.LobbyManagerInstance.OnNetworkMessage != null)
			{
				byte[] array = new byte[dataLen];
				Marshal.Copy(dataPtr, array, 0, dataLen);
				discord.LobbyManagerInstance.OnNetworkMessage(lobbyId, userId, channelId, array);
			}
		}

		public IEnumerable<User> GetMemberUsers(long lobbyID)
		{
			int num = MemberCount(lobbyID);
			List<User> list = new List<User>();
			for (int i = 0; i < num; i++)
			{
				list.Add(GetMemberUser(lobbyID, GetMemberUserId(lobbyID, i)));
			}
			return list;
		}

		public void SendLobbyMessage(long lobbyID, string data, SendLobbyMessageHandler handler)
		{
			SendLobbyMessage(lobbyID, Encoding.UTF8.GetBytes(data), handler);
		}
	}
	public class NetworkManager
	{
		internal struct FFIEvents
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void MessageHandler(IntPtr ptr, ulong peerId, byte channelId, IntPtr dataPtr, int dataLen);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void RouteUpdateHandler(IntPtr ptr, [MarshalAs(UnmanagedType.LPStr)] string routeData);

			internal MessageHandler OnMessage;

			internal RouteUpdateHandler OnRouteUpdate;
		}

		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void GetPeerIdMethod(IntPtr methodsPtr, ref ulong peerId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result FlushMethod(IntPtr methodsPtr);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result OpenPeerMethod(IntPtr methodsPtr, ulong peerId, [MarshalAs(UnmanagedType.LPStr)] string routeData);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result UpdatePeerMethod(IntPtr methodsPtr, ulong peerId, [MarshalAs(UnmanagedType.LPStr)] string routeData);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result ClosePeerMethod(IntPtr methodsPtr, ulong peerId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result OpenChannelMethod(IntPtr methodsPtr, ulong peerId, byte channelId, bool reliable);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result CloseChannelMethod(IntPtr methodsPtr, ulong peerId, byte channelId);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result SendMessageMethod(IntPtr methodsPtr, ulong peerId, byte channelId, byte[] data, int dataLen);

			internal GetPeerIdMethod GetPeerId;

			internal FlushMethod Flush;

			internal OpenPeerMethod OpenPeer;

			internal UpdatePeerMethod UpdatePeer;

			internal ClosePeerMethod ClosePeer;

			internal OpenChannelMethod OpenChannel;

			internal CloseChannelMethod CloseChannel;

			internal SendMessageMethod SendMessage;
		}

		public delegate void MessageHandler(ulong peerId, byte channelId, byte[] data);

		public delegate void RouteUpdateHandler(string routeData);

		private IntPtr MethodsPtr;

		private object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		public event MessageHandler OnMessage;

		public event RouteUpdateHandler OnRouteUpdate;

		internal NetworkManager(IntPtr ptr, IntPtr eventsPtr, ref FFIEvents events)
		{
			if (eventsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
			InitEvents(eventsPtr, ref events);
			MethodsPtr = ptr;
			if (MethodsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
		}

		private void InitEvents(IntPtr eventsPtr, ref FFIEvents events)
		{
			events.OnMessage = OnMessageImpl;
			events.OnRouteUpdate = OnRouteUpdateImpl;
			Marshal.StructureToPtr(events, eventsPtr, fDeleteOld: false);
		}

		public ulong GetPeerId()
		{
			ulong peerId = 0uL;
			Methods.GetPeerId(MethodsPtr, ref peerId);
			return peerId;
		}

		public void Flush()
		{
			Result result = Methods.Flush(MethodsPtr);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void OpenPeer(ulong peerId, string routeData)
		{
			Result result = Methods.OpenPeer(MethodsPtr, peerId, routeData);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void UpdatePeer(ulong peerId, string routeData)
		{
			Result result = Methods.UpdatePeer(MethodsPtr, peerId, routeData);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void ClosePeer(ulong peerId)
		{
			Result result = Methods.ClosePeer(MethodsPtr, peerId);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void OpenChannel(ulong peerId, byte channelId, bool reliable)
		{
			Result result = Methods.OpenChannel(MethodsPtr, peerId, channelId, reliable);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void CloseChannel(ulong peerId, byte channelId)
		{
			Result result = Methods.CloseChannel(MethodsPtr, peerId, channelId);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		public void SendMessage(ulong peerId, byte channelId, byte[] data)
		{
			Result result = Methods.SendMessage(MethodsPtr, peerId, channelId, data, data.Length);
			if (result != 0)
			{
				throw new ResultException(result);
			}
		}

		[MonoPInvokeCallback]
		private static void OnMessageImpl(IntPtr ptr, ulong peerId, byte channelId, IntPtr dataPtr, int dataLen)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.NetworkManagerInstance.OnMessage != null)
			{
				byte[] array = new byte[dataLen];
				Marshal.Copy(dataPtr, array, 0, dataLen);
				discord.NetworkManagerInstance.OnMessage(peerId, channelId, array);
			}
		}

		[MonoPInvokeCallback]
		private static void OnRouteUpdateImpl(IntPtr ptr, string routeData)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.NetworkManagerInstance.OnRouteUpdate != null)
			{
				discord.NetworkManagerInstance.OnRouteUpdate(routeData);
			}
		}
	}
	public class OverlayManager
	{
		internal struct FFIEvents
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ToggleHandler(IntPtr ptr, bool locked);

			internal ToggleHandler OnToggle;
		}

		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void IsEnabledMethod(IntPtr methodsPtr, ref bool enabled);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void IsLockedMethod(IntPtr methodsPtr, ref bool locked);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SetLockedCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void SetLockedMethod(IntPtr methodsPtr, bool locked, IntPtr callbackData, SetLockedCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void OpenActivityInviteCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void OpenActivityInviteMethod(IntPtr methodsPtr, ActivityActionType type, IntPtr callbackData, OpenActivityInviteCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void OpenGuildInviteCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void OpenGuildInviteMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string code, IntPtr callbackData, OpenGuildInviteCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void OpenVoiceSettingsCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void OpenVoiceSettingsMethod(IntPtr methodsPtr, IntPtr callbackData, OpenVoiceSettingsCallback callback);

			internal IsEnabledMethod IsEnabled;

			internal IsLockedMethod IsLocked;

			internal SetLockedMethod SetLocked;

			internal OpenActivityInviteMethod OpenActivityInvite;

			internal OpenGuildInviteMethod OpenGuildInvite;

			internal OpenVoiceSettingsMethod OpenVoiceSettings;
		}

		public delegate void SetLockedHandler(Result result);

		public delegate void OpenActivityInviteHandler(Result result);

		public delegate void OpenGuildInviteHandler(Result result);

		public delegate void OpenVoiceSettingsHandler(Result result);

		public delegate void ToggleHandler(bool locked);

		private IntPtr MethodsPtr;

		private object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		public event ToggleHandler OnToggle;

		internal OverlayManager(IntPtr ptr, IntPtr eventsPtr, ref FFIEvents events)
		{
			if (eventsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
			InitEvents(eventsPtr, ref events);
			MethodsPtr = ptr;
			if (MethodsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
		}

		private void InitEvents(IntPtr eventsPtr, ref FFIEvents events)
		{
			events.OnToggle = OnToggleImpl;
			Marshal.StructureToPtr(events, eventsPtr, fDeleteOld: false);
		}

		public bool IsEnabled()
		{
			bool enabled = false;
			Methods.IsEnabled(MethodsPtr, ref enabled);
			return enabled;
		}

		public bool IsLocked()
		{
			bool locked = false;
			Methods.IsLocked(MethodsPtr, ref locked);
			return locked;
		}

		[MonoPInvokeCallback]
		private static void SetLockedCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			SetLockedHandler setLockedHandler = (SetLockedHandler)gCHandle.Target;
			gCHandle.Free();
			setLockedHandler(result);
		}

		public void SetLocked(bool locked, SetLockedHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.SetLocked(MethodsPtr, locked, GCHandle.ToIntPtr(value), SetLockedCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void OpenActivityInviteCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			OpenActivityInviteHandler openActivityInviteHandler = (OpenActivityInviteHandler)gCHandle.Target;
			gCHandle.Free();
			openActivityInviteHandler(result);
		}

		public void OpenActivityInvite(ActivityActionType type, OpenActivityInviteHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.OpenActivityInvite(MethodsPtr, type, GCHandle.ToIntPtr(value), OpenActivityInviteCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void OpenGuildInviteCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			OpenGuildInviteHandler openGuildInviteHandler = (OpenGuildInviteHandler)gCHandle.Target;
			gCHandle.Free();
			openGuildInviteHandler(result);
		}

		public void OpenGuildInvite(string code, OpenGuildInviteHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.OpenGuildInvite(MethodsPtr, code, GCHandle.ToIntPtr(value), OpenGuildInviteCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void OpenVoiceSettingsCallbackImpl(IntPtr ptr, Result result)
		{
			GCHandle gCHandle = GCHandle.FromIntPtr(ptr);
			OpenVoiceSettingsHandler openVoiceSettingsHandler = (OpenVoiceSettingsHandler)gCHandle.Target;
			gCHandle.Free();
			openVoiceSettingsHandler(result);
		}

		public void OpenVoiceSettings(OpenVoiceSettingsHandler callback)
		{
			GCHandle value = GCHandle.Alloc(callback);
			Methods.OpenVoiceSettings(MethodsPtr, GCHandle.ToIntPtr(value), OpenVoiceSettingsCallbackImpl);
		}

		[MonoPInvokeCallback]
		private static void OnToggleImpl(IntPtr ptr, bool locked)
		{
			Discord discord = (Discord)GCHandle.FromIntPtr(ptr).Target;
			if (discord.OverlayManagerInstance.OnToggle != null)
			{
				discord.OverlayManagerInstance.OnToggle(locked);
			}
		}
	}
	public class StorageManager
	{
		internal struct FFIEvents
		{
		}

		internal struct FFIMethods
		{
			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result ReadMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string name, byte[] data, int dataLen, ref uint read);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ReadAsyncCallback(IntPtr ptr, Result result, IntPtr dataPtr, int dataLen);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ReadAsyncMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string name, IntPtr callbackData, ReadAsyncCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ReadAsyncPartialCallback(IntPtr ptr, Result result, IntPtr dataPtr, int dataLen);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void ReadAsyncPartialMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string name, ulong offset, ulong length, IntPtr callbackData, ReadAsyncPartialCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result WriteMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string name, byte[] data, int dataLen);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void WriteAsyncCallback(IntPtr ptr, Result result);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void WriteAsyncMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string name, byte[] data, int dataLen, IntPtr callbackData, WriteAsyncCallback callback);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result DeleteMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string name);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result ExistsMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string name, ref bool exists);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate void CountMethod(IntPtr methodsPtr, ref int count);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result StatMethod(IntPtr methodsPtr, [MarshalAs(UnmanagedType.LPStr)] string name, ref FileStat stat);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result StatAtMethod(IntPtr methodsPtr, int index, ref FileStat stat);

			[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
			internal delegate Result GetPathMethod(IntPtr methodsPtr, StringBuilder path);

			internal ReadMethod Read;

			internal ReadAsyncMethod ReadAsync;

			internal ReadAsyncPartialMethod ReadAsyncPartial;

			internal WriteMethod Write;

			internal WriteAsyncMethod WriteAsync;

			internal DeleteMethod Delete;

			internal ExistsMethod Exists;

			internal CountMethod Count;

			internal StatMethod Stat;

			internal StatAtMethod StatAt;

			internal GetPathMethod GetPath;
		}

		public delegate void ReadAsyncHandler(Result result, byte[] data);

		public delegate void ReadAsyncPartialHandler(Result result, byte[] data);

		public delegate void WriteAsyncHandler(Result result);

		private IntPtr MethodsPtr;

		private object MethodsStructure;

		private FFIMethods Methods
		{
			get
			{
				if (MethodsStructure == null)
				{
					MethodsStructure = Marshal.PtrToStructure(MethodsPtr, typeof(FFIMethods));
				}
				return (FFIMethods)MethodsStructure;
			}
		}

		internal StorageManager(IntPtr ptr, IntPtr eventsPtr, ref FFIEvents events)
		{
			if (eventsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalError);
			}
			InitEvents(eventsPtr, ref events);
			MethodsPtr = ptr;
			if (MethodsPtr == IntPtr.Zero)
			{
				throw new ResultException(Result.InternalErr

Steven-Custom_Boombox_Music/CustomBoomboxTracks.dll.old

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CustomBoomboxTracks.Configuration;
using CustomBoomboxTracks.Managers;
using CustomBoomboxTracks.Utilities;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Networking;

[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("CustomBoomboxTracks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0")]
[assembly: AssemblyProduct("CustomBoomboxTracks")]
[assembly: AssemblyTitle("CustomBoomboxTracks")]
[assembly: AssemblyVersion("1.4.0.0")]
namespace CustomBoomboxTracks
{
	[BepInPlugin("com.steven.lethalcompany.boomboxmusic", "Custom Boombox Music", "1.4.0")]
	public class BoomboxPlugin : BaseUnityPlugin
	{
		private const string GUID = "com.steven.lethalcompany.boomboxmusic";

		private const string NAME = "Custom Boombox Music";

		private const string VERSION = "1.4.0";

		private static BoomboxPlugin Instance;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			LogInfo("Loading...");
			AudioManager.GenerateFolders();
			Config.Init();
			new Harmony("com.steven.lethalcompany.boomboxmusic").PatchAll();
			LogInfo("Loading Complete!");
		}

		internal static void LogDebug(string message)
		{
			Instance.Log(message, (LogLevel)32);
		}

		internal static void LogInfo(string message)
		{
			Instance.Log(message, (LogLevel)16);
		}

		internal static void LogWarning(string message)
		{
			Instance.Log(message, (LogLevel)4);
		}

		internal static void LogError(string message)
		{
			Instance.Log(message, (LogLevel)2);
		}

		internal static void LogError(Exception ex)
		{
			Instance.Log(ex.Message + "\n" + ex.StackTrace, (LogLevel)2);
		}

		private void Log(string message, LogLevel logLevel)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.Log(logLevel, (object)message);
		}
	}
}
namespace CustomBoomboxTracks.Utilities
{
	public class SharedCoroutineStarter : MonoBehaviour
	{
		private static SharedCoroutineStarter _instance;

		public static Coroutine StartCoroutine(IEnumerator routine)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_instance == (Object)null)
			{
				_instance = new GameObject("Shared Coroutine Starter").AddComponent<SharedCoroutineStarter>();
				Object.DontDestroyOnLoad((Object)(object)_instance);
			}
			return ((MonoBehaviour)_instance).StartCoroutine(routine);
		}
	}
}
namespace CustomBoomboxTracks.Patches
{
	[HarmonyPatch(typeof(BoomboxItem), "PocketItem")]
	internal class BoomboxItem_PocketItem
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = instructions.ToList();
			bool flag = false;
			for (int i = 0; i < list.Count; i++)
			{
				if (!flag)
				{
					if (list[i].opcode == OpCodes.Call)
					{
						flag = true;
					}
					continue;
				}
				if (list[i].opcode == OpCodes.Ret)
				{
					break;
				}
				list[i].opcode = OpCodes.Nop;
			}
			return list;
		}
	}
	[HarmonyPatch(typeof(BoomboxItem), "Start")]
	internal class BoomboxItem_Start
	{
		private static void Postfix(BoomboxItem __instance)
		{
			if (AudioManager.FinishedLoading)
			{
				AudioManager.ApplyClips(__instance);
				return;
			}
			AudioManager.OnAllSongsLoaded += delegate
			{
				AudioManager.ApplyClips(__instance);
			};
		}
	}
	[HarmonyPatch(typeof(BoomboxItem), "StartMusic")]
	internal class BoomboxItem_StartMusic
	{
		private static void Postfix(BoomboxItem __instance, bool startMusic)
		{
			if (startMusic)
			{
				BoomboxPlugin.LogInfo("Playing " + ((Object)__instance.boomboxAudio.clip).name);
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "Awake")]
	internal class StartOfRound_Awake
	{
		private static void Prefix()
		{
			AudioManager.Load();
		}
	}
}
namespace CustomBoomboxTracks.Managers
{
	internal static class AudioManager
	{
		private static string[] allSongPaths;

		private static List<AudioClip> clips = new List<AudioClip>();

		private static bool firstRun = true;

		private static bool finishedLoading = false;

		private static readonly string directory = Path.Combine(Paths.BepInExRootPath, "Custom Songs", "Boombox Music");

		public static bool FinishedLoading => finishedLoading;

		public static bool HasNoSongs => allSongPaths.Length == 0;

		public static event Action OnAllSongsLoaded;

		public static void GenerateFolders()
		{
			Directory.CreateDirectory(directory);
			BoomboxPlugin.LogInfo("Created directory at " + directory);
		}

		public static void Load()
		{
			if (!firstRun)
			{
				return;
			}
			firstRun = false;
			allSongPaths = Directory.GetFiles(directory);
			if (allSongPaths.Length == 0)
			{
				BoomboxPlugin.LogWarning("No songs found!");
				return;
			}
			BoomboxPlugin.LogInfo("Preparing to load AudioClips...");
			List<Coroutine> list = new List<Coroutine>();
			string[] array = allSongPaths;
			for (int i = 0; i < array.Length; i++)
			{
				Coroutine item = SharedCoroutineStarter.StartCoroutine(LoadAudioClip(array[i]));
				list.Add(item);
			}
			SharedCoroutineStarter.StartCoroutine(WaitForAllClips(list));
		}

		private static IEnumerator LoadAudioClip(string filePath)
		{
			BoomboxPlugin.LogInfo("Loading " + filePath + "!");
			if ((int)GetAudioType(filePath) == 0)
			{
				BoomboxPlugin.LogError("Failed to load AudioClip from " + filePath + "\nUnsupported file extension!");
				yield break;
			}
			UnityWebRequest loader = UnityWebRequestMultimedia.GetAudioClip(filePath, GetAudioType(filePath));
			if (Config.StreamFromDisk)
			{
				DownloadHandler downloadHandler = loader.downloadHandler;
				((DownloadHandlerAudioClip)((downloadHandler is DownloadHandlerAudioClip) ? downloadHandler : null)).streamAudio = true;
			}
			loader.SendWebRequest();
			while (!loader.isDone)
			{
				yield return null;
			}
			if (loader.error != null)
			{
				BoomboxPlugin.LogError("Error loading clip from path: " + filePath + "\n" + loader.error);
				BoomboxPlugin.LogError(loader.error);
				yield break;
			}
			AudioClip content = DownloadHandlerAudioClip.GetContent(loader);
			if (Object.op_Implicit((Object)(object)content) && (int)content.loadState == 2)
			{
				BoomboxPlugin.LogInfo("Loaded " + filePath);
				((Object)content).name = Path.GetFileName(filePath);
				clips.Add(content);
			}
			else
			{
				BoomboxPlugin.LogError("Failed to load clip at: " + filePath + "\nThis might be due to an mismatch between the audio codec and the file extension!");
			}
		}

		private static IEnumerator WaitForAllClips(List<Coroutine> coroutines)
		{
			foreach (Coroutine coroutine in coroutines)
			{
				yield return coroutine;
			}
			clips.Sort((AudioClip first, AudioClip second) => ((Object)first).name.CompareTo(((Object)second).name));
			finishedLoading = true;
			AudioManager.OnAllSongsLoaded?.Invoke();
			AudioManager.OnAllSongsLoaded = null;
		}

		public static void ApplyClips(BoomboxItem __instance)
		{
			BoomboxPlugin.LogInfo("Applying clips!");
			if (Config.UseDefaultSongs)
			{
				__instance.musicAudios = __instance.musicAudios.Concat(clips).ToArray();
			}
			else
			{
				__instance.musicAudios = clips.ToArray();
			}
			BoomboxPlugin.LogInfo($"Total Clip Count: {__instance.musicAudios.Length}");
		}

		private static AudioType GetAudioType(string path)
		{
			string text = Path.GetExtension(path).ToLower();
			switch (text)
			{
			case ".wav":
				return (AudioType)20;
			case ".ogg":
				return (AudioType)14;
			case ".mp3":
				return (AudioType)13;
			default:
				BoomboxPlugin.LogError("Unsupported extension type: " + text);
				return (AudioType)0;
			}
		}
	}
}
namespace CustomBoomboxTracks.Configuration
{
	internal static class Config
	{
		private const string CONFIG_FILE_NAME = "boombox.cfg";

		private static ConfigFile _config;

		private static ConfigEntry<bool> _useDefaultSongs;

		private static ConfigEntry<bool> _streamAudioFromDisk;

		public static bool UseDefaultSongs
		{
			get
			{
				if (!_useDefaultSongs.Value)
				{
					return AudioManager.HasNoSongs;
				}
				return true;
			}
		}

		public static bool StreamFromDisk => _streamAudioFromDisk.Value;

		public static void Init()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			BoomboxPlugin.LogInfo("Initializing config...");
			_config = new ConfigFile(Path.Combine(Paths.ConfigPath, "boombox.cfg"), true);
			_useDefaultSongs = _config.Bind<bool>("Config", "Use Default Songs", false, "Include the default songs in the rotation.");
			_streamAudioFromDisk = _config.Bind<bool>("Config", "Stream Audio From Disk", false, "Requires less memory and takes less time to load, but prevents playing the same song twice at once.");
			BoomboxPlugin.LogInfo("Config initialized!");
		}

		private static void PrintConfig()
		{
			BoomboxPlugin.LogInfo($"Use Default Songs: {_useDefaultSongs.Value}");
			BoomboxPlugin.LogInfo($"Stream From Disk: {_streamAudioFromDisk}");
		}
	}
}

Thorlar-HealthStation/OctolarFirstMod.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using OctolarFirstMod.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OctolarFirstMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OctolarFirstMod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a761e7d0-2e73-4d38-b7ad-3010bdcd4702")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace OctolarFirstMod
{
	[BepInPlugin("Octolar.Healthstation", "Health Station mod", "1.0.0.1")]
	public class OctolarFirstMod : BaseUnityPlugin
	{
		private const string modGUID = "Octolar.Healthstation";

		private const string modName = "Health Station mod";

		private const string modVersion = "1.0.0.1";

		private readonly Harmony harmony = new Harmony("Octolar.Healthstation");

		private static OctolarFirstMod Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Octolar.Healthstation");
			mls.LogInfo((object)"Octolar HealthStation mod is now active");
			harmony.PatchAll(typeof(OctolarFirstMod));
			harmony.PatchAll(typeof(ItemChargerPatch));
		}
	}
}
namespace OctolarFirstMod.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	[HarmonyPatch(typeof(ItemCharger))]
	internal class ItemChargerPatch
	{
		[HarmonyPatch("ChargeItem")]
		[HarmonyPostfix]
		private static void ChargerHealsPatch()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			GameNetworkManager.Instance.localPlayerController.DamagePlayer(-100, false, true, (CauseOfDeath)0, 0, false, default(Vector3));
			if (GameNetworkManager.Instance.localPlayerController.health >= 10 && GameNetworkManager.Instance.localPlayerController.criticallyInjured)
			{
				GameNetworkManager.Instance.localPlayerController.MakeCriticallyInjured(false);
			}
		}
	}
}

tinyhoot-ShipLoot/ShipLoot/ShipLoot.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ShipLoot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("ShipLoot")]
[assembly: AssemblyCopyright("Copyright © tinyhoot 2023")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ShipLoot
{
	[BepInPlugin("com.github.tinyhoot.ShipLoot", "ShipLoot", "1.0")]
	internal class ShipLoot : BaseUnityPlugin
	{
		public const string GUID = "com.github.tinyhoot.ShipLoot";

		public const string NAME = "ShipLoot";

		public const string VERSION = "1.0";

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("com.github.tinyhoot.ShipLoot").PatchAll(Assembly.GetExecutingAssembly());
		}
	}
}
namespace ShipLoot.Patches
{
	[HarmonyPatch]
	internal class HudManagerPatcher
	{
		private static GameObject _totalCounter;

		private static TextMeshProUGUI _textMesh;

		private static float _displayTimeLeft;

		private const float DisplayTime = 5f;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		private static void OnScan(HUDManager __instance, CallbackContext context)
		{
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && ((CallbackContext)(ref context)).performed && __instance.CanPlayerScan() && !(__instance.playerPingingScan > -0.5f) && (StartOfRound.Instance.inShipPhase || GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom))
			{
				if (!Object.op_Implicit((Object)(object)_totalCounter))
				{
					CopyValueCounter();
				}
				float num = CalculateLootValue();
				((TMP_Text)_textMesh).text = $"SHIP: ${num:F0}";
				_displayTimeLeft = 5f;
				if (!_totalCounter.activeSelf)
				{
					((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(ShipLootCoroutine());
				}
			}
		}

		private static IEnumerator ShipLootCoroutine()
		{
			_totalCounter.SetActive(true);
			while (_displayTimeLeft > 0f)
			{
				float displayTimeLeft = _displayTimeLeft;
				_displayTimeLeft = 0f;
				yield return (object)new WaitForSeconds(displayTimeLeft);
			}
			_totalCounter.SetActive(false);
		}

		private static float CalculateLootValue()
		{
			List<GrabbableObject> list = (from obj in GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>()
				where ((Object)obj).name != "ClipboardManual" && ((Object)obj).name != "StickyNoteItem"
				select obj).ToList();
			ShipLoot.Log.LogDebug((object)"Calculating total ship scrap value.");
			CollectionExtensions.Do<GrabbableObject>((IEnumerable<GrabbableObject>)list, (Action<GrabbableObject>)delegate(GrabbableObject scrap)
			{
				ShipLoot.Log.LogDebug((object)$"{((Object)scrap).name} - ${scrap.scrapValue}");
			});
			return list.Sum((GrabbableObject scrap) => scrap.scrapValue);
		}

		private static void CopyValueCounter()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/ValueCounter");
			if (!Object.op_Implicit((Object)(object)val))
			{
				ShipLoot.Log.LogError((object)"Failed to find ValueCounter object to copy!");
			}
			_totalCounter = Object.Instantiate<GameObject>(val.gameObject, val.transform.parent, false);
			_totalCounter.transform.Translate(0f, 1f, 0f);
			Vector3 localPosition = _totalCounter.transform.localPosition;
			_totalCounter.transform.localPosition = new Vector3(localPosition.x + 50f, -50f, localPosition.z);
			_textMesh = _totalCounter.GetComponentInChildren<TextMeshProUGUI>();
		}
	}
}

vasanex-ItemQuickSwitch/ItemQuickSwitchMod.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
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 GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[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("ItemQuickSwitchMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod for selecting item slots directly")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("ItemQuickSwitchMod")]
[assembly: AssemblyTitle("ItemQuickSwitchMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 ItemQuickSwitchMod
{
	public sealed class CustomAction
	{
		public class ActionItem
		{
			public string Id { get; }

			public Key Shortcut { get; }

			public string Description { get; }

			public int SlotNumber { get; }

			public ConfigEntry<Key> ConfigEntry { get; set; }

			public ActionItem(string id, Key config, string description, int slotNumber)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				Id = id;
				Shortcut = config;
				Description = description;
				SlotNumber = slotNumber;
			}
		}

		public static readonly ActionItem Emote1 = new ActionItem("Emote1", (Key)94, "Dance emote", 0);

		public static readonly ActionItem Emote2 = new ActionItem("Emote2", (Key)95, "Point emote", 0);

		public static readonly ActionItem Slot1 = new ActionItem("Slot1", (Key)41, "Equip Slot 1", 0);

		public static readonly ActionItem Slot2 = new ActionItem("Slot2", (Key)42, "Equip Slot 2", 1);

		public static readonly ActionItem Slot3 = new ActionItem("Slot3", (Key)43, "Equip Slot 3", 2);

		public static readonly ActionItem Slot4 = new ActionItem("Slot4", (Key)44, "Equip Slot 4", 3);

		public static readonly ActionItem[] AllActions = new ActionItem[6] { Emote1, Emote2, Slot1, Slot2, Slot3, Slot4 };
	}
	[BepInPlugin("de.vasanex.ItemQuickSwitchMod", "ItemQuickSwitchMod", "1.1.0")]
	public class ItemQuickSwitchMod : BaseUnityPlugin
	{
		private Harmony _harmony;

		private void Awake()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ItemQuickSwitchMod is creating binds!");
			CustomAction.ActionItem[] allActions = CustomAction.AllActions;
			foreach (CustomAction.ActionItem actionItem in allActions)
			{
				ConfigEntry<Key> configEntry = ((BaseUnityPlugin)this).Config.Bind<Key>("Bindings", actionItem.Id, actionItem.Shortcut, actionItem.Description);
				actionItem.ConfigEntry = configEntry;
			}
			_harmony = new Harmony("de.vasanex.ItemQuickSwitchMod");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ItemQuickSwitchMod is loaded!");
		}
	}
	public static class StaticPluginInfo
	{
		public const string GUID = "de.vasanex.ItemQuickSwitchMod";

		public const string NAME = "ItemQuickSwitchMod";
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ItemQuickSwitchMod";

		public const string PLUGIN_NAME = "ItemQuickSwitchMod";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace ItemQuickSwitchMod.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private static readonly Dictionary<string, MethodInfo> MethodCache = new Dictionary<string, MethodInfo>();

		private static readonly object[] BackwardsParam = new object[1] { false };

		private static readonly object[] ForwardsParam = new object[1] { true };

		private static object InvokePrivateMethod(PlayerControllerB instance, string methodName, object[] parameters = null)
		{
			MethodCache.TryGetValue(methodName, out var value);
			if ((object)value == null)
			{
				value = typeof(PlayerControllerB).GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic);
			}
			MethodCache[methodName] = value;
			return value?.Invoke(instance, parameters);
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void PlayerControllerB_Update(PlayerControllerB __instance, ref float ___timeSinceSwitchingSlots, ref bool ___throwingObject)
		{
			if ((!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || (((NetworkBehaviour)__instance).IsServer && !__instance.isHostPlayerObject)) && !__instance.isTestingPlayer)
			{
				return;
			}
			CustomAction.ActionItem actionItem = Array.Find(CustomAction.AllActions, (CustomAction.ActionItem it) => ((ButtonControl)Keyboard.current[it.ConfigEntry.Value]).wasPressedThisFrame);
			if (actionItem == null)
			{
				return;
			}
			string id = actionItem.Id;
			string text = id;
			if (!(text == "Emote1"))
			{
				if (text == "Emote2")
				{
					PerformEmote(__instance, 2);
					return;
				}
				StopEmotes(__instance);
				if (SwitchItemSlots(__instance, actionItem.SlotNumber, ___timeSinceSwitchingSlots, ___throwingObject))
				{
					___timeSinceSwitchingSlots = 0f;
				}
			}
			else
			{
				PerformEmote(__instance, 1);
			}
		}

		private static void PerformEmote(PlayerControllerB __instance, int emoteId)
		{
			__instance.timeSinceStartingEmote = 0f;
			__instance.performingEmote = true;
			__instance.playerBodyAnimator.SetInteger("emoteNumber", emoteId);
			__instance.StartPerformingEmoteServerRpc();
		}

		private static bool SwitchItemSlots(PlayerControllerB __instance, int requestedSlot, float timeSinceSwitchingSlots, bool isThrowingObject)
		{
			if (!IsItemSwitchPossible(__instance, timeSinceSwitchingSlots, isThrowingObject) || __instance.currentItemSlot == requestedSlot)
			{
				return false;
			}
			int num = __instance.currentItemSlot - requestedSlot;
			bool flag = num > 0;
			if (Math.Abs(num) == __instance.ItemSlots.Length - 1)
			{
				object[] parameters = (flag ? ForwardsParam : BackwardsParam);
				InvokePrivateMethod(__instance, "SwitchItemSlotsServerRpc", parameters);
			}
			else
			{
				object[] parameters2 = (flag ? BackwardsParam : ForwardsParam);
				do
				{
					InvokePrivateMethod(__instance, "SwitchItemSlotsServerRpc", parameters2);
					num += ((!flag) ? 1 : (-1));
				}
				while (num != 0);
			}
			ShipBuildModeManager.Instance.CancelBuildMode(true);
			__instance.playerBodyAnimator.SetBool("GrabValidated", false);
			object[] parameters3 = new object[2] { requestedSlot, null };
			InvokePrivateMethod(__instance, "SwitchToItemSlot", parameters3);
			if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null)
			{
				((Component)__instance.currentlyHeldObjectServer).gameObject.GetComponent<AudioSource>().PlayOneShot(__instance.currentlyHeldObjectServer.itemProperties.grabSFX, 0.6f);
			}
			return true;
		}

		private static bool IsItemSwitchPossible(PlayerControllerB __instance, float timeSinceSwitchingSlots, bool isThrowingObject)
		{
			return !((double)timeSinceSwitchingSlots < 0.01 || __instance.inTerminalMenu || __instance.isGrabbingObjectAnimation || __instance.inSpecialInteractAnimation || isThrowingObject) && !__instance.isTypingChat && !__instance.twoHanded && !__instance.activatingItem && !__instance.jetpackControls && !__instance.disablingJetpackControls;
		}

		private static void StopEmotes(PlayerControllerB __instance)
		{
			__instance.performingEmote = false;
			__instance.StopPerformingEmoteServerRpc();
			__instance.timeSinceStartingEmote = 0f;
		}
	}
}

x753-More_Suits/MoreSuits.dll

Decompiled 6 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 BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MoreSuits")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A mod that adds more suit options to Lethal Company")]
[assembly: AssemblyFileVersion("1.3.2.0")]
[assembly: AssemblyInformationalVersion("1.3.2")]
[assembly: AssemblyProduct("MoreSuits")]
[assembly: AssemblyTitle("MoreSuits")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.2.0")]
[module: UnverifiableCode]
namespace MoreSuits;

[BepInPlugin("x753.More_Suits", "More Suits", "1.3.2")]
public class MoreSuitsMod : BaseUnityPlugin
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void StartPatch(ref StartOfRound __instance)
		{
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Expected O, but got Unknown
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Expected O, but got Unknown
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (SuitsAdded)
				{
					return;
				}
				for (int i = 0; i < __instance.unlockablesList.unlockables.Count; i++)
				{
					UnlockableItem val = __instance.unlockablesList.unlockables[i];
					if (!((Object)(object)val.suitMaterial != (Object)null) || !val.alreadyUnlocked)
					{
						continue;
					}
					List<string> list = Directory.GetDirectories(Paths.PluginPath, "moresuits", SearchOption.AllDirectories).ToList();
					List<string> list2 = new List<string>();
					List<string> list3 = DisabledSuits.Value.ToLower().Replace(".png", "").Split(',')
						.ToList();
					List<string> list4 = new List<string>();
					foreach (string item in list)
					{
						if (File.Exists(Path.Combine(item, "!less-suits.txt")))
						{
							string[] collection = new string[9] { "glow", "kirby", "knuckles", "luigi", "mario", "minion", "skeleton", "slayer", "smile" };
							list4.AddRange(collection);
							break;
						}
					}
					foreach (string item2 in list)
					{
						if (item2 != "")
						{
							string[] files = Directory.GetFiles(item2, "*.png");
							list2.AddRange(files);
						}
					}
					list2.Sort();
					foreach (string item3 in list2)
					{
						if (list3.Contains(Path.GetFileNameWithoutExtension(item3).ToLower()))
						{
							continue;
						}
						string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
						if (list4.Contains(Path.GetFileNameWithoutExtension(item3).ToLower()) && item3.Contains(directoryName))
						{
							continue;
						}
						UnlockableItem val2;
						Material val3;
						if (Path.GetFileNameWithoutExtension(item3).ToLower() == "default")
						{
							val2 = val;
							val3 = val2.suitMaterial;
						}
						else
						{
							string text = JsonUtility.ToJson((object)val);
							val2 = JsonUtility.FromJson<UnlockableItem>(text);
							val3 = Object.Instantiate<Material>(val2.suitMaterial);
						}
						byte[] array = File.ReadAllBytes(item3);
						Texture2D val4 = new Texture2D(2, 2);
						ImageConversion.LoadImage(val4, array);
						val3.mainTexture = (Texture)(object)val4;
						val2.unlockableName = Path.GetFileNameWithoutExtension(item3);
						try
						{
							string path = Path.Combine(Path.GetDirectoryName(item3), "advanced", val2.unlockableName + ".json");
							if (File.Exists(path))
							{
								string[] array2 = File.ReadAllLines(path);
								string[] array3 = array2;
								foreach (string text2 in array3)
								{
									string[] array4 = text2.Trim().Split(':');
									if (array4.Length != 2)
									{
										continue;
									}
									string text3 = array4[0].Trim('"', ' ', ',');
									string text4 = array4[1].Trim('"', ' ', ',');
									float result2;
									Vector4 vector;
									if (text3 == "PRICE" && int.TryParse(text4, out var result))
									{
										try
										{
											AddToRotatingShop(val2, result, __instance.unlockablesList.unlockables.Count);
										}
										catch (Exception ex)
										{
											Debug.Log((object)("Something went wrong with More Suits! Could not add a suit to the rotating shop. Error: " + ex));
										}
									}
									else if (text4 == "KEYWORD")
									{
										val3.EnableKeyword(text3);
									}
									else if (text4.Contains(".png"))
									{
										string path2 = Path.Combine(Path.GetDirectoryName(item3), "advanced", text4);
										byte[] array5 = File.ReadAllBytes(path2);
										Texture2D val5 = new Texture2D(2, 2);
										ImageConversion.LoadImage(val5, array5);
										val3.SetTexture(text3, (Texture)(object)val5);
									}
									else if (float.TryParse(text4, out result2))
									{
										val3.SetFloat(text3, result2);
									}
									else if (TryParseVector4(text4, out vector))
									{
										val3.SetVector(text3, vector);
									}
								}
							}
						}
						catch (Exception ex2)
						{
							Debug.Log((object)("Something went wrong with More Suits! Error: " + ex2));
						}
						val2.suitMaterial = val3;
						if (val2.unlockableName.ToLower() != "default")
						{
							__instance.unlockablesList.unlockables.Add(val2);
						}
					}
					SuitsAdded = true;
					break;
				}
			}
			catch (Exception ex3)
			{
				Debug.Log((object)("Something went wrong with More Suits! Error: " + ex3));
			}
		}

		[HarmonyPatch("PositionSuitsOnRack")]
		[HarmonyPrefix]
		private static bool PositionSuitsOnRackPatch(ref StartOfRound __instance)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			List<UnlockableSuit> source = Object.FindObjectsOfType<UnlockableSuit>().ToList();
			source = source.OrderBy((UnlockableSuit suit) => suit.syncedSuitID.Value).ToList();
			int num = 0;
			foreach (UnlockableSuit item in source)
			{
				AutoParentToShip component = ((Component)item).gameObject.GetComponent<AutoParentToShip>();
				component.overrideOffset = true;
				component.positionOffset = new Vector3(-2.45f, 2.75f, -8.41f) + __instance.rightmostSuitPosition.forward * 0.18f * (float)num;
				component.rotationOffset = new Vector3(0f, 90f, 0f);
				num++;
			}
			return false;
		}
	}

	private const string modGUID = "x753.More_Suits";

	private const string modName = "More Suits";

	private const string modVersion = "1.3.2";

	private readonly Harmony harmony = new Harmony("x753.More_Suits");

	private static MoreSuitsMod Instance;

	public static bool SuitsAdded;

	public static ConfigEntry<string> DisabledSuits;

	private static TerminalNode cancelPurchase;

	private static TerminalKeyword buyKeyword;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		DisabledSuits = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Disabled Suit List", "UglySuit751.png,UglySuit752.png,UglySuit753.png", "Comma-separated list of suits that shouldn't be loaded");
		harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin More Suits is loaded!");
	}

	private static void AddToRotatingShop(UnlockableItem newSuit, int price, int unlockableID)
	{
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Expected O, but got Unknown
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Expected O, but got Unknown
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_029a: Expected O, but got Unknown
		Terminal val = Object.FindObjectOfType<Terminal>();
		for (int i = 0; i < val.terminalNodes.allKeywords.Length; i++)
		{
			if (((Object)val.terminalNodes.allKeywords[i]).name == "Buy")
			{
				buyKeyword = val.terminalNodes.allKeywords[i];
				break;
			}
		}
		newSuit.alreadyUnlocked = false;
		newSuit.shopSelectionNode = ScriptableObject.CreateInstance<TerminalNode>();
		((Object)newSuit.shopSelectionNode).name = newSuit.unlockableName + "SuitBuy1";
		newSuit.shopSelectionNode.creatureName = newSuit.unlockableName + " suit";
		newSuit.shopSelectionNode.displayText = "You have requested to order " + newSuit.unlockableName + " suits.\nTotal cost of item: [totalCost].\n\nPlease CONFIRM or DENY.\n\n";
		newSuit.shopSelectionNode.clearPreviousText = true;
		newSuit.shopSelectionNode.shipUnlockableID = unlockableID;
		newSuit.shopSelectionNode.itemCost = price;
		newSuit.shopSelectionNode.overrideOptions = true;
		CompatibleNoun val2 = new CompatibleNoun();
		val2.noun = ScriptableObject.CreateInstance<TerminalKeyword>();
		val2.noun.word = "confirm";
		val2.noun.isVerb = true;
		val2.result = ScriptableObject.CreateInstance<TerminalNode>();
		((Object)val2.result).name = newSuit.unlockableName + "SuitBuyConfirm";
		val2.result.creatureName = "";
		val2.result.displayText = "Ordered " + newSuit.unlockableName + " suits! Your new balance is [playerCredits].\n\n";
		val2.result.clearPreviousText = true;
		val2.result.shipUnlockableID = unlockableID;
		val2.result.buyUnlockable = true;
		val2.result.itemCost = price;
		val2.result.terminalEvent = "";
		CompatibleNoun val3 = new CompatibleNoun();
		val3.noun = ScriptableObject.CreateInstance<TerminalKeyword>();
		val3.noun.word = "deny";
		val3.noun.isVerb = true;
		if ((Object)(object)cancelPurchase == (Object)null)
		{
			cancelPurchase = ScriptableObject.CreateInstance<TerminalNode>();
		}
		val3.result = cancelPurchase;
		((Object)val3.result).name = "MoreSuitsCancelPurchase";
		val3.result.displayText = "Cancelled order.\n";
		newSuit.shopSelectionNode.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { val2, val3 };
		TerminalKeyword val4 = ScriptableObject.CreateInstance<TerminalKeyword>();
		((Object)val4).name = newSuit.unlockableName + "Suit";
		val4.word = newSuit.unlockableName.ToLower() + " suit";
		val4.defaultVerb = buyKeyword;
		CompatibleNoun val5 = new CompatibleNoun();
		val5.noun = val4;
		val5.result = newSuit.shopSelectionNode;
		List<CompatibleNoun> list = buyKeyword.compatibleNouns.ToList();
		list.Add(val5);
		buyKeyword.compatibleNouns = list.ToArray();
		List<TerminalKeyword> list2 = val.terminalNodes.allKeywords.ToList();
		list2.Add(val4);
		list2.Add(val2.noun);
		list2.Add(val3.noun);
		val.terminalNodes.allKeywords = list2.ToArray();
	}

	public static bool TryParseVector4(string input, out Vector4 vector)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		vector = Vector4.zero;
		string[] array = input.Split(',');
		if (array.Length == 4 && float.TryParse(array[0], out var result) && float.TryParse(array[1], out var result2) && float.TryParse(array[2], out var result3) && float.TryParse(array[3], out var result4))
		{
			vector = new Vector4(result, result2, result3, result4);
			return true;
		}
		return false;
	}
}