Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ConfigManager v1.0.0
ConfigManager.dll
Decompiled 21 hours 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.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ConfigurationManager.Utilities; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ConfigManager")] [assembly: AssemblyDescription("Standalone Valheim configuration manager")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("sighsorry")] [assembly: AssemblyMetadata("Author", "sighsorry")] [assembly: AssemblyProduct("ConfigManager")] [assembly: AssemblyCopyright("Copyright © 2018-2026 ConfigManager contributors; modifications © 2026 sighsorry")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("0bac4d10-1d45-4b13-861c-48bae48536e9")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] public struct HSLColor { public float h; public float s; public float l; public float a; public HSLColor(float h, float s, float l, float a) { this.h = h; this.s = s; this.l = l; this.a = a; } public HSLColor(float h, float s, float l) { this.h = h; this.s = s; this.l = l; a = 1f; } public HSLColor(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) HSLColor hSLColor = FromRGBA(c); h = hSLColor.h; s = hSLColor.s; l = hSLColor.l; a = hSLColor.a; } public static HSLColor FromRGBA(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) float num = c.a; float num2 = Mathf.Min(Mathf.Min(c.r, c.g), c.b); float num3 = Mathf.Max(Mathf.Max(c.r, c.g), c.b); float num4 = (num2 + num3) / 2f; float num5; float num6; if (num2 == num3) { num5 = 0f; num6 = 0f; } else { float num7 = num3 - num2; num5 = ((num4 <= 0.5f) ? (num7 / (num3 + num2)) : (num7 / (2f - (num3 + num2)))); num6 = 0f; if (c.r == num3) { num6 = (c.g - c.b) / num7; } else if (c.g == num3) { num6 = 2f + (c.b - c.r) / num7; } else if (c.b == num3) { num6 = 4f + (c.r - c.g) / num7; } num6 = Mathf.Repeat(num6 * 60f, 360f); } return new HSLColor(num6, num5, num4, num); } public Color ToRGBA() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) float num = a; float num2 = ((l <= 0.5f) ? (l * (1f + s)) : (l + s - l * s)); float n = 2f * l - num2; float num3; float num4; float num5; if (s == 0f) { num3 = (num4 = (num5 = l)); } else { num3 = Value(n, num2, h + 120f); num4 = Value(n, num2, h); num5 = Value(n, num2, h - 120f); } return new Color(num3, num4, num5, num); } private static float Value(float n1, float n2, float hue) { hue = Mathf.Repeat(hue, 360f); if (hue < 60f) { return n1 + (n2 - n1) * hue / 60f; } if (hue < 180f) { return n2; } if (hue < 240f) { return n1 + (n2 - n1) * (240f - hue) / 60f; } return n1; } public static implicit operator HSLColor(Color src) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return FromRGBA(src); } public static implicit operator Color(HSLColor src) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return src.ToRGBA(); } } namespace ConfigurationManager { internal sealed class ConfigurationManagerAttributes { public string Category { get; set; } public string DispName { get; set; } public int? CategoryOrder { get; set; } public int? Order { get; set; } public bool? Browsable { get; set; } public bool? IsAdvanced { get; set; } public bool? ReadOnly { get; set; } public bool? HideDefaultButton { get; set; } } internal readonly struct ThemePalette { public Color WindowBackground { get; } public Color EntryBackground { get; } public Color TooltipBackground { get; } public Color HeaderBackground { get; } public Color HeaderHoverBackground { get; } public Color SettingWindowBackground { get; } public Color Widget { get; } public Color Enabled { get; } public Color MainText { get; } public Color DefaultValueText { get; } public Color ChangedValueText { get; } public Color ReadOnlyText { get; } public Color FileEditorText { get; } private ThemePalette(Color windowBackground, Color entryBackground, Color tooltipBackground, Color headerBackground, Color headerHoverBackground, Color settingWindowBackground, Color widget, Color enabled, Color mainText, Color defaultValueText, Color changedValueText, Color readOnlyText, Color fileEditorText) { //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) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) WindowBackground = windowBackground; EntryBackground = entryBackground; TooltipBackground = tooltipBackground; HeaderBackground = headerBackground; HeaderHoverBackground = headerHoverBackground; SettingWindowBackground = settingWindowBackground; Widget = widget; Enabled = enabled; MainText = mainText; DefaultValueText = defaultValueText; ChangedValueText = changedValueText; ReadOnlyText = readOnlyText; FileEditorText = fileEditorText; } public static ThemePalette CreateValheim() { //IL_0014: 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_0046: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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) return new ThemePalette(new Color(0f, 0f, 0f, 1f), new Color(0.55f, 0.5f, 0.5f, 0.94f), new Color(0.55f, 0.5f, 0.45f, 0.95f), new Color(0.74f, 0.54f, 0.37f, 0.8f), new Color(0.88f, 0.46f, 0f, 0.8f), new Color(0.55f, 0.5f, 0.5f, 0.65f), new Color(0.88f, 0.46f, 0f, 0.8f), new Color(0.88f, 0.46f, 0f, 1f), new Color(1f, 0.827f, 0.463f, 1f), new Color(1f, 0.827f, 0.463f, 1f), new Color(0.9f, 0.9f, 0.9f, 1f), Color.gray, new Color(0.9f, 0.9f, 0.9f, 1f)); } } public class ConfigFilesEditor : IDisposable { private enum FileEditState { None, CreatingFolder, CreatingFile, RenamingFile } private static readonly string _trashBinDirectory = Path.Combine(Paths.CachePath, "ConfigManagerTrashBin"); private static readonly string[] _directories = new string[3] { Paths.ConfigPath, Paths.PluginPath, _trashBinDirectory }; private static readonly HashSet<string> _editableExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".json", ".yaml", ".yml", ".cfg" }; private readonly Dictionary<string, bool> _folderStates = new Dictionary<string, bool>(); private Vector2 _scrollPosition; private string _fileContent; private string _originalFileContent; private Vector2 _textScrollPosition; private Rect _windowRect = new Rect(ConfigurationManager._windowPositionTextEditor.Value, ConfigurationManager._windowSizeTextEditor.Value); private const int WindowId = -680; private const string SearchBoxName = "searchBoxEditor"; private const int DirectoryOffset = 20; private const string TextEditorControlName = "textEditorTextField"; private bool _focusSearchBox; private bool _focusTextArea; private string _searchString; private string _errorText; private string _activeFile; private string _activeDirectory; private string _newItemName; private string _newItemErrorText; private FileEditState _fileNameState; private bool _isOpen; private bool _clearCache; private int _directoryDepth; private readonly Dictionary<string, string[]> _cachedFileTree = new Dictionary<string, string[]>(); private readonly Dictionary<string, string[]> _cachedDirectories = new Dictionary<string, string[]>(); private FileSystemWatcher[] _watchers = Array.Empty<FileSystemWatcher>(); private string SearchString { get { return _searchString; } set { if (value == null) { value = string.Empty; } _searchString = value; } } public bool IsOpen { get { return _isOpen; } set { if (_isOpen != (_isOpen = value)) { ClearCache(); } } } private void SetFileEditState(FileEditState newState) { _fileNameState = newState; _newItemErrorText = string.Empty; _newItemName = string.Empty; } public void OnGUI() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0051: 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_00ad: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00d3: Unknown result type (might be due to invalid IL or missing references) if (IsOpen) { ((Rect)(ref _windowRect)).size = ConfigurationManager._windowSizeTextEditor.Value; ((Rect)(ref _windowRect)).position = ConfigurationManager._windowPositionTextEditor.Value; Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = ConfigurationManager.Palette.WindowBackground; _windowRect = GUI.Window(-680, _windowRect, new WindowFunction(DrawWindow), Utility.IsNullOrWhiteSpace(_activeFile) ? "Configuration Files Editor" : ("..." + _activeFile.Replace(Path.GetDirectoryName(Paths.BepInExRootPath) ?? string.Empty, "")), ConfigurationManagerStyles.GetWindowStyle()); if (!UnityInput.Current.GetKeyDown((KeyCode)323) && ((Rect)(ref _windowRect)).position != ConfigurationManager._windowPositionTextEditor.Value) { SaveCurrentSizeAndPosition(); } GUI.backgroundColor = backgroundColor; } } internal void SaveCurrentSizeAndPosition() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) ConfigurationManager._windowSizeTextEditor.Value = new Vector2(Mathf.Clamp(((Rect)(ref _windowRect)).size.x, 1000f / ConfigurationManager.instance.ScaleFactor, ConfigurationManager.instance.ScreenWidth), Mathf.Clamp(((Rect)(ref _windowRect)).size.y, 600f / ConfigurationManager.instance.ScaleFactor, ConfigurationManager.instance.ScreenHeight)); ConfigurationManager._windowPositionTextEditor.Value = new Vector2(Mathf.Clamp(((Rect)(ref _windowRect)).position.x, 0f, ConfigurationManager.instance.ScreenWidth - ConfigurationManager._windowSize.Value.x / 4f), Mathf.Clamp(((Rect)(ref _windowRect)).position.y, 0f, ConfigurationManager.instance.ScreenHeight - 40f)); ((BaseUnityPlugin)ConfigurationManager.instance).Config.Save(); } private void DrawSearchBox() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Search:", ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(ConfigurationManagerStyles.GetLabelStyle().CalcSize(new GUIContent("Search:")).x + 4f) }); GUI.SetNextControlName("searchBoxEditor"); SearchString = GUILayout.TextField(SearchString, ConfigurationManagerStyles.GetTextStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (_focusSearchBox) { GUI.FocusWindow(-680); GUI.FocusControl("searchBoxEditor"); _focusSearchBox = false; } Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = ConfigurationManager.Palette.Widget; if (GUILayout.Button("Clear", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { SearchString = string.Empty; } GUI.backgroundColor = backgroundColor; GUILayout.EndHorizontal(); } private void DrawContentButtons() { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUI.enabled = !Utility.IsNullOrWhiteSpace(_activeFile) && _fileContent != _originalFileContent; if (GUILayout.Button("Save", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { SaveActiveFile(); } GUI.enabled = true; GUILayout.Label(_errorText, ConfigurationManagerStyles.GetLabelStyle(isDefaultValue: false), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUILayout.Label("Font size: ", ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); if (int.TryParse(GUILayout.TextField(StringExtensionMethods.ToFastString(ConfigurationManager._textEditorFontSize.Value), ConfigurationManagerStyles.GetTextStyle((float)ConfigurationManager._textEditorFontSize.Value, (float)(int)((ConfigEntryBase)ConfigurationManager._textEditorFontSize).DefaultValue), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }), out var result)) { ConfigurationManager._textEditorFontSize.Value = Mathf.Clamp(result, 8, 36); } ConfigurationManager._textEditorWordWrap.Value = GUILayout.Toggle(ConfigurationManager._textEditorWordWrap.Value, "Word wrap", ConfigurationManagerStyles.GetToggleStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); if (GUILayout.Button("Close", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { IsOpen = false; } GUILayout.EndHorizontal(); } private void DrawWindow(int windowID) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = ConfigurationManager.Palette.EntryBackground; GUILayout.BeginVertical(ConfigurationManagerStyles.GetBackgroundStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MaxWidth(GetFileListWidth()) }); DrawSearchBox(); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(((Rect)(ref _windowRect)).width * 0.3f) }); _directoryDepth = 0; DrawDirectories(_directories); GUILayout.EndScrollView(); DrawDirectoriesMenu(); GUILayout.EndVertical(); GUILayout.BeginVertical(ConfigurationManagerStyles.GetBackgroundStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MaxWidth(((Rect)(ref _windowRect)).width * 0.7f) }); DrawContentButtons(); _textScrollPosition = GUILayout.BeginScrollView(_textScrollPosition, Array.Empty<GUILayoutOption>()); GUI.enabled = File.Exists(_activeFile); GUI.SetNextControlName("textEditorTextField"); _fileContent = GUILayout.TextArea(_fileContent, ConfigurationManagerStyles.GetFileEditorTextArea(), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true) }); if (_focusTextArea || GUI.GetNameOfFocusedControl() == "textEditorTextField") { GUI.FocusWindow(-680); GUI.FocusControl("textEditorTextField"); _focusTextArea = false; } GUI.enabled = true; GUILayout.EndScrollView(); if (ConfigurationManager._showFullName.Value) { GUILayout.TextField(_activeFile, ConfigurationManagerStyles.GetTextStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); } GUILayout.EndVertical(); GUI.backgroundColor = backgroundColor; GUILayout.EndHorizontal(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width, 20f)); if (!SettingFieldDrawer.DrawCurrentDropdown()) { ConfigurationManager.DrawTooltip(_windowRect); } _windowRect = Utils.ResizeWindow(windowID, _windowRect, out var sizeChanged); if (sizeChanged) { SaveCurrentSizeAndPosition(); } } private float GetFileListWidth() { return ((Rect)(ref _windowRect)).width * 0.3f; } private void DrawDirectory(string path) { _directoryDepth++; DrawDirectories(GetDirectories(path)); if (path == _activeDirectory && _fileNameState == FileEditState.CreatingFolder) { DrawFileNameField(); } DrawFiles(path); _directoryDepth--; } private void DrawDirectories(IEnumerable<string> directories) { foreach (string directory in directories) { if ((ConfigurationManager._showTrashBin.Value || !(directory == _trashBinDirectory)) && (ConfigurationManager._showEmptyFolders.Value || DirectoryContainsValidFiles(directory))) { if (!_folderStates.ContainsKey(directory)) { _folderStates[directory] = false; } bool num = _folderStates[directory]; bool flag = (_folderStates[directory] = GUILayout.Toggle(_folderStates[directory], Path.GetFileName(directory), ConfigurationManagerStyles.GetDirectoryStyle(directory == _activeDirectory), Array.Empty<GUILayoutOption>())); if (num != flag && _folderStates[directory]) { _activeDirectory = directory; SetFileEditState(FileEditState.None); } if (_folderStates[directory]) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Space(20f); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); DrawDirectory(directory); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } } } } private void DrawFileNameField() { GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MaxWidth(GetFileListWidth() - (float)(20 * (_directoryDepth + 1)) - 5f) }); if (_fileNameState == FileEditState.CreatingFolder || _fileNameState == FileEditState.CreatingFile) { GUILayout.Label((_fileNameState == FileEditState.CreatingFolder) ? "Folder:" : "File:", ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); } _newItemName = GUILayout.TextField(_newItemName, ConfigurationManagerStyles.GetFileNameFieldStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button("OK", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { if (_fileNameState == FileEditState.CreatingFolder || _fileNameState == FileEditState.CreatingFile) { CreateNewItem(_newItemName, _fileNameState == FileEditState.CreatingFolder); } else if (_fileNameState == FileEditState.RenamingFile) { RenameActiveFile(); } } GUILayout.EndHorizontal(); if (!Utility.IsNullOrWhiteSpace(_newItemErrorText)) { GUILayout.Label(_newItemErrorText, ConfigurationManagerStyles.GetFileNameErrorStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); } GUILayout.EndVertical(); } private void RenameActiveFile() { if (_newItemName == Path.GetFileName(_activeFile)) { SetFileEditState(FileEditState.None); return; } string directoryName = Path.GetDirectoryName(_activeFile); if (directoryName == null) { return; } if (!TryGetSafeChildPath(directoryName, _newItemName, out var path)) { _newItemErrorText = "Invalid file name"; return; } if (File.Exists(path) || Directory.Exists(path)) { _newItemErrorText = "File already exists"; return; } try { File.Move(_activeFile, path); _activeFile = path; SetFileEditState(FileEditState.None); } catch (Exception ex) { _newItemErrorText = ex.Message; } } private void MoveActiveFileToTrash() { if (Utility.IsNullOrWhiteSpace(_activeFile)) { return; } Directory.CreateDirectory(_trashBinDirectory); string text = Path.Combine(_trashBinDirectory, Path.GetFileName(_activeFile)); if (File.Exists(text)) { text = Path.Combine(_trashBinDirectory, $"{Path.GetFileNameWithoutExtension(text)}_{DateTime.UtcNow:yyyyMMdd_HHmmss}_{Guid.NewGuid():N}{Path.GetExtension(text)}"); } try { if (_activeFile != null) { File.Move(_activeFile, text); } _activeFile = string.Empty; _fileContent = string.Empty; _originalFileContent = string.Empty; SetFileEditState(FileEditState.None); } catch (Exception ex) { _newItemErrorText = ex.Message; } } public ConfigFilesEditor() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) InitializeFileWatcher(); } private void InitializeFileWatcher() { _watchers = new FileSystemWatcher[2] { new FileSystemWatcher(Paths.ConfigPath), new FileSystemWatcher(Paths.PluginPath) }; FileSystemWatcher[] watchers = _watchers; foreach (FileSystemWatcher obj in watchers) { obj.IncludeSubdirectories = true; obj.SynchronizingObject = ThreadingHelper.SynchronizingObject; obj.Changed += delegate { ClearCache(); }; obj.Created += delegate { ClearCache(); }; obj.Deleted += delegate { ClearCache(); }; obj.Renamed += delegate { ClearCache(); }; } } private void ClearCache() { _clearCache = true; FileSystemWatcher[] watchers = _watchers; for (int i = 0; i < watchers.Length; i++) { watchers[i].EnableRaisingEvents = IsOpen; } } internal void SetWatching(bool enabled) { FileSystemWatcher[] watchers = _watchers; for (int i = 0; i < watchers.Length; i++) { watchers[i].EnableRaisingEvents = enabled && IsOpen; } } private string[] GetFiles(string path) { if (_clearCache) { _cachedFileTree.Clear(); _cachedDirectories.Clear(); } _clearCache = false; if (_cachedFileTree.TryGetValue(path, out var value)) { return value; } string[] array; try { array = (Directory.Exists(path) ? Directory.GetFiles(path) : Array.Empty<string>()); } catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) { ConfigurationManager.LogWarning("Could not read files from " + path + ": " + ex.Message); array = Array.Empty<string>(); } _cachedFileTree[path] = array; return array; } private string[] GetDirectories(string path) { if (_clearCache) { _cachedFileTree.Clear(); _cachedDirectories.Clear(); } _clearCache = false; if (_cachedDirectories.TryGetValue(path, out var value)) { return value; } string[] array; try { array = (Directory.Exists(path) ? (from directory in Directory.GetDirectories(path) where (File.GetAttributes(directory) & FileAttributes.ReparsePoint) == 0 select directory).ToArray() : Array.Empty<string>()); } catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) { ConfigurationManager.LogWarning("Could not read directories from " + path + ": " + ex.Message); array = Array.Empty<string>(); } _cachedDirectories[path] = array; return array; } private void DrawFiles(string path) { bool flag = false; string[] files = GetFiles(path); foreach (string text in files) { if (IsValidFile(text)) { if (text == _activeFile && _fileNameState == FileEditState.RenamingFile) { DrawFileNameField(); } else if (GUILayout.Button(Path.GetFileName(text), ConfigurationManagerStyles.GetFileStyle(text == _activeFile), Array.Empty<GUILayoutOption>())) { LoadFileToEditor(text); } if (path == _activeDirectory && text == _activeFile && _fileNameState == FileEditState.CreatingFile) { DrawFileNameField(); flag = true; } } } if (!flag && path == _activeDirectory && _fileNameState == FileEditState.CreatingFile) { DrawFileNameField(); } } private bool IsValidFile(string file) { string fileName = Path.GetFileName(file); if (fileName == "manifest.json") { return false; } try { if ((File.GetAttributes(file) & FileAttributes.ReparsePoint) != FileAttributes.None) { return false; } } catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) { return false; } if (string.Equals(fileName, "ConfigManager.hiddensettings.txt", StringComparison.OrdinalIgnoreCase)) { if (!Utility.IsNullOrWhiteSpace(SearchString)) { return fileName.IndexOf(SearchString, StringComparison.OrdinalIgnoreCase) > -1; } return true; } if (Chainloader.PluginInfos.Values.Any((PluginInfo plugin) => plugin.Instance.Config.ConfigFilePath == file)) { return false; } string extension = Path.GetExtension(file); if (_editableExtensions.Contains(extension)) { if (!Utility.IsNullOrWhiteSpace(SearchString)) { return fileName.IndexOf(SearchString, StringComparison.OrdinalIgnoreCase) > -1; } return true; } return false; } private bool DirectoryContainsValidFiles(string path) { if (!GetFiles(path).Any(IsValidFile)) { return GetDirectories(path).Any(DirectoryContainsValidFiles); } return true; } private void LoadFileToEditor(string filePath) { try { _fileContent = File.ReadAllText(filePath); _originalFileContent = _fileContent; _activeFile = filePath; _activeDirectory = Path.GetDirectoryName(filePath); _errorText = string.Empty; SetFileEditState(FileEditState.None); _focusTextArea = true; } catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) { ConfigurationManager.LogError("Failed to load file " + filePath + ": " + ex.Message); _errorText = "Failed to load file"; _fileContent = ex.Message; _originalFileContent = string.Empty; _activeFile = string.Empty; } } private void DrawDirectoriesMenu() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("New folder", ConfigurationManagerStyles.GetButtonStyle(), Array.Empty<GUILayoutOption>())) { SetFileEditState(FileEditState.CreatingFolder); } if (GUILayout.Button("New file", ConfigurationManagerStyles.GetButtonStyle(), Array.Empty<GUILayoutOption>())) { SetFileEditState(FileEditState.CreatingFile); } if (GUILayout.Button("Rename", ConfigurationManagerStyles.GetButtonStyle(), Array.Empty<GUILayoutOption>())) { SetFileEditState(FileEditState.RenamingFile); _newItemName = Path.GetFileName(_activeFile); } if (GUILayout.Button(new GUIContent("Delete", "File will be moved into Trash Bin"), ConfigurationManagerStyles.GetButtonStyle(), Array.Empty<GUILayoutOption>())) { MoveActiveFileToTrash(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); ConfigurationManager._showEmptyFolders.Value = GUILayout.Toggle(ConfigurationManager._showEmptyFolders.Value, "Show empty folders", ConfigurationManagerStyles.GetToggleStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUILayout.FlexibleSpace(); ConfigurationManager._showFullName.Value = GUILayout.Toggle(ConfigurationManager._showFullName.Value, new GUIContent("Show file name", "Show full name of active file"), ConfigurationManagerStyles.GetToggleStyle(), Array.Empty<GUILayoutOption>()); ConfigurationManager._showTrashBin.Value = GUILayout.Toggle(ConfigurationManager._showTrashBin.Value, "Show Trash Bin", ConfigurationManagerStyles.GetToggleStyle(), Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); GUILayout.EndVertical(); } private void CreateNewItem(string itemName, bool isFolder) { if (string.IsNullOrWhiteSpace(itemName) || string.IsNullOrEmpty(_activeDirectory)) { return; } if (!TryGetSafeChildPath(_activeDirectory, itemName, out var path)) { _newItemErrorText = "Invalid file or folder name"; return; } if (File.Exists(path) || Directory.Exists(path)) { _newItemErrorText = "File already exists"; return; } try { if (isFolder) { Directory.CreateDirectory(path); ConfigurationManager._showEmptyFolders.Value = true; _activeDirectory = path; _activeFile = string.Empty; } else { File.Create(path).Close(); LoadFileToEditor(path); } SetFileEditState(FileEditState.None); } catch (Exception ex) { _newItemErrorText = ex.Message; } } private void SaveActiveFile() { try { if (Utility.IsNullOrWhiteSpace(_activeFile) || !File.Exists(_activeFile)) { _errorText = "The active file no longer exists"; return; } using (FileStream fileStream = new FileStream(_activeFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None)) { string a; using (StreamReader streamReader = new StreamReader(fileStream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, 1024, leaveOpen: true)) { a = streamReader.ReadToEnd(); } if (!string.Equals(a, _originalFileContent, StringComparison.Ordinal)) { _errorText = "The file changed outside ConfigManager. Reload it before saving."; return; } fileStream.Position = 0L; fileStream.SetLength(0L); using (StreamWriter streamWriter = new StreamWriter(fileStream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), 1024, leaveOpen: true)) { streamWriter.Write(_fileContent); streamWriter.Flush(); } fileStream.Flush(); } _originalFileContent = _fileContent; _errorText = string.Empty; } catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) { _errorText = ex.Message; } } private static bool TryGetSafeChildPath(string directory, string itemName, out string path) { path = null; if (Utility.IsNullOrWhiteSpace(directory) || Utility.IsNullOrWhiteSpace(itemName) || Path.IsPathRooted(itemName)) { return false; } string text = itemName.Trim(); if (text.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0 || text.IndexOf(Path.DirectorySeparatorChar) >= 0 || text.IndexOf(Path.AltDirectorySeparatorChar) >= 0 || text.IndexOf('/') >= 0 || text.IndexOf('\\') >= 0) { return false; } try { string text2 = Path.GetFullPath(directory).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); if (!IsPathInsideEditorRoots(text2)) { return false; } string fullPath = Path.GetFullPath(Path.Combine(text2, text)); string b = Path.GetDirectoryName(fullPath)?.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); if (!string.Equals(text2, b, GetPathComparison())) { return false; } path = fullPath; return true; } catch (Exception ex) when (ex is ArgumentException || ex is NotSupportedException || ex is PathTooLongException) { return false; } } private static bool IsPathInsideEditorRoots(string path) { string[] directories = _directories; for (int i = 0; i < directories.Length; i++) { string text = Path.GetFullPath(directories[i]).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); if (string.Equals(path, text, GetPathComparison()) || path.StartsWith(text + Path.DirectorySeparatorChar, GetPathComparison())) { return true; } } return false; } private static StringComparison GetPathComparison() { if (Path.DirectorySeparatorChar != '\\') { return StringComparison.Ordinal; } return StringComparison.OrdinalIgnoreCase; } public void Dispose() { FileSystemWatcher[] watchers = _watchers; for (int i = 0; i < watchers.Length; i++) { watchers[i].Dispose(); } _watchers = Array.Empty<FileSystemWatcher>(); } } 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)); } } public override object Get() { return Entry.BoxedValue; } protected override void SetValue(object newVal) { Entry.BoxedValue = newVal; } internal bool ShouldBeHidden() { return ConfigurationManager.IsSettingHidden(base.PluginInfo.GUID + "=" + Entry.Definition.Section + "=" + Entry.Definition.Key); } } internal static class HiddenSettingsParser { internal static bool TryParseLine(string rawLine, out string setting) { setting = null; if (rawLine == null) { return false; } string text = rawLine.Trim(); if (text.Length == 0 || text.StartsWith("#", StringComparison.Ordinal)) { return false; } int num = text.IndexOf('='); int num2 = ((num < 0) ? (-1) : text.IndexOf('=', num + 1)); if (num <= 0 || num2 <= num + 1 || num2 == text.Length - 1) { return false; } string text2 = text.Substring(0, num).Trim(); string text3 = text.Substring(num + 1, num2 - num - 1).Trim(); string text4 = text.Substring(num2 + 1).Trim(); if (text2.Length == 0 || text3.Length == 0 || text4.Length == 0) { return false; } setting = text2 + "=" + text3 + "=" + text4; return true; } } internal class SettingEditWindow { private sealed class ColorCacheEntry { public Color Last; public Texture2D Tex; } private Rect _windowRect = new Rect(ConfigurationManager._windowPositionEditSetting.Value, ConfigurationManager._windowSizeEditSetting.Value); private const int WindowId = -6800; private const string NewItemFieldControlName = "StringListNewItemField"; private SettingEntryBase setting; private static SettingEntryBase _currentKeyboardShortcutToSet; private static IEnumerable<KeyCode> _keysToCheck; private static readonly Dictionary<SettingEntryBase, ColorCacheEntry> ColorCache = new Dictionary<SettingEntryBase, ColorCacheEntry>(); private Vector2 _scrollPosition = Vector2.zero; private Vector2 _scrollPositionEnum = Vector2.zero; private int listIndex = -1; private IList listEnum; private Action drawerFunction; private string errorText; private object valueToSet; private string errorOnSetting; private readonly List<string> vectorParts = new List<string>(); private readonly List<float> vectorFloats = new List<float>(); private readonly List<float> vectorDefault = new List<float>(); private string colorAsHEX; private List<string> separatedStringDefault = new List<string>(); private List<string> separatedString = new List<string>(); private string separator; private int editStringView; private string newItem; private ConfigEntryBase dummyCustomDrawerConfigEntry; private static readonly Dictionary<Type, string> typeMappings = new Dictionary<Type, string> { { typeof(int), "Integer" }, { typeof(float), "Float" }, { typeof(double), "Double" }, { typeof(decimal), "Decimal" }, { typeof(bool), "Boolean" }, { typeof(string), "String" }, { typeof(long), "Long" }, { typeof(short), "Short" }, { typeof(byte), "Byte" }, { typeof(sbyte), "Signed Byte" }, { typeof(uint), "Unsigned Integer" }, { typeof(ulong), "Unsigned Long" }, { typeof(ushort), "Unsigned Short" }, { typeof(char), "Character" }, { typeof(DateTime), "DateTime" }, { typeof(TimeSpan), "TimeSpan" }, { typeof(Guid), "GUID" }, { typeof(KeyValuePair<, >), "Map<Key, Value>" }, { typeof(object), "Object" } }; private readonly Dictionary<Type, bool> _canCovertCache = new Dictionary<Type, bool>(); public Dictionary<Type, Action> SettingDrawHandlers { get; } private bool IsStringList { get { if (setting != null && setting.SettingType != null) { return typeof(IList<string>).IsAssignableFrom(setting.SettingType); } return false; } } public bool IsOpen { get; set; } public SettingEditWindow() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) SettingDrawHandlers = new Dictionary<Type, Action> { { typeof(bool), DrawBoolField }, { typeof(KeyboardShortcut), DrawKeyboardShortcut }, { typeof(KeyCode), DrawKeyCode }, { typeof(Color), DrawColor }, { typeof(Vector2), DrawVector }, { typeof(Vector3), DrawVector }, { typeof(Vector4), DrawVector }, { typeof(Quaternion), DrawVector } }; } public void EditSetting(SettingEntryBase setting) { if (this.setting == setting && IsOpen) { IsOpen = false; return; } this.setting = setting; InitializeWindow(); IsOpen = true; } public void OnGUI() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0051: 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_0096: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) if (IsOpen) { ((Rect)(ref _windowRect)).size = ConfigurationManager._windowSizeEditSetting.Value; ((Rect)(ref _windowRect)).position = ConfigurationManager._windowPositionEditSetting.Value; Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = ConfigurationManager.Palette.WindowBackground; _windowRect = GUI.Window(-6800, _windowRect, new WindowFunction(DrawWindow), $"{setting.PluginInfo.Name} {setting.PluginInfo.Version}", ConfigurationManagerStyles.GetWindowStyle()); if (!UnityInput.Current.GetKeyDown((KeyCode)323) && ((Rect)(ref _windowRect)).position != ConfigurationManager._windowPositionEditSetting.Value) { SaveCurrentSizeAndPosition(); } GUI.backgroundColor = backgroundColor; } } private void UpdateStringList() { if (Utility.IsNullOrWhiteSpace(separator)) { separator = ","; } if (setting.SettingType != typeof(string) && !IsStringList) { return; } separatedString.Clear(); if (IsStringList) { try { separatedString.AddRange(valueToSet as IList<string>); } catch { separatedString.AddRange(valueToSet.ToString().Split(new string[1] { separator }, StringSplitOptions.None)); } } else { separatedString.AddRange(valueToSet.ToString().Split(new string[1] { separator }, StringSplitOptions.None)); } separatedStringDefault.Clear(); if (setting.DefaultValue == null) { return; } if (IsStringList) { try { separatedStringDefault.AddRange((setting.DefaultValue as IList<string>).Select((string s) => s.Trim())); return; } catch { separatedStringDefault.AddRange(from s in setting.DefaultValue.ToString().Split(new string[1] { separator }, StringSplitOptions.None) select s.Trim()); return; } } separatedStringDefault.AddRange(from s in setting.DefaultValue.ToString().Split(new string[1] { separator }, StringSplitOptions.None) select s.Trim()); } private void InitializeWindow() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown listEnum = null; listIndex = -1; drawerFunction = null; valueToSet = ((setting.SettingType == typeof(Color)) ? ((object)Utils.RoundColorToHEX((Color)setting.Get())) : setting.Get()); errorText = string.Empty; errorOnSetting = string.Empty; colorAsHEX = ((setting.SettingType == typeof(Color)) ? ("#" + ColorUtility.ToHtmlStringRGBA((Color)valueToSet)) : string.Empty); separator = ","; separatedString.Clear(); newItem = string.Empty; editStringView = 0; _scrollPosition = Vector2.zero; _scrollPositionEnum = Vector2.zero; dummyCustomDrawerConfigEntry = null; if (setting is ConfigSettingEntry configSettingEntry && (setting.CustomDrawer != null || setting.CustomHotkeyDrawer != null)) { ConstructorInfo constructorInfo = AccessTools.Constructor(typeof(ConfigEntry<>).MakeGenericType(configSettingEntry.Entry.SettingType), new Type[4] { typeof(ConfigFile), typeof(ConfigDefinition), configSettingEntry.Entry.SettingType, typeof(ConfigDescription) }, false); dummyCustomDrawerConfigEntry = (ConfigEntryBase)constructorInfo.Invoke(new object[4] { configSettingEntry.Entry.ConfigFile, configSettingEntry.Entry.Definition, configSettingEntry.Entry.DefaultValue, configSettingEntry.Entry.Description }); dummyCustomDrawerConfigEntry.BoxedValue = configSettingEntry.Entry.BoxedValue; } if (setting.AcceptableValueRange.Key != null) { drawerFunction = DrawRangeField; } else if (setting.AcceptableValues != null && setting.AcceptableValues.Length != 0 && setting.SettingType.IsInstanceOfType(setting.AcceptableValues.FirstOrDefault((object x) => x != null))) { SetAcceptableValuesDrawer(); } else if (setting.SettingType.IsEnum && setting.SettingType != typeof(KeyCode)) { listEnum = Enum.GetValues(setting.SettingType); if (setting.SettingType.GetCustomAttributes(typeof(FlagsAttribute), inherit: false).Any()) { drawerFunction = DrawFlagsField; } else { drawerFunction = DrawEnumListField; } } else { SettingDrawHandlers.TryGetValue(setting.SettingType, out drawerFunction); } InitListIndex(); InitVectorParts(); UpdateStringList(); } private void InitListIndex() { listIndex = ((listEnum == null) ? (-1) : listEnum.IndexOf(valueToSet)); } private void InitVectorParts() { //IL_0049: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) vectorParts.Clear(); vectorFloats.Clear(); vectorDefault.Clear(); if (setting.SettingType == typeof(Vector2)) { FillVectorList<Vector2>(vectorFloats, (Vector2)valueToSet); FillVectorList<Vector2>(vectorDefault, (Vector2)setting.DefaultValue); } else if (setting.SettingType == typeof(Vector3)) { FillVectorList<Vector3>(vectorFloats, (Vector3)valueToSet); FillVectorList<Vector3>(vectorDefault, (Vector3)setting.DefaultValue); } else if (setting.SettingType == typeof(Vector4)) { FillVectorList<Vector4>(vectorFloats, (Vector4)valueToSet); FillVectorList<Vector4>(vectorDefault, (Vector4)setting.DefaultValue); } else if (setting.SettingType == typeof(Quaternion)) { FillVectorList<Quaternion>(vectorFloats, (Quaternion)valueToSet); FillVectorList<Quaternion>(vectorDefault, (Quaternion)setting.DefaultValue); } vectorParts.AddRange(vectorFloats.Select((float f) => f.ToString())); } private void SetAcceptableValuesDrawer() { if (setting.SettingType == typeof(KeyCode)) { listEnum = ((setting.AcceptableValues.Length > 1) ? setting.AcceptableValues : Enum.GetValues(setting.SettingType)); drawerFunction = DrawKeyCode; } else { listEnum = setting.AcceptableValues; drawerFunction = DrawEnumListField; } } internal void SaveCurrentSizeAndPosition() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) ConfigurationManager._windowSizeEditSetting.Value = new Vector2(Mathf.Clamp(((Rect)(ref _windowRect)).size.x, 200f, ConfigurationManager.instance.ScreenWidth / 2f), Mathf.Clamp(((Rect)(ref _windowRect)).size.y, 200f, ConfigurationManager.instance.ScreenHeight * 0.9f)); ConfigurationManager._windowPositionEditSetting.Value = new Vector2(Mathf.Clamp(((Rect)(ref _windowRect)).position.x, 0f, ConfigurationManager.instance.ScreenWidth - ConfigurationManager._windowSize.Value.x / 4f), Mathf.Clamp(((Rect)(ref _windowRect)).position.y, 0f, ConfigurationManager.instance.ScreenHeight - 40f)); ((BaseUnityPlugin)ConfigurationManager.instance).Config.Save(); } private void DrawWindow(int windowID) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = ConfigurationManager.Palette.EntryBackground; GUILayout.BeginVertical(ConfigurationManagerStyles.GetSettingWindowBackgroundStyle(), Array.Empty<GUILayoutOption>()); GUILayout.Space(1f); GUILayout.Label("<b>" + setting.Category + "</b>", ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); DrawDelimiterLine(); GUILayout.Space(1f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(false) }); GUILayout.Label(setting.DispName + " ", ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); GUILayout.Label("(" + GetTypeRepresentation(setting.SettingType) + ")", ConfigurationManagerStyles.GetLabelStyleInfo(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUILayout.EndHorizontal(); GUILayout.Label(setting.Description, ConfigurationManagerStyles.GetLabelStyle(isDefaultValue: false), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (setting.DefaultValue != null) { GUIStyle labelStyle = ConfigurationManagerStyles.GetLabelStyle(); GUIContent val = new GUIContent("Default: "); float num = labelStyle.CalcSize(val).x + 3f; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(false) }); GUILayout.Label("Default: ", labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num) }); GUILayout.Label(GetValueRepresentation(setting.DefaultValue, setting.SettingType) ?? "", ConfigurationManagerStyles.GetLabelStyleInfo(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUILayout.EndHorizontal(); } DrawDelimiterLine(); GUILayout.Space(5f); DrawSettingValue(); if (!Utility.IsNullOrWhiteSpace(errorOnSetting)) { GUILayout.Label(errorOnSetting, ConfigurationManagerStyles.GetLabelStyle(), Array.Empty<GUILayoutOption>()); } DrawDelimiterLine(); GUILayout.Space(1f); DrawMenuButtons(); GUILayout.EndVertical(); GUI.backgroundColor = backgroundColor; GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width, 20f)); if (!SettingFieldDrawer.DrawCurrentDropdown()) { ConfigurationManager.DrawTooltip(_windowRect); } _windowRect = Utils.ResizeWindow(windowID, _windowRect, out var sizeChanged); if (sizeChanged) { SaveCurrentSizeAndPosition(); } } private void DrawLabel(string label, string value) { bool flag = !Utility.IsNullOrWhiteSpace(label) && !Utility.IsNullOrWhiteSpace(value); if (flag) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); } if (!Utility.IsNullOrWhiteSpace(label)) { GUILayout.Label(Utility.IsNullOrWhiteSpace(value) ? label : (label + ":"), ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); } if (!Utility.IsNullOrWhiteSpace(value)) { GUILayout.Label(value, ConfigurationManagerStyles.GetLabelStyleInfo(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); } if (flag) { GUILayout.EndHorizontal(); } } private void DrawInfo(string info) { DrawLabel(null, info); } private string GetTypeRepresentation(Type type) { if (!type.IsGenericType) { if (!typeMappings.TryGetValue(type, out var value)) { return type.Name; } return value; } Type[] genericArguments = type.GetGenericArguments(); string value2; string text = string.Join(", ", genericArguments.Select((Type t) => (!typeMappings.TryGetValue(t, out value2)) ? t.Name : value2)); return ZDOHelper.GetValueOrDefaultPiktiv<Type, string>((IDictionary<Type, string>)typeMappings, type, type.Name) + "<" + text + ">"; } private string GetValueRepresentation(object value, Type type) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (type == typeof(Color)) { return "#" + ColorUtility.ToHtmlStringRGBA((Color)value); } if (type == typeof(bool)) { if (!(bool)value) { return "Disabled"; } return "Enabled"; } return value.ToString(); } private void DrawMenuButtons() { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); bool enabled = GUI.enabled; GUI.enabled = enabled && !IsValueToSetDefaultValue(); DrawDefaultButton(); GUI.enabled = enabled; GUILayout.Label("Press Escape to close window", ConfigurationManagerStyles.GetLabelStyleInfo(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); enabled = GUI.enabled; GUI.enabled = enabled && !ConfigurationManagerStyles.IsEqualConfigValues(setting.SettingType, valueToSet, setting.Get()); if (GUILayout.Button("Apply", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { ApplySettingValue(); } GUI.enabled = enabled; if (GUILayout.Button("Close", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { IsOpen = false; } GUILayout.EndHorizontal(); } private void ApplySettingValue() { if (valueToSet != null) { try { setting.Set(valueToSet); InitializeWindow(); } catch (Exception ex) { errorOnSetting = ex.ToString(); } } } private void DrawSettingValue() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = ConfigurationManager.Palette.Widget; bool drawStringMenu = false; _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, Array.Empty<GUILayoutOption>()); if (!DrawCustomField() && !DrawKnownDrawer()) { if (errorText.Length > 0) { GUILayout.Label("Error:\n" + errorText, ConfigurationManagerStyles.GetLabelStyle(), Array.Empty<GUILayoutOption>()); } DrawUnknownField(out drawStringMenu); } GUILayout.EndScrollView(); if (drawStringMenu) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Edit as: ", ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); _ = editStringView; int num = (editStringView = GUILayout.SelectionGrid(editStringView, new string[2] { "Text", "List" }, 2, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })); if (editStringView > 0) { GUILayout.Label("Separator: ", ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); if (separator != (separator = GUILayout.TextField(separator, Array.Empty<GUILayoutOption>()))) { UpdateStringList(); } if (GUILayout.Button("Trim whitespace", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { separatedString = separatedString.Select((string s) => s.Trim()).ToList(); valueToSet = setting.StrToObj(string.Join(separator, separatedString)); } } GUILayout.EndHorizontal(); } GUI.backgroundColor = backgroundColor; } private static void DrawDelimiterLine() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = ConfigurationManager.Palette.Widget; GUILayout.Label("", ConfigurationManagerStyles.GetDelimiterLine(), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(2f) }); GUI.backgroundColor = backgroundColor; } private bool DrawKnownDrawer() { if (drawerFunction == null) { return false; } try { drawerFunction(); return true; } catch (Exception ex) { ConfigurationManager.LogWarning(ex); errorText = ex.GetType().Name + " - " + ex.Message; } return false; } public bool DrawCustomField() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) if (SettingFieldDrawer.IsSettingFailedToCustomDraw(setting)) { GUILayout.Label("Error when calling custom drawer function.", Array.Empty<GUILayoutOption>()); return false; } Color contentColor = GUI.contentColor; bool flag = true; int fontSize = GUI.skin.textField.fontSize; int fontSize2 = GUI.skin.textArea.fontSize; int fontSize3 = GUI.skin.label.fontSize; int fontSize4 = GUI.skin.button.fontSize; GUI.skin.textArea.fontSize = ConfigurationManagerStyles.fontSize; GUI.skin.textField.fontSize = ConfigurationManagerStyles.fontSize; GUI.skin.label.fontSize = ConfigurationManagerStyles.fontSize; GUI.skin.button.fontSize = ConfigurationManagerStyles.fontSize; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); int rightColumnWidth = ConfigurationManager.instance.RightColumnWidth; ConfigurationManager.instance.SetRightColumnWidth(Mathf.RoundToInt(((Rect)(ref _windowRect)).width * 0.9f)); try { GUI.contentColor = (IsValueToSetDefaultValue() ? ConfigurationManager.Palette.DefaultValueText : ConfigurationManager.Palette.ChangedValueText); if (setting.CustomDrawer != null) { setting.CustomDrawer(dummyCustomDrawerConfigEntry); } else if (setting.CustomHotkeyDrawer != null) { bool isCurrentlyAcceptingInput = _currentKeyboardShortcutToSet == setting; bool flag2 = isCurrentlyAcceptingInput; setting.CustomHotkeyDrawer(dummyCustomDrawerConfigEntry, ref isCurrentlyAcceptingInput); if (isCurrentlyAcceptingInput != flag2) { _currentKeyboardShortcutToSet = (isCurrentlyAcceptingInput ? setting : null); } } else { flag = false; } } catch (Exception e) { SettingFieldDrawer.SetSettingFailedToCustomDraw(setting, e); flag = false; } finally { ConfigurationManager.instance.SetRightColumnWidth(rightColumnWidth); } GUILayout.EndHorizontal(); GUI.contentColor = contentColor; GUI.skin.textField.fontSize = fontSize; GUI.skin.textArea.fontSize = fontSize2; GUI.skin.label.fontSize = fontSize3; GUI.skin.button.fontSize = fontSize4; if (flag && dummyCustomDrawerConfigEntry != null) { valueToSet = dummyCustomDrawerConfigEntry.BoxedValue; } return flag; } private void DrawRangeField() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown object obj = valueToSet; 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 = ConfigurationManagerStyles.GetTextStyle(setting).CalcHeight(new GUIContent(obj.ToString()), 100f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Range: ", ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); GUILayout.Label($"{num2} - {num3}", ConfigurationManagerStyles.GetLabelStyleInfo(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num4) }); try { float num5 = DrawCenteredHorizontalSlider(num, num2, num3, num4); if ((double)Math.Abs(num5 - num) >= (double)Mathf.Abs(num3 - num2) / Math.Pow(10.0, 5.0)) { valueToSet = Convert.ChangeType(Utils.RoundWithPrecision(num5, 3), setting.SettingType, CultureInfo.InvariantCulture); } if (setting.ShowRangeAsPercent == true) { SettingFieldDrawer.DrawCenteredLabel($"{Mathf.Abs(num5 - num2) / Mathf.Abs(num3 - num2):P0}", ConfigurationManagerStyles.GetLabelStyle(setting)); return; } string text = obj.ToString().AppendZeroIfFloat(setting.SettingType); string text2 = GUILayout.TextField(text, ConfigurationManagerStyles.GetTextStyle(setting), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }); if (text2 != text && Utils.TryParseFloat(text2, out var result)) { float value = Mathf.Clamp(result, num2, num3); valueToSet = Convert.ChangeType(Utils.RoundWithPrecision(value, 3), setting.SettingType); } } finally { GUILayout.EndHorizontal(); } } private static float DrawCenteredHorizontalSlider(float converted, float leftValue, float rightValue, float height) { GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(height) }); GUILayout.Space(height * 0.35f); float result = GUILayout.HorizontalSlider(converted, leftValue, rightValue, ConfigurationManagerStyles.GetSliderStyle(), ConfigurationManagerStyles.GetThumbStyle(), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(height) }); GUILayout.EndVertical(); return result; } private void DrawUnknownField(out bool drawStringMenu) { drawStringMenu = false; if (setting.ObjToStr != null && setting.StrToObj != null) { string text = setting.ObjToStr(valueToSet).AppendZeroIfFloat(setting.SettingType); if (setting.SettingType == typeof(string) || IsStringList) { if (editStringView > 0) { DrawEditableList(); valueToSet = setting.StrToObj(string.Join(separator, separatedString)); GUILayout.FlexibleSpace(); } else { string text2 = GUILayout.TextArea(text, ConfigurationManagerStyles.GetTextStyle(IsValueToSetDefaultValue()), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }).AppendZeroIfFloat(setting.SettingType); if (text2 != text) { valueToSet = setting.StrToObj(text2); } } drawStringMenu = true; } else { string text3 = GUILayout.TextArea(text, ConfigurationManagerStyles.GetTextStyle(IsValueToSetDefaultValue()), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }).AppendZeroIfFloat(setting.SettingType); if (text3 != text) { valueToSet = setting.StrToObj(text3); } } return; } string text4 = ((valueToSet == null) ? "NULL" : Convert.ToString(valueToSet, CultureInfo.InvariantCulture).AppendZeroIfFloat(setting.SettingType)); if (CanCovert(text4, setting.SettingType)) { string text5 = GUILayout.TextArea(text4, ConfigurationManagerStyles.GetTextStyle(IsValueToSetDefaultValue()), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }).AppendZeroIfFloat(setting.SettingType); if (text5 != text4) { try { valueToSet = Convert.ChangeType(text5, setting.SettingType, CultureInfo.InvariantCulture); } catch { } } } else { valueToSet = GUILayout.TextArea(text4, ConfigurationManagerStyles.GetTextStyle(IsValueToSetDefaultValue()), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }).AppendZeroIfFloat(setting.SettingType); } } private void DrawEditableList() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Invalid comparison between Unknown and I4 //IL_01a2: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Round(ConfigurationManagerStyles.GetButtonStyle().CalcSize(new GUIContent("▲")).x); for (int i = 0; i < separatedString.Count; i++) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("✕", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num) })) { GUILayout.EndHorizontal(); separatedString.RemoveAt(i); break; } separatedString[i] = GUILayout.TextArea(separatedString[i], ConfigurationManagerStyles.GetTextStyle(separatedStringDefault.IndexOf(separatedString[i].Trim()) == i), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); bool enabled = GUI.enabled; GUI.enabled = i > 0; if (GUILayout.Button("▲", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num) })) { SwapElements(i, i - 1); } GUI.enabled = i < separatedString.Count - 1; if (GUILayout.Button("▼", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num) })) { SwapElements(i, i + 1); } GUI.enabled = enabled; GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUI.SetNextControlName("StringListNewItemField"); newItem = GUILayout.TextField(newItem, ConfigurationManagerStyles.GetTextStyle(isDefaultValue: false), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (string.IsNullOrEmpty(newItem) && (int)Event.current.type == 7) { GUI.Label(GUILayoutUtility.GetLastRect(), "Enter new value", ConfigurationManagerStyles.GetPlaceholderTextStyle()); } if (GUILayout.Button("Add", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }) && !string.IsNullOrWhiteSpace(newItem)) { separatedString.Add(newItem); newItem = ""; GUI.FocusControl("StringListNewItemField"); } GUILayout.EndHorizontal(); void SwapElements(int indexA, int indexB) { List<string> list = separatedString; List<string> list2 = separatedString; string value = separatedString[indexB]; string value2 = separatedString[indexA]; list[indexA] = value; list2[indexB] = value2; } } private bool IsValueToSetDefaultValue() { return ConfigurationManagerStyles.IsEqualConfigValues(setting.SettingType, valueToSet, setting.DefaultValue); } private bool CanCovert(string value, Type type) { if (_canCovertCache.ContainsKey(type)) { return _canCovertCache[type]; } try { Convert.ChangeType(value, type); _canCovertCache[type] = true; return true; } catch { _canCovertCache[type] = false; return false; } } public static void ClearCache() { foreach (KeyValuePair<SettingEntryBase, ColorCacheEntry> item in ColorCache) { Object.Destroy((Object)(object)item.Value.Tex); } ColorCache.Clear(); } internal void DrawDefaultButton() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) if (setting.HideDefaultButton) { return; } Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = ConfigurationManager.Palette.Widget; if (setting.DefaultValue != null) { if (DrawResetButton()) { if (setting.SettingType == typeof(Color)) { valueToSet = Utils.RoundColorToHEX((Color)setting.DefaultValue); colorAsHEX = "#" + ColorUtility.ToHtmlStringRGBA((Color)valueToSet); } else { valueToSet = setting.DefaultValue; } if (dummyCustomDrawerConfigEntry != null) { dummyCustomDrawerConfigEntry.BoxedValue = setting.DefaultValue; } InitListIndex(); InitVectorParts(); UpdateStringList(); ClearCache(); } } else if (setting.SettingType.IsClass && DrawResetButton()) { valueToSet = null; if (dummyCustomDrawerConfigEntry != null) { dummyCustomDrawerConfigEntry.BoxedValue = null; } InitListIndex(); InitVectorParts(); UpdateStringList(); ClearCache(); } GUI.backgroundColor = backgroundColor; static bool DrawResetButton() { GUILayout.Space(5f); return GUILayout.Button("Reset", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); } } private void DrawBoolField() { //IL_0008: 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_0023: 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_0084: Unknown result type (might be due to invalid IL or missing references) GUI.backgroundColor = ConfigurationManager.Palette.Widget; bool flag = (bool)valueToSet; Color backgroundColor = GUI.backgroundColor; if (flag) { GUI.backgroundColor = ConfigurationManager.Palette.Enabled; } bool flag2 = GUILayout.SelectionGrid((!flag) ? 1 : 0, new string[2] { "Enabled", "Disabled" }, 2, ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }) == 0; if (flag2 != flag) { valueToSet = flag2; } if (flag) { GUI.backgroundColor = backgroundColor; } } private void DrawFlagsField() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) long num = Convert.ToInt64(valueToSet); long num2 = Convert.ToInt64(setting.DefaultValue); var array = (from Enum x in Enum.GetValues(setting.SettingType) select new { name = x.ToString(), val = Convert.ToInt64(x) }).ToArray(); float num3 = ((Rect)(ref _windowRect)).width * 0.8f; GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MaxWidth(num3) }); int num4 = 0; while (num4 < array.Length) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); int num5 = 0; bool flag = false; for (; num4 < array.Length; num4++) { var anon = array[num4]; if (anon.val != 0L) { bool flag2 = (num & anon.val) == anon.val; bool flag3 = (num2 & anon.val) == anon.val; GUIStyle buttonStyle = ConfigurationManagerStyles.GetButtonStyle(flag2 == flag3); int num6 = (int)buttonStyle.CalcSize(new GUIContent(anon.name)).x; if ((float)(num5 + num6) > num3 && flag) { break; } flag = true; num5 += num6; GUI.changed = false; if (GUILayout.Button(anon.name, buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { flag2 = !flag2; } if (GUI.changed) { long value = (flag2 ? (num | anon.val) : (num & ~anon.val)); valueToSet = Enum.ToObject(setting.SettingType, value); } } } if (!flag) { num4++; } GUILayout.EndHorizontal(); } GUI.changed = false; GUILayout.EndVertical(); GUILayout.FlexibleSpace(); } private void DrawEnumListField() { //IL_0024: 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_0035: Unknown result type (might be due to invalid IL or missing references) GUIContent[] array = listEnum.Cast<object>().Select(SettingFieldDrawer.ObjectToGuiContent).ToArray(); _scrollPositionEnum = GUILayout.BeginScrollView(_scrollPositionEnum, false, false, Array.Empty<GUILayoutOption>()); try { listIndex = GUILayout.SelectionGrid(listIndex, array, 1, ConfigurationManagerStyles.GetComboBoxStyle(), Array.Empty<GUILayoutOption>()); if (listEnum != null && listIndex >= 0 && listIndex < listEnum.Count) { valueToSet = listEnum[listIndex]; } } finally { GUILayout.EndScrollView(); } GUILayout.FlexibleSpace(); } private void DrawKeyCode() { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0070: 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_007b: 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) if (_currentKeyboardShortcutToSet == setting) { GUILayout.Label("Press any key", ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUIUtility.keyboardControl = -1; if (_keysToCheck == null) { _keysToCheck = UnityInput.Current.SupportedKeyCodes.Except((IEnumerable<KeyCode>)(object)new KeyCode[2] { (KeyCode)323, default(KeyCode) }).ToArray(); } foreach (KeyCode item in _keysToCheck) { if (UnityInput.Current.GetKeyUp(item)) { valueToSet = item; _currentKeyboardShortcutToSet = null; break; } } if (GUILayout.Button("Cancel", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { _currentKeyboardShortcutToSet = null; } } else { if (listEnum == null) { listEnum = Enum.GetValues(setting.SettingType); } DrawEnumListField(); if (GUILayout.Button(new GUIContent("Set"), ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { _currentKeyboardShortcutToSet = setting; } } } private void DrawKeyboardShortcut() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_009f: Unknown result type (might be due to invalid IL or missing references) if (_currentKeyboardShortcutToSet == setting) { GUILayout.Label("Press any key", 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)) { valueToSet = (object)new KeyboardShortcut(item, _keysToCheck.Where((Func<KeyCode, bool>)current.GetKey).ToArray()); _currentKeyboardShortcutToSet = null; break; } } if (GUILayout.Button("Cancel", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { _currentKeyboardShortcutToSet = null; } } else { if (GUILayout.Button(valueToSet.ToString(), ConfigurationManagerStyles.GetButtonStyle(setting), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { _currentKeyboardShortcutToSet = setting; } if (GUILayout.Button("Clear", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { valueToSet = KeyboardShortcut.Empty; _currentKeyboardShortcutToSet = null; } } } private void DrawVectorPart(int position) { object obj = position switch { 0 => "X", 1 => "Y", 2 => "Z", 3 => "W", _ => "", }; float result; bool isDefaultValue = Utils.TryParseFloat(vectorParts[position], out result) && vectorDefault[position] == result; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label((string?)obj + " ", ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); vectorParts[position] = GUILayout.TextField(vectorParts[position], ConfigurationManagerStyles.GetTextStyle(isDefaultValue), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }).KeepDigitsAndFirstDot(); GUILayout.EndHorizontal(); } private void DrawVector() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < vectorParts.Count; i++) { DrawVectorPart(i); } for (int j = 0; j < vectorParts.Count; j++) { if (Utils.TryParseFloat(vectorParts[j], out var result)) { vectorFloats[j] = result; } } if (setting.SettingType == typeof(Vector2)) { valueToSet = (object)new Vector2(vectorFloats[0], vectorFloats[1]); } else if (setting.SettingType == typeof(Vector3)) { valueToSet = (object)new Vector3(vectorFloats[0], vectorFloats[1], vectorFloats[2]); } else if (setting.SettingType == typeof(Vector4)) { valueToSet = (object)new Vector4(vectorFloats[0], vectorFloats[1], vectorFloats[2], vectorFloats[3]); } else if (setting.SettingType == typeof(Quaternion)) { valueToSet = (object)new Quaternion(vectorFloats[0], vectorFloats[1], vectorFloats[2], vectorFloats[3]); } GUILayout.FlexibleSpace(); } private void DrawColor() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) Color value = (Color)valueToSet; Color val = Utils.RoundColorToHEX((Color)setting.DefaultValue); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); DrawHexField(ref value, val); GUILayout.Space(3f); GUIHelper.BeginColor(value); GUILayout.Label(string.Empty, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (!ColorCache.TryGetValue(setting, out var value2)) { value2 = new ColorCacheEntry { Tex = new Texture2D(40, 10, (TextureFormat)5, false), Last = value }; value2.Tex.FillTexture(value); ColorCache[setting] = 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); DrawColorField("Red", ref value, ref value.r, Utils.RoundColor(value.r) == Utils.RoundColor(val.r)); DrawColorField("Green", ref value, ref value.g, Utils.RoundColor(value.g) == Utils.RoundColor(val.g)); DrawColorField("Blue", ref value, ref value.b, Utils.RoundColor(value.b) == Utils.RoundColor(val.b)); DrawColorField("Alpha", ref value, ref value.a, Utils.RoundColor(value.a) == Utils.RoundColor(val.a)); HSLColor hSLColor = val; HSLColor settingColor = value; DrawHSLField("Hue", ref settingColor, ref settingColor.h, Utils.RoundWithPrecision(settingColor.h, 1) == Utils.RoundWithPrecision(hSLColor.h, 1)); DrawHSLField("Saturation", ref settingColor, ref settingColor.s, Utils.RoundColor(settingColor.s) == Utils.RoundColor(hSLColor.s)); DrawHSLField("Lightness", ref settingColor, ref settingColor.l, Utils.RoundColor(settingColor.l) == Utils.RoundColor(hSLColor.l)); value = settingColor; if (value != value2.Last) { valueToSet = value; value2.Tex.FillTexture(value); value2.Last = value; colorAsHEX = "#" + ColorUtility.ToHtmlStringRGBA(value); } GUILayout.EndVertical(); } private bool DrawHexField(ref Color value, Color defaultValue) { //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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) GUIStyle textStyle = ConfigurationManagerStyles.GetTextStyle(value, defaultValue); Utils.UpdateHexString(ref colorAsHEX, GUILayout.TextField(colorAsHEX, textStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(textStyle.CalcSize(new GUIContent("#CCCCCCCC.")).x), GUILayout.ExpandWidth(false) })); bool enabled = GUI.enabled; GUI.enabled = !colorAsHEX.Replace("#", "").Equals(ColorUtility.ToHtmlStringRGBA(value), StringComparison.OrdinalIgnoreCase); Color val = default(Color); if (GUILayout.Button("Set", ConfigurationManagerStyles.GetButtonStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }) && ColorUtility.TryParseHtmlString(colorAsHEX, ref val)) { value = val; } GUI.enabled = enabled; return ConfigurationManagerStyles.IsEqualColorConfig(value, defaultValue); } private void DrawColorField(string fieldLabel, ref Color settingColor, ref float settingValue, bool isDefaultValue) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(fieldLabel, ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(ConfigurationManagerStyles.GetLabelStyle().CalcSize(new GUIContent("Green.")).x), GUILayout.ExpandWidth(false) }); GUIStyle textStyle = ConfigurationManagerStyles.GetTextStyle(isDefaultValue); Vector2 val = textStyle.CalcSize(new GUIContent("0,000.")); string text = GUILayout.TextField(Utils.RoundWithPrecision(settingValue, 3).ToString("0.000"), textStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(val.x), GUILayout.ExpandWidth(false) }); float result; if (text.StartsWith('1')) { SetColorValue(ref settingColor, 1f); } else if (text.StartsWith('0') && settingValue == 1f) { SetColorValue(ref settingColor, 0f); } else if (Utils.TryParseFloat(text, out result)) { SetColorValue(ref settingColor, result); } if (byte.TryParse(GUILayout.TextField((Utils.RoundWithPrecision(settingValue, 3) * 255f).ToString("F0"), textStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(textStyle.CalcSize(new GUIContent("000.")).x), GUILayout.ExpandWidth(false) }), out var result2)) { SetColorValue(ref settingColor, (float)(int)result2 / 255f); } SetColorValue(ref settingColor, DrawCenteredHorizontalSlider(settingValue, 0f, 1f, val.y)); GUILayout.EndHorizontal(); void SetColorValue(ref Color color, float value) { float num = Utils.RoundWithPrecision(value, 3); switch (fieldLabel) { case "Red": color.r = Mathf.Clamp01(num); break; case "Green": color.g = Mathf.Clamp01(num); break; case "Blue": color.b = Mathf.Clamp01(num); break; case "Alpha": color.a = Mathf.Clamp01(num); break; } } } private void DrawHSLField(string fieldLabel, ref HSLColor settingColor, ref float settingValue, bool isDefaultValue) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(fieldLabel, ConfigurationManagerStyles.GetLabelStyle(), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(ConfigurationManagerStyles.GetLabelStyle().CalcSize(new GUIContent("Saturation..")).x), GUILayout.ExpandWidth(false) }); GUIStyle textStyle = ConfigurationManagerStyles.GetTextStyle(isDefaultValue); Vector2 val = textStyle.CalcSize(new GUIContent("000,00.")); if (Utils.TryParseFloat(GUILayout.TextField(Utils.RoundWithPrecision(settingValue, (fieldLabel == "Hue") ? 2 : 4).ToString((fieldLabel == "Hue") ? "000.00" : "0.0000"), textStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(val.x), GUILayout.ExpandWidth(false) }), out var result)) { SetColorValue(ref settingColor, result); } SetColorValue(ref settingColor, DrawCenteredHorizontalSlider(settingValue, 0f, (fieldLabel == "Hue") ? 360f : 1f, val.y)); GUILayout.EndHorizontal(); void SetColorValue(ref HSLColor color, float value) { float num = Utils.RoundWithPrecision(value, (fieldLabel == "Hue") ? 2 : 4); switch (fieldLabel) { case "Hue": color.h = Mathf.Clamp(num, 0f, 360f); break; case "Saturation": color.s = Mathf.Clamp01((num > 1f) ? (num / 100f) : num); break; case "Lightness": color.l = Mathf.Clamp01((num > 1f) ? (num / 100f) : num); break; } } } private static void FillVectorList<T>(List<float> list, T value) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_00a0: