Decompiled source of ConfigurationManager v1.0.5
ConfigurationManager.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ConfigurationManager.Utilities; using HarmonyLib; using JetBrains.Annotations; using LitJson; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ConfigurationManager")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ConfigurationManager")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("0bac4d10-1d45-4b13-861c-48bae48536e9")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ConfigurationManager { 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 (property != null) { base.AcceptableValues = ((IEnumerable)property.GetValue(values, null)).Cast<object>().ToArray(); return; } PropertyInfo property2 = type.GetProperty("MinValue", BindingFlags.Instance | BindingFlags.Public); PropertyInfo property3 = type.GetProperty("MaxValue", BindingFlags.Instance | BindingFlags.Public); if (property2 != null && property3 != null) { base.AcceptableValueRange = new KeyValuePair<object, object>(property2.GetValue(values, null), property3.GetValue(values, null)); base.ShowRangeAsPercent = ((base.AcceptableValueRange.Key.Equals(0) || base.AcceptableValueRange.Key.Equals(1)) && base.AcceptableValueRange.Value.Equals(100)) || (base.AcceptableValueRange.Key.Equals(0f) && base.AcceptableValueRange.Value.Equals(1f)); } } public override object Get() { return Entry.BoxedValue; } protected override void SetValue(object newVal) { Entry.BoxedValue = newVal; } internal bool ShouldBeHidden() { return ConfigurationManager.hiddenSettings.Value.Contains(base.PluginInfo.GUID + "=" + Entry.Definition.Section + "=" + Entry.Definition.Key); } } internal class LegacySettingEntry : SettingEntryBase { private Type _settingType; public override string DispName { get { return string.IsNullOrEmpty(base.DispName) ? Property.Name : base.DispName; } protected internal set { base.DispName = value; } } public object Instance { get; internal set; } public PropertyInfo Property { get; internal set; } public override Type SettingType => _settingType ?? (_settingType = Property.PropertyType); public object Wrapper { get; internal set; } private LegacySettingEntry() { } public override object Get() { return Property.GetValue(Instance, null); } protected override void SetValue(object newVal) { Property.SetValue(Instance, newVal, null); } public static LegacySettingEntry FromConfigWrapper(object instance, PropertyInfo settingProp, BepInPlugin pluginInfo, BaseUnityPlugin pluginInstance) { try { object value = settingProp.GetValue(instance, null); if (value == null) { ConfigurationManager.LogInfo($"Skipping ConfigWrapper entry because it's null : {instance} | {settingProp.Name} | {((pluginInfo != null) ? pluginInfo.Name : null)}"); return null; } PropertyInfo property = value.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public); LegacySettingEntry legacySettingEntry = new LegacySettingEntry(); legacySettingEntry.SetFromAttributes(settingProp.GetCustomAttributes(inherit: false), pluginInstance); if (property == null) { ConfigurationManager.LogInfo("Failed to find property Value of ConfigWrapper"); return null; } legacySettingEntry.Browsable = property.CanRead && property.CanWrite && legacySettingEntry.Browsable != false; legacySettingEntry.Property = property; legacySettingEntry.Instance = value; legacySettingEntry.Wrapper = value; if (legacySettingEntry.DispName == "Value") { legacySettingEntry.DispName = value.GetType().GetProperty("Key", BindingFlags.Instance | BindingFlags.Public)?.GetValue(value, null) as string; } if (string.IsNullOrEmpty(legacySettingEntry.Category)) { string text = value.GetType().GetProperty("Section", BindingFlags.Instance | BindingFlags.Public)?.GetValue(value, null) as string; if (text != ((pluginInfo != null) ? pluginInfo.GUID : null)) { legacySettingEntry.Category = text; } } object strToObj = value.GetType().GetField("_strToObj", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value); if (strToObj != null) { MethodInfo inv2 = strToObj.GetType().GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public); if (inv2 != null) { legacySettingEntry.StrToObj = (string s) => inv2.Invoke(strToObj, new object[1] { s }); } } object objToStr = value.GetType().GetField("_objToStr", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(value); if (objToStr != null) { MethodInfo inv = objToStr.GetType().GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public); if (inv != null) { legacySettingEntry.ObjToStr = (object o) => inv.Invoke(objToStr, new object[1] { o }) as string; } } else { legacySettingEntry.ObjToStr = (object o) => o.ToString(); } return legacySettingEntry; } catch (SystemException ex) { ConfigurationManager.LogInfo($"Failed to create ConfigWrapper entry : {instance} | {settingProp?.Name} | {((pluginInfo != null) ? pluginInfo.Name : null)} | Error: {ex.Message}"); return null; } } public static LegacySettingEntry FromNormalProperty(object instance, PropertyInfo settingProp, BepInPlugin pluginInfo, BaseUnityPlugin pluginInstance) { LegacySettingEntry legacySettingEntry = new LegacySettingEntry(); legacySettingEntry.SetFromAttributes(settingProp.GetCustomAttributes(inherit: false), pluginInstance); if (!legacySettingEntry.Browsable.HasValue) { legacySettingEntry.Browsable = settingProp.CanRead && settingProp.CanWrite; } legacySettingEntry.ReadOnly = settingProp.CanWrite; legacySettingEntry.Property = settingProp; legacySettingEntry.Instance = instance; return legacySettingEntry; } } 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); private static readonly FieldInfo[] _myFields = typeof(SettingEntryBase).GetFields(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 != true) { 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; } Type type = obj.GetType(); if (!(type.Name == "ConfigurationManagerAttributes")) { continue; } PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public); foreach (var item in from my in _myProperties join other in properties on my.Name equals other.Name select new { my, other }) { try { object value = item.other.GetValue(obj); if (value != null) { item.my.SetValue(this, value); } } catch (Exception ex) { ConfigurationManager.LogInfo("Failed to copy value " + item.my.Name + " from provided tag object " + type.FullName + " - " + ex.Message); } } foreach (var item2 in from my in _myFields join other in properties on my.Name equals other.Name select new { my, other }) { try { object value2 = item2.other.GetValue(obj); if (value2 != null) { item2.my.SetValue(this, value2); } } catch (Exception ex2) { ConfigurationManager.LogInfo("Failed to copy value " + item2.my.Name + " from provided tag object " + type.FullName + " - " + ex2.Message); } } FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); foreach (var item3 in from my in _myFields join other in fields on my.Name equals other.Name select new { my, other }) { try { object value3 = item3.other.GetValue(obj); if (value3 != null) { item3.my.SetValue(this, value3); } } catch (Exception ex3) { ConfigurationManager.LogInfo("Failed to copy value " + item3.my.Name + " from provided tag object " + type.FullName + " - " + ex3.Message); } } foreach (var item4 in from my in _myProperties join other in fields on my.Name equals other.Name select new { my, other }) { try { object value4 = item4.other.GetValue(obj); if (value4 != null) { item4.my.SetValue(this, value4); } } catch (Exception ex4) { ConfigurationManager.LogInfo("Failed to copy value " + item4.my.Name + " from provided tag object " + type.FullName + " - " + ex4.Message); } } } } } internal class SettingFieldDrawer { private sealed class ColorCacheEntry { public Color Last; public Texture2D Tex; } private static IEnumerable<KeyCode> _keysToCheck; private static readonly Dictionary<SettingEntryBase, ComboBox> _comboBoxCache; private static readonly Dictionary<SettingEntryBase, ColorCacheEntry> _colorCache; private static ConfigurationManager _instance; private static SettingEntryBase _currentKeyboardShortcutToSet; private readonly Dictionary<Type, bool> _canCovertCache = new Dictionary<Type, bool>(); public static Dictionary<Type, Action<SettingEntryBase>> SettingDrawHandlers { get; } public static bool SettingKeyboardShortcut => _currentKeyboardShortcutToSet != null; static SettingFieldDrawer() { _comboBoxCache = new Dictionary<SettingEntryBase, ComboBox>(); _colorCache = new Dictionary<SettingEntryBase, ColorCacheEntry>(); SettingDrawHandlers = new Dictionary<Type, Action<SettingEntryBase>> { { typeof(bool), DrawBoolField }, { typeof(KeyboardShortcut), DrawKeyboardShortcut }, { typeof(KeyCode), DrawKeyCode }, { typeof(Color), DrawColor }, { typeof(Vector2), DrawVector2 }, { typeof(Vector3), DrawVector3 }, { typeof(Vector4), DrawVector4 }, { typeof(Quaternion), DrawQuaternion } }; } public SettingFieldDrawer(ConfigurationManager instance) { _instance = instance; } public void DrawSettingValue(SettingEntryBase setting) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_00e0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) GUI.backgroundColor = ConfigurationManager._widgetBackgroundColor.Value; if (setting.CustomDrawer != null) { Color contentColor = GUI.contentColor; GUI.contentColor = (setting.Get().ToString().Equals(setting.DefaultValue.ToString(), StringComparison.OrdinalIgnoreCase) ? ConfigurationManager._fontColorValueDefault.Value : ConfigurationManager._fontColorValueChanged.Value); setting.CustomDrawer((setting is ConfigSettingEntry configSettingEntry) ? configSettingEntry.Entry : null); GUI.contentColor = contentColor; } else if (setting.CustomHotkeyDrawer != null) { bool isCurrentlyAcceptingInput = _currentKeyboardShortcutToSet == setting; bool flag = isCurrentlyAcceptingInput; Color contentColor2 = GUI.contentColor; GUI.contentColor = (setting.Get().ToString().Equals(setting.DefaultValue.ToString(), StringComparison.OrdinalIgnoreCase) ? ConfigurationManager._fontColorValueDefault.Value : ConfigurationManager._fontColorValueChanged.Value); setting.CustomHotkeyDrawer((setting is ConfigSettingEntry configSettingEntry2) ? configSettingEntry2.Entry : null, ref isCurrentlyAcceptingInput); GUI.contentColor = contentColor2; if (isCurrentlyAcceptingInput != flag) { _currentKeyboardShortcutToSet = (isCurrentlyAcceptingInput ? setting : null); } } else if (setting.ShowRangeAsPercent.HasValue && setting.AcceptableValueRange.Key != null) { DrawRangeField(setting); } else if (setting.AcceptableValues != null) { DrawListField(setting); } else if (!DrawFieldBasedOnValueType(setting)) { if (setting.SettingType.IsEnum) { DrawEnumField(setting); } else { DrawUnknownField(setting, _instance.RightColumnWidth); } } } public static void ClearCache() { ClearComboboxCache(); foreach (KeyValuePair<SettingEntryBase, ColorCacheEntry> item in _colorCache) { Object.Destroy((Object)(object)item.Value.Tex); } _colorCache.Clear(); } public static void ClearComboboxCache() { _comboBoxCache.Clear(); } public static void DrawCenteredLabel(string text, GUIStyle labelStyle, params GUILayoutOption[] options) { GUILayout.BeginHorizontal(options); GUILayout.FlexibleSpace(); GUILayout.Label(text, labelStyle, Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } public static void DrawCategoryHeader(string text) { GUILayout.Label(text, ConfigurationManagerStyles.GetCategoryStyle(), Array.Empty<GUILayoutOption>()); } public static bool DrawPluginHeader(GUIContent content) { return GUILayout.Button(content, ConfigurationManagerStyles.GetHeaderStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); } public static bool DrawCurrentDropdown() { if (ComboBox.CurrentDropdownDrawer != null) { ComboBox.CurrentDropdownDrawer(); ComboBox.CurrentDropdownDrawer = null; return true; } return false; } private static void DrawListField(SettingEntryBase setting) { object[] acceptableValues = setting.AcceptableValues; if (acceptableValues.Length == 0) { throw new ArgumentException("AcceptableValueListAttribute returned an empty list of acceptable values. You need to supply at least 1 option."); } if (!setting.SettingType.IsInstanceOfType(acceptableValues.FirstOrDefault((object x) => x != null))) { throw new ArgumentException("AcceptableValueListAttribute returned a list with items of type other than the settng type itself."); } if (setting.SettingType == typeof(KeyCode)) { DrawKeyCode(setting); } else { DrawComboboxField(setting, acceptableValues, ((Rect)(ref _instance.currentWindowRect)).yMax); } } private static bool DrawFieldBasedOnValueType(SettingEntryBase setting) { if (SettingDrawHandlers.TryGetValue(setting.SettingType, out var value)) { value(setting); return true; } return false; } private static void DrawBoolField(SettingEntryBase setting) { //IL_0006: 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_0022: 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_008e: Unknown result type (might be due to invalid IL or missing references) GUI.backgroundColor = ConfigurationManager._widgetBackgroundColor.Value; bool flag = (bool)setting.Get(); Color backgroundColor = GUI.backgroundColor; if (flag) { GUI.backgroundColor = ConfigurationManager._enabledBackgroundColor.Value; } bool flag2 = GUILayout.Toggle(flag, flag ? ConfigurationManager._enabledText.Value : ConfigurationManager._disabledText.Value, ConfigurationManagerStyles.GetToggleStyle(setting), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (flag2 != flag) { setting.Set(flag2); } if (flag) { GUI.backgroundColor = backgroundColor; } } private static void DrawEnumField(SettingEntryBase setting) { if (setting.SettingType.GetCustomAttributes(typeof(FlagsAttribute), inherit: false).Any()) { DrawFlagsField(setting, Enum.GetValues(setting.SettingType), _instance.RightColumnWidth); } else { DrawComboboxField(setting, Enum.GetValues(setting.SettingType), ((Rect)(ref _instance.currentWindowRect)).yMax); } } private static void DrawFlagsField(SettingEntryBase setting, IList enumValues, int maxWidth) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) long num = Convert.ToInt64(setting.Get()); long num2 = Convert.ToInt64(setting.DefaultValue); 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(Array.Empty<GUILayoutOption>()); int num3 = 0; for (; i < array.Length; i++) { var anon = array[i]; if (anon.val != 0) { int num4 = (int)GUI.skin.toggle.CalcSize(new GUIContent(anon.name)).x; num3 += num4; if (num3 > maxWidth) { break; } GUI.changed = false; bool flag = (num & anon.val) == anon.val; bool flag2 = (num2 & anon.val) == anon.val; bool flag3 = GUILayout.Toggle(flag, anon.name, ConfigurationManagerStyles.GetToggleStyle(flag == flag2), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); if (GUI.changed) { long value = (flag3 ? (num | anon.val) : (num & ~anon.val)); setting.Set(Enum.ToObject(setting.SettingType, value)); } } } GUILayout.EndHorizontal(); } GUI.changed = false; GUILayout.EndVertical(); GUILayout.FlexibleSpace(); } private static void DrawComboboxField(SettingEntryBase setting, IList list, float windowYmax) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) GUIContent val = ObjectToGuiContent(setting.Get()); Rect rect = GUILayoutUtility.GetRect(val, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (!_comboBoxCache.TryGetValue(setting, out var value)) { value = new ComboBox(rect, val, list.Cast<object>().Select(ObjectToGuiContent).ToArray(), ObjectToGuiContent(setting.DefaultValue), ConfigurationManagerStyles.GetButtonStyle(), ConfigurationManagerStyles.GetButtonStyle(isDefaulValue: false), ConfigurationManagerStyles.GetBoxStyle(), ConfigurationManagerStyles.GetComboBoxStyle(), 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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(descriptionAttribute.Description); } return new GUIContent(x.ToString().ToProperCase()); } return new GUIContent(x.ToString()); } private static void DrawRangeField(SettingEntryBase setting) { object obj = setting.Get(); float num = (float)Convert.ToDouble(obj, CultureInfo.InvariantCulture); float num2 = (float)Convert.ToDouble(setting.AcceptableValueRange.Key, CultureInfo.InvariantCulture); float num3 = (float)Convert.ToDouble(setting.AcceptableValueRange.Value, CultureInfo.InvariantCulture); float num4 = GUILayout.HorizontalSlider(num, num2, num3, ConfigurationManagerStyles.GetSliderStyle(), ConfigurationManagerStyles.GetThumbStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (Math.Abs(num4 - num) > Mathf.Abs(num3 - num2) / 1000f) { object newVal = Convert.ChangeType(Mathf.Round(num4 * 1000f) / 1000f, setting.SettingType, CultureInfo.InvariantCulture); setting.Set(newVal); } if (setting.ShowRangeAsPercent == true) { DrawCenteredLabel(Mathf.Round(100f * Mathf.Abs(num4 - num2) / Mathf.Abs(num3 - num2)) + "%", ConfigurationManagerStyles.GetLabelStyle(setting), GUILayout.Width(50f)); return; } string text = (Utils.IsFloat(setting.SettingType) ? ((float)obj).ToString(CultureInfo.InvariantCulture).AppendZero() : obj.ToString()); string text2 = GUILayout.TextField(text, ConfigurationManagerStyles.GetTextStyle(setting), (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(Mathf.Round(num6 * 1000f) / 1000f, setting.SettingType, CultureInfo.InvariantCulture)); } catch (FormatException) { } } private void DrawUnknownField(SettingEntryBase setting, int rightColumnWidth) { //IL_0063: 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 (setting.ObjToStr != null && setting.StrToObj != null) { string text = setting.ObjToStr(setting.Get()).AppendZeroIfFloat(setting.SettingType); if (Utility.IsNullOrWhiteSpace(text) && setting.DefaultValue.ToString() != "") { GUI.backgroundColor = ConfigurationManager._fontColorValueChanged.Value; } string text2 = GUILayout.TextField(text, ConfigurationManagerStyles.GetTextStyle(setting), (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 (Utility.IsNullOrWhiteSpace(text3) && setting.DefaultValue.ToString() != "") { GUI.backgroundColor = ConfigurationManager._fontColorValueChanged.Value; } if (CanCovert(text3, setting.SettingType)) { string text4 = GUILayout.TextField(text3, ConfigurationManagerStyles.GetTextStyle(setting), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MaxWidth((float)rightColumnWidth) }); if (text4 != text3) { try { setting.Set(Convert.ChangeType(text4, setting.SettingType, CultureInfo.InvariantCulture)); } catch { } } } else { GUILayout.TextArea(text3, ConfigurationManagerStyles.GetTextStyle(setting), (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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) if (_currentKeyboardShortcutToSet == setting) { GUILayout.Label(ConfigurationManager._shortcutKeysText.Value, ConfigurationManagerStyles.GetLabelStyle(), (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 (GUILayout.Button(ConfigurationManager._cancelText.Value, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { _currentKeyboardShortcutToSet = null; } } else { object[] acceptableValues = setting.AcceptableValues; Array list = ((acceptableValues != null && acceptableValues.Length > 1) ? setting.AcceptableValues : Enum.GetValues(setting.SettingType)); DrawComboboxField(setting, list, ((Rect)(ref _instance.currentWindowRect)).yMax); if (GUILayout.Button(new GUIContent(ConfigurationManager._shortcutKeyText.Value), ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { _currentKeyboardShortcutToSet = setting; } } } private static void DrawKeyboardShortcut(SettingEntryBase setting) { //IL_0023: 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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) object obj = setting.Get(); if (obj.GetType() == typeof(KeyCode)) { obj = (object)new KeyboardShortcut((KeyCode)obj, Array.Empty<KeyCode>()); } if (_currentKeyboardShortcutToSet == setting) { GUILayout.Label(ConfigurationManager._shortcutKeysText.Value, ConfigurationManagerStyles.GetButtonStyle(), (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((object)new KeyboardShortcut(item, _keysToCheck.Where((Func<KeyCode, bool>)current.GetKey).ToArray())); _currentKeyboardShortcutToSet = null; break; } } if (GUILayout.Button(ConfigurationManager._cancelText.Value, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { _currentKeyboardShortcutToSet = null; } } else { if (GUILayout.Button(setting.Get().ToString(), ConfigurationManagerStyles.GetButtonStyle(setting), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { _currentKeyboardShortcutToSet = setting; } if (GUILayout.Button(ConfigurationManager._clearText.Value, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { setting.Set(KeyboardShortcut.Empty); _currentKeyboardShortcutToSet = null; } } } private static void DrawVector2(SettingEntryBase obj) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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", ((Vector2)obj.DefaultValue).x); val.y = DrawSingleVectorSlider(val.y, "Y", ((Vector2)obj.DefaultValue).y); if (val != val2) { obj.Set(val); } } private static void DrawVector3(SettingEntryBase obj) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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) Vector3 val = (Vector3)obj.Get(); Vector3 val2 = val; val.x = DrawSingleVectorSlider(val.x, "X", ((Vector3)obj.DefaultValue).x); val.y = DrawSingleVectorSlider(val.y, "Y", ((Vector3)obj.DefaultValue).y); val.z = DrawSingleVectorSlider(val.z, "Z", ((Vector3)obj.DefaultValue).z); if (val != val2) { obj.Set(val); } } private static void DrawVector4(SettingEntryBase obj) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) Vector4 val = (Vector4)obj.Get(); Vector4 val2 = val; val.x = DrawSingleVectorSlider(val.x, "X", ((Vector4)obj.DefaultValue).x); val.y = DrawSingleVectorSlider(val.y, "Y", ((Vector4)obj.DefaultValue).y); val.z = DrawSingleVectorSlider(val.z, "Z", ((Vector4)obj.DefaultValue).z); val.w = DrawSingleVectorSlider(val.w, "W", ((Vector4)obj.DefaultValue).w); if (val != val2) { obj.Set(val); } } private static void DrawQuaternion(SettingEntryBase obj) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) Quaternion val = (Quaternion)obj.Get(); Quaternion val2 = val; val.x = DrawSingleVectorSlider(val.x, "X", ((Quaternion)obj.DefaultValue).x); val.y = DrawSingleVectorSlider(val.y, "Y", ((Quaternion)obj.DefaultValue).y); val.z = DrawSingleVectorSlider(val.z, "Z", ((Quaternion)obj.DefaultValue).z); val.w = DrawSingleVectorSlider(val.w, "W", ((Quaternion)obj.DefaultValue).w); if (val != val2) { obj.Set(val); } } private static float DrawSingleVectorSlider(float setting, string label, float defaultValue) { GUILayout.Label(label, ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); float.TryParse(GUILayout.TextField(setting.ToString("F", CultureInfo.InvariantCulture), ConfigurationManagerStyles.GetTextStyle(setting, defaultValue), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }), NumberStyles.Any, CultureInfo.InvariantCulture, out var result); return result; } private static void DrawColor(SettingEntryBase obj) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0093: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) Color value = (Color)obj.Get(); GUILayout.BeginVertical(ConfigurationManagerStyles.GetBoxStyle(), Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); bool isDefaultValue = DrawHexField(ref value, (Color)obj.DefaultValue); GUILayout.Space(3f); GUIHelper.BeginColor(value); GUILayout.Label(string.Empty, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (!_colorCache.TryGetValue(obj, out var value2)) { value2 = new ColorCacheEntry { Tex = new Texture2D(40, 10, (TextureFormat)5, false), Last = value }; value2.Tex.FillTexture(value); _colorCache[obj] = value2; } if ((int)Event.current.type == 7) { GUI.DrawTexture(GUILayoutUtility.GetLastRect(), (Texture)(object)value2.Tex); } GUIHelper.EndColor(); GUILayout.Space(3f); GUILayout.EndHorizontal(); GUILayout.Space(2f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); DrawColorField("R", ref value, ref value.r, isDefaultValue); GUILayout.Space(3f); DrawColorField("G", ref value, ref value.g, isDefaultValue); GUILayout.Space(3f); DrawColorField("B", ref value, ref value.b, isDefaultValue); GUILayout.Space(3f); DrawColorField("A", ref value, ref value.a, isDefaultValue); if (value != value2.Last) { obj.Set(value); value2.Tex.FillTexture(value); value2.Last = value; } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } private static bool DrawHexField(ref Color value, Color defaultValue) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_007c: Unknown result type (might be due to invalid IL or missing references) string text = "#" + ColorUtility.ToHtmlStringRGBA(value); string text2 = GUILayout.TextField(text, ConfigurationManagerStyles.GetTextStyle(value, defaultValue), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.MaxWidth(Mathf.Clamp(95f * (float)ConfigurationManagerStyles.fontSize / 14f, 80f, 180f)), GUILayout.ExpandWidth(false) }); Color val = default(Color); if (text2 != text && ColorUtility.TryParseHtmlString(text2, ref val)) { value = val; } return ConfigurationManagerStyles.IsEqualColorConfig(value, defaultValue); } private static void DrawColorField(string fieldLabel, ref Color settingColor, ref float settingValue, bool isDefaultValue) { GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(fieldLabel, ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); string text = settingValue.ToString("0.000"); SetColorValue(ref settingColor, float.Parse(GUILayout.TextField(text, ConfigurationManagerStyles.GetTextStyle(isDefaultValue), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.MaxWidth(45f), GUILayout.ExpandWidth(true) }))); GUILayout.EndHorizontal(); GUILayout.Space(1f); SetColorValue(ref settingColor, GUILayout.HorizontalSlider(settingValue, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })); GUILayout.EndVertical(); void SetColorValue(ref Color color, float value) { switch (fieldLabel) { case "R": color.r = RoundTo000(); break; case "G": color.g = RoundTo000(); break; case "B": color.b = RoundTo000(); break; case "A": color.a = RoundTo000(); break; } float RoundTo000() { return Mathf.Round(value * 1000f) / 1000f; } } } } internal static class SettingSearcher { private static readonly ICollection<string> _updateMethodNames = new string[4] { "Update", "FixedUpdate", "LateUpdate", "OnGUI" }; public static void CollectSettings(out IEnumerable<SettingEntryBase> results, out List<string> modsWithoutSettings, bool showDebug) { modsWithoutSettings = new List<string>(); try { results = GetBepInExCoreConfig(); } catch (Exception data) { results = Enumerable.Empty<SettingEntryBase>(); ConfigurationManager.LogInfo(data); } BaseUnityPlugin[] array = Utils.FindPlugins(); BaseUnityPlugin[] array2 = array; foreach (BaseUnityPlugin val in array2) { if ((Object)(object)val == (Object)null) { continue; } Type type = ((object)val).GetType(); BepInPlugin metadata = val.Info.Metadata; if (type.GetCustomAttributes(typeof(BrowsableAttribute), inherit: false).Cast<BrowsableAttribute>().Any((BrowsableAttribute x) => !x.Browsable)) { modsWithoutSettings.Add(metadata.Name); continue; } List<SettingEntryBase> list = new List<SettingEntryBase>(); list.AddRange(GetPluginConfig(val).Cast<SettingEntryBase>()); int count = list.FindAll((SettingEntryBase x) => x.Browsable == false).Count; if (count > 0) { list.RemoveAll((SettingEntryBase x) => x.Browsable == false); } if (!list.Any()) { modsWithoutSettings.Add(metadata.Name); } if (showDebug && type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Any((MethodInfo x) => _updateMethodNames.Contains(x.Name))) { LegacySettingEntry legacySettingEntry = LegacySettingEntry.FromNormalProperty(val, type.GetProperty("enabled"), metadata, val); legacySettingEntry.DispName = "!Allow plugin to run on every frame"; legacySettingEntry.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."; legacySettingEntry.IsAdvanced = true; list.Add(legacySettingEntry); } if (list.Any()) { results = results.Concat(list); } } } private static IEnumerable<SettingEntryBase> GetBepInExCoreConfig() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown PropertyInfo property = typeof(ConfigFile).GetProperty("CoreConfig", BindingFlags.Static | BindingFlags.NonPublic); if (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((KeyValuePair<ConfigDefinition, ConfigEntryBase> x) => new ConfigSettingEntry(x.Value, null) { IsAdvanced = true, PluginInfo = bepinMeta }).Cast<SettingEntryBase>(); } private static IEnumerable<ConfigSettingEntry> GetPluginConfig(BaseUnityPlugin plugin) { return ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)plugin.Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> x) => new ConfigSettingEntry(x.Value, plugin)); } } public class ConfigurationManagerStyles { private static GUIStyle windowStyle; private static GUIStyle labelStyle; private static GUIStyle labelStyleValueDefault; private static GUIStyle labelStyleValueChanged; private static GUIStyle textStyleValueDefault; private static GUIStyle textStyleValueChanged; private static GUIStyle toggleStyle; private static GUIStyle toggleStyleValueDefault; private static GUIStyle toggleStyleValueChanged; private static GUIStyle buttonStyle; private static GUIStyle buttonStyleValueDefault; private static GUIStyle buttonStyleValueChanged; private static GUIStyle comboBoxStyle; private static GUIStyle boxStyle; private static GUIStyle sliderStyle; private static GUIStyle thumbStyle; private static GUIStyle categoryHeaderStyle; private static GUIStyle pluginHeaderStyle; private static GUIStyle backgroundStyle; private static GUIStyle tooltipStyle; public static int fontSize = 14; public static void CreateStyles() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0071: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_0183: 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_01b2: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Expected O, but got Unknown //IL_0300: 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_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Expected O, but got Unknown //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Expected O, but got Unknown //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Expected O, but got Unknown //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Expected O, but got Unknown //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Expected O, but got Unknown //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Expected O, but got Unknown //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Expected O, but got Unknown //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Expected O, but got Unknown //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Expected O, but got Unknown ConfigurationManager._textSize.Value = Mathf.Clamp(ConfigurationManager._textSize.Value, 10, 30); if (fontSize != ConfigurationManager._textSize.Value) { fontSize = ConfigurationManager._textSize.Value; SettingFieldDrawer.ClearCache(); } windowStyle = new GUIStyle(GUI.skin.window); windowStyle.normal.textColor = ConfigurationManager._fontColor.Value; windowStyle.fontSize = fontSize; windowStyle.onNormal.textColor = ConfigurationManager._fontColor.Value; labelStyle = new GUIStyle(GUI.skin.label); labelStyle.normal.textColor = ConfigurationManager._fontColor.Value; labelStyle.fontSize = fontSize; labelStyleValueDefault = new GUIStyle(GUI.skin.label); labelStyleValueDefault.normal.textColor = ConfigurationManager._fontColorValueDefault.Value; labelStyleValueDefault.fontSize = fontSize; labelStyleValueChanged = new GUIStyle(GUI.skin.label); labelStyleValueChanged.normal.textColor = ConfigurationManager._fontColorValueChanged.Value; labelStyleValueChanged.fontSize = fontSize; textStyleValueDefault = new GUIStyle(GUI.skin.textArea); textStyleValueDefault.normal.textColor = ConfigurationManager._fontColorValueDefault.Value; textStyleValueDefault.fontSize = fontSize; textStyleValueChanged = new GUIStyle(GUI.skin.textArea); GUIStyle obj = textStyleValueChanged; obj.name += "changed"; textStyleValueChanged.normal.textColor = ConfigurationManager._fontColorValueChanged.Value; textStyleValueChanged.fontSize = fontSize; buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.normal.textColor = ConfigurationManager._fontColor.Value; buttonStyle.onNormal.textColor = ConfigurationManager._fontColor.Value; buttonStyle.fontSize = fontSize; buttonStyleValueDefault = new GUIStyle(GUI.skin.button); GUIStyle obj2 = buttonStyleValueDefault; obj2.name += "default"; buttonStyleValueDefault.normal.textColor = ConfigurationManager._fontColorValueDefault.Value; buttonStyleValueDefault.onNormal.textColor = ConfigurationManager._fontColorValueDefault.Value; buttonStyleValueDefault.fontSize = fontSize; buttonStyleValueChanged = new GUIStyle(GUI.skin.button); GUIStyle obj3 = buttonStyleValueChanged; obj3.name += "changed"; buttonStyleValueChanged.normal.textColor = ConfigurationManager._fontColorValueChanged.Value; buttonStyleValueChanged.onNormal.textColor = ConfigurationManager._fontColorValueChanged.Value; buttonStyleValueChanged.fontSize = fontSize; categoryHeaderStyle = new GUIStyle(labelStyle) { alignment = (TextAnchor)1, wordWrap = true, stretchWidth = true }; pluginHeaderStyle = new GUIStyle(categoryHeaderStyle); toggleStyle = new GUIStyle(GUI.skin.toggle); toggleStyle.normal.textColor = ConfigurationManager._fontColor.Value; toggleStyle.onNormal.textColor = ConfigurationManager._fontColor.Value; toggleStyle.fontSize = fontSize; toggleStyleValueDefault = new GUIStyle(toggleStyle); toggleStyleValueDefault.normal.textColor = ConfigurationManager._fontColorValueDefault.Value; toggleStyleValueDefault.onNormal.textColor = ConfigurationManager._fontColorValueDefault.Value; toggleStyleValueChanged = new GUIStyle(toggleStyle); GUIStyle obj4 = toggleStyleValueChanged; obj4.name += "changed"; toggleStyleValueChanged.normal.textColor = ConfigurationManager._fontColorValueChanged.Value; toggleStyleValueChanged.onNormal.textColor = ConfigurationManager._fontColorValueChanged.Value; boxStyle = new GUIStyle(GUI.skin.box); boxStyle.normal.textColor = ConfigurationManager._fontColor.Value; boxStyle.onNormal.textColor = ConfigurationManager._fontColor.Value; boxStyle.fontSize = fontSize; comboBoxStyle = new GUIStyle(GUI.skin.button); comboBoxStyle.normal = boxStyle.normal; comboBoxStyle.normal.textColor = ConfigurationManager._fontColorValueDefault.Value; comboBoxStyle.hover.background = comboBoxStyle.normal.background; comboBoxStyle.hover.textColor = ConfigurationManager._fontColorValueChanged.Value; comboBoxStyle.fontSize = fontSize; comboBoxStyle.border = boxStyle.border; comboBoxStyle.stretchHeight = true; comboBoxStyle.padding.top = 1; comboBoxStyle.padding.bottom = 1; comboBoxStyle.margin.top = 0; comboBoxStyle.margin.bottom = 0; backgroundStyle = new GUIStyle(GUI.skin.box); backgroundStyle.normal.textColor = ConfigurationManager._fontColor.Value; backgroundStyle.fontSize = fontSize; backgroundStyle.normal.background = ConfigurationManager.EntryBackground; tooltipStyle = new GUIStyle(GUI.skin.box); tooltipStyle.normal.textColor = ConfigurationManager._fontColor.Value; tooltipStyle.fontSize = fontSize; tooltipStyle.wordWrap = true; tooltipStyle.alignment = (TextAnchor)4; sliderStyle = new GUIStyle(GUI.skin.horizontalSlider); thumbStyle = new GUIStyle(GUI.skin.horizontalSliderThumb); } public static GUIStyle GetWindowStyle() { return windowStyle; } public static GUIStyle GetCategoryStyle() { return categoryHeaderStyle; } public static GUIStyle GetHeaderStyle() { return pluginHeaderStyle; } public static GUIStyle GetSliderStyle() { return sliderStyle; } public static GUIStyle GetThumbStyle() { return thumbStyle; } public static GUIStyle GetBoxStyle() { return boxStyle; } public static GUIStyle GetTooltipStyle() { return tooltipStyle; } public static GUIStyle GetBackgroundStyle() { return backgroundStyle; } public static GUIStyle GetComboBoxStyle() { return comboBoxStyle; } public static GUIStyle GetToggleStyle() { return toggleStyle; } public static GUIStyle GetToggleStyle(bool isDefaulValue = true) { return isDefaulValue ? toggleStyleValueDefault : toggleStyleValueChanged; } public static GUIStyle GetToggleStyle(SettingEntryBase setting) { return GetToggleStyle((bool)setting.Get() == (bool)setting.DefaultValue); } public static GUIStyle GetLabelStyle() { return labelStyle; } public static GUIStyle GetLabelStyle(bool isDefaulValue = true) { return isDefaulValue ? labelStyleValueDefault : labelStyleValueChanged; } public static GUIStyle GetLabelStyle(SettingEntryBase setting) { return GetLabelStyle(setting.Get().ToString() == setting.DefaultValue.ToString()); } public static GUIStyle GetButtonStyle() { return buttonStyle; } public static GUIStyle GetButtonStyle(bool isDefaulValue = true) { return isDefaulValue ? buttonStyleValueDefault : buttonStyleValueChanged; } public static GUIStyle GetButtonStyle(SettingEntryBase setting) { return GetButtonStyle(setting.Get().ToString() == setting.DefaultValue.ToString()); } public static GUIStyle GetTextStyle(bool isDefaulValue = true) { return isDefaulValue ? textStyleValueDefault : textStyleValueChanged; } public static GUIStyle GetTextStyle(SettingEntryBase setting) { return GetTextStyle(setting.Get().ToString() == setting.DefaultValue.ToString()); } public static GUIStyle GetTextStyle(float setting, float defaultValue) { return GetTextStyle(setting == defaultValue); } public static GUIStyle GetTextStyle(Color setting, Color defaultValue) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GetTextStyle(IsEqualColorConfig(setting, defaultValue)); } public static bool IsEqualColorConfig(Color setting, Color defaultValue) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ColorUtility.ToHtmlStringRGBA(setting) == ColorUtility.ToHtmlStringRGBA(defaultValue); } } [BepInPlugin("shudnal.ConfigurationManager", "Valheim Configuration Manager", "1.0.5")] [BepInIncompatibility("com.bepis.bepinex.configurationmanager")] public class ConfigurationManager : BaseUnityPlugin { public enum ReadOnlyStyle { Ignored, Colored, Disabled, Hidden } private sealed class PluginSettingsData { public sealed class PluginSettingsGroupData { public string Name; public List<SettingEntryBase> Settings; } public BepInPlugin Info; public List<PluginSettingsGroupData> Categories; private bool _collapsed; public bool Collapsed { get { return _collapsed; } set { _collapsed = value; Height = 0; } } public int Height { get; set; } } public enum PreventInput { Off, Player, All } [HarmonyPatch(typeof(PlayerController), "TakeInput")] [HarmonyPriority(0)] public static class PlayerController_TakeInput_PreventInput { public static void Postfix(ref bool __result) { if (PreventPlayerInput()) { __result = __result && !instance.DisplayingWindow; } } } [HarmonyPatch(typeof(TextInput), "IsVisible")] [HarmonyPriority(0)] public static class TextInput_IsVisible_PreventInput { public static void Postfix(ref bool __result) { if (PreventPlayerInput()) { __result = __result || instance.DisplayingWindow; } } } [HarmonyPatch] public static class ZInput_PreventAllInput { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(ZInput), "AcceptInputFromSource", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetKey", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetKeyDown", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetKeyNew", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetMouseButton", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetMouseButtonDown", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetMouseButtonUp", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetMouseButtonNew", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetButton", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetButtonDown", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetButtonUp", (Type[])null, (Type[])null); } [HarmonyPriority(800)] private static bool Prefix(ref bool __result) { return !PreventAllInput() || !instance.DisplayingWindow || (__result = false); } } [HarmonyPatch] public static class ZInput_Float_PreventMouseInput { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(ZInput), "GetAxis", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(ZInput), "GetMouseScrollWheel", (Type[])null, (Type[])null); } [HarmonyPriority(0)] private static void Postfix(ref float __result) { if (PreventPlayerInput() && instance.DisplayingWindow) { __result = 0f; } } } [HarmonyPatch(typeof(ZInput), "GetMouseDelta")] public static class ZInput_GetMouseDelta_PreventMouseInput { [HarmonyPriority(0)] public static void Postfix(ref Vector2 __result) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (PreventPlayerInput() && instance.DisplayingWindow) { __result = Vector2.zero; } } } public const string pluginID = "shudnal.ConfigurationManager"; public const string pluginName = "Valheim Configuration Manager"; public const string pluginVersion = "1.0.5"; internal static ConfigurationManager instance; private static SettingFieldDrawer _fieldDrawer; private const int WindowId = -68; private const string SearchBoxName = "searchBox"; private bool _focusSearchBox; private string _searchString = string.Empty; public bool OverrideHotkey; private bool _displayingWindow; private bool _obsoleteCursor; private string _modsWithoutSettings; private List<SettingEntryBase> _allSettings; private List<PluginSettingsData> _filteredSetings = new List<PluginSettingsData>(); internal Rect currentWindowRect; private Vector2 _settingWindowScrollPos; private bool _showDebug; private PropertyInfo _curLockState; private PropertyInfo _curVisible; private int _previousCursorLockState; private bool _previousCursorVisible; public static ConfigEntry<bool> _showAdvanced; public static ConfigEntry<bool> _showKeybinds; public static ConfigEntry<bool> _showSettings; public static ConfigEntry<bool> _loggingEnabled; public static ConfigEntry<ReadOnlyStyle> _readOnlyStyle; public static ConfigEntry<KeyboardShortcut> _keybind; public static ConfigEntry<bool> _hideSingleSection; public static ConfigEntry<bool> _pluginConfigCollapsedDefault; public static ConfigEntry<Vector2> _windowPosition; public static ConfigEntry<Vector2> _windowSize; public static ConfigEntry<int> _textSize; public static ConfigEntry<bool> _orderPluginByGuid; public static ConfigEntry<string> _windowTitle; public static ConfigEntry<string> _normalText; public static ConfigEntry<string> _shortcutsText; public static ConfigEntry<string> _advancedText; public static ConfigEntry<string> _closeText; public static ConfigEntry<string> _searchText; public static ConfigEntry<string> _reloadText; public static ConfigEntry<string> _resetText; public static ConfigEntry<string> _resetSettingText; public static ConfigEntry<string> _expandText; public static ConfigEntry<string> _collapseText; public static ConfigEntry<string> _clearText; public static ConfigEntry<string> _cancelText; public static ConfigEntry<string> _enabledText; public static ConfigEntry<string> _disabledText; public static ConfigEntry<string> _shortcutKeyText; public static ConfigEntry<string> _shortcutKeysText; public static ConfigEntry<string> _noOptionsPluginsText; public static ConfigEntry<Color> _windowBackgroundColor; public static ConfigEntry<Color> _entryBackgroundColor; public static ConfigEntry<Color> _fontColor; public static ConfigEntry<Color> _fontColorValueChanged; public static ConfigEntry<Color> _fontColorValueDefault; public static ConfigEntry<Color> _widgetBackgroundColor; public static ConfigEntry<Color> _enabledBackgroundColor; public static ConfigEntry<Color> _readOnlyColor; internal static string hiddenSettingsFileName = "shudnal.ConfigurationManager.hiddensettings.json"; public static ConfigEntry<bool> _pauseGame; public static ConfigEntry<PreventInput> _preventInput; private static readonly Harmony harmony = new Harmony("shudnal.ConfigurationManager"); internal static readonly ConfigSync configSync = new ConfigSync("shudnal.ConfigurationManager") { DisplayName = "Valheim Configuration Manager", CurrentVersion = "1.0.5", MinimumRequiredVersion = "1.0.5" }; internal static readonly CustomSyncedValue<List<string>> hiddenSettings = new CustomSyncedValue<List<string>>(configSync, "Hidden settings", new List<string>()); private static DirectoryInfo pluginDirectory; private static DirectoryInfo configDirectory; internal Rect DefaultWindowRect { get; private set; } internal static Texture2D WindowBackground { get; private set; } internal static Texture2D EntryBackground { get; private set; } internal int LeftColumnWidth { get; private set; } internal int RightColumnWidth { get; private set; } public bool DisplayingWindow { get { return _displayingWindow; } set { if (_displayingWindow == value) { return; } _displayingWindow = value; SettingFieldDrawer.ClearCache(); if (_displayingWindow) { BuildSettingList(); _focusSearchBox = false; if (_curLockState != null) { _previousCursorLockState = (_obsoleteCursor ? Convert.ToInt32((bool)_curLockState.GetValue(null, null)) : ((int)_curLockState.GetValue(null, null))); _previousCursorVisible = (bool)_curVisible.GetValue(null, null); } } else if (!_previousCursorVisible || _previousCursorLockState != 0) { SetUnlockCursor(_previousCursorLockState, _previousCursorVisible); } this.DisplayingWindowChanged?.Invoke(this, new ValueChangedEventArgs<bool>(value)); } } public string SearchString { get { return _searchString; } private set { if (value == null) { value = string.Empty; } if (!(_searchString == value)) { _searchString = value; BuildFilteredSettingList(); } } } public event EventHandler<ValueChangedEventArgs<bool>> DisplayingWindowChanged; private void OnGUI() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0040: 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) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_0168: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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) if (DisplayingWindow) { CreateBackgrounds(); ConfigurationManagerStyles.CreateStyles(); SetUnlockCursor(0, cursorVisible: true); GUI.Box(currentWindowRect, GUIContent.none, new GUIStyle()); GUI.backgroundColor = _windowBackgroundColor.Value; ((Rect)(ref currentWindowRect)).size = new Vector2(Math.Clamp(_windowSize.Value.x, 400f, Screen.width), Math.Clamp(_windowSize.Value.y, 400f, Screen.height)); RightColumnWidth = Mathf.RoundToInt(Mathf.Clamp(((Rect)(ref currentWindowRect)).width / 2.5f * (float)ConfigurationManagerStyles.fontSize / 12f, ((Rect)(ref currentWindowRect)).width * 0.5f, ((Rect)(ref currentWindowRect)).width * 0.8f)); LeftColumnWidth = Mathf.RoundToInt(Mathf.Clamp(((Rect)(ref currentWindowRect)).width - (float)RightColumnWidth - 100f, ((Rect)(ref currentWindowRect)).width * 0.2f, ((Rect)(ref currentWindowRect)).width * 0.5f)) - 15; currentWindowRect = GUILayout.Window(-68, currentWindowRect, new WindowFunction(SettingsWindow), _windowTitle.Value, ConfigurationManagerStyles.GetWindowStyle(), Array.Empty<GUILayoutOption>()); if (!UnityInput.Current.GetKey((KeyCode)323) && (((Rect)(ref currentWindowRect)).x != _windowPosition.Value.x || ((Rect)(ref currentWindowRect)).y != _windowPosition.Value.y)) { SaveCurrentSizeAndPosition(); } } } internal void SaveCurrentSizeAndPosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) _windowPosition.Value = ((Rect)(ref currentWindowRect)).position; _windowSize.Value = ((Rect)(ref currentWindowRect)).size; ((BaseUnityPlugin)this).Config.Save(); SettingFieldDrawer.ClearComboboxCache(); } private void SettingsWindow(int id) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Invalid comparison between Unknown and I4 //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref currentWindowRect)).width, 20f)); DrawWindowHeader(); _settingWindowScrollPos = GUILayout.BeginScrollView(_settingWindowScrollPos, false, true, Array.Empty<GUILayoutOption>()); float y = _settingWindowScrollPos.y; float height = ((Rect)(ref currentWindowRect)).height; GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); int num = 0; foreach (PluginSettingsData filteredSeting in _filteredSetings) { if (filteredSeting.Height == 0 || ((float)(num + filteredSeting.Height) >= y && (float)num <= y + height)) { try { DrawSinglePlugin(filteredSeting); } catch (ArgumentException) { } if (filteredSeting.Height == 0 && (int)Event.current.type == 7) { Rect lastRect = GUILayoutUtility.GetLastRect(); filteredSeting.Height = (int)((Rect)(ref lastRect)).height; } } else { try { if (filteredSeting.Height > 0) { GUILayout.Space((float)filteredSeting.Height); } } catch (ArgumentException) { } } num += filteredSeting.Height; } GUILayout.Space(20f); GUILayout.Label(_noOptionsPluginsText.Value + ": " + _modsWithoutSettings, ConfigurationManagerStyles.GetLabelStyle(), Array.Empty<GUILayoutOption>()); GUILayout.Space(10f); GUILayout.EndVertical(); GUILayout.EndScrollView(); if (!SettingFieldDrawer.DrawCurrentDropdown()) { DrawTooltip(currentWindowRect); } currentWindowRect = Utils.ResizeWindow(id, currentWindowRect, out var sizeChanged); if (sizeChanged) { SaveCurrentSizeAndPosition(); } } private void DrawWindowHeader() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) GUI.backgroundColor = _entryBackgroundColor.Value; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUI.enabled = SearchString == string.Empty; bool flag = GUILayout.Toggle(_showSettings.Value, _normalText.Value, ConfigurationManagerStyles.GetToggleStyle(), Array.Empty<GUILayoutOption>()); if (_showSettings.Value != flag) { _showSettings.Value = flag; BuildFilteredSettingList(); } flag = GUILayout.Toggle(_showKeybinds.Value, _shortcutsText.Value, ConfigurationManagerStyles.GetToggleStyle(), Array.Empty<GUILayoutOption>()); if (_showKeybinds.Value != flag) { _showKeybinds.Value = flag; BuildFilteredSettingList(); } flag = GUILayout.Toggle(_showAdvanced.Value, _advancedText.Value, ConfigurationManagerStyles.GetToggleStyle(), Array.Empty<GUILayoutOption>()); if (_showAdvanced.Value != flag) { _showAdvanced.Value = flag; BuildFilteredSettingList(); } GUI.enabled = true; flag = GUILayout.Toggle(_showDebug, "Debug mode", ConfigurationManagerStyles.GetToggleStyle(), Array.Empty<GUILayoutOption>()); if (_showDebug != flag) { _showDebug = flag; BuildSettingList(); } if (GUILayout.Button(_closeText.Value, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { DisplayingWindow = false; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(_searchText.Value, ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); GUI.SetNextControlName("searchBox"); SearchString = GUILayout.TextField(SearchString, ConfigurationManagerStyles.GetTextStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (_focusSearchBox) { GUI.FocusWindow(-68); GUI.FocusControl("searchBox"); _focusSearchBox = false; } Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = _widgetBackgroundColor.Value; if (GUILayout.Button(_clearText.Value, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { SearchString = string.Empty; } GUI.backgroundColor = backgroundColor; GUILayout.Space(8f); if (GUILayout.Button(_pluginConfigCollapsedDefault.Value ? _expandText.Value : _collapseText.Value, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { bool flag2 = !_pluginConfigCollapsedDefault.Value; _pluginConfigCollapsedDefault.Value = flag2; foreach (PluginSettingsData filteredSeting in _filteredSetings) { filteredSeting.Collapsed = flag2; } } GUILayout.EndHorizontal(); } private void DrawSinglePlugin(PluginSettingsData plugin) { //IL_0006: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_01d2: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) GUI.backgroundColor = _entryBackgroundColor.Value; GUILayout.BeginVertical(ConfigurationManagerStyles.GetBackgroundStyle(), Array.Empty<GUILayoutOption>()); GUIContent content = (_showDebug ? new GUIContent(plugin.Info.Name.TrimStart('!') + " " + plugin.Info.Version, "GUID: " + plugin.Info.GUID) : new GUIContent(plugin.Info.Name.TrimStart('!') + " " + plugin.Info.Version)); bool flag = !string.IsNullOrEmpty(SearchString); if (SettingFieldDrawer.DrawPluginHeader(content) && !flag) { plugin.Collapsed = !plugin.Collapsed; } if (flag || !plugin.Collapsed) { foreach (PluginSettingsData.PluginSettingsGroupData category in plugin.Categories) { if (!string.IsNullOrEmpty(category.Name) && (plugin.Categories.Count > 1 || !_hideSingleSection.Value)) { SettingFieldDrawer.DrawCategoryHeader(category.Name); } foreach (SettingEntryBase setting in category.Settings) { DrawSingleSetting(setting); GUILayout.Space(2f); } } GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = _widgetBackgroundColor.Value; if (GUILayout.Button(_reloadText.Value, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { using (List<PluginSettingsData.PluginSettingsGroupData>.Enumerator enumerator3 = plugin.Categories.GetEnumerator()) { if (enumerator3.MoveNext()) { PluginSettingsData.PluginSettingsGroupData current3 = enumerator3.Current; using List<SettingEntryBase>.Enumerator enumerator4 = current3.Settings.GetEnumerator(); if (enumerator4.MoveNext()) { SettingEntryBase current4 = enumerator4.Current; current4.PluginInstance.Config.Reload(); } } } BuildFilteredSettingList(); } if (GUILayout.Button(_resetText.Value, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { foreach (PluginSettingsData.PluginSettingsGroupData category2 in plugin.Categories) { foreach (SettingEntryBase setting2 in category2.Settings) { setting2.Set(setting2.DefaultValue); } } BuildFilteredSettingList(); } GUI.backgroundColor = backgroundColor; GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } private void DrawSingleSetting(SettingEntryBase setting) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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) Color contentColor = GUI.contentColor; bool enabled = GUI.enabled; if (setting.ReadOnly == true && _readOnlyStyle.Value != 0) { if (enabled) { GUI.enabled = _readOnlyStyle.Value != ReadOnlyStyle.Disabled; } if (_readOnlyStyle.Value == ReadOnlyStyle.Colored) { GUI.contentColor = _readOnlyColor.Value; } } GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); try { DrawSettingName(setting); _fieldDrawer.DrawSettingValue(setting); DrawDefaultButton(setting); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.Log((LogLevel)2, (object)$"Failed to draw setting {setting.DispName} - {arg}"); GUILayout.Label("Failed to draw this field, check log for details.", ConfigurationManagerStyles.GetLabelStyle(), Array.Empty<GUILayoutOption>()); } GUILayout.EndHorizontal(); if (enabled && !ComboBox.IsShown()) { GUI.enabled = enabled; } GUI.contentColor = contentColor; } private void DrawSettingName(SettingEntryBase setting) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown if (!setting.HideSettingName) { GUILayout.Label(new GUIContent(setting.DispName.TrimStart('!'), setting.Description), ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width((float)LeftColumnWidth), GUILayout.MaxWidth((float)LeftColumnWidth) }); } } private static void DrawDefaultButton(SettingEntryBase setting) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (setting.HideDefaultButton) { return; } GUI.backgroundColor = _widgetBackgroundColor.Value; if (setting.DefaultValue != null) { if (DrawDefaultButton()) { setting.Set(setting.DefaultValue); } } else if (setting.SettingType.IsClass && DrawDefaultButton()) { setting.Set(null); } static bool DrawDefaultButton() { GUILayout.Space(5f); return GUILayout.Button(_resetSettingText.Value, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); } } private void BuildSettingList() { SettingSearcher.CollectSettings(out var results, out var modsWithoutSettings, _showDebug); _modsWithoutSettings = string.Join(", ", (from x in modsWithoutSettings select x.TrimStart('!') into x orderby x select x).ToArray()); _allSettings = results.ToList(); BuildFilteredSettingList(); } private void BuildFilteredSettingList() { IEnumerable<SettingEntryBase> source = _allSettings; string[] searchStrings = SearchString.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (searchStrings.Length != 0) { source = source.Where((SettingEntryBase x) => ContainsSearchString(x, searchStrings)); } else { if (!_showAdvanced.Value) { source = source.Where((SettingEntryBase x) => x.IsAdvanced != true); } if (!_showKeybinds.Value) { source = source.Where((SettingEntryBase x) => !IsKeyboardShortcut(x)); } if (!_showSettings.Value) { source = source.Where((SettingEntryBase x) => x.IsAdvanced == true || IsKeyboardShortcut(x)); } if (_readOnlyStyle.Value == ReadOnlyStyle.Hidden) { source = source.Where((SettingEntryBase x) => x.ReadOnly != true); } if (HideSettings()) { source = source.Where((SettingEntryBase x) => !(x as ConfigSettingEntry).ShouldBeHidden()); } } bool settingsAreCollapsed = _pluginConfigCollapsedDefault.Value; HashSet<string> nonDefaultCollpasingStateByPluginName = new HashSet<string>(); foreach (PluginSettingsData filteredSeting in _filteredSetings) { if (filteredSeting.Collapsed != settingsAreCollapsed) { nonDefaultCollpasingStateByPluginName.Add(filteredSeting.Info.Name); } } _filteredSetings = (from x in (from x in source group x by x.PluginInfo).Select(delegate(IGrouping<BepInPlugin, SettingEntryBase> pluginSettings) { IEnumerable<PluginSettingsData.PluginSettingsGroupData> source2 = from eb in pluginSettings group eb by eb.Category into x orderby string.Equals(x.Key, "Keyboard shortcuts", StringComparison.Ordinal), x.Key select new PluginSettingsData.PluginSettingsGroupData { Name = x.Key, Settings = (from set in x orderby set.Order descending, set.DispName select set).ToList() }; return new PluginSettingsData { Info = pluginSettings.Key, Categories = source2.ToList(), Collapsed = (nonDefaultCollpasingStateByPluginName.Contains(pluginSettings.Key.Name) ? (!settingsAreCollapsed) : settingsAreCollapsed) }; }) orderby _orderPluginByGuid.Value ? x.Info.GUID : x.Info.Name select x).ToList(); } private static bool IsKeyboardShortcut(SettingEntryBase x) { return x.SettingType == typeof(KeyboardShortcut); } private static bool ContainsSearchString(SettingEntryBase setting, string[] searchStrings) { string combinedSearchTarget = setting.PluginInfo.Name + "\n" + setting.PluginInfo.GUID + "\n" + setting.DispName + "\n" + setting.Category + "\n" + setting.Description + "\n" + setting.DefaultValue?.ToString() + "\n" + setting.Get(); return searchStrings.All((string s) => combinedSearchTarget.IndexOf(s, StringComparison.InvariantCultureIgnoreCase) >= 0); } private void CalculateDefaultWindowRect() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Min(Screen.width, 650); int num2 = Mathf.Min(Screen.height, 800); int num3 = Mathf.RoundToInt((float)(Screen.width - num) / 2f); int num4 = Mathf.RoundToInt((float)(Screen.height - num2) / 2f); DefaultWindowRect = new Rect((float)num3, (float)num4, (float)num, (float)num2); Rect defaultWindowRect = DefaultWindowRect; LeftColumnWidth = Mathf.RoundToInt(((Rect)(ref defaultWindowRect)).width / 2.5f); defaultWindowRect = DefaultWindowRect; RightColumnWidth = (int)((Rect)(ref defaultWindowRect)).width - LeftColumnWidth - 115; } private static void DrawTooltip(Rect area) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_004b: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(GUI.tooltip)) { Event current = Event.current; Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = _entryBackgroundColor.Value; float num = ConfigurationManagerStyles.GetTooltipStyle().CalcHeight(new GUIContent(GUI.tooltip), 400f) + 10f; float num2 = ((current.mousePosition.x + 400f > ((Rect)(ref area)).width) ? (((Rect)(ref area)).width - 400f) : current.mousePosition.x); float num3 = ((current.mousePosition.y + 25f + num > ((Rect)(ref area)).height) ? (current.mousePosition.y - num) : (current.mousePosition.y + 25f)); GUI.Box(new Rect(num2, num3, 400f, num), GUI.tooltip, ConfigurationManagerStyles.GetTooltipStyle()); GUI.backgroundColor = backgroundColor; } } private void CreateBackgrounds() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1, (TextureFormat)5, false); val.SetPixel(0, 0, _windowBackgroundColor.Value); val.Apply(); WindowBackground = val; Texture2D val2 = new Texture2D(1, 1, (TextureFormat)5, false); val2.SetPixel(0, 0, _entryBackgroundColor.Value); val2.Apply(); EntryBackground = val2; } private void SetUnlockCursor(int lockState, bool cursorVisible) { if (_curLockState != null) { if (_obsoleteCursor) { _curLockState.SetValue(null, Convert.ToBoolean(lockState), null); } else { _curLockState.SetValue(null, lockState, null); } _curVisible.SetValue(null, cursorVisible, null); } } internal static void LogInfo(object data) { if (_loggingEnabled.Value) { ((BaseUnityPlugin)instance).Logger.LogInfo(data); } } private void Awake() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0183: 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_01ad: 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) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Expected O, but got Unknown //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Expected O, but got Unknown //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Expected O, but got Unknown //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Expected O, but got Unknown //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Expected O, but got Unknown //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Expected O, but got Unknown //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Expected O, but got Unknown //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Expected O, but got Unknown //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Expected O, but got Unknown //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Expected O, but got Unknown //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Expected O, but got Unknown //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Expected O, but got Unknown //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Expected O, but got Unknown //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Expected O, but got Unknown //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_071c: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) instance = this; CalculateDefaultWindowRect(); _fieldDrawer = new SettingFieldDrawer(this); _keybind = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Show config manager", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), new ConfigDescription("The shortcut used to toggle the config manager window on and off.\nThe key can be overridden by a game-specific plugin if necessary, in that case this setting is ignored.", (AcceptableValueBase)null, Array.Empty<object>())); _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); _readOnlyStyle = ((BaseUnityPlugin)this).Config.Bind<ReadOnlyStyle>("Filtering", "Style readonly entries", ReadOnlyStyle.Colored, new ConfigDescription("Entries marked as readonly are not available for change.", (AcceptableValueBase)null, Array.Empty<object>())); _readOnlyStyle.SettingChanged += delegate { BuildSettingList(); }; _hideSingleSection = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Hide single sections", false, new ConfigDescription("Show section title for plugins with only one section", (AcceptableValueBase)null, Array.Empty<object>())); _loggingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Logging enabled", false, new ConfigDescription("Enable logging", (AcceptableValueBase)null, Array.Empty<object>())); _pluginConfigCollapsedDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Plugin collapsed default", true, new ConfigDescription("If set to true plugins will be collapsed when opening the configuration manager window", (AcceptableValueBase)null, Array.Empty<object>())); _windowPosition = ((BaseUnityPlugin)this).Config.Bind<Vector2>("General", "Window position", new Vector2(55f, 35f), "Window position"); ConfigFile config = ((BaseUnityPlugin)this).Config; Rect defaultWindowRect = DefaultWindowRect; _windowSize = config.Bind<Vector2>("General", "Window size", ((Rect)(ref defaultWindowRect)).size, "Window size"); _textSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Font size", 14, "Font size"); _orderPluginByGuid = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Order plugins by GUID", false, "Default order is by plugin name"); _orderPluginByGuid.SettingChanged += delegate { BuildSettingList(); }; _windowTitle = ((BaseUnityPlugin)this).Config.Bind<string>("Text - Menu", "Window Title", "Configuration Manager", new ConfigDescription("Window title text", (AcceptableValueBase)null, Array.Empty<object>())); _normalText = ((BaseUnityPlugin)this).Config.Bind<string>("Text - Menu", "Normal", "Normal", new ConfigDescription("Normal settings toggle text", (AcceptableValueBase)null, Array.Empty<object>())); _shortcutsText = ((BaseUnityPlugin)this).Config.Bind<string>("Text - Menu", "Shortcuts", "Keybinds", new ConfigDescription("Shortcut key settings toggle text", (AcceptableValueBase)null, Array.Empty<object>())); _advancedText = ((BaseUnityPlugin)this).Config.Bind<string>("Text - Menu", "Advanced", "Advanced", new ConfigDescription("Advanced settings toggle text", (AcceptableValueBase)null, Array.Empty<object>())); _closeText = ((BaseUnityPlugin)this).Config.Bind<string>("Text - Menu", "Close", "Close", new ConfigDescription("Advanced settings toggle text", (AcceptableValueBase)null, Array.Empty<object>())); _searchText = ((BaseUnityPlugin)this).Config.Bind<string>("Text - Menu", "Search", "Search Settings:", new ConfigDescription("Search label text", (AcceptableValueBase)null, Array.Empty<object>())); _expandText = ((BaseUnityPlugin)this).Config.Bind<string>("Text - Menu", "List Expand", "Expand", new ConfigDescription("Expand button text", (AcceptableValueBase)null, Array.Empty<object>())); _collapseText = ((BaseUnityPlugin)this).Config.Bind<string>("Text - Menu", "List Collapse", "Collapse", new ConfigDescription("Collapse button text", (AcceptableValueBase)null, Array.Empty<object>())); _noOptionsPlugins