using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using ModConfigManager.Api; using ModConfigManager.Configuration; using ModConfigManager.Localization; using ModConfigManager.UI; using ModConfigManager.Utils; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.Localization; using UnityEngine.Localization.Settings; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ModConfigManager")] [assembly: AssemblyDescription("ModConfigManager mod for Old Market Simulator by Ice Box Studio")] [assembly: AssemblyCompany("Ice Box Studio")] [assembly: AssemblyProduct("ModConfigManager")] [assembly: AssemblyCopyright("Copyright © 2026 Ice Box Studio All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("C3B7F3C2-0B5A-4A25-B3D2-1F7C8F4D8A12")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.2.0")] namespace ModConfigManager { [BepInPlugin("IceBoxStudio.ModConfigManager", "ModConfigManager", "1.0.2")] public class ModConfigManager : BaseUnityPlugin { public static ModConfigManager _Instance; private Harmony _harmony; private bool patchesApplied; public static ModConfigManager Instance => _Instance; internal static ManualLogSource Logger { get; private set; } private void Awake() { _Instance = this; Logger = ((BaseUnityPlugin)this).Logger; try { Logger.LogInfo((object)"============================================="); Logger.LogInfo((object)("ModConfigManager " + LocalizationManager.Instance.GetLocalizedText("plugin.initializing"))); Logger.LogInfo((object)(LocalizationManager.Instance.GetLocalizedText("plugin.author_prefix") + "Ice Box Studio(https://steamcommunity.com/id/ibox666/)")); SetupModNameOverrides(); ModConfigManagerApi.InitializeDefaultWhitelist(); ApplyPatches(); Logger.LogInfo((object)("ModConfigManager " + LocalizationManager.Instance.GetLocalizedText("plugin.initialized"))); Logger.LogInfo((object)"============================================="); } catch (Exception ex) { Logger.LogError((object)("ModConfigManager 初始化错误: " + ex.Message + "\n" + ex.StackTrace)); } } private static void SetupModNameOverrides() { ModConfigManagerApi.InitializeDefaultDisplayNameOverrides(); } private void ApplyPatches() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (!patchesApplied) { try { _harmony = new Harmony("IceBoxStudio.ModConfigManager"); _harmony.PatchAll(); patchesApplied = true; return; } catch (Exception ex) { Logger.LogError((object)("ModConfigManager 应用补丁错误: " + ex.Message + "\n" + ex.StackTrace)); return; } } Logger.LogInfo((object)LocalizationManager.Instance.GetLocalizedText("plugin.patches_skipped")); } public static IReadOnlyList GetInstalledPlugins() { return Chainloader.PluginInfos?.Values?.ToList() ?? new List(); } public static string GetConfigPathForPlugin(PluginInfo info) { string gUID = info.Metadata.GUID; string text = Path.Combine(Paths.ConfigPath, gUID + ".cfg"); if (File.Exists(text)) { return text; } string text2 = Path.Combine(Paths.ConfigPath, info.Metadata.Name + ".cfg"); if (File.Exists(text2)) { return text2; } return text; } } public static class PluginInfo { public const string PLUGIN_GUID = "IceBoxStudio.ModConfigManager"; public const string PLUGIN_NAME = "ModConfigManager"; public const string PLUGIN_VERSION = "1.0.2"; } } namespace ModConfigManager.Utils { public static class InputActionBindingHelper { public static InputAction CreateButtonAction(string actionName, string hotkey, Action onPerformed) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown string text = BuildBindingPath(hotkey); if (string.IsNullOrWhiteSpace(text)) { return null; } InputAction val = new InputAction(actionName, (InputActionType)1, text, (string)null, (string)null, (string)null); if (onPerformed != null) { val.performed += delegate { onPerformed(); }; } val.Enable(); return val; } public static string BuildBindingPath(string hotkey) { if (string.IsNullOrWhiteSpace(hotkey)) { return null; } string text = hotkey.Trim(); if (text.Contains("<") && text.Contains(">")) { return text; } string text2 = text.ToLowerInvariant(); return text2 switch { "leftbutton" => "/leftButton", "rightbutton" => "/rightButton", "middlebutton" => "/middleButton", "backbutton" => "/backButton", "forwardbutton" => "/forwardButton", "buttonsouth" => "/buttonSouth", "buttoneast" => "/buttonEast", "buttonwest" => "/buttonWest", "buttonnorth" => "/buttonNorth", "leftshoulder" => "/leftShoulder", "rightshoulder" => "/rightShoulder", "lefttrigger" => "/leftTrigger", "righttrigger" => "/rightTrigger", "dpadUp" => "/dpad/up", "dpadDown" => "/dpad/down", "dpadLeft" => "/dpad/left", "dpadRight" => "/dpad/right", "startbutton" => "/start", "selectbutton" => "/select", "leftstickpress" => "/leftStickPress", "rightstickpress" => "/rightStickPress", _ => "/" + text2, }; } public static string FormatHotkeyForDisplay(string s) { if (string.IsNullOrWhiteSpace(s)) { return string.Empty; } s = s.Trim(); if (s.Length == 1) { return s.ToUpperInvariant(); } if (s[0] == 'f' || s[0] == 'F') { bool flag = true; for (int i = 1; i < s.Length; i++) { if (!char.IsDigit(s[i])) { flag = false; break; } } if (flag) { return ("F" + s.Substring(1)).ToUpperInvariant(); } } string text = s.ToLowerInvariant(); switch (text) { case "leftbutton": return "Mouse Left"; case "rightbutton": return "Mouse Right"; case "middlebutton": return "Mouse Middle"; case "backbutton": return "Mouse Back"; case "forwardbutton": return "Mouse Forward"; case "buttonsouth": return "Gamepad A"; case "buttoneast": return "Gamepad B"; case "buttonwest": return "Gamepad X"; case "buttonnorth": return "Gamepad Y"; case "leftshoulder": return "Gamepad LB"; case "rightshoulder": return "Gamepad RB"; case "lefttrigger": return "Gamepad LT"; case "righttrigger": return "Gamepad RT"; case "dpadup": return "D-Pad Up"; case "dpaddown": return "D-Pad Down"; case "dpadleft": return "D-Pad Left"; case "dpadright": return "D-Pad Right"; case "startbutton": return "Gamepad Start"; case "selectbutton": return "Gamepad Select"; case "leftstickpress": return "Left Stick Press"; case "rightstickpress": return "Right Stick Press"; default: switch (text.Length) { case 5: switch (text[0]) { case 's': if (!(text == "slash")) { break; } return "/"; case 'm': if (!(text == "minus")) { break; } return "-"; case 'c': if (!(text == "comma")) { break; } return ","; case 'q': if (!(text == "quote")) { break; } return "'"; } break; case 9: switch (text[4]) { case 's': if (!(text == "backslash")) { break; } return "\\"; case 'c': if (!(text == "semicolon")) { break; } return ";"; case 'q': if (!(text == "backquote")) { break; } return "`"; } break; case 6: switch (text[0]) { case 'e': if (!(text == "equals")) { break; } return "="; case 'p': if (!(text == "period")) { break; } return "."; } break; case 4: if (!(text == "plus")) { break; } return "+"; case 11: if (!(text == "leftbracket")) { break; } return "["; case 12: if (!(text == "rightbracket")) { break; } return "]"; } break; case null: break; } switch (text) { case "alt": case "ctrl": case "shift": case "enter": case "space": case "escape": case "esc": case "tab": case "backspace": case "capslock": return char.ToUpper(s[0]) + s.Substring(1).ToLowerInvariant(); case "leftalt": return "LeftAlt"; case "rightalt": return "RightAlt"; case "leftctrl": return "LeftCtrl"; case "rightctrl": return "RightCtrl"; case "leftshift": return "LeftShift"; case "rightshift": return "RightShift"; default: return char.ToUpper(s[0]) + s.Substring(1).ToLowerInvariant(); } } } } namespace ModConfigManager.UI { public static class ModManagerUI { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__9_0; public static Action <>9__9_1; public static Action <>9__11_0; public static Func <>9__19_0; public static Action <>9__22_0; public static Action <>9__23_0; public static Func <>9__25_0; public static UnityAction <>9__25_1; public static Action <>9__25_3; public static Action <>9__25_4; public static Func <>9__25_5; public static Func <>9__26_4; public static UnityAction <>9__26_5; public static Action <>9__26_8; public static Action <>9__26_9; internal void b__9_0() { SetActive(value: false); } internal void b__9_1(string _) { RefreshLocalizedTexts(); BuildModsList(); if (_selectedPlugin != null && !UIHelper.Instance.IsCapturing) { ReloadConfigPanel(); } } internal void b__11_0() { RefreshAllInputFields(); } internal string b__19_0(PluginInfo p) { return LocalizationManager.Instance.GetModDisplayName(p.Metadata.Name); } internal void b__22_0(string _) { RefreshLocalizedTexts(); } internal void b__23_0() { RefreshAllInputFields(); } internal bool b__25_0(ConfigSection s) { return s.Items.Count == 0; } internal void b__25_1() { } internal void b__25_3() { RefreshAllInputFields(); } internal void b__25_4() { HideCenterHint(); } internal bool b__25_5(ConfigSection s) { return s.Items.Count > 0; } internal string b__26_4(string m) { return LocalizationManager.Instance.GetModDisplayName(m); } internal void b__26_5() { } internal void b__26_8() { ReloadConfigPanel(); } internal void b__26_9() { ReloadConfigPanel(); } } private static GameObject _root; private static RectTransform _listContent; private static Transform _configPanel; private static UIStyle _style; private static GameObject _originalWelcomeNote; private static PluginInfo _selectedPlugin; private static TextMeshProUGUI _centerHintLabel; private static TMP_Text _titleLabel; private static TMP_Text _restartHintLabel; public static void Initialize() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00b4: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Expected O, but got Unknown //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Expected O, but got Unknown //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root != (Object)null) { return; } GameObject welcomeNotePanel = GetWelcomeNotePanel(); if ((Object)(object)welcomeNotePanel != (Object)null) { _style = UIStyleHelper.CaptureFrom(welcomeNotePanel.transform); _originalWelcomeNote = welcomeNotePanel; } else { _style = new UIStyle(); } Canvas val = null; try { if ((Object)(object)UIManager.Instance != (Object)null) { val = ((Component)UIManager.Instance).GetComponentInParent(); } } catch { } if ((Object)(object)val == (Object)null) { val = Object.FindObjectOfType(); } if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("ModManagerCanvas"); Canvas val3 = val2.AddComponent(); val3.renderMode = (RenderMode)0; val3.sortingOrder = 32767; val2.AddComponent().uiScaleMode = (ScaleMode)1; val2.AddComponent(); Object.DontDestroyOnLoad((Object)val2); val = val3; } _root = new GameObject("ModManagerUIRoot"); _root.transform.SetParent(((Component)val).transform, false); RectTransform obj2 = _root.AddComponent(); obj2.anchorMin = Vector2.zero; obj2.anchorMax = Vector2.one; obj2.offsetMin = Vector2.zero; obj2.offsetMax = Vector2.zero; _root.AddComponent().blocksRaycasts = true; GameObject originalWelcomeNote = _originalWelcomeNote; Transform val4 = ((originalWelcomeNote != null) ? originalWelcomeNote.transform.Find("PanelBlurBG") : null); if ((Object)(object)val4 != (Object)null) { GameObject obj3 = Object.Instantiate(((Component)val4).gameObject); ((Object)obj3).name = "DimOverlay"; obj3.transform.SetParent(_root.transform, false); RectTransform component = obj3.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } Image component2 = obj3.GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).raycastTarget = true; } } GameObject val5 = new GameObject("PanelBackground"); val5.transform.SetParent(_root.transform, false); RectTransform obj4 = val5.AddComponent(); obj4.anchorMin = new Vector2(0.5f, 0.5f); obj4.anchorMax = new Vector2(0.5f, 0.5f); obj4.sizeDelta = new Vector2(1200f, 600f); Image val6 = val5.AddComponent(); if ((Object)(object)_style.PanelSprite != (Object)null) { val6.sprite = _style.PanelSprite; val6.type = (Type)1; ((Graphic)val6).material = _style.PanelMaterial; ((Graphic)val6).color = _style.PanelColor; } else { ((Graphic)val6).color = new Color(0.2f, 0.2f, 0.2f, 0.95f); } _titleLabel = CreateTMP(val5.transform, LocalizationManager.Instance.GetLocalizedText("ui.title"), 32, (TextAlignmentOptions)514); UIStyleHelper.ApplyTMPStyle(_titleLabel, _style); ((Graphic)_titleLabel).color = new Color(0.541f, 0.317f, 0.149f, 1f); RectTransform component3 = ((Component)_titleLabel).GetComponent(); component3.anchorMin = new Vector2(0f, 1f); component3.anchorMax = new Vector2(1f, 1f); component3.pivot = new Vector2(0.5f, 1f); component3.anchoredPosition = new Vector2(0f, -50f); component3.sizeDelta = new Vector2(0f, 40f); GameObject val7 = new GameObject("ButtonClose"); val7.transform.SetParent(val5.transform, false); Image val8 = val7.AddComponent(); Sprite val9 = UIStyleHelper.FindSpriteByName("buttonSquare_grey_pressed"); if ((Object)(object)val9 != (Object)null) { val8.sprite = val9; val8.type = (Type)1; } ((Graphic)val8).color = new Color(0.6235f, 0.2745f, 0.2196f, 1f); Button obj5 = val7.AddComponent