Decompiled source of BepInExConfigurationManagerIL2CPP v18.3.0

BepInEx/plugins/ConfigurationManager/BepInEx.KeyboardShortcut.dll

Decompiled 7 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.Runtime.Versioning;
using BepInEx.Logging;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BepInEx.KeyboardShortcut")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BepInEx.KeyboardShortcut")]
[assembly: AssemblyCopyright("Copyright © Bepis 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("29e2f128-9187-41a9-b834-537d3721cd3a")]
[assembly: AssemblyFileVersion("6.0.0.0")]
[assembly: AssemblyInformationalVersion("6.0.0-be.672")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("6.0.0.0")]
namespace BepInEx.Configuration;

public struct KeyboardShortcut
{
	public static readonly KeyboardShortcut Empty;

	public static readonly IEnumerable<KeyCode> AllKeyCodes;

	public static readonly KeyCode[] ModifierBlockKeyCodes;

	private readonly KeyCode[] _allKeys;

	private static MethodInfo logMethod;

	public KeyCode MainKey
	{
		get
		{
			if (_allKeys != null && _allKeys.Length != 0)
			{
				return _allKeys[0];
			}
			return (KeyCode)0;
		}
	}

	public IEnumerable<KeyCode> Modifiers => _allKeys?.Skip(1) ?? Enumerable.Empty<KeyCode>();

	static KeyboardShortcut()
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Expected O, but got Unknown
		Empty = default(KeyboardShortcut);
		AllKeyCodes = Enum.GetValues(typeof(KeyCode)) as KeyCode[];
		IEnumerable<KeyCode> allKeyCodes = AllKeyCodes;
		KeyCode[] array = new KeyCode[8];
		RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
		ModifierBlockKeyCodes = allKeyCodes.Except((IEnumerable<KeyCode>)(object)array).ToArray();
		logMethod = typeof(Logger).GetMethod("Log", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2]
		{
			typeof(LogLevel),
			typeof(object)
		}, null);
		TomlTypeConverter.AddConverter(typeof(KeyboardShortcut), new TypeConverter
		{
			ConvertToString = (object o, Type type) => ((KeyboardShortcut)o).Serialize(),
			ConvertToObject = (string s, Type type) => Deserialize(s)
		});
	}

	public KeyboardShortcut(KeyCode mainKey, params KeyCode[] modifiers)
		: this(((IEnumerable<KeyCode>)(object)new KeyCode[1] { (KeyCode)(int)mainKey }).Concat(modifiers).ToArray())
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected I4, but got Unknown
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		if ((int)mainKey == 0 && modifiers.Any())
		{
			throw new ArgumentException("Can't set mainKey to KeyCode.None if there are any modifiers");
		}
	}

	private KeyboardShortcut(KeyCode[] keys)
	{
		_allKeys = SanitizeKeys(keys);
	}

	private static KeyCode[] SanitizeKeys(params KeyCode[] keys)
	{
		if (keys == null || keys.Length == 0 || (int)keys[0] == 0)
		{
			return (KeyCode[])(object)new KeyCode[1];
		}
		return ((IEnumerable<KeyCode>)(object)new KeyCode[1] { keys[0] }).Concat(from x in keys.Skip(1).Distinct()
			where (int)x != (int)keys[0]
			orderby (int)x
			select x).ToArray();
	}

	public static KeyboardShortcut Deserialize(string str)
	{
		try
		{
			return new KeyboardShortcut(((IEnumerable<string>)str.Split(new char[5] { ' ', '+', ',', ';', '|' }, StringSplitOptions.RemoveEmptyEntries)).Select((Func<string, KeyCode>)((string x) => (KeyCode)Enum.Parse(typeof(KeyCode), x))).ToArray());
		}
		catch (SystemException ex)
		{
			logMethod?.Invoke(null, new object[2]
			{
				(object)(LogLevel)2,
				"Failed to read keybind from settings: " + ex.Message
			});
		}
		return Empty;
	}

	public string Serialize()
	{
		if (_allKeys == null)
		{
			return string.Empty;
		}
		return string.Join(" + ", _allKeys.Select((KeyCode x) => ((object)(KeyCode)(ref x)).ToString()).ToArray());
	}

	public bool IsDown()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: 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_000a: Unknown result type (might be due to invalid IL or missing references)
		KeyCode mainKey = MainKey;
		if ((int)mainKey != 0 && Input.GetKeyDown(mainKey))
		{
			return ModifierKeyTest();
		}
		return false;
	}

	public bool IsPressed()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: 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_000a: Unknown result type (might be due to invalid IL or missing references)
		KeyCode mainKey = MainKey;
		if ((int)mainKey != 0 && Input.GetKey(mainKey))
		{
			return ModifierKeyTest();
		}
		return false;
	}

	public bool IsUp()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: 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_000a: Unknown result type (might be due to invalid IL or missing references)
		KeyCode mainKey = MainKey;
		if ((int)mainKey != 0 && Input.GetKeyUp(mainKey))
		{
			return ModifierKeyTest();
		}
		return false;
	}

	private bool ModifierKeyTest()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		KeyCode mainKey = MainKey;
		if (_allKeys.All((KeyCode key) => key == mainKey || Input.GetKey(key)))
		{
			return ModifierBlockKeyCodes.Except(_allKeys).All((KeyCode key) => !Input.GetKey(key));
		}
		return false;
	}

	public override string ToString()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		if ((int)MainKey == 0)
		{
			return "Not set";
		}
		return string.Join(" + ", _allKeys.Select((KeyCode key) => ((object)(KeyCode)(ref key)).ToString()).ToArray());
	}

	public override bool Equals(object obj)
	{
		//IL_0010: 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)
		if (obj is KeyboardShortcut keyboardShortcut && MainKey == keyboardShortcut.MainKey)
		{
			return Modifiers.SequenceEqual(keyboardShortcut.Modifiers);
		}
		return false;
	}

	public override int GetHashCode()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		if ((int)MainKey == 0)
		{
			return 0;
		}
		return _allKeys.Aggregate(_allKeys.Length, (int current, KeyCode item) => current * 31 + item);
	}
}

BepInEx/plugins/ConfigurationManager/ConfigurationManager.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using ConfigurationManager.Utilities;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyProduct("BepInEx.ConfigurationManager")]
[assembly: AssemblyTitle("BepInEx.ConfigurationManager")]
[assembly: AssemblyDescription("Universal in-game configuration manager for BepInEx plugins")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("https://github.com/BepInEx/BepInEx.ConfigurationManager")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("18.3.0.0")]
namespace ConfigurationManager
{
	internal static class SettingSearcher
	{
		private static readonly ICollection<string> _updateMethodNames = new string[4] { "Update", "FixedUpdate", "LateUpdate", "OnGUI" };

		public static IReadOnlyList<PluginInfo> FindPlugins()
		{
			return ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Values.Where((PluginInfo x) => x.Instance is BasePlugin).ToList();
		}

		public static void CollectSettings(out IEnumerable<SettingEntryBase> results, out List<string> modsWithoutSettings, bool showDebug)
		{
			modsWithoutSettings = new List<string>();
			try
			{
				results = GetBepInExCoreConfig();
			}
			catch (Exception ex)
			{
				results = Enumerable.Empty<SettingEntryBase>();
				ConfigurationManager.Logger.LogError((object)ex);
			}
			foreach (PluginInfo item in FindPlugins())
			{
				Type type = item.Instance.GetType();
				bool flag = false;
				if (type.GetCustomAttributes(typeof(BrowsableAttribute), inherit: false).Cast<BrowsableAttribute>().Any((BrowsableAttribute x) => !x.Browsable))
				{
					BepInPlugin metadata = item.Metadata;
					if (metadata.GUID != "com.bepis.bepinex.configurationmanager")
					{
						modsWithoutSettings.Add(metadata.Name);
						continue;
					}
					flag = true;
				}
				List<SettingEntryBase> list = GetPluginConfig(item).Cast<SettingEntryBase>().ToList();
				list.RemoveAll((SettingEntryBase x) => x.Browsable == false);
				if (list.Count == 0 || flag)
				{
					list.ForEach(delegate(SettingEntryBase x)
					{
						x.IsAdvanced = true;
					});
				}
				if (showDebug)
				{
					Assembly pluginAssembly = type.Assembly;
					foreach (MonoBehaviour item2 in ((IEnumerable<MonoBehaviour>)Object.FindObjectsOfType<MonoBehaviour>()).Where((MonoBehaviour behaviour) => ((object)behaviour).GetType().Assembly == pluginAssembly))
					{
						Type type2 = ((object)item2).GetType();
						if (type2.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Any((MethodInfo m) => _updateMethodNames.Contains(m.Name)))
						{
							PropertyInfo property = type2.GetProperty("enabled");
							PropertySettingEntry propertySettingEntry = new PropertySettingEntry(item2, property, item);
							propertySettingEntry.DispName = "!Allow plugin to run on every frame";
							propertySettingEntry.Description = "Disabling this will disable some or all of the plugin's functionality.\nHooks and event-based functionality will not be disabled.\nThis setting will be lost after game restart.";
							propertySettingEntry.IsAdvanced = true;
							list.Add(propertySettingEntry);
							break;
						}
					}
				}
				if (list.Count > 0)
				{
					results = results.Concat(list);
				}
			}
		}

		private static IEnumerable<SettingEntryBase> GetBepInExCoreConfig()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			BepInPlugin bepinMeta = new BepInPlugin("BepInEx", "BepInEx", ((object)Paths.BepInExVersion).ToString().Split('+')[0]);
			return ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)ConfigFile.CoreConfig).Select((Func<KeyValuePair<ConfigDefinition, ConfigEntryBase>, SettingEntryBase>)((KeyValuePair<ConfigDefinition, ConfigEntryBase> kvp) => new ConfigSettingEntry(kvp.Value, null)
			{
				IsAdvanced = true,
				PluginInfo = bepinMeta
			}));
		}

		private static IEnumerable<ConfigSettingEntry> GetPluginConfig(PluginInfo plugin)
		{
			object instance = plugin.Instance;
			BasePlugin val = (BasePlugin)((instance is BasePlugin) ? instance : null);
			if (val == null)
			{
				return Enumerable.Empty<ConfigSettingEntry>();
			}
			return ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)val.Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> kvp) => new ConfigSettingEntry(kvp.Value, plugin));
		}
	}
	internal sealed class ConfigSettingEntry : SettingEntryBase
	{
		public ConfigEntryBase Entry { get; }

		public override Type SettingType => Entry.SettingType;

		public ConfigSettingEntry(ConfigEntryBase entry, PluginInfo owner)
		{
			Entry = entry;
			DispName = entry.Definition.Key;
			base.Category = entry.Definition.Section;
			ConfigDescription description = entry.Description;
			base.Description = ((description != null) ? description.Description : null);
			TypeConverter converter = TomlTypeConverter.GetConverter(entry.SettingType);
			if (converter != null)
			{
				base.ObjToStr = (object o) => converter.ConvertToString(o, entry.SettingType);
				base.StrToObj = (string s) => converter.ConvertToObject(s, entry.SettingType);
			}
			ConfigDescription description2 = entry.Description;
			AcceptableValueBase val = ((description2 != null) ? description2.AcceptableValues : null);
			if (val != null)
			{
				GetAcceptableValues(val);
			}
			base.DefaultValue = entry.DefaultValue;
			ConfigDescription description3 = entry.Description;
			SetFromAttributes((description3 != null) ? description3.Tags : null, owner);
		}

		private void GetAcceptableValues(AcceptableValueBase values)
		{
			Type type = ((object)values).GetType();
			PropertyInfo property = type.GetProperty("AcceptableValues", BindingFlags.Instance | BindingFlags.Public);
			if (property != null)
			{
				base.AcceptableValues = ((IEnumerable)property.GetValue(values, null)).Cast<object>().ToArray();
				return;
			}
			PropertyInfo property2 = type.GetProperty("MinValue", BindingFlags.Instance | BindingFlags.Public);
			PropertyInfo property3 = type.GetProperty("MaxValue", BindingFlags.Instance | BindingFlags.Public);
			if (property2 != null && property3 != null)
			{
				base.AcceptableValueRange = new KeyValuePair<object, object>(property2.GetValue(values, null), property3.GetValue(values, null));
				base.ShowRangeAsPercent = ((base.AcceptableValueRange.Key.Equals(0) || base.AcceptableValueRange.Key.Equals(1)) && base.AcceptableValueRange.Value.Equals(100)) || (base.AcceptableValueRange.Key.Equals(0f) && base.AcceptableValueRange.Value.Equals(1f));
			}
		}

		public override object Get()
		{
			return Entry.BoxedValue;
		}

		protected override void SetValue(object newVal)
		{
			Entry.BoxedValue = newVal;
		}
	}
	[BepInPlugin("com.bepis.bepinex.configurationmanager", "Configuration Manager", "18.3")]
	[Browsable(false)]
	public class ConfigurationManager : BasePlugin
	{
		private class ConfigurationManagerBehaviour : MonoBehaviour
		{
			internal static ConfigurationManager Plugin;

			private void Start()
			{
				Plugin.Start();
			}

			private void Update()
			{
				Plugin.Update();
			}

			private void LateUpdate()
			{
				Plugin.LateUpdate();
			}

			private void OnGUI()
			{
				Plugin.OnGUI();
			}
		}

		private sealed class PluginSettingsData
		{
			public sealed class PluginSettingsGroupData
			{
				public string Name;

				public List<SettingEntryBase> Settings;
			}

			public BepInPlugin Info;

			public List<PluginSettingsGroupData> Categories;

			public int Height;

			public string Website;

			private bool _collapsed;

			public bool Collapsed
			{
				get
				{
					return _collapsed;
				}
				set
				{
					_collapsed = value;
					Height = 0;
				}
			}
		}

		public const string GUID = "com.bepis.bepinex.configurationmanager";

		public const string Version = "18.3";

		internal static ManualLogSource Logger;

		private static SettingFieldDrawer _fieldDrawer;

		private static readonly Color _advancedSettingColor = new Color(1f, 0.95f, 0.67f, 1f);

		private const int WindowId = -68;

		private const string SearchBoxName = "searchBox";

		private bool _focusSearchBox;

		private string _searchString = string.Empty;

		public bool OverrideHotkey;

		private bool _displayingWindow;

		private bool _obsoleteCursor;

		private string _modsWithoutSettings;

		private List<SettingEntryBase> _allSettings;

		private List<PluginSettingsData> _filteredSetings = new List<PluginSettingsData>();

		private bool _windowWasMoved;

		private bool _tipsPluginHeaderWasClicked;

		private bool _tipsWindowWasMoved;

		private Rect _screenRect;

		private Vector2 _settingWindowScrollPos;

		private int _tipsHeight;

		private PropertyInfo _curLockState;

		private PropertyInfo _curVisible;

		private int _previousCursorLockState;

		private bool _previousCursorVisible;

		private readonly ConfigEntry<bool> _showAdvanced;

		private readonly ConfigEntry<bool> _showKeybinds;

		private readonly ConfigEntry<bool> _showSettings;

		private readonly ConfigEntry<KeyboardShortcut> _keybind;

		private readonly ConfigEntry<bool> _hideSingleSection;

		private readonly ConfigEntry<bool> _pluginConfigCollapsedDefault;

		private bool _showDebug;

		internal Rect SettingWindowRect { get; private set; }

		public bool IsWindowFullscreen
		{
			get
			{
				if (DisplayingWindow)
				{
					return !_windowWasMoved;
				}
				return false;
			}
		}

		internal int LeftColumnWidth { get; private set; }

		internal int RightColumnWidth { get; private set; }

		public bool DisplayingWindow
		{
			get
			{
				return _displayingWindow;
			}
			set
			{
				if (_displayingWindow == value)
				{
					return;
				}
				_displayingWindow = value;
				SettingFieldDrawer.ClearCache();
				if (_displayingWindow)
				{
					CalculateWindowRect();
					BuildSettingList();
					_focusSearchBox = true;
					if (_curLockState != null)
					{
						_previousCursorLockState = (_obsoleteCursor ? Convert.ToInt32((bool)_curLockState.GetValue(null, null)) : ((int)_curLockState.GetValue(null, null)));
						_previousCursorVisible = (bool)_curVisible.GetValue(null, null);
					}
				}
				else if (!_previousCursorVisible || _previousCursorLockState != 0)
				{
					SetUnlockCursor(_previousCursorLockState, _previousCursorVisible);
				}
				this.DisplayingWindowChanged?.Invoke(this, new ValueChangedEventArgs<bool>(value));
			}
		}

		public string SearchString
		{
			get
			{
				return _searchString;
			}
			private set
			{
				if (value == null)
				{
					value = string.Empty;
				}
				if (!(_searchString == value))
				{
					_searchString = value;
					BuildFilteredSettingList();
				}
			}
		}

		public event EventHandler<ValueChangedEventArgs<bool>> DisplayingWindowChanged;

		public ConfigurationManager()
		{
			//IL_00a4: 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)
			//IL_00be: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			Logger = ((BasePlugin)this).Log;
			_fieldDrawer = new SettingFieldDrawer(this);
			_showAdvanced = ((BasePlugin)this).Config.Bind<bool>("Filtering", "Show advanced", false, (ConfigDescription)null);
			_showKeybinds = ((BasePlugin)this).Config.Bind<bool>("Filtering", "Show keybinds", true, (ConfigDescription)null);
			_showSettings = ((BasePlugin)this).Config.Bind<bool>("Filtering", "Show settings", true, (ConfigDescription)null);
			_keybind = ((BasePlugin)this).Config.Bind<KeyboardShortcut>("General", "Show config manager", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), new ConfigDescription("The shortcut used to toggle the config manager window on and off.\nThe key can be overridden by a game-specific plugin if necessary, in that case this setting is ignored.", (AcceptableValueBase)null, Array.Empty<object>()));
			_hideSingleSection = ((BasePlugin)this).Config.Bind<bool>("General", "Hide single sections", false, new ConfigDescription("Show section title for plugins with only one section", (AcceptableValueBase)null, Array.Empty<object>()));
			_pluginConfigCollapsedDefault = ((BasePlugin)this).Config.Bind<bool>("General", "Plugin collapsed default", true, new ConfigDescription("If set to true plugins will be collapsed when opening the configuration manager window", (AcceptableValueBase)null, Array.Empty<object>()));
		}

		public override void Load()
		{
			ConfigurationManagerBehaviour.Plugin = this;
			((BasePlugin)this).AddComponent<ConfigurationManagerBehaviour>();
		}

		public static void RegisterCustomSettingDrawer(Type settingType, Action<SettingEntryBase> onGuiDrawer)
		{
			if (settingType == null)
			{
				throw new ArgumentNullException("settingType");
			}
			if (onGuiDrawer == null)
			{
				throw new ArgumentNullException("onGuiDrawer");
			}
			if (SettingFieldDrawer.SettingDrawHandlers.ContainsKey(settingType))
			{
				Logger.LogWarning((object)("Tried to add a setting drawer for type " + settingType.FullName + " while one already exists."));
			}
			else
			{
				SettingFieldDrawer.SettingDrawHandlers[settingType] = onGuiDrawer;
			}
		}

		public void BuildSettingList()
		{
			SettingSearcher.CollectSettings(out var results, out var modsWithoutSettings, _showDebug);
			_modsWithoutSettings = string.Join(", ", (from x in modsWithoutSettings
				select x.TrimStart('!') into x
				orderby x
				select x).ToArray());
			_allSettings = results.ToList();
			BuildFilteredSettingList();
		}

		private void BuildFilteredSettingList()
		{
			IEnumerable<SettingEntryBase> source = _allSettings;
			string[] searchStrings = SearchString.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
			if (searchStrings.Length != 0)
			{
				source = source.Where((SettingEntryBase x) => ContainsSearchString(x, searchStrings));
			}
			else
			{
				if (!_showAdvanced.Value)
				{
					source = source.Where((SettingEntryBase x) => x.IsAdvanced != true);
				}
				if (!_showKeybinds.Value)
				{
					source = source.Where((SettingEntryBase x) => !IsKeyboardShortcut(x));
				}
				if (!_showSettings.Value)
				{
					source = source.Where((SettingEntryBase x) => x.IsAdvanced == true || IsKeyboardShortcut(x));
				}
			}
			bool settingsAreCollapsed = _pluginConfigCollapsedDefault.Value;
			HashSet<string> nonDefaultCollpasingStateByPluginName = new HashSet<string>();
			foreach (PluginSettingsData filteredSeting in _filteredSetings)
			{
				if (filteredSeting.Collapsed != settingsAreCollapsed)
				{
					nonDefaultCollpasingStateByPluginName.Add(filteredSeting.Info.Name);
				}
			}
			_filteredSetings = (from x in (from x in source
					group x by x.PluginInfo).Select(delegate(IGrouping<BepInPlugin, SettingEntryBase> pluginSettings)
				{
					IEnumerable<PluginSettingsData.PluginSettingsGroupData> source2 = from eb in pluginSettings
						group eb by eb.Category into x
						orderby string.Equals(x.Key, "Keyboard shortcuts", StringComparison.Ordinal), x.Key
						select new PluginSettingsData.PluginSettingsGroupData
						{
							Name = x.Key,
							Settings = (from set in x
								orderby set.Order descending, set.DispName
								select set).ToList()
						};
					string website = Utils.GetWebsite(pluginSettings.First().PluginInstance);
					return new PluginSettingsData
					{
						Info = pluginSettings.Key,
						Categories = source2.ToList(),
						Collapsed = (nonDefaultCollpasingStateByPluginName.Contains(pluginSettings.Key.Name) ? (!settingsAreCollapsed) : settingsAreCollapsed),
						Website = website
					};
				})
				orderby x.Info.Name
				select x).ToList();
		}

		private static bool IsKeyboardShortcut(SettingEntryBase x)
		{
			if (!(x.SettingType == typeof(KeyboardShortcut)))
			{
				return x.SettingType == typeof(KeyCode);
			}
			return true;
		}

		private static bool ContainsSearchString(SettingEntryBase setting, string[] searchStrings)
		{
			string combinedSearchTarget = setting.PluginInfo.Name + "\n" + setting.PluginInfo.GUID + "\n" + setting.DispName + "\n" + setting.Category + "\n" + setting.Description + "\n" + setting.DefaultValue?.ToString() + "\n" + setting.Get();
			return searchStrings.All((string s) => combinedSearchTarget.IndexOf(s, StringComparison.InvariantCultureIgnoreCase) >= 0);
		}

		private void CalculateWindowRect()
		{
			//IL_005d: 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_0083: 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)
			//IL_008f: 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)
			int num = Mathf.Min(Screen.width, 650);
			int num2 = ((Screen.height < 560) ? Screen.height : (Screen.height - 100));
			int num3 = Mathf.RoundToInt((float)(Screen.width - num) / 2f);
			int num4 = Mathf.RoundToInt((float)(Screen.height - num2) / 2f);
			SettingWindowRect = new Rect((float)num3, (float)num4, (float)num, (float)num2);
			_screenRect = new Rect(0f, 0f, (float)Screen.width, (float)Screen.height);
			Rect settingWindowRect = SettingWindowRect;
			LeftColumnWidth = Mathf.RoundToInt(((Rect)(ref settingWindowRect)).width / 2.5f);
			settingWindowRect = SettingWindowRect;
			RightColumnWidth = (int)((Rect)(ref settingWindowRect)).width - LeftColumnWidth - 115;
			_windowWasMoved = false;
		}

		private void OnGUI()
		{
			//IL_0013: 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_001d: 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_0085: 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)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_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)
			//IL_005f: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			if (!DisplayingWindow)
			{
				return;
			}
			SetUnlockCursor(0, cursorVisible: true);
			Vector2 val = Vector2.op_Implicit(Input.mousePosition);
			val.y = (float)Screen.height - val.y;
			Rect settingWindowRect;
			if (!_windowWasMoved)
			{
				if (GUI.Button(_screenRect, string.Empty, GUI.skin.box))
				{
					settingWindowRect = SettingWindowRect;
					if (!((Rect)(ref settingWindowRect)).Contains(val))
					{
						DisplayingWindow = false;
					}
				}
				ImguiUtils.DrawWindowBackground(SettingWindowRect);
			}
			Rect val2 = GUILayout.Window(-68, SettingWindowRect, WindowFunction.op_Implicit((Action<int>)SettingsWindow), "Plugin / mod settings", (Il2CppReferenceArray<GUILayoutOption>)null);
			if (val2 != SettingWindowRect)
			{
				_windowWasMoved = true;
				SettingWindowRect = val2;
				_tipsWindowWasMoved = true;
			}
			if (SettingFieldDrawer.SettingKeyboardShortcut)
			{
				return;
			}
			if (_windowWasMoved)
			{
				settingWindowRect = SettingWindowRect;
				if (!((Rect)(ref settingWindowRect)).Contains(val))
				{
					return;
				}
			}
			Input.ResetInputAxes();
		}

		private static void DrawTooltip(Rect area)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_004d: 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_0053: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00bf: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			string tooltip = GUI.tooltip;
			if (!string.IsNullOrEmpty(tooltip))
			{
				GUIStyle obj = GUI.skin.box.CreateCopy();
				obj.wordWrap = true;
				obj.alignment = (TextAnchor)4;
				GUIContent val = new GUIContent(tooltip);
				float num = obj.CalcHeight(val, 400f) + 10f;
				Vector2 mousePosition = Event.current.mousePosition;
				float num2 = ((mousePosition.x + 400f > ((Rect)(ref area)).width) ? (((Rect)(ref area)).width - 400f) : mousePosition.x);
				float num3 = ((mousePosition.y + 25f + num > ((Rect)(ref area)).height) ? (mousePosition.y - num) : (mousePosition.y + 25f));
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(num2, num3, 400f, num);
				ImguiUtils.DrawContolBackground(val2, Color.black);
				obj.Draw(val2, val, -1);
			}
		}

		private void SettingsWindow(int id)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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)
			//IL_0065: Invalid comparison between Unknown and I4
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Invalid comparison between Unknown and I4
			//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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			DrawWindowHeader();
			_settingWindowScrollPos = GUILayout.BeginScrollView(_settingWindowScrollPos, false, true, Array.Empty<GUILayoutOption>());
			float y = _settingWindowScrollPos.y;
			Rect val = SettingWindowRect;
			float height = ((Rect)(ref val)).height;
			GUILayout.BeginVertical((Il2CppReferenceArray<GUILayoutOption>)null);
			if (string.IsNullOrEmpty(SearchString))
			{
				DrawTips();
				if (_tipsHeight == 0 && (int)Event.current.type == 7)
				{
					val = GUILayoutUtility.GetLastRect();
					_tipsHeight = (int)((Rect)(ref val)).height;
				}
			}
			int num = _tipsHeight;
			foreach (PluginSettingsData filteredSeting in _filteredSetings)
			{
				if (filteredSeting.Height == 0 || ((float)(num + filteredSeting.Height) >= y && (float)num <= y + height))
				{
					try
					{
						DrawSinglePlugin(filteredSeting);
					}
					catch (Il2CppException)
					{
					}
					if (filteredSeting.Height == 0 && (int)Event.current.type == 7)
					{
						val = GUILayoutUtility.GetLastRect();
						filteredSeting.Height = (int)((Rect)(ref val)).height;
					}
				}
				else
				{
					try
					{
						GUILayout.Space((float)filteredSeting.Height);
					}
					catch (Il2CppException)
					{
					}
				}
				num += filteredSeting.Height;
			}
			if (_showDebug)
			{
				GUILayout.Space(10f);
				GUILayout.Label("Plugins with no options available: " + _modsWithoutSettings, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			else
			{
				GUILayout.Space(70f);
			}
			GUILayout.EndVertical();
			GUILayout.EndScrollView();
			if (!SettingFieldDrawer.DrawCurrentDropdown())
			{
				DrawTooltip(SettingWindowRect);
			}
			GUI.DragWindow();
		}

		private void DrawTips()
		{
			string text = ((!_tipsPluginHeaderWasClicked) ? "Tip: Click plugin names to expand. Click setting and group names to see their descriptions." : ((!_tipsWindowWasMoved) ? "Tip: You can drag this window to move it. It will stay open while you interact with the game." : null));
			if (text != null)
			{
				GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label(text, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.EndHorizontal();
			}
		}

		private void DrawWindowHeader()
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUI.enabled = SearchString == string.Empty;
			bool flag = GUILayout.Toggle(_showSettings.Value, "Normal settings", (Il2CppReferenceArray<GUILayoutOption>)null);
			if (_showSettings.Value != flag)
			{
				_showSettings.Value = flag;
				BuildFilteredSettingList();
			}
			flag = GUILayout.Toggle(_showKeybinds.Value, "Keyboard shortcuts", (Il2CppReferenceArray<GUILayoutOption>)null);
			if (_showKeybinds.Value != flag)
			{
				_showKeybinds.Value = flag;
				BuildFilteredSettingList();
			}
			Color color = GUI.color;
			GUI.color = _advancedSettingColor;
			flag = GUILayout.Toggle(_showAdvanced.Value, "Advanced settings", (Il2CppReferenceArray<GUILayoutOption>)null);
			if (_showAdvanced.Value != flag)
			{
				_showAdvanced.Value = flag;
				BuildFilteredSettingList();
			}
			GUI.color = color;
			GUI.enabled = true;
			GUILayout.Space(8f);
			flag = GUILayout.Toggle(_showDebug, "Debug info", (Il2CppReferenceArray<GUILayoutOption>)null);
			if (_showDebug != flag)
			{
				_showDebug = flag;
				BuildSettingList();
			}
			if (GUILayout.Button("Open Log", (Il2CppReferenceArray<GUILayoutOption>)null))
			{
				try
				{
					Utils.OpenLog();
				}
				catch (SystemException ex)
				{
					Logger.Log((LogLevel)10, (object)ex.Message);
				}
			}
			GUILayout.Space(8f);
			if (GUILayout.Button("Close", (Il2CppReferenceArray<GUILayoutOption>)null))
			{
				DisplayingWindow = false;
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Search: ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
			GUI.SetNextControlName("searchBox");
			SearchString = GUILayout.TextField(SearchString, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if (_focusSearchBox)
			{
				GUI.FocusWindow(-68);
				GUI.FocusControl("searchBox");
				_focusSearchBox = false;
			}
			if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
			{
				SearchString = string.Empty;
			}
			GUILayout.Space(8f);
			if (GUILayout.Button(_pluginConfigCollapsedDefault.Value ? "Expand All" : "Collapse All", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
			{
				bool flag2 = !_pluginConfigCollapsedDefault.Value;
				_pluginConfigCollapsedDefault.Value = flag2;
				foreach (PluginSettingsData filteredSeting in _filteredSetings)
				{
					filteredSeting.Collapsed = flag2;
				}
				_tipsPluginHeaderWasClicked = true;
			}
			GUILayout.EndHorizontal();
		}

		private void DrawSinglePlugin(PluginSettingsData plugin)
		{
			//IL_00c3: 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)
			//IL_0108: Expected O, but got Unknown
			//IL_0126: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical(GUI.skin.box, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUIContent val = (_showDebug ? new GUIContent($"{plugin.Info.Name.TrimStart('!')} {plugin.Info.Version}", (Texture)null, "GUID: " + plugin.Info.GUID) : new GUIContent($"{plugin.Info.Name.TrimStart('!')} {plugin.Info.Version}"));
			bool flag = !string.IsNullOrEmpty(SearchString);
			bool flag2 = plugin.Website != null;
			if (flag2)
			{
				GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Space(29f);
			}
			if (SettingFieldDrawer.DrawPluginHeader(val, plugin.Collapsed && !flag) && !flag)
			{
				_tipsPluginHeaderWasClicked = true;
				plugin.Collapsed = !plugin.Collapsed;
			}
			if (flag2)
			{
				Color color = GUI.color;
				GUI.color = Color.gray;
				if (GUILayout.Button(new GUIContent("URL", (Texture)null, plugin.Website), GUI.skin.label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					Utils.OpenWebsite(plugin.Website);
				}
				GUI.color = color;
				GUILayout.EndHorizontal();
			}
			if (flag || !plugin.Collapsed)
			{
				foreach (PluginSettingsData.PluginSettingsGroupData category in plugin.Categories)
				{
					if (!string.IsNullOrEmpty(category.Name) && (plugin.Categories.Count > 1 || !_hideSingleSection.Value))
					{
						SettingFieldDrawer.DrawCategoryHeader(category.Name);
					}
					foreach (SettingEntryBase setting in category.Settings)
					{
						DrawSingleSetting(setting);
						GUILayout.Space(2f);
					}
				}
			}
			GUILayout.EndVertical();
		}

		private void DrawSingleSetting(SettingEntryBase setting)
		{
			//IL_0027: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			try
			{
				DrawSettingName(setting);
				_fieldDrawer.DrawSettingValue(setting);
				DrawDefaultButton(setting);
			}
			catch (Exception ex)
			{
				ManualLogSource logger = Logger;
				LogLevel val = (LogLevel)2;
				LogLevel val2 = val;
				bool flag = default(bool);
				BepInExLogInterpolatedStringHandler val3 = new BepInExLogInterpolatedStringHandler(26, 2, val, ref flag);
				if (flag)
				{
					val3.AppendLiteral("Failed to draw setting ");
					val3.AppendFormatted<string>(setting.DispName);
					val3.AppendLiteral(" - ");
					val3.AppendFormatted<Exception>(ex);
				}
				logger.Log(val2, val3);
				GUILayout.Label("Failed to draw this field, check log for details.", (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			GUILayout.EndHorizontal();
		}

		private void DrawSettingName(SettingEntryBase setting)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0078: Expected O, but got Unknown
			//IL_0078: 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)
			if (!setting.HideSettingName)
			{
				Color color = GUI.color;
				if (setting.IsAdvanced == true)
				{
					GUI.color = _advancedSettingColor;
				}
				GUILayout.Label(new GUIContent(setting.DispName.TrimStart('!'), (Texture)null, setting.Description), (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width((float)LeftColumnWidth),
					GUILayout.MaxWidth((float)LeftColumnWidth)
				});
				GUI.color = color;
			}
		}

		private static void DrawDefaultButton(SettingEntryBase setting)
		{
			if (setting.HideDefaultButton)
			{
				return;
			}
			object defaultValue = setting.DefaultValue;
			if (defaultValue != null || setting.SettingType.IsClass)
			{
				GUILayout.Space(5f);
				if (GUILayout.Button("Reset", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					setting.Set(defaultValue);
				}
			}
		}

		private void Start()
		{
			Type typeFromHandle = typeof(Cursor);
			_curLockState = typeFromHandle.GetProperty("lockState", BindingFlags.Static | BindingFlags.Public);
			_curVisible = typeFromHandle.GetProperty("visible", BindingFlags.Static | BindingFlags.Public);
			if (_curLockState == null && _curVisible == null)
			{
				_obsoleteCursor = true;
				_curLockState = typeof(Screen).GetProperty("lockCursor", BindingFlags.Static | BindingFlags.Public);
				_curVisible = typeof(Screen).GetProperty("showCursor", BindingFlags.Static | BindingFlags.Public);
			}
			try
			{
				((BasePlugin)this).Config.Save();
			}
			catch (IOException ex)
			{
				Logger.Log((LogLevel)12, (object)("WARNING: Failed to write to config directory, expect issues!\nError message:" + ex.Message));
			}
			catch (UnauthorizedAccessException ex2)
			{
				Logger.Log((LogLevel)12, (object)("WARNING: Permission denied to write to config directory, expect issues!\nError message:" + ex2.Message));
			}
		}

		private void Update()
		{
			//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)
			if (DisplayingWindow)
			{
				SetUnlockCursor(0, cursorVisible: true);
			}
			if (!OverrideHotkey)
			{
				KeyboardShortcut value = _keybind.Value;
				if (((KeyboardShortcut)(ref value)).IsDown())
				{
					DisplayingWindow = !DisplayingWindow;
				}
			}
		}

		private void LateUpdate()
		{
			if (DisplayingWindow)
			{
				SetUnlockCursor(0, cursorVisible: true);
			}
		}

		private void SetUnlockCursor(int lockState, bool cursorVisible)
		{
			if (_curLockState != null)
			{
				if (_obsoleteCursor)
				{
					_curLockState.SetValue(null, Convert.ToBoolean(lockState), null);
				}
				else
				{
					_curLockState.SetValue(null, lockState, null);
				}
				_curVisible.SetValue(null, cursorVisible, null);
			}
		}
	}
	internal class PropertySettingEntry : SettingEntryBase
	{
		private Type _settingType;

		public object Instance { get; internal set; }

		public PropertyInfo Property { get; internal set; }

		public override string DispName
		{
			get
			{
				if (!string.IsNullOrEmpty(base.DispName))
				{
					return base.DispName;
				}
				return Property.Name;
			}
			protected internal set
			{
				base.DispName = value;
			}
		}

		public override Type SettingType => _settingType ?? (_settingType = Property.PropertyType);

		public PropertySettingEntry(object instance, PropertyInfo settingProp, PluginInfo pluginInstance)
		{
			SetFromAttributes(settingProp.GetCustomAttributes(inherit: false), pluginInstance);
			if (!base.Browsable.HasValue)
			{
				base.Browsable = settingProp.CanRead && settingProp.CanWrite;
			}
			base.ReadOnly = settingProp.CanWrite;
			Property = settingProp;
			Instance = instance;
		}

		public override object Get()
		{
			return Property.GetValue(Instance, null);
		}

		protected override void SetValue(object newVal)
		{
			Property.SetValue(Instance, newVal, null);
		}
	}
	public abstract class SettingEntryBase
	{
		public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput);

		private static readonly PropertyInfo[] _myProperties = typeof(SettingEntryBase).GetProperties(BindingFlags.Instance | BindingFlags.Public);

		public object[] AcceptableValues { get; protected set; }

		public KeyValuePair<object, object> AcceptableValueRange { get; protected set; }

		public bool? ShowRangeAsPercent { get; protected set; }

		public Action<ConfigEntryBase> CustomDrawer { get; private set; }

		public CustomHotkeyDrawerFunc CustomHotkeyDrawer { get; private set; }

		public bool? Browsable { get; protected set; }

		public string Category { get; protected set; }

		public object DefaultValue { get; protected set; }

		public bool HideDefaultButton { get; protected set; }

		public bool HideSettingName { get; protected set; }

		public string Description { get; protected internal set; }

		public virtual string DispName { get; protected internal set; }

		public BepInPlugin PluginInfo { get; protected internal set; }

		public bool? ReadOnly { get; protected set; }

		public abstract Type SettingType { get; }

		public PluginInfo PluginInstance { get; private set; }

		public bool? IsAdvanced { get; internal set; }

		public int Order { get; protected set; }

		public Func<object, string> ObjToStr { get; internal set; }

		public Func<string, object> StrToObj { get; internal set; }

		public abstract object Get();

		public void Set(object newVal)
		{
			if (ReadOnly != true)
			{
				SetValue(newVal);
			}
		}

		protected abstract void SetValue(object newVal);

		internal void SetFromAttributes(object[] attribs, PluginInfo pluginInstance)
		{
			PluginInstance = pluginInstance;
			PluginInfo = ((pluginInstance != null) ? pluginInstance.Metadata : null);
			if (attribs == null || attribs.Length == 0)
			{
				return;
			}
			foreach (object obj in attribs)
			{
				if (obj == null)
				{
					continue;
				}
				if (!(obj is DisplayNameAttribute displayNameAttribute))
				{
					if (!(obj is CategoryAttribute categoryAttribute))
					{
						if (!(obj is DescriptionAttribute descriptionAttribute))
						{
							if (!(obj is DefaultValueAttribute defaultValueAttribute))
							{
								if (!(obj is ReadOnlyAttribute readOnlyAttribute))
								{
									if (!(obj is BrowsableAttribute browsableAttribute))
									{
										Action<SettingEntryBase> action = obj as Action<SettingEntryBase>;
										if (action == null)
										{
											if (obj is string text)
											{
												switch (text)
												{
												case "ReadOnly":
													ReadOnly = true;
													break;
												case "Browsable":
													Browsable = true;
													break;
												case "Unbrowsable":
												case "Hidden":
													Browsable = false;
													break;
												case "Advanced":
													IsAdvanced = true;
													break;
												}
												continue;
											}
											Type type = obj.GetType();
											if (!(type.Name == "ConfigurationManagerAttributes"))
											{
												break;
											}
											FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public);
											foreach (var item in from my in _myProperties
												join other in fields on my.Name equals other.Name
												select new { my, other })
											{
												try
												{
													object obj2 = item.other.GetValue(obj);
													if (obj2 != null)
													{
														if (item.my.PropertyType != item.other.FieldType && typeof(Delegate).IsAssignableFrom(item.my.PropertyType))
														{
															obj2 = Delegate.CreateDelegate(item.my.PropertyType, ((Delegate)obj2).Target, ((Delegate)obj2).Method);
														}
														item.my.SetValue(this, obj2, null);
													}
												}
												catch (Exception ex)
												{
													ConfigurationManager.Logger.LogWarning((object)($"Failed to copy value {item.my.Name} from provided tag object {type.FullName} - " + ex.Message));
												}
											}
										}
										else
										{
											CustomDrawer = delegate
											{
												action(this);
											};
										}
									}
									else
									{
										Browsable = browsableAttribute.Browsable;
									}
								}
								else
								{
									ReadOnly = readOnlyAttribute.IsReadOnly;
								}
							}
							else
							{
								DefaultValue = defaultValueAttribute.Value;
							}
						}
						else
						{
							Description = descriptionAttribute.Description;
						}
					}
					else
					{
						Category = categoryAttribute.Category;
					}
				}
				else
				{
					DispName = displayNameAttribute.DisplayName;
				}
			}
		}
	}
	internal class SettingFieldDrawer
	{
		private sealed class ColorCacheEntry
		{
			public Color Last;

			public Texture2D Tex;
		}

		private static IEnumerable<KeyCode> _keysToCheck;

		private static readonly Dictionary<SettingEntryBase, ComboBox> _comboBoxCache;

		private static readonly Dictionary<SettingEntryBase, ColorCacheEntry> _colorCache;

		private static ConfigurationManager _instance;

		private static SettingEntryBase _currentKeyboardShortcutToSet;

		private static GUIStyle _categoryHeaderSkin;

		private static GUIStyle _pluginHeaderSkin;

		private readonly Dictionary<Type, bool> _canCovertCache = new Dictionary<Type, bool>();

		private static bool _drawColorHex;

		public static Dictionary<Type, Action<SettingEntryBase>> SettingDrawHandlers { get; }

		public static bool SettingKeyboardShortcut => _currentKeyboardShortcutToSet != null;

		static SettingFieldDrawer()
		{
			_comboBoxCache = new Dictionary<SettingEntryBase, ComboBox>();
			_colorCache = new Dictionary<SettingEntryBase, ColorCacheEntry>();
			SettingDrawHandlers = new Dictionary<Type, Action<SettingEntryBase>>
			{
				{
					typeof(bool),
					DrawBoolField
				},
				{
					typeof(KeyboardShortcut),
					DrawKeyboardShortcut
				},
				{
					typeof(KeyCode),
					DrawKeyCode
				},
				{
					typeof(Color),
					DrawColor
				},
				{
					typeof(Vector2),
					DrawVector2
				},
				{
					typeof(Vector3),
					DrawVector3
				},
				{
					typeof(Vector4),
					DrawVector4
				},
				{
					typeof(Quaternion),
					DrawQuaternion
				}
			};
		}

		public SettingFieldDrawer(ConfigurationManager instance)
		{
			_instance = instance;
		}

		public void DrawSettingValue(SettingEntryBase setting)
		{
			if (setting.CustomDrawer != null)
			{
				setting.CustomDrawer((setting is ConfigSettingEntry configSettingEntry) ? configSettingEntry.Entry : null);
			}
			else if (setting.CustomHotkeyDrawer != null)
			{
				bool isCurrentlyAcceptingInput = _currentKeyboardShortcutToSet == setting;
				bool flag = isCurrentlyAcceptingInput;
				setting.CustomHotkeyDrawer((setting is ConfigSettingEntry configSettingEntry2) ? configSettingEntry2.Entry : null, ref isCurrentlyAcceptingInput);
				if (isCurrentlyAcceptingInput != flag)
				{
					_currentKeyboardShortcutToSet = (isCurrentlyAcceptingInput ? setting : null);
				}
			}
			else if (setting.ShowRangeAsPercent.HasValue && setting.AcceptableValueRange.Key != null)
			{
				DrawRangeField(setting);
			}
			else if (setting.AcceptableValues != null)
			{
				DrawListField(setting);
			}
			else if (!DrawFieldBasedOnValueType(setting))
			{
				if (setting.SettingType.IsEnum)
				{
					DrawEnumField(setting);
				}
				else
				{
					DrawUnknownField(setting, _instance.RightColumnWidth);
				}
			}
		}

		public static void ClearCache()
		{
			_comboBoxCache.Clear();
			foreach (KeyValuePair<SettingEntryBase, ColorCacheEntry> item in _colorCache)
			{
				Object.Destroy((Object)(object)item.Value.Tex);
			}
			_colorCache.Clear();
		}

		public static void DrawCenteredLabel(string text, params GUILayoutOption[] options)
		{
			GUILayout.BeginHorizontal(options);
			GUILayout.FlexibleSpace();
			GUILayout.Label(text, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
		}

		public static void DrawCategoryHeader(string text)
		{
			if (_categoryHeaderSkin == null)
			{
				_categoryHeaderSkin = GUI.skin.label.CreateCopy();
				_categoryHeaderSkin.alignment = (TextAnchor)1;
				_categoryHeaderSkin.wordWrap = true;
				_categoryHeaderSkin.stretchWidth = true;
				_categoryHeaderSkin.fontSize = 14;
			}
			GUILayout.Label(text, _categoryHeaderSkin, Array.Empty<GUILayoutOption>());
		}

		public static bool DrawPluginHeader(GUIContent content, bool isCollapsed)
		{
			if (_pluginHeaderSkin == null)
			{
				_pluginHeaderSkin = GUI.skin.label.CreateCopy();
				_pluginHeaderSkin.alignment = (TextAnchor)1;
				_pluginHeaderSkin.wordWrap = true;
				_pluginHeaderSkin.stretchWidth = true;
				_pluginHeaderSkin.fontSize = 15;
			}
			if (isCollapsed)
			{
				content.text += "\n...";
			}
			return GUILayout.Button(content, _pluginHeaderSkin, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
		}

		public static bool DrawCurrentDropdown()
		{
			if (ComboBox.CurrentDropdownDrawer != null)
			{
				ComboBox.CurrentDropdownDrawer();
				ComboBox.CurrentDropdownDrawer = null;
				return true;
			}
			return false;
		}

		private static void DrawListField(SettingEntryBase setting)
		{
			//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)
			object[] acceptableValues = setting.AcceptableValues;
			if (acceptableValues.Length == 0)
			{
				throw new ArgumentException("AcceptableValueListAttribute returned an empty list of acceptable values. You need to supply at least 1 option.");
			}
			if (!setting.SettingType.IsInstanceOfType(acceptableValues.FirstOrDefault((object x) => x != null)))
			{
				throw new ArgumentException("AcceptableValueListAttribute returned a list with items of type other than the settng type itself.");
			}
			if (setting.SettingType == typeof(KeyCode))
			{
				DrawKeyCode(setting);
				return;
			}
			Rect settingWindowRect = _instance.SettingWindowRect;
			DrawComboboxField(setting, acceptableValues, ((Rect)(ref settingWindowRect)).yMax);
		}

		private static bool DrawFieldBasedOnValueType(SettingEntryBase setting)
		{
			if (SettingDrawHandlers.TryGetValue(setting.SettingType, out var value))
			{
				value(setting);
				return true;
			}
			return false;
		}

		private static void DrawBoolField(SettingEntryBase setting)
		{
			bool flag = (bool)setting.Get();
			bool flag2 = GUILayout.Toggle(flag, flag ? "Enabled" : "Disabled", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if (flag2 != flag)
			{
				setting.Set(flag2);
			}
		}

		private static void DrawEnumField(SettingEntryBase setting)
		{
			//IL_004a: 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)
			if (setting.SettingType.GetCustomAttributes(typeof(FlagsAttribute), inherit: false).Any())
			{
				DrawFlagsField(setting, Enum.GetValues(setting.SettingType), _instance.RightColumnWidth);
				return;
			}
			Array values = Enum.GetValues(setting.SettingType);
			Rect settingWindowRect = _instance.SettingWindowRect;
			DrawComboboxField(setting, values, ((Rect)(ref settingWindowRect)).yMax);
		}

		private static void DrawFlagsField(SettingEntryBase setting, IList enumValues, int maxWidth)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			long num = Convert.ToInt64(setting.Get());
			var array = (from Enum x in enumValues
				select new
				{
					name = x.ToString(),
					val = Convert.ToInt64(x)
				}).ToArray();
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MaxWidth((float)maxWidth) });
			int i = 0;
			while (i < array.Length)
			{
				GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
				int num2 = 0;
				for (; i < array.Length; i++)
				{
					var anon = array[i];
					if (anon.val != 0L)
					{
						int num3 = (int)GUI.skin.toggle.CalcSize(new GUIContent(anon.name)).x;
						num2 += num3;
						if (num2 > maxWidth)
						{
							break;
						}
						GUI.changed = false;
						bool flag = GUILayout.Toggle((num & anon.val) == anon.val, anon.name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
						if (GUI.changed)
						{
							long value = (flag ? (num | anon.val) : (num & ~anon.val));
							setting.Set(Enum.ToObject(setting.SettingType, value));
						}
					}
				}
				GUILayout.EndHorizontal();
			}
			GUI.changed = false;
			GUILayout.EndVertical();
			GUILayout.FlexibleSpace();
		}

		private static void DrawComboboxField(SettingEntryBase setting, IList list, float windowYmax)
		{
			//IL_003f: 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_00a1: 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)
			GUIContent val = ObjectToGuiContent(setting.Get());
			Rect rect = GUILayoutUtility.GetRect(val, GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if (!_comboBoxCache.TryGetValue(setting, out var value))
			{
				value = new ComboBox(rect, val, list.Cast<object>().Select(ObjectToGuiContent).ToArray(), GUI.skin.button, windowYmax);
				_comboBoxCache[setting] = value;
			}
			else
			{
				value.Rect = rect;
				value.ButtonContent = val;
			}
			value.Show(delegate(int id)
			{
				if (id >= 0 && id < list.Count)
				{
					setting.Set(list[id]);
				}
			});
		}

		private static GUIContent ObjectToGuiContent(object x)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			if (x is Enum)
			{
				DescriptionAttribute descriptionAttribute = x.GetType().GetMember(x.ToString()).FirstOrDefault()?.GetCustomAttributes(typeof(DescriptionAttribute), inherit: false).Cast<DescriptionAttribute>().FirstOrDefault();
				if (descriptionAttribute == null)
				{
					return new GUIContent(x.ToString().ToProperCase());
				}
				return new GUIContent(descriptionAttribute.Description);
			}
			return new GUIContent(x.ToString());
		}

		private static void DrawRangeField(SettingEntryBase setting)
		{
			object obj = setting.Get();
			float num = (float)Convert.ToDouble(obj, CultureInfo.InvariantCulture);
			float num2 = (float)Convert.ToDouble(setting.AcceptableValueRange.Key, CultureInfo.InvariantCulture);
			float num3 = (float)Convert.ToDouble(setting.AcceptableValueRange.Value, CultureInfo.InvariantCulture);
			float num4 = GUILayout.HorizontalSlider(num, num2, num3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if (Math.Abs(num4 - num) > Mathf.Abs(num3 - num2) / 1000f)
			{
				object newVal = Convert.ChangeType(num4, setting.SettingType, CultureInfo.InvariantCulture);
				setting.Set(newVal);
			}
			if (setting.ShowRangeAsPercent == true)
			{
				DrawCenteredLabel(Mathf.Round(100f * Mathf.Abs(num4 - num2) / Mathf.Abs(num3 - num2)) + "%", GUILayout.Width(50f));
				return;
			}
			string text = obj.ToString().AppendZeroIfFloat(setting.SettingType);
			string text2 = GUILayout.TextField(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (!(text2 != text))
			{
				return;
			}
			try
			{
				float num5 = Mathf.Clamp((float)Convert.ToDouble(text2, CultureInfo.InvariantCulture), num2, num3);
				setting.Set(Convert.ChangeType(num5, setting.SettingType, CultureInfo.InvariantCulture));
			}
			catch (FormatException)
			{
			}
		}

		private void DrawUnknownField(SettingEntryBase setting, int rightColumnWidth)
		{
			if (setting.ObjToStr != null && setting.StrToObj != null)
			{
				string text = setting.ObjToStr(setting.Get()).AppendZeroIfFloat(setting.SettingType);
				string text2 = GUILayout.TextField(text, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width((float)rightColumnWidth),
					GUILayout.MaxWidth((float)rightColumnWidth)
				});
				if (text2 != text)
				{
					setting.Set(setting.StrToObj(text2));
				}
			}
			else
			{
				object obj = setting.Get();
				string text3 = ((obj == null) ? "NULL" : obj.ToString().AppendZeroIfFloat(setting.SettingType));
				if (CanCovert(text3, setting.SettingType))
				{
					string text4 = GUILayout.TextField(text3, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width((float)rightColumnWidth),
						GUILayout.MaxWidth((float)rightColumnWidth)
					});
					if (text4 != text3)
					{
						setting.Set(Convert.ChangeType(text4, setting.SettingType, CultureInfo.InvariantCulture));
					}
				}
				else
				{
					GUILayout.TextArea(text3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MaxWidth((float)rightColumnWidth) });
				}
			}
			GUILayout.FlexibleSpace();
		}

		private bool CanCovert(string value, Type type)
		{
			if (_canCovertCache.ContainsKey(type))
			{
				return _canCovertCache[type];
			}
			try
			{
				Convert.ChangeType(value, type);
				_canCovertCache[type] = true;
				return true;
			}
			catch
			{
				_canCovertCache[type] = false;
				return false;
			}
		}

		private static void DrawKeyCode(SettingEntryBase setting)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			if (_currentKeyboardShortcutToSet == setting)
			{
				GUILayout.Label("Press any key", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				GUIUtility.keyboardControl = -1;
				KeyCode val = ((IEnumerable<KeyCode>)KeyboardShortcut.ModifierBlockKeyCodes).FirstOrDefault((Func<KeyCode, bool>)Input.GetKeyUp);
				if ((int)val != 0)
				{
					setting.Set(val);
					_currentKeyboardShortcutToSet = null;
				}
				if (GUILayout.Button("Cancel", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					_currentKeyboardShortcutToSet = null;
				}
			}
			else
			{
				object[] acceptableValues = setting.AcceptableValues;
				Array list = ((acceptableValues != null && acceptableValues.Length > 1) ? setting.AcceptableValues : Enum.GetValues(setting.SettingType));
				Rect settingWindowRect = _instance.SettingWindowRect;
				DrawComboboxField(setting, list, ((Rect)(ref settingWindowRect)).yMax);
				if (GUILayout.Button(new GUIContent("Set...", (Texture)null, "Set the key by pressing any key on your keyboard."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					_currentKeyboardShortcutToSet = setting;
				}
			}
		}

		private static void DrawKeyboardShortcut(SettingEntryBase setting)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0045: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			if (_currentKeyboardShortcutToSet == setting)
			{
				GUILayout.Label("Press any key combination", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				GUIUtility.keyboardControl = -1;
				KeyCode val = ((IEnumerable<KeyCode>)KeyboardShortcut.ModifierBlockKeyCodes).FirstOrDefault((Func<KeyCode, bool>)Input.GetKeyUp);
				if ((int)val != 0)
				{
					setting.Set((object)new KeyboardShortcut(val, ((IEnumerable<KeyCode>)KeyboardShortcut.ModifierBlockKeyCodes).Where((Func<KeyCode, bool>)Input.GetKey).ToArray()));
					_currentKeyboardShortcutToSet = null;
				}
				if (GUILayout.Button("Cancel", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					_currentKeyboardShortcutToSet = null;
				}
			}
			else
			{
				if (GUILayout.Button(setting.Get().ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
				{
					_currentKeyboardShortcutToSet = setting;
				}
				if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					setting.Set(KeyboardShortcut.Empty);
					_currentKeyboardShortcutToSet = null;
				}
			}
		}

		private static void DrawVector2(SettingEntryBase obj)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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)
			Vector2 val = (Vector2)obj.Get();
			Vector2 val2 = val;
			val.x = DrawSingleVectorSlider(val.x, "X");
			val.y = DrawSingleVectorSlider(val.y, "Y");
			if (val != val2)
			{
				obj.Set(val);
			}
		}

		private static void DrawVector3(SettingEntryBase obj)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (Vector3)obj.Get();
			Vector3 val2 = val;
			val.x = DrawSingleVectorSlider(val.x, "X");
			val.y = DrawSingleVectorSlider(val.y, "Y");
			val.z = DrawSingleVectorSlider(val.z, "Z");
			if (val != val2)
			{
				obj.Set(val);
			}
		}

		private static void DrawVector4(SettingEntryBase obj)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0055: 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_006b: 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)
			Vector4 val = (Vector4)obj.Get();
			Vector4 val2 = val;
			val.x = DrawSingleVectorSlider(val.x, "X");
			val.y = DrawSingleVectorSlider(val.y, "Y");
			val.z = DrawSingleVectorSlider(val.z, "Z");
			val.w = DrawSingleVectorSlider(val.w, "W");
			if (val != val2)
			{
				obj.Set(val);
			}
		}

		private static void DrawQuaternion(SettingEntryBase obj)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0055: 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_006b: 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)
			Quaternion val = (Quaternion)obj.Get();
			Quaternion val2 = val;
			val.x = DrawSingleVectorSlider(val.x, "X");
			val.y = DrawSingleVectorSlider(val.y, "Y");
			val.z = DrawSingleVectorSlider(val.z, "Z");
			val.w = DrawSingleVectorSlider(val.w, "W");
			if (val != val2)
			{
				obj.Set(val);
			}
		}

		private static float DrawSingleVectorSlider(float setting, string label)
		{
			GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
			float.TryParse(GUILayout.TextField(setting.ToString("F", CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }), NumberStyles.Any, CultureInfo.InvariantCulture, out var result);
			return result;
		}

		private static void DrawColor(SettingEntryBase obj)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_003a: 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_0041: 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_008c: 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_00c8: 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_01ee: 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_0276: 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_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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)
			Color val = (Color)obj.Get();
			GUI.changed = false;
			if (!_colorCache.TryGetValue(obj, out var value))
			{
				Texture2D tex2 = new Texture2D(100, 20, (TextureFormat)5, false);
				value = new ColorCacheEntry
				{
					Tex = tex2,
					Last = val
				};
				FillTex(val, tex2);
				_colorCache[obj] = value;
			}
			GUILayout.BeginVertical((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label((Texture)(object)value.Tex, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
			string text = (_drawColorHex ? ("#" + ColorUtility.ToHtmlStringRGBA(val)) : $"{val.r:F2} {val.g:F2} {val.b:F2} {val.a:F2}");
			string text2 = GUILayout.TextField(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if (GUI.changed && text != text2)
			{
				if (_drawColorHex)
				{
					Color val2 = default(Color);
					if (ColorUtility.TryParseHtmlString(text2, ref val2))
					{
						val = val2;
					}
				}
				else
				{
					string[] array = text2.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))
					{
						((Color)(ref val))..ctor(result, result2, result3, result4);
					}
				}
			}
			_drawColorHex = GUILayout.Toggle(_drawColorHex, "Hex", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("R", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
			val.r = GUILayout.HorizontalSlider(val.r, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.Label("G", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
			val.g = GUILayout.HorizontalSlider(val.g, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.Label("B", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
			val.b = GUILayout.HorizontalSlider(val.b, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.Label("A", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
			val.a = GUILayout.HorizontalSlider(val.a, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
			if (val != value.Last)
			{
				obj.Set(val);
				FillTex(val, value.Tex);
				value.Last = val;
			}
			static void FillTex(Color color, Texture2D tex)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				if (color.a < 1f)
				{
					tex.FillTextureCheckerboard();
				}
				tex.FillTexture(color);
			}
		}
	}
	public sealed class ValueChangedEventArgs<TValue> : EventArgs
	{
		public TValue NewValue { get; }

		public ValueChangedEventArgs(TValue newValue)
		{
			NewValue = newValue;
		}
	}
}
namespace ConfigurationManager.Utilities
{
	internal class ComboBox
	{
		private static bool forceToUnShow;

		private static int useControlID = -1;

		private readonly string buttonStyle;

		private bool isClickedComboButton;

		private readonly GUIContent[] listContent;

		private readonly GUIStyle listStyle;

		private readonly int _windowYmax;

		private Vector2 _scrollPosition = Vector2.zero;

		public Rect Rect { get; set; }

		public GUIContent ButtonContent { get; set; }

		public static Action CurrentDropdownDrawer { get; set; }

		public ComboBox(Rect rect, GUIContent buttonContent, GUIContent[] listContent, GUIStyle listStyle, float windowYmax)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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)
			Rect = rect;
			ButtonContent = buttonContent;
			this.listContent = listContent;
			buttonStyle = "button";
			this.listStyle = listStyle;
			_windowYmax = (int)windowYmax;
		}

		public void Show(Action<int> onItemSelected)
		{
			//IL_0031: 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)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_00d9: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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)
			//IL_0168: 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_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: 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)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			if (forceToUnShow)
			{
				forceToUnShow = false;
				isClickedComboButton = false;
			}
			bool flag = false;
			int controlID = GUIUtility.GetControlID((FocusType)2);
			Vector2 val = Vector2.zero;
			if ((int)Event.current.GetTypeForControl(controlID) == 1 && isClickedComboButton)
			{
				flag = true;
				val = Event.current.mousePosition;
			}
			if (GUI.Button(Rect, ButtonContent, GUIStyle.op_Implicit(buttonStyle)))
			{
				if (useControlID == -1)
				{
					useControlID = controlID;
					isClickedComboButton = false;
				}
				if (useControlID != controlID)
				{
					forceToUnShow = true;
					useControlID = controlID;
				}
				isClickedComboButton = true;
			}
			if (isClickedComboButton)
			{
				GUI.enabled = false;
				GUI.color = new Color(1f, 1f, 1f, 2f);
				Rect rect = Rect;
				float x = ((Rect)(ref rect)).x;
				rect = Rect;
				Vector2 location = GUIUtility.GUIToScreenPoint(new Vector2(x, ((Rect)(ref rect)).y + listStyle.CalcHeight(listContent[0], 1f)));
				rect = Rect;
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(((Rect)(ref rect)).width, listStyle.CalcHeight(listContent[0], 1f) * (float)listContent.Length);
				Rect innerRect = new Rect(0f, 0f, val2.x, val2.y);
				Rect outerRectScreen = new Rect(location.x, location.y, val2.x, val2.y);
				if (((Rect)(ref outerRectScreen)).yMax > (float)_windowYmax)
				{
					((Rect)(ref outerRectScreen)).height = (float)_windowYmax - ((Rect)(ref outerRectScreen)).y;
					ref Rect reference = ref outerRectScreen;
					((Rect)(ref reference)).width = ((Rect)(ref reference)).width + 20f;
				}
				if (val != Vector2.zero && ((Rect)(ref outerRectScreen)).Contains(GUIUtility.GUIToScreenPoint(val)))
				{
					flag = false;
				}
				CurrentDropdownDrawer = delegate
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//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_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)
					//IL_003b: 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_0057: 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_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_006f: Unknown result type (might be due to invalid IL or missing references)
					GUI.enabled = true;
					Vector2 val3 = GUIUtility.ScreenToGUIPoint(location);
					Rect val4 = default(Rect);
					((Rect)(ref val4))..ctor(val3.x, val3.y, ((Rect)(ref outerRectScreen)).width, ((Rect)(ref outerRectScreen)).height);
					ImguiUtils.DrawContolBackground(val4);
					_scrollPosition = GUI.BeginScrollView(val4, _scrollPosition, innerRect, false, false);
					int num = GUI.SelectionGrid(innerRect, -1, Il2CppReferenceArray<GUIContent>.op_Implicit(listContent), 1, listStyle);
					if (num != -1)
					{
						onItemSelected(num);
						isClickedComboButton = false;
					}
					GUI.EndScrollView(true);
				};
			}
			if (flag)
			{
				isClickedComboButton = false;
			}
		}
	}
	internal static class ImguiUtils
	{
		private static Dictionary<ulong, Texture2D> _texCache = new Dictionary<ulong, Texture2D>();

		public static void DrawWindowBackground(Rect position, Color? color = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			DrawBackground(position, color, 7, 4, 3, 2, 1, 1, 1);
		}

		public static void DrawContolBackground(Rect position, Color? color = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			DrawBackground(position, color, 5, 3, 2, 1, 1);
		}

		private static void DrawBackground(Rect position, Color? color, params int[] corner)
		{
			//IL_0123: 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_0055: 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)
			//IL_006d: 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_0077: 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_0104: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			int num = (int)((Rect)(ref position)).width;
			int num2 = (int)((Rect)(ref position)).height;
			if (num <= 0 || num2 <= 0)
			{
				return;
			}
			ulong key = (ulong)(((long)num << 32) | (uint)num2);
			_texCache.TryGetValue(key, out var value);
			if (!Object.op_Implicit((Object)(object)value))
			{
				Color32[] array = (Color32[])(object)new Color32[num * num2];
				array.Fill(Color32.op_Implicit((Color)(((??)color) ?? Color.gray)));
				Color32 value2 = Color32.op_Implicit(Color.clear);
				int num3 = Math.Min(corner.Length, num2);
				int num4 = 0;
				int num5 = -1;
				while (num4 <= num3)
				{
					int num6 = ((num5 >= 0) ? Math.Min(corner[num5], num) : 0);
					int num7 = ((num4 < num3) ? Math.Min(corner[num4], num) : 0);
					num7 += num6;
					num6 = num4 * num - num6;
					array.Fill(num6, num7, value2);
					num6 = array.Length - num6 - num7;
					array.Fill(num6, num7, value2);
					num5 = num4++;
				}
				value = new Texture2D(num, num2, (TextureFormat)4, false);
				value.SetPixels32(Il2CppStructArray<Color32>.op_Implicit(array));
				value.Apply();
				_texCache[key] = value;
			}
			GUI.DrawTexture(position, (Texture)(object)value, (ScaleMode)0, true);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void Fill<T>(this T[] array, T value)
		{
			new Span<T>(array).Fill(value);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void Fill<T>(this T[] array, int start, int length, T value)
		{
			new Span<T>(array, start, length).Fill(value);
		}
	}
	internal static class Utils
	{
		public static string ToProperCase(this string str)
		{
			if (string.IsNullOrEmpty(str))
			{
				return string.Empty;
			}
			if (str.Length < 2)
			{
				return str;
			}
			string text = str.Substring(0, 1).ToUpper();
			for (int i = 1; i < str.Length; i++)
			{
				if (char.IsUpper(str[i]))
				{
					text += " ";
				}
				text += str[i];
			}
			return text;
		}

		public static string AppendZero(this string s)
		{
			if (s.Contains("."))
			{
				return s;
			}
			return s + ".0";
		}

		public static string AppendZeroIfFloat(this string s, Type type)
		{
			if (!(type == typeof(float)) && !(type == typeof(double)) && !(type == typeof(decimal)))
			{
				return s;
			}
			return s.AppendZero();
		}

		public static void FillTexture(this Texture2D tex, Color color)
		{
			//IL_0000: 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_0018: 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_001e: 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_0020: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//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_0047: Unknown result type (might be due to invalid IL or missing references)
			if (color.a < 1f)
			{
				for (int i = 0; i < ((Texture)tex).width; i++)
				{
					for (int j = 0; j < ((Texture)tex).height; j++)
					{
						Color pixel = tex.GetPixel(i, j);
						Color val = Color.Lerp(pixel, color, color.a);
						val.a = Mathf.Max(pixel.a, color.a);
						tex.SetPixel(i, j, val);
					}
				}
			}
			else
			{
				for (int k = 0; k < ((Texture)tex).width; k++)
				{
					for (int l = 0; l < ((Texture)tex).height; l++)
					{
						tex.SetPixel(k, l, color);
					}
				}
			}
			tex.Apply(false);
		}

		public static void FillTextureCheckerboard(this Texture2D tex)
		{
			//IL_0020: 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)
			for (int i = 0; i < ((Texture)tex).width; i++)
			{
				for (int j = 0; j < ((Texture)tex).height; j++)
				{
					tex.SetPixel(i, j, ((i / 10 + j / 10) % 2 == 1) ? Color.black : Color.white);
				}
			}
			tex.Apply(false);
		}

		public static void OpenLog()
		{
			List<string> list = new List<string>();
			string text = Path.Combine(Application.dataPath, "..");
			list.Add(Path.Combine(text, "output_log.txt"));
			list.Add(Path.Combine(Application.dataPath, "output_log.txt"));
			PropertyInfo property = typeof(Application).GetProperty("consoleLogPath", BindingFlags.Static | BindingFlags.Public);
			if (property != null)
			{
				string item = property.GetValue(null, null) as string;
				list.Add(item);
			}
			if (Directory.Exists(Application.persistentDataPath))
			{
				string item2 = Directory.GetFiles(Application.persistentDataPath, "output_log.txt", SearchOption.AllDirectories).FirstOrDefault();
				list.Add(item2);
			}
			if (!TryOpen(list.Where(File.Exists).OrderByDescending(File.GetLastWriteTimeUtc).FirstOrDefault()))
			{
				list.Clear();
				list.AddRange(Directory.GetFiles(text, "LogOutput.log*", SearchOption.AllDirectories));
				list.AddRange(Directory.GetFiles(text, "output_log.txt", SearchOption.AllDirectories));
				if (!TryOpen(list.Where(File.Exists).OrderByDescending(File.GetLastWriteTimeUtc).FirstOrDefault()))
				{
					throw new FileNotFoundException("No log files were found");
				}
			}
			static bool TryOpen(string path)
			{
				if (path == null)
				{
					return false;
				}
				try
				{
					Process.Start(new ProcessStartInfo(path)
					{
						UseShellExecute = true
					});
					return true;
				}
				catch
				{
					return false;
				}
			}
		}

		public static string GetWebsite(PluginInfo bepInPlugin)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			if (bepInPlugin == null)
			{
				return null;
			}
			try
			{
				string location = bepInPlugin.Location;
				if (!File.Exists(location))
				{
					return null;
				}
				FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(location);
				return new string[5] { versionInfo.CompanyName, versionInfo.FileDescription, versionInfo.Comments, versionInfo.LegalCopyright, versionInfo.LegalTrademarks }.FirstOrDefault((string x) => Uri.IsWellFormedUriString(x, UriKind.Absolute));
			}
			catch (Exception ex)
			{
				ManualLogSource logger = ConfigurationManager.Logger;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(25, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to get URI for ");
					BepInPlugin metadata = bepInPlugin.Metadata;
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((metadata != null) ? metadata.Name : null);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				logger.LogWarning(val);
				return null;
			}
		}

		public static void OpenWebsite(string url)
		{
			//IL_0030: 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_0032: 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)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (string.IsNullOrEmpty(url))
				{
					throw new Exception("Empty URL");
				}
				Process.Start(new ProcessStartInfo(url)
				{
					UseShellExecute = true
				});
			}
			catch (Exception ex)
			{
				ManualLogSource logger = ConfigurationManager.Logger;
				LogLevel val = (LogLevel)12;
				LogLevel val2 = val;
				bool flag = default(bool);
				BepInExLogInterpolatedStringHandler val3 = new BepInExLogInterpolatedStringHandler(27, 2, val, ref flag);
				if (flag)
				{
					val3.AppendLiteral("Failed to open URL ");
					val3.AppendFormatted<string>(url);
					val3.AppendLiteral("\nCause: ");
					val3.AppendFormatted<string>(ex.Message);
				}
				logger.Log(val2, val3);
			}
		}

		public static GUIStyle CreateCopy(this GUIStyle original)
		{
			//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)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0013: Expected O, but got Unknown
			GUIStyle val = new GUIStyle();
			val.m_Ptr = GUIStyle.Internal_Copy(val, original);
			return val;
		}
	}
}