Decompiled source of Azus UnOfficial ConfigManager v18.4.1

BepInEx/plugins/ConfigurationManager.dll

Decompiled a month 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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ConfigurationManager.Utilities;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("https://github.com/BepInEx/BepInEx.ConfigurationManager")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2019 / LGPL-3.0")]
[assembly: AssemblyFileVersion("18.4.1.0")]
[assembly: AssemblyInformationalVersion("18.4.1+f8941b39d912234b8e277d92467a897bfbd6445b")]
[assembly: AssemblyProduct("BepInEx.ConfigurationManager")]
[assembly: AssemblyTitle("Universal in-game configuration manager for BepInEx plugins")]
[assembly: AssemblyVersion("18.4.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ConfigurationManager
{
	internal static class SettingSearcher
	{
		private static readonly ICollection<string> _updateMethodNames = new string[4] { "Update", "FixedUpdate", "LateUpdate", "OnGUI" };

		public static HashSet<string> recognizedFiles = new HashSet<string>();

		public static List<string> OtherConfigFiles { get; private set; } = new List<string>();


		public static BaseUnityPlugin[] FindPlugins()
		{
			return (from x in Chainloader.PluginInfos.Values
				select x.Instance into plugin
				where (Object)(object)plugin != (Object)null
				select plugin).Union(Object.FindObjectsOfType(typeof(BaseUnityPlugin)).Cast<BaseUnityPlugin>()).ToArray();
		}

		public static void CollectSettings(out IEnumerable<SettingEntryBase> results, out List<string> modsWithoutSettings, bool showDebug)
		{
			modsWithoutSettings = new List<string>();
			OtherConfigFiles = new List<string>();
			try
			{
				results = GetBepInExCoreConfig();
			}
			catch (Exception ex)
			{
				results = Enumerable.Empty<SettingEntryBase>();
				ConfigurationManager.Logger.LogError((object)ex);
			}
			recognizedFiles.Clear();
			OtherConfigFiles.Clear();
			BaseUnityPlugin[] array = FindPlugins();
			foreach (BaseUnityPlugin val in array)
			{
				Type type = ((object)val).GetType();
				BepInPlugin metadata = val.Info.Metadata;
				string item = ((metadata != null) ? metadata.Name : null) ?? ((object)val).GetType().FullName;
				if (type.GetCustomAttributes(typeof(BrowsableAttribute), inherit: false).Cast<BrowsableAttribute>().Any((BrowsableAttribute x) => !x.Browsable))
				{
					modsWithoutSettings.Add(item);
					continue;
				}
				List<SettingEntryBase> list = new List<SettingEntryBase>();
				list.AddRange(GetPluginConfig(val).Cast<SettingEntryBase>());
				list.RemoveAll((SettingEntryBase x) => x.Browsable == false);
				if (list.Count == 0)
				{
					modsWithoutSettings.Add(item);
				}
				recognizedFiles.Add(val.Config.ConfigFilePath);
				if (showDebug && type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Any((MethodInfo x) => _updateMethodNames.Contains(x.Name)))
				{
					PropertySettingEntry propertySettingEntry = new PropertySettingEntry(val, type.GetProperty("enabled"), val);
					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);
				}
				if (list.Count > 0)
				{
					results = results.Concat(list);
				}
			}
			List<string> first = (from file in Directory.GetFiles(Paths.ConfigPath, "*.*", SearchOption.AllDirectories)
				where file.EndsWith(".cfg") || file.EndsWith(".json") || file.EndsWith(".yaml") || file.EndsWith(".yml")
				select file).ToList();
			OtherConfigFiles = first.Except(recognizedFiles).ToList();
		}

		private static IEnumerable<SettingEntryBase> GetBepInExCoreConfig()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			PropertyInfo property = typeof(ConfigFile).GetProperty("CoreConfig", BindingFlags.Static | BindingFlags.NonPublic);
			if ((object)property == null)
			{
				throw new ArgumentNullException("coreConfigProp");
			}
			ConfigFile source = (ConfigFile)property.GetValue(null, null);
			BepInPlugin bepinMeta = new BepInPlugin("BepInEx", "BepInEx", typeof(Chainloader).Assembly.GetName().Version.ToString());
			return ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)source).Select((Func<KeyValuePair<ConfigDefinition, ConfigEntryBase>, SettingEntryBase>)((KeyValuePair<ConfigDefinition, ConfigEntryBase> kvp) => new ConfigSettingEntry(kvp.Value, null)
			{
				IsAdvanced = true,
				PluginInfo = bepinMeta
			}));
		}

		private static IEnumerable<ConfigSettingEntry> GetPluginConfig(BaseUnityPlugin plugin)
		{
			return ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)plugin.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, BaseUnityPlugin 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 ((object)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 ((object)property2 != null && (object)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.4.1")]
	public class ConfigurationManager : BaseUnityPlugin
	{
		private enum Tab
		{
			Plugins,
			OtherFiles
		}

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

				public List<SettingEntryBase> Settings;

				public float CalculatedHeight;

				public bool Collapsed { get; set; } = true;

			}

			public BepInPlugin Info;

			public List<PluginSettingsGroupData> Categories;

			public int Height;

			public string Website;
		}

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

		public const string Version = "18.4.1";

		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;

		private string _selectedPluginName;

		private const string FileEditorName = "fileEditor";

		private string _fileEditorString = string.Empty;

		private bool _focusFileEditor;

		private string _otherFileTypeFilter = "all";

		private List<string> _cachedOtherFiles;

		private string _cachedOtherFileTypeFilter;

		private const float baseWidth = 1920f;

		private const float baseHeight = 1080f;

		private Tab _selectedTab;

		private string _selectedOtherFile;

		private bool fileDeleted;

		private static HashSet<string> _pinnedPlugins = new HashSet<string>();

		public bool OverrideHotkey;

		private bool _displayingWindow;

		private bool _obsoleteCursor;

		private string _modsWithoutSettings;

		private List<SettingEntryBase> _allSettings;

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

		private bool _windowWasMoved;

		private bool _tipsPluginHeaderWasClicked;

		private bool _tipsWindowWasMoved;

		private Rect _screenRect;

		private Vector2 _pluginWindowScrollPos;

		private Vector2 _settingWindowScrollPos;

		private PropertyInfo _curLockState;

		private PropertyInfo _curVisible;

		private int _previousCursorLockState;

		private bool _previousCursorVisible;

		private GameObject _overlayCanvasObj;

		private Canvas _overlayCanvas;

		private CanvasScaler _overlayCanvasScaler;

		private GraphicRaycaster _overlayRaycaster;

		private Image _overlayBlocker;

		private readonly Dictionary<string, string> _otherFileContents = new Dictionary<string, string>();

		private readonly ConfigEntry<bool> _showAdvanced;

		private readonly ConfigEntry<bool> _showKeybinds;

		private readonly ConfigEntry<bool> _showSettings;

		private readonly ConfigEntry<bool> _showDefault;

		private readonly ConfigEntry<KeyboardShortcut> _keybind;

		private readonly ConfigEntry<bool> _hideSingleSection;

		private readonly ConfigEntry<string> _pinnedPluginsConfig;

		private bool _showAdditionalInfo;

		public static ConfigEntry<Vector2> _windowSize;

		public static ConfigEntry<int> _textSize;

		public static ConfigEntry<Color> _fontColor;

		public static ConfigEntry<Color> _guidfontColor;

		public static ConfigEntry<Color> _widgetBackgroundColor;

		public static ConfigEntry<Color> _settingDescriptionColor;

		public static ConfigEntry<Color> _closeButtonColor;

		public static ConfigEntry<Color> _cancelButtonColor;

		public static ConfigEntry<Color> _lightGreenSettingTextColor;

		public static ConfigEntry<Color> _saveButtonColor;

		public static ConfigEntry<Color> _leftPanelColor;

		public static ConfigEntry<Color> _panelBackgroundColor;

		public static ConfigEntry<Color> _categorySectionColor;

		public static ConfigEntry<Color> _categoryHeaderColor;

		public static ConfigEntry<Color> _slidersColor;

		public static ConfigEntry<Color> _mediumGreySlidersColor;

		public static ConfigEntry<Color> _classTypeColor;

		public static ConfigEntry<Color> _highlightColor;

		public static ConfigEntry<Color> _defaultValueColor;

		public static ConfigEntry<Color> _rangeValueColor;

		internal Rect SettingWindowRect { get; private set; }

		internal int LeftColumnWidth { get; private set; }

		internal int RightColumnWidth { get; set; }

		public bool DisplayingWindow
		{
			get
			{
				return _displayingWindow;
			}
			set
			{
				if (_displayingWindow == value)
				{
					return;
				}
				_displayingWindow = value;
				SettingFieldDrawer.ClearCache();
				ImguiUtils.CreateBackgrounds();
				if (_displayingWindow)
				{
					CalculateWindowRect();
					BuildSettingList();
					_focusSearchBox = true;
					ShowOverlayCanvas();
					if ((object)_curLockState != null)
					{
						_previousCursorLockState = (_obsoleteCursor ? Convert.ToInt32((bool)_curLockState.GetValue(null, null)) : ((int)_curLockState.GetValue(null, null)));
						_previousCursorVisible = (bool)_curVisible.GetValue(null, null);
					}
				}
				else
				{
					HideOverlayCanvas();
					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_006d: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Expected O, but got Unknown
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Expected O, but got Unknown
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			_fieldDrawer = new SettingFieldDrawer(this);
			_windowSize = ((BaseUnityPlugin)this).Config.Bind<Vector2>("General", "Window Size", new Vector2(0.55f, 0.95f), "Window size. The x is the width and the y is the height. This is a percent of screen to take up. 0.5 in the x is 50% of the screen width.");
			_textSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Font Size", 14, "Font Size");
			_textSize.SettingChanged += delegate
			{
				ImguiUtils.RecreateStyles();
			};
			_fontColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Font Color", new Color(1f, 1f, 1f, 1f), "Font color");
			_guidfontColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "GUID Font Color", Color.gray, "GUID Font color");
			_fontColor.SettingChanged += delegate
			{
				ImguiUtils.RecreateStyles();
			};
			_widgetBackgroundColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Widget Color", GUIHelper.DarkGreenSaveButton, "Widget color");
			_settingDescriptionColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Description Color", GUIHelper.SettingDescription, "Description Color");
			_closeButtonColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Close Button Color", GUIHelper.RedCloseButton, "Color for the close button (#BF3030).");
			_closeButtonColor.SettingChanged += delegate
			{
				ImguiUtils.RecreateStyles();
			};
			_cancelButtonColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Cancel Button Color", GUIHelper.DarkRedCancelButton, "Color for the cancel button (#541B1B).");
			_lightGreenSettingTextColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Setting Text Color", GUIHelper.LightGreenSettingText, "Setting text color (#A7EDA7).");
			_saveButtonColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Save Button Color", GUIHelper.DarkGreenSaveButton, "Save button color (#1C401B).");
			_leftPanelColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Left Panel Color", GUIHelper.DarkGreyLeftPanel, "Dark grey background for the left panel (#262626).");
			_leftPanelColor.SettingChanged += delegate
			{
				ImguiUtils.RecreateStyles();
			};
			_panelBackgroundColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Panel Background Color", GUIHelper.WhitePanelBackground, "Black background for the entire panel (#0D0D0D).");
			_categorySectionColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Category Section Color", GUIHelper.MediumBlackCategorySection, "Medium black background for category sections (#1F1F1F).");
			_categoryHeaderColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Category Header Color", GUIHelper.MediumBlackCategoryHeader, "Medium black background for category header (#121212).");
			_slidersColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Sliders Color", GUIHelper.LightGreySliders, "Sliders color (#4C4C4C).");
			_classTypeColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Class/Type Name Color", GUIHelper.GreenClassTypeName, "Green for class/type name (#148B32).");
			_defaultValueColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Default Value Label Color", GUIHelper.DefaultValueColor, "Default Value label color (#FFF4AC).");
			_rangeValueColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Range Value Label Color", GUIHelper.RangeValueColor, "Range Value label color.");
			_highlightColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Highlight Color", GUIHelper.YellowTanHighlight, "Highlight of buttons and sections (#989076).");
			_highlightColor.SettingChanged += delegate
			{
				ImguiUtils.RecreateStyles();
			};
			_showAdvanced = ((BaseUnityPlugin)this).Config.Bind<bool>("Filtering", "Show advanced", false, (ConfigDescription)null);
			_showKeybinds = ((BaseUnityPlugin)this).Config.Bind<bool>("Filtering", "Show keybinds", true, (ConfigDescription)null);
			_showSettings = ((BaseUnityPlugin)this).Config.Bind<bool>("Filtering", "Show settings", true, (ConfigDescription)null);
			_showDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("Filtering", "Show default settings as well as changed", true, (ConfigDescription)null);
			_keybind = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Show config manager", new KeyboardShortcut((KeyCode)282, (KeyCode[])(object)new KeyCode[0]), 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, new object[0]));
			_hideSingleSection = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Hide single sections", false, new ConfigDescription("Show section title for plugins with only one section", (AcceptableValueBase)null, new object[0]));
			_pinnedPluginsConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Pins", "Pinned plugins", "", new ConfigDescription("Comma-separated list of plugin GUIDs to pin to the top of the list. Use the GUID of the plugin to pin it, or use the configuration manager UI to pin it.", (AcceptableValueBase)null, new object[0]));
		}

		public static void RegisterCustomSettingDrawer(Type settingType, Action<SettingEntryBase> onGuiDrawer)
		{
			if ((object)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, _showAdditionalInfo);
			_modsWithoutSettings = string.Join(", ", (from x in modsWithoutSettings
				select x.TrimStart(new char[1] { '!' }) into x
				orderby x
				select x).ToArray());
			_allSettings = results.ToList();
			BuildFilteredSettingList();
		}

		private void BuildFilteredSettingList()
		{
			for (int i = 0; i < _filteredSettings.Count; i++)
			{
				PluginSettingsData data = _filteredSettings[i];
				PluginSettingsDataPool.Release(data);
			}
			_filteredSettings.Clear();
			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.GetValueOrDefault());
				}
				if (!_showKeybinds.Value)
				{
					source = source.Where((SettingEntryBase x) => !IsKeyboardShortcut(x));
				}
				if (!_showSettings.Value)
				{
					source = source.Where((SettingEntryBase x) => x.IsAdvanced.GetValueOrDefault() || IsKeyboardShortcut(x));
				}
				if (!_showDefault.Value)
				{
					source = source.Where((SettingEntryBase x) => x.DefaultValue != null && x.Get() != null && !x.Get().Equals(x.DefaultValue));
				}
			}
			_filteredSettings = (from x in (from x in source
					group x by x.PluginInfo).Select(delegate(IGrouping<BepInPlugin, SettingEntryBase> pluginSettings)
				{
					List<string> originalCategoryOrder = pluginSettings.Select((SettingEntryBase x) => x.Category).Distinct().ToList();
					IEnumerable<PluginSettingsData.PluginSettingsGroupData> source2 = from x in pluginSettings
						group x by x.Category into x
						orderby originalCategoryOrder.IndexOf(x.Key), 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 PluginSettingsDataPool.Get(pluginSettings.Key, source2.ToList(), website);
				})
				orderby x.Info.Name
				select x).ToList();
			_filteredSettings = (from p in _filteredSettings
				orderby IsPinned(p.Info.GUID) descending, p.Info.Name
				select p).ToList();
		}

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

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

		private void CalculateWindowRect()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			float x = _windowSize.Value.x;
			float y = _windowSize.Value.y;
			float num = (float)Screen.width / 1920f;
			float num2 = Mathf.Clamp((float)Screen.width * x, (float)Screen.width * 0.25f, (float)Screen.width * x);
			float num3 = Mathf.Clamp((float)Screen.height * y, (float)Screen.width * 0.2f, (float)Screen.height * y);
			float num4 = Mathf.Round(((float)Screen.width - num2) / 2f);
			float num5 = Mathf.Round(((float)Screen.height - num3) / 2f);
			float num6 = num4 / num;
			float num7 = num5 / num;
			float num8 = num2 / num;
			float num9 = num3 / num;
			SettingWindowRect = new Rect(num6, num7, num8, num9);
			_screenRect = new Rect(0f, 0f, 1920f, 1080f);
			Rect settingWindowRect = SettingWindowRect;
			LeftColumnWidth = Mathf.RoundToInt(((Rect)(ref settingWindowRect)).width / 3.5f);
			settingWindowRect = SettingWindowRect;
			RightColumnWidth = (int)((Rect)(ref settingWindowRect)).width - LeftColumnWidth;
			_windowWasMoved = false;
		}

		private void OnGUI()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_003d: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00f4: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: 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_01a2: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			if (!DisplayingWindow)
			{
				return;
			}
			if ((int)Event.current.type == 5)
			{
				KeyCode keyCode = Event.current.keyCode;
				KeyboardShortcut value = _keybind.Value;
				if (keyCode == ((KeyboardShortcut)(ref value)).MainKey)
				{
					DisplayingWindow = false;
					return;
				}
			}
			Matrix4x4 matrix = GUI.matrix;
			float num = (float)Screen.width / 1920f;
			float num2 = num;
			GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(num2, num2, 1f));
			Rect settingWindowRect;
			if ((int)Event.current.type == 0)
			{
				Vector2 mousePosition = Event.current.mousePosition;
				settingWindowRect = SettingWindowRect;
				if (!((Rect)(ref settingWindowRect)).Contains(mousePosition))
				{
					DisplayingWindow = false;
				}
			}
			if (_textSize.Value > 9 && _textSize.Value < 100)
			{
				ImguiUtils.fontSize = Mathf.Clamp(_textSize.Value, 10, 30);
			}
			ImguiUtils.CreateStyles();
			SetUnlockCursor(0, cursorVisible: true);
			Vector2 val = Vector2.op_Implicit(UnityInput.Current.mousePosition);
			val.y = (float)Screen.height - val.y;
			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 = GUIHelper.CreateWindowWithColor(-68, SettingWindowRect, new WindowFunction(SettingsWindow), "Configuration Manager 18.4.1", _panelBackgroundColor.Value);
			GUI.FocusWindow(-68);
			if (val2 != SettingWindowRect)
			{
				_windowWasMoved = true;
				SettingWindowRect = val2;
				_tipsWindowWasMoved = true;
			}
			if (!SettingFieldDrawer.SettingKeyboardShortcut)
			{
				if (_windowWasMoved)
				{
					settingWindowRect = SettingWindowRect;
					if (!((Rect)(ref settingWindowRect)).Contains(val))
					{
						goto IL_01d7;
					}
				}
				Input.ResetInputAxes();
			}
			goto IL_01d7;
			IL_01d7:
			GUI.matrix = matrix;
		}

		private static void DrawTooltip(Rect area)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_004e: 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_0055: 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_0083: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			string tooltip = GUI.tooltip;
			if (!string.IsNullOrEmpty(tooltip))
			{
				GUIStyle val = GUI.skin.box.CreateCopy();
				val.wordWrap = true;
				val.alignment = (TextAnchor)4;
				GUIContent val2 = new GUIContent(tooltip);
				float num = val.CalcHeight(val2, 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 val3 = default(Rect);
				((Rect)(ref val3))..ctor(num2, num3, 400f, num);
				ImguiUtils.DrawControlBackground(val3, Color.black);
				val.Draw(val3, val2, -1);
			}
		}

		private void SettingsWindow(int id)
		{
			//IL_000b: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Invalid comparison between Unknown and I4
			//IL_0928: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08be: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_064f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0656: Expected O, but got Unknown
			//IL_0796: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0830: Unknown result type (might be due to invalid IL or missing references)
			Rect val = SettingWindowRect;
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref val)).width, 20f));
			DrawWindowHeader();
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MaxWidth((float)(LeftColumnWidth + RightColumnWidth)) });
			GUILayout.BeginVertical(ImguiUtils.leftPanelStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.MaxWidth((float)LeftColumnWidth),
				GUILayout.ExpandWidth(false)
			});
			GUILayout.BeginHorizontal(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			if (GUIHelper.CreateButtonWithColor("Plugins", default(Color), ImguiUtils.buttonStyle, GUILayout.ExpandWidth(true)))
			{
				_selectedTab = Tab.Plugins;
				_selectedPluginName = null;
				_selectedOtherFile = null;
			}
			if (GUIHelper.CreateButtonWithColor("Other Config Files", default(Color), ImguiUtils.buttonStyle, GUILayout.ExpandWidth(true)))
			{
				_selectedTab = Tab.OtherFiles;
				_selectedPluginName = null;
				_selectedOtherFile = null;
			}
			GUILayout.EndHorizontal();
			if (_selectedTab == Tab.OtherFiles)
			{
				GUILayout.BeginHorizontal(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[0]);
				if (GUILayout.Button("All", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					_otherFileTypeFilter = "all";
				}
				if (GUILayout.Button("CFG", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					_otherFileTypeFilter = "cfg";
				}
				if (GUILayout.Button("JSON", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					_otherFileTypeFilter = "json";
				}
				if (GUILayout.Button("YAML", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					_otherFileTypeFilter = "yaml";
				}
				GUILayout.EndHorizontal();
			}
			_pluginWindowScrollPos = GUILayout.BeginScrollView(_pluginWindowScrollPos, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			if (_selectedTab == Tab.Plugins)
			{
				int i = 0;
				PluginSettingsData pluginSettingsData;
				for (int j = 0; j < _filteredSettings.Count; i += pluginSettingsData.Height + 1, j++)
				{
					pluginSettingsData = _filteredSettings[j];
					if (pluginSettingsData.Height != 0)
					{
						if ((float)(i + pluginSettingsData.Height) >= _pluginWindowScrollPos.y)
						{
							float num = i;
							float y = _pluginWindowScrollPos.y;
							val = SettingWindowRect;
							if (num <= y + ((Rect)(ref val)).height)
							{
								goto IL_0250;
							}
						}
						try
						{
							if (pluginSettingsData.Height > 0)
							{
								GUILayout.Space((float)pluginSettingsData.Height);
							}
						}
						catch (ArgumentException)
						{
						}
						continue;
					}
					goto IL_0250;
					IL_0250:
					try
					{
						DrawSinglePlugin(pluginSettingsData);
					}
					catch (ArgumentException)
					{
					}
					if (pluginSettingsData.Height == 0 && (int)Event.current.type == 7)
					{
						val = GUILayoutUtility.GetLastRect();
						pluginSettingsData.Height = (int)((Rect)(ref val)).height;
					}
				}
			}
			else if (_selectedTab == Tab.OtherFiles)
			{
				if (_cachedOtherFiles == null || _cachedOtherFileTypeFilter != _otherFileTypeFilter || fileDeleted)
				{
					fileDeleted = false;
					List<string> otherConfigFiles = SettingSearcher.OtherConfigFiles;
					_cachedOtherFiles = new List<string>();
					if (string.IsNullOrEmpty(_otherFileTypeFilter) || _otherFileTypeFilter == "all")
					{
						_cachedOtherFiles.AddRange(otherConfigFiles);
					}
					else
					{
						string text = _otherFileTypeFilter.ToLowerInvariant();
						if (text == "yaml")
						{
							foreach (string item in otherConfigFiles)
							{
								string extension = Path.GetExtension(item);
								if (!string.IsNullOrEmpty(extension))
								{
									extension = extension.Substring(1).ToLowerInvariant();
									if (extension == "yaml" || extension == "yml")
									{
										_cachedOtherFiles.Add(item);
									}
								}
							}
						}
						else
						{
							foreach (string item2 in otherConfigFiles)
							{
								string extension2 = Path.GetExtension(item2);
								if (!string.IsNullOrEmpty(extension2))
								{
									extension2 = extension2.Substring(1).ToLowerInvariant();
									if (extension2 == text)
									{
										_cachedOtherFiles.Add(item2);
									}
								}
							}
						}
					}
					_cachedOtherFileTypeFilter = _otherFileTypeFilter;
				}
				for (int k = 0; k < _cachedOtherFiles.Count; k++)
				{
					DrawOtherFile(_cachedOtherFiles[k]);
				}
			}
			if (_showAdditionalInfo)
			{
				GUILayout.Space(10f);
				GUIHelper.BeginColor(_fontColor.Value);
				GUILayout.Label("Plugins with no options available: " + _modsWithoutSettings, (GUILayoutOption[])(object)new GUILayoutOption[0]);
				GUIHelper.EndColor();
			}
			else
			{
				GUILayout.Space(70f);
			}
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
			GUILayout.Box(GUIContent.none, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(1f),
				GUILayout.ExpandHeight(true)
			});
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.MaxWidth((float)RightColumnWidth),
				GUILayout.ExpandWidth(true)
			});
			if (_selectedTab == Tab.Plugins && string.IsNullOrEmpty(_selectedPluginName))
			{
				GUIHelper.CreateLabelWithColor("Select a plugin from the left column to view settings.", _fontColor.Value, ImguiUtils.labelStyle);
			}
			else if (_selectedTab == Tab.OtherFiles && string.IsNullOrEmpty(_selectedOtherFile))
			{
				GUIHelper.CreateLabelWithColor("Select a file from the left column to edit.", _fontColor.Value, ImguiUtils.labelStyle);
			}
			PluginSettingsData pluginSettingsData2 = _filteredSettings.FirstOrDefault((PluginSettingsData p) => p.Info.Name == _selectedPluginName);
			string text2 = ((pluginSettingsData2 != null && !string.IsNullOrEmpty(_selectedPluginName)) ? pluginSettingsData2.Info.Name : ((pluginSettingsData2 != null || string.IsNullOrEmpty(_selectedOtherFile)) ? "Select a plugin or file to edit." : Path.GetFileName(_selectedOtherFile)));
			GUIHelper.CreateLabelWithColor("Editing: " + text2, _fontColor.Value, ImguiUtils.labelStyle, GUILayout.ExpandWidth(false));
			if (_selectedTab == Tab.Plugins && pluginSettingsData2 != null)
			{
				GUILayout.BeginHorizontal(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
				GUIStyle val2 = new GUIStyle(GUI.skin.button);
				string text3 = "Reset All Settings For " + pluginSettingsData2.Info.Name;
				if (GUILayout.Button(text3, val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					foreach (PluginSettingsData.PluginSettingsGroupData category in pluginSettingsData2.Categories)
					{
						foreach (SettingEntryBase setting in category.Settings)
						{
							setting.Set(setting.DefaultValue);
						}
					}
					BuildFilteredSettingList();
				}
				if (GUILayout.Button("Collapse All Settings", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					foreach (PluginSettingsData.PluginSettingsGroupData category2 in pluginSettingsData2.Categories)
					{
						category2.Collapsed = !category2.Collapsed;
					}
				}
				GUILayout.EndHorizontal();
			}
			if (_selectedTab == Tab.OtherFiles && !string.IsNullOrEmpty(_selectedOtherFile))
			{
				GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
				if (GUIHelper.CreateButtonWithColor("Save", _saveButtonColor.Value, ImguiUtils.buttonStyle, GUILayout.ExpandWidth(false)))
				{
					File.WriteAllText(_selectedOtherFile, _otherFileContents[_selectedOtherFile]);
					Logger.LogInfo((object)("File saved: " + _selectedOtherFile));
				}
				if (GUIHelper.CreateButtonWithColor("Open File at Location", _saveButtonColor.Value, ImguiUtils.buttonStyle, GUILayout.ExpandWidth(false)))
				{
					Utils.OpenFileLocation(_selectedOtherFile);
				}
				GUILayout.FlexibleSpace();
				if (GUIHelper.CreateButtonWithColor("Delete File", _closeButtonColor.Value, ImguiUtils.redbuttonStyle, GUILayout.ExpandWidth(false)))
				{
					File.Delete(_selectedOtherFile);
					_otherFileContents.Remove(_selectedOtherFile);
					Logger.LogInfo((object)("File deleted: " + _selectedOtherFile));
					BuildSettingList();
					_selectedOtherFile = null;
					fileDeleted = true;
				}
				GUILayout.EndHorizontal();
			}
			_settingWindowScrollPos = GUILayout.BeginScrollView(_settingWindowScrollPos, false, true, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width((float)RightColumnWidth) });
			if (_selectedTab == Tab.Plugins && pluginSettingsData2 != null && !string.IsNullOrEmpty(_selectedPluginName))
			{
				try
				{
					DrawPluginSettings(pluginSettingsData2);
				}
				catch (Exception)
				{
				}
			}
			else if (_selectedTab == Tab.OtherFiles && !string.IsNullOrEmpty(_selectedOtherFile))
			{
				DrawOtherFileEditor(_selectedOtherFile);
			}
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();
			if (!SettingFieldDrawer.DrawCurrentDropdown())
			{
				DrawTooltip(SettingWindowRect);
			}
		}

		private void DrawOtherFileEditor(string filePath)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!_otherFileContents.TryGetValue(filePath, out var value))
				{
					value = File.ReadAllText(filePath);
					_otherFileContents[filePath] = value;
				}
				GUI.SetNextControlName("fileEditor");
				string text = GUILayout.TextArea(value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
				if (text != _otherFileContents[filePath])
				{
					_otherFileContents[filePath] = text;
				}
				if (GUI.GetNameOfFocusedControl() == "fileEditor")
				{
					GUI.FocusWindow(-68);
					GUI.FocusControl("fileEditor");
				}
			}
			catch (Exception ex)
			{
				GUIHelper.CreateLabelWithColor("Failed to load or edit file: " + ex.Message, _fontColor.Value, ImguiUtils.labelStyle, GUILayout.ExpandWidth(false));
			}
		}

		private void DrawWindowHeader()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: 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_022f: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUI.enabled = SearchString == string.Empty;
			bool value = _showSettings.Value;
			GUIStyle toggleStyle = ImguiUtils.toggleStyle;
			bool flag = GUIHelper.CreateToggleWithColor(value, " Normal settings", default(Color), toggleStyle);
			if (_showSettings.Value != flag)
			{
				_showSettings.Value = flag;
				BuildFilteredSettingList();
			}
			bool value2 = _showDefault.Value;
			toggleStyle = ImguiUtils.toggleStyle;
			flag = GUIHelper.CreateToggleWithColor(value2, " Show Default Configs", default(Color), toggleStyle);
			if (_showDefault.Value != flag)
			{
				_showDefault.Value = flag;
				BuildFilteredSettingList();
			}
			bool value3 = _showKeybinds.Value;
			toggleStyle = ImguiUtils.toggleStyle;
			flag = GUIHelper.CreateToggleWithColor(value3, " Keyboard shortcuts", default(Color), toggleStyle);
			if (_showKeybinds.Value != flag)
			{
				_showKeybinds.Value = flag;
				BuildFilteredSettingList();
			}
			flag = GUIHelper.CreateToggleWithColor(_showAdvanced.Value, " Advanced settings", _advancedSettingColor, null);
			if (_showAdvanced.Value != flag)
			{
				_showAdvanced.Value = flag;
				BuildFilteredSettingList();
			}
			GUI.enabled = true;
			GUILayout.Space(8f);
			bool showAdditionalInfo = _showAdditionalInfo;
			toggleStyle = ImguiUtils.toggleStyle;
			flag = GUIHelper.CreateToggleWithColor(showAdditionalInfo, " Additional info", default(Color), toggleStyle);
			if (_showAdditionalInfo != flag)
			{
				_showAdditionalInfo = flag;
				BuildSettingList();
			}
			toggleStyle = ImguiUtils.buttonStyle;
			if (GUIHelper.CreateButtonWithColor("Open BepInEx Log", default(Color), toggleStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
			{
				try
				{
					Utils.OpenBepInExLog();
				}
				catch (SystemException ex)
				{
					Logger.Log((LogLevel)10, (object)ex.Message);
				}
			}
			toggleStyle = ImguiUtils.buttonStyle;
			if (GUIHelper.CreateButtonWithColor("Open Player Log", default(Color), toggleStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
			{
				try
				{
					Utils.OpenLog();
				}
				catch (SystemException ex2)
				{
					Logger.Log((LogLevel)10, (object)ex2.Message);
				}
			}
			GUILayout.Space(8f);
			if (GUIHelper.CreateButtonWithColor("Close", _closeButtonColor.Value, ImguiUtils.redbuttonStyle))
			{
				DisplayingWindow = false;
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUIHelper.CreateLabelWithColor("Search: ", _fontColor.Value, ImguiUtils.labelStyle, 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 (GUIHelper.CreateButtonWithColor("Clear", _widgetBackgroundColor.Value, ImguiUtils.redbuttonStyle, GUILayout.ExpandWidth(false)))
			{
				SearchString = string.Empty;
			}
			GUILayout.EndHorizontal();
		}

		private void DrawSinglePlugin(PluginSettingsData plugin)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_018f: 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_01b7: Expected O, but got Unknown
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = GUI.skin.box.CreateCopy();
			val.hover.background = TexturePool.GetColorTexture(_highlightColor.Value);
			val.normal.background = TexturePool.GetColorTexture(_categorySectionColor.Value);
			val.fontSize = ImguiUtils.fontSize;
			GUILayout.BeginVertical(val, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUIContent content = (_showAdditionalInfo ? new GUIContent($"{plugin.Info.Name.TrimStart(new char[1] { '!' })} {plugin.Info.Version}\n<size=10><color=#{ColorUtility.ToHtmlStringRGBA(_guidfontColor.Value)}>GUID: {plugin.Info.GUID}</color></size>", (Texture)null, "GUID: " + plugin.Info.GUID) : new GUIContent($"{plugin.Info.Name.TrimStart(new char[1] { '!' })} {plugin.Info.Version}\n<size=10><color=#{ColorUtility.ToHtmlStringRGBA(_guidfontColor.Value)}>GUID: {plugin.Info.GUID}</color></size>"));
			bool flag = plugin.Website != null;
			if (flag)
			{
				GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
				GUILayout.Space(29f);
			}
			if (SettingFieldDrawer.DrawPluginHeader(content))
			{
				_tipsPluginHeaderWasClicked = true;
				_selectedPluginName = plugin.Info.Name;
			}
			if (flag)
			{
				if (GUIHelper.CreateButtonWithColor(new GUIContent("URL", (Texture)null, plugin.Website), ImguiUtils.buttonStyle, _settingDescriptionColor.Value, GUILayout.ExpandWidth(false)))
				{
					Utils.OpenWebsite(plugin.Website);
				}
				GUILayout.EndHorizontal();
			}
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.FlexibleSpace();
			if (IsPinned(plugin.Info.GUID))
			{
				if (GUIHelper.CreateButtonWithColor("Unpin", _closeButtonColor.Value, ImguiUtils.redbuttonStyle, GUILayout.ExpandWidth(false)))
				{
					UnpinPlugin(plugin.Info.GUID);
					BuildFilteredSettingList();
				}
			}
			else if (GUIHelper.CreateButtonWithColor("Pin", _saveButtonColor.Value, ImguiUtils.buttonStyle, GUILayout.ExpandWidth(false)))
			{
				PinPlugin(plugin.Info.GUID);
				BuildFilteredSettingList();
			}
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		private void DrawPluginSettings(PluginSettingsData selectedPlugin)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Invalid comparison between Unknown and I4
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			float y = _settingWindowScrollPos.y;
			Rect val = SettingWindowRect;
			float height = ((Rect)(ref val)).height;
			float num = 0f;
			foreach (PluginSettingsData.PluginSettingsGroupData category in selectedPlugin.Categories)
			{
				float num2 = category.CalculatedHeight;
				if (num2 != 0f && (!(num + num2 >= y) || !(num <= y + height)))
				{
					GUILayout.Space(num2);
					num += num2;
					continue;
				}
				GUILayout.Space(1f);
				float num3 = 0f;
				if ((int)Event.current.type == 7)
				{
					val = GUILayoutUtility.GetLastRect();
					num3 = ((Rect)(ref val)).yMax;
				}
				GUILayout.BeginVertical(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.ExpandWidth(false),
					GUILayout.MaxWidth((float)RightColumnWidth)
				});
				if (!string.IsNullOrEmpty(category.Name) && SettingFieldDrawer.DrawCollapsibleCategoryHeader(category.Name, category.Collapsed))
				{
					category.Collapsed = !category.Collapsed;
				}
				if (!category.Collapsed)
				{
					foreach (SettingEntryBase setting in category.Settings)
					{
						DrawSingleSetting(setting);
						GUILayout.Space(5f);
					}
				}
				GUILayout.EndVertical();
				if ((int)Event.current.type == 7)
				{
					val = GUILayoutUtility.GetLastRect();
					float yMax = ((Rect)(ref val)).yMax;
					num2 = (category.CalculatedHeight = yMax - num3);
				}
				num += num2;
			}
		}

		private void DrawOtherFile(string file)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_00b6: 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)
			string text = Path.GetExtension(file).ToUpperInvariant().TrimStart(new char[1] { '.' });
			string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
			GUIContent content = new GUIContent(fileNameWithoutExtension + " " + Environment.NewLine + "<size=10><color=#" + ColorUtility.ToHtmlStringRGBA(_guidfontColor.Value) + ">[" + text + "]</color></size>", (Texture)null, "File Type: " + text);
			bool flag = !string.IsNullOrEmpty(SearchString);
			GUIStyle val = GUI.skin.box.CreateCopy();
			Texture2D texture2D = TexturePool.GetTexture2D(1, 1, (TextureFormat)4, mipChain: false);
			texture2D.SetPixel(0, 0, _highlightColor.Value);
			texture2D.Apply();
			Texture2D texture2D2 = TexturePool.GetTexture2D(1, 1, (TextureFormat)4, mipChain: false);
			texture2D2.SetPixel(0, 0, _categorySectionColor.Value);
			texture2D2.Apply();
			val.hover.background = texture2D;
			val.normal.background = texture2D2;
			TexturePool.ReleaseTexture2D(texture2D);
			TexturePool.ReleaseTexture2D(texture2D2);
			GUILayout.BeginVertical(val, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			if (SettingFieldDrawer.DrawPluginHeader(content) && !flag)
			{
				_tipsPluginHeaderWasClicked = true;
				_selectedOtherFile = file;
			}
			GUILayout.EndVertical();
		}

		private void DrawSingleSetting(SettingEntryBase setting)
		{
			//IL_0109: 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_0040: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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)
			GUIStyle val = GUI.skin.box.CreateCopy();
			bool flag = setting.DefaultValue != null && setting.Get() != null && setting.Get().Equals(setting.DefaultValue);
			Color color = (Color)(flag ? _categorySectionColor.Value : new Color(_categorySectionColor.Value.r / 2f, _categorySectionColor.Value.g / 2f, _categorySectionColor.Value.b / 2f, _categorySectionColor.Value.a));
			val.normal.background = TexturePool.GetColorTexture(color);
			GUILayout.BeginHorizontal(val, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(false),
				GUILayout.MaxWidth((float)RightColumnWidth)
			});
			try
			{
				DrawSettingName(setting);
				if (!flag)
				{
					DrawDefaultButton(setting);
				}
			}
			catch (Exception arg)
			{
				Logger.Log((LogLevel)2, (object)$"Failed to draw setting {setting.DispName} - {arg}");
				GUIHelper.CreateLabelWithColor("Failed to draw this field, check log for details.", _fontColor.Value, ImguiUtils.labelStyle);
			}
			GUILayout.EndHorizontal();
		}

		private void DrawSettingName(SettingEntryBase setting)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			if (!setting.HideSettingName)
			{
				GUIStyle val = GUI.skin.label.CreateCopy();
				val.wordWrap = true;
				val.fontStyle = (FontStyle)1;
				val.normal.textColor = _lightGreenSettingTextColor.Value;
				val.richText = true;
				GUIStyle val2 = GUI.skin.label.CreateCopy();
				val2.wordWrap = true;
				val2.fontStyle = (FontStyle)2;
				val2.normal.textColor = _settingDescriptionColor.Value;
				GUIStyle val3 = GUI.skin.label.CreateCopy();
				val3.wordWrap = true;
				val3.fontStyle = (FontStyle)2;
				val3.normal.textColor = _classTypeColor.Value;
				GUIStyle val4 = GUI.skin.label.CreateCopy();
				val4.wordWrap = true;
				val4.fontStyle = (FontStyle)2;
				val4.normal.textColor = _rangeValueColor.Value;
				GUIStyle val5 = GUI.skin.label.CreateCopy();
				val5.wordWrap = true;
				val5.fontStyle = (FontStyle)3;
				val5.normal.textColor = _defaultValueColor.Value;
				GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]);
				GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
				string text = setting.DispName.TrimStart(new char[1] { '!' });
				string text2 = ((setting.Description.Contains("[Synced with Server]") || (setting.ReadOnly.HasValue && setting.ReadOnly.Value)) ? " <size=20><color=#FF0000>⇅</color></size>" : string.Empty);
				text += text2;
				GUILayout.Label(text, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
				GUILayout.Label(" (" + setting.SettingType.Name + ")", val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
				if (setting.AcceptableValueRange.Key != null)
				{
					object key = setting.AcceptableValueRange.Key;
					object value = setting.AcceptableValueRange.Value;
					GUILayout.Label($" [{key} - {value}]", val4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
				}
				if (setting.DefaultValue != null)
				{
					GUILayout.Label($" Default: {setting.DefaultValue}", val5, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
				}
				GUILayout.EndHorizontal();
				if (!string.IsNullOrEmpty(setting.Description))
				{
					GUILayout.Label(setting.Description, val2, (GUILayoutOption[])(object)new GUILayoutOption[0]);
				}
				_fieldDrawer.DrawSettingValue(setting);
				GUILayout.EndVertical();
			}
			else
			{
				_fieldDrawer.DrawSettingValue(setting);
			}
		}

		private static void DrawDefaultButton(SettingEntryBase setting)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (setting.HideDefaultButton)
			{
				return;
			}
			object defaultValue = setting.DefaultValue;
			if (defaultValue != null || setting.SettingType.IsClass)
			{
				Rect lastRect = GUILayoutUtility.GetLastRect();
				Rect r = default(Rect);
				((Rect)(ref r))..ctor(((Rect)(ref lastRect)).x + ((Rect)(ref lastRect)).width - 65f, ((Rect)(ref lastRect)).y, 60f, 20f);
				if (GUIHelper.CreateButtonWithColor("Reset", r, ImguiUtils.buttonStyle))
				{
					setting.Set(defaultValue);
				}
			}
		}

		public static void PinPlugin(string pluginName)
		{
			if (!_pinnedPlugins.Contains(pluginName))
			{
				_pinnedPlugins.Add(pluginName);
			}
			UpdatePluginConfig();
		}

		public static void UnpinPlugin(string pluginName)
		{
			_pinnedPlugins.Remove(pluginName);
			UpdatePluginConfig();
		}

		public static bool IsPinned(string pluginName)
		{
			return _pinnedPlugins.Contains(pluginName);
		}

		public static void UpdatePluginConfig()
		{
			string value = string.Join(",", _pinnedPlugins.ToArray());
			SettingFieldDrawer._instance._pinnedPluginsConfig.Value = value;
			((BaseUnityPlugin)SettingFieldDrawer._instance).Config.Save();
		}

		private void LoadPinnedPluginsFromConfig()
		{
			string value = _pinnedPluginsConfig.Value;
			if (!string.IsNullOrEmpty(value))
			{
				_pinnedPlugins = new HashSet<string>(value.Split(new char[1] { ',' }));
			}
		}

		private void CreateOverlayCanvas()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_00c1: 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)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_overlayCanvasObj != (Object)null))
			{
				_overlayCanvasObj = new GameObject("ConfigurationManagerOverlayCanvas");
				Object.DontDestroyOnLoad((Object)(object)_overlayCanvasObj);
				_overlayCanvas = _overlayCanvasObj.AddComponent<Canvas>();
				_overlayCanvasScaler = _overlayCanvasObj.AddComponent<CanvasScaler>();
				_overlayRaycaster = _overlayCanvasObj.AddComponent<GraphicRaycaster>();
				_overlayCanvas.renderMode = (RenderMode)0;
				_overlayCanvas.sortingOrder = 9999;
				GameObject val = new GameObject("ConfigurationManagerBlockerImage");
				val.transform.SetParent(_overlayCanvasObj.transform, false);
				_overlayBlocker = val.AddComponent<Image>();
				((Graphic)_overlayBlocker).color = new Color(0f, 0f, 0f, 0.5f);
				((Graphic)_overlayBlocker).raycastTarget = true;
				RectTransform rectTransform = ((Graphic)_overlayBlocker).rectTransform;
				rectTransform.anchorMin = Vector2.zero;
				rectTransform.anchorMax = Vector2.one;
				rectTransform.offsetMin = Vector2.zero;
				rectTransform.offsetMax = Vector2.zero;
			}
		}

		private void ShowOverlayCanvas()
		{
			if ((Object)(object)_overlayCanvasObj == (Object)null)
			{
				CreateOverlayCanvas();
			}
			_overlayCanvasObj.SetActive(true);
		}

		private void HideOverlayCanvas()
		{
			if ((Object)(object)_overlayCanvasObj != (Object)null)
			{
				_overlayCanvasObj.SetActive(false);
			}
		}

		private void Start()
		{
			LoadPinnedPluginsFromConfig();
			Type typeFromHandle = typeof(Cursor);
			_curLockState = typeFromHandle.GetProperty("lockState", BindingFlags.Static | BindingFlags.Public);
			_curVisible = typeFromHandle.GetProperty("visible", BindingFlags.Static | BindingFlags.Public);
			if ((object)_curLockState == null && (object)_curVisible == null)
			{
				_obsoleteCursor = true;
				_curLockState = typeof(Screen).GetProperty("lockCursor", BindingFlags.Static | BindingFlags.Public);
				_curVisible = typeof(Screen).GetProperty("showCursor", BindingFlags.Static | BindingFlags.Public);
			}
			try
			{
				((BaseUnityPlugin)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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Invalid comparison between Unknown and I4
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Invalid comparison between Unknown and I4
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Invalid comparison between Unknown and I4
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Invalid comparison between Unknown and I4
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Invalid comparison between Unknown and I4
			if (DisplayingWindow)
			{
				SetUnlockCursor(0, cursorVisible: true);
				if (GUI.GetNameOfFocusedControl() == "fileEditor" && ((int)Event.current.type == 4 || (int)Event.current.type == 5) && Event.current.isKey)
				{
					Input.ResetInputAxes();
					if (Input.GetKeyDown((KeyCode)27))
					{
						GUI.FocusControl((string)null);
						Event.current.Use();
					}
					if ((int)Event.current.keyCode == 9 && (int)Event.current.type == 5)
					{
						GUIUtility.keyboardControl = 0;
						GUIUtility.hotControl = 0;
						Event.current.Use();
						GUIUtility.ExitGUI();
					}
					if ((int)Event.current.keyCode == 13 && (int)Event.current.type == 5)
					{
						GUIUtility.keyboardControl = 0;
						GUIUtility.hotControl = 0;
						Event.current.Use();
						GUIUtility.ExitGUI();
					}
					return;
				}
			}
			if (!OverrideHotkey && !DisplayingWindow)
			{
				KeyboardShortcut value = _keybind.Value;
				if (((KeyboardShortcut)(ref value)).IsUp())
				{
					ImguiUtils.CreateBackgrounds();
					DisplayingWindow = true;
				}
			}
		}

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

		private void OnDestroy()
		{
			TexturePool.ClearAll();
			TexturePool.ClearCache();
			PluginSettingsDataPool.ClearAll();
			GC.Collect();
		}

		private void SetUnlockCursor(int lockState, bool cursorVisible)
		{
			if ((object)_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, BaseUnityPlugin 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 BaseUnityPlugin 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.GetValueOrDefault())
			{
				SetValue(newVal);
			}
		}

		protected abstract void SetValue(object newVal);

		internal void SetFromAttributes(object[] attribs, BaseUnityPlugin pluginInstance)
		{
			PluginInstance = pluginInstance;
			PluginInfo = ((pluginInstance != null) ? pluginInstance.Info.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 ((object)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 FloatConfigCacheEntry
		{
			public float Value;

			public string FieldText = string.Empty;

			public Color FieldColor = Color.clear;
		}

		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 readonly Dictionary<SettingEntryBase, FloatConfigCacheEntry> _floatConfigCache;

		internal 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 Texture2D _hueSatTex;

		private static bool _isDraggingHSRect;

		private static Vector2 _hsDragPos;

		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>();
			_floatConfigCache = new Dictionary<SettingEntryBase, FloatConfigCacheEntry>();
			_isDraggingHSRect = false;
			SettingDrawHandlers = new Dictionary<Type, Action<SettingEntryBase>>
			{
				{
					typeof(bool),
					DrawBoolField
				},
				{
					typeof(float),
					DrawFloatField
				},
				{
					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 bool IsModifiedValue(SettingEntryBase entry)
		{
			if (entry.DefaultValue != null && entry.Get() != null)
			{
				return !entry.Get().Equals(entry.DefaultValue);
			}
			return false;
		}

		public void DrawSettingValue(SettingEntryBase setting)
		{
			if (setting.CustomDrawer != null)
			{
				_instance.RightColumnWidth -= (IsModifiedValue(setting) ? 90 : 50);
				GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.MaxWidth((float)(_instance.RightColumnWidth - 50)),
					GUILayout.ExpandWidth(false)
				});
				setting.CustomDrawer((setting is ConfigSettingEntry configSettingEntry) ? configSettingEntry.Entry : null);
				GUILayout.EndHorizontal();
				_instance.RightColumnWidth += (IsModifiedValue(setting) ? 90 : 50);
			}
			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, _instance.RightColumnWidth);
			}
			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)
			{
				ColorCacheEntry value = item.Value;
				if ((Object)(object)value.Tex != (Object)null)
				{
					TexturePool.ReleaseTexture2D(value.Tex);
				}
			}
			_colorCache.Clear();
		}

		public static void DrawCenteredLabel(string text, params GUILayoutOption[] options)
		{
			GUILayout.BeginHorizontal(options);
			GUILayout.FlexibleSpace();
			GUILayout.Label(text, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
		}

		public static void DrawCategoryHeader(string text)
		{
			//IL_0093: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (_categoryHeaderSkin == null || (_categoryHeaderSkin != null && ConfigurationManager._categoryHeaderColor.Value != _categoryHeaderSkin.normal.background.GetPixel(0, 0)))
			{
				_categoryHeaderSkin = GUI.skin.box.CreateCopy();
				_categoryHeaderSkin.alignment = (TextAnchor)1;
				_categoryHeaderSkin.wordWrap = true;
				_categoryHeaderSkin.stretchWidth = true;
				_categoryHeaderSkin.fontSize = 16;
				_categoryHeaderSkin.fontStyle = (FontStyle)1;
				_categoryHeaderSkin.normal.background = TexturePool.GetColorTexture(ConfigurationManager._categoryHeaderColor.Value);
			}
			GUIStyle categoryHeaderSkin = _categoryHeaderSkin;
			GUIHelper.CreateLabelWithColor(text, default(Color), categoryHeaderSkin);
		}

		public static bool DrawCollapsibleCategoryHeader(string text, bool collapsed)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (_categoryHeaderSkin == null || (_categoryHeaderSkin != null && ConfigurationManager._categoryHeaderColor.Value != _categoryHeaderSkin.normal.background.GetPixel(0, 0)))
			{
				_categoryHeaderSkin = GUI.skin.box.CreateCopy();
				_categoryHeaderSkin.alignment = (TextAnchor)1;
				_categoryHeaderSkin.wordWrap = true;
				_categoryHeaderSkin.stretchWidth = true;
				_categoryHeaderSkin.fontSize = 16;
				_categoryHeaderSkin.fontStyle = (FontStyle)1;
				_categoryHeaderSkin.normal.background = TexturePool.GetColorTexture(ConfigurationManager._categoryHeaderColor.Value);
			}
			string text2 = (collapsed ? ("► " + text) : ("▼ " + text));
			return GUILayout.Button(text2, _categoryHeaderSkin, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
		}

		public static bool DrawPluginHeader(GUIContent content)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (_pluginHeaderSkin == null)
			{
				_pluginHeaderSkin = GUI.skin.label.CreateCopy();
				_pluginHeaderSkin.alignment = (TextAnchor)1;
				_pluginHeaderSkin.wordWrap = true;
				_pluginHeaderSkin.stretchWidth = true;
				_pluginHeaderSkin.fontSize = 15;
			}
			return GUIHelper.CreateButtonWithColor(content, _pluginHeaderSkin, default(Color), 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_0073: 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)
			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 ((object)setting.SettingType == typeof(KeyCode))
			{
				DrawKeyCode(setting);
				return;
			}
			Rect settingWindowRect = _instance.SettingWindowRect;
			DrawComboboxField(setting, acceptableValues, ((Rect)(ref settingWindowRect)).yMax, _instance.RightColumnWidth);
		}

		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)
		{
			//IL_0026: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			bool flag = (bool)setting.Get();
			string text = (flag ? "Enabled" : "Disabled");
			Color color = (flag ? Color.green : Color.red);
			GUIStyle val = new GUIStyle(GUI.skin.button);
			val.normal.textColor = ConfigurationManager._fontColor.Value;
			bool flag2 = GUIHelper.CreateToggleWithColor(flag, text, color, val, GUILayout.ExpandWidth(false));
			if (flag2 != flag)
			{
				setting.Set(flag2);
			}
		}

		public static void DrawFloatField(SettingEntryBase configEntry)
		{
			//IL_0028: 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_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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)configEntry.Get();
			if (!_floatConfigCache.TryGetValue(configEntry, out var value))
			{
				value = new FloatConfigCacheEntry
				{
					Value = num,
					FieldColor = GUI.color
				};
				_floatConfigCache[configEntry] = value;
			}
			if (GUIHelper.HasChanged() || GUIHelper.IsEnterPressed() || (double)value.Value != (double)num)
			{
				value.Value = num;
				value.FieldText = num.ToString(NumberFormatInfo.InvariantInfo);
				value.FieldColor = GUI.color;
			}
			string text = GUIHelper.CreateTextFieldWithColor(value.FieldText, value.FieldColor, GUILayout.ExpandWidth(true));
			if (text == value.FieldText)
			{
				return;
			}
			value.FieldText = text;
			if (ShouldParse(text) && float.TryParse(text, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out var result))
			{
				configEntry.Set(result);
				value.Value = (float)configEntry.Get();
				value.FieldText = value.Value.ToString(NumberFormatInfo.InvariantInfo);
				if (value.FieldText == text)
				{
					value.FieldColor = GUI.color;
					return;
				}
				value.FieldColor = Color.yellow;
				value.FieldText = text;
			}
			else
			{
				value.FieldColor = Color.red;
			}
		}

		private static bool ShouldParse(string text)
		{
			if (text == null || text.Length <= 0)
			{
				return false;
			}
			switch (text[text.Length - 1])
			{
			case '+':
			case ',':
			case '-':
			case '.':
			case 'E':
			case 'e':
				return false;
			default:
				return true;
			}
		}

		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, _instance.RightColumnWidth);
		}

		private static void DrawFlagsField(SettingEntryBase setting, IList enumValues, int maxWidth)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_0091: 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((GUILayoutOption[])(object)new GUILayoutOption[0]);
				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, int rightColumnWidth)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			GUIContent val = ObjectToGuiContent($"{setting.Get()}");
			Rect rect = GUILayoutUtility.GetRect(val, GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(false),
				GUILayout.MaxWidth((float)_instance.RightColumnWidth / 4f)
			});
			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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			if (x is Enum)
			{
				Type type = x.GetType();
				DescriptionAttribute descriptionAttribute = type.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, int rightColumnWidth)
		{
			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[2]
			{
				GUILayout.ExpandWidth(false),
				GUILayout.MaxWidth((float)rightColumnWidth)
			});
			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.GetValueOrDefault())
			{
				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 = (float)Convert.ToDouble(text2, CultureInfo.InvariantCulture);
				float num6 = Mathf.Clamp(num5, num2, num3);
				setting.Set(Convert.ChangeType(num6, 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[1] { 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[1] { 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
			{
				object obj = Convert.ChangeType(value, type);
				_canCovertCache[type] = true;
				return true;
			}
			catch
			{
				_canCovertCache[type] = false;
				return false;
			}
		}

		private static void DrawKeyCode(SettingEntryBase setting)
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//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_006f: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			if (_currentKeyboardShortcutToSet == setting)
			{
				GUILayout.Label("Press any key", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				GUIUtility.keyboardControl = -1;
				IInputSystem current = UnityInput.Current;
				if (_keysToCheck == null)
				{
					_keysToCheck = current.SupportedKeyCodes.Except((IEnumerable<KeyCode>)(object)new KeyCode[2]
					{
						(KeyCode)323,
						default(KeyCode)
					}).ToArray();
				}
				foreach (KeyCode item in _keysToCheck)
				{
					if (current.GetKeyUp(item))
					{
						setting.Set(item);
						_currentKeyboardShortcutToSet = null;
						break;
					}
				}
				if (GUIHelper.CreateButtonWithColor("Cancel", ConfigurationManager._cancelButtonColor.Value, ImguiUtils.buttonStyle, 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, _instance.RightColumnWidth);
				if (GUIHelper.CreateButtonWithColor(new GUIContent("Set...", (Texture)null, "Set the key by pressing any key on your keyboard."), ImguiUtils.buttonStyle, default(Color), GUILayout.ExpandWidth(false)))
				{
					_currentKeyboardShortcutToSet = setting;
				}
			}
		}

		private static void DrawKeyboardShortcut(SettingEntryBase setting)
		{
			//IL_0012: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			if (_currentKeyboardShortcutToSet == setting)
			{
				GUIHelper.CreateLabelWithColor("Press any key combination", default(Color), ImguiUtils.textStyle, GUILayout.ExpandWidth(true));
				GUIUtility.keyboardControl = -1;
				IInputSystem current = UnityInput.Current;
				if (_keysToCheck == null)
				{
					_keysToCheck = current.SupportedKeyCodes.Except((IEnumerable<KeyCode>)(object)new KeyCode[2]
					{
						(KeyCode)323,
						default(KeyCode)
					}).ToArray();
				}
				foreach (KeyCode item in _keysToCheck)
				{
					if (current.GetKeyUp(item))
					{
						setting.Set((object)new KeyboardShortcut(item, _keysToCheck.Where((Func<KeyCode, bool>)current.GetKey).ToArray()));
						_currentKeyboardShortcutToSet = null;
						break;
					}
				}
				if (GUIHelper.CreateButtonWithColor("Cancel", ConfigurationManager._cancelButtonColor.Value, ImguiUtils.buttonStyle, GUILayout.ExpandWidth(false)))
				{
					_currentKeyboardShortcutToSet = null;
				}
			}
			else
			{
				if (GUILayout.Button("   " + setting.Get().ToString() + "   ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
				{
					_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 I