using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; 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 HarmonyLib; using HowtoFishLocalizationAPI.Api; using ModUpdateChecker.Configuration; using ModUpdateChecker.Localization; using ModUpdateChecker.Runtime; using ModUpdateChecker.UI; using Newtonsoft.Json; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ModUpdateChecker")] [assembly: AssemblyDescription("Thunderstore update checker for How to Fish by Ice Box Studio")] [assembly: AssemblyCompany("Ice Box Studio")] [assembly: AssemblyProduct("ModUpdateChecker")] [assembly: AssemblyCopyright("Copyright © 2026 Ice Box Studio All rights reserved.")] [assembly: ComVisible(false)] [assembly: Guid("b4d4f8f4-83a7-4ec6-bf6b-7cdaf33f2a52")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace ModUpdateChecker { [BepInPlugin("IceBoxStudio.HowToFish.ModUpdateChecker", "ModUpdateChecker", "1.0.0")] [BepInDependency("IceBoxStudio.HowToFish.LocalizationAPI", "1.0.0")] public sealed class ModUpdateCheckerPlugin : BaseUnityPlugin { private Harmony _harmony; internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; try { Log.LogInfo((object)"============================================="); Log.LogInfo((object)("ModUpdateChecker " + I18n.Text("plugin.initializing"))); Log.LogInfo((object)(I18n.Text("plugin.author_prefix") + "Ice Box Studio(https://steamcommunity.com/id/ibox666/)")); ConfigManager.Init(((BaseUnityPlugin)this).Config); ModUpdateRuntime.Init((MonoBehaviour)(object)this); _harmony = new Harmony("IceBoxStudio.HowToFish.ModUpdateChecker"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); Log.LogInfo((object)("ModUpdateChecker " + I18n.Text("plugin.initialized"))); Log.LogInfo((object)"============================================="); } catch (Exception arg) { Log.LogError((object)$"Failed to initialize ModUpdateChecker: {arg}"); } } private void Update() { ModUpdateRuntime.Update(); } } public static class PluginInfo { public const string PLUGIN_GUID = "IceBoxStudio.HowToFish.ModUpdateChecker"; public const string PLUGIN_NAME = "ModUpdateChecker"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace ModUpdateChecker.UI { internal sealed class ModUpdateUi : MonoBehaviour { private static readonly BindingFlags PrivateInstance = BindingFlags.Instance | BindingFlags.NonPublic; private static ModUpdateUi _current; private GameObject _mainMenuButton; private GameObject _pauseHolder; private GameObject _mainScreen; private GameObject _optionsScreen; private GameObject _serverScreen; private GameObject _root; private GameObject _buttonTemplate; private Transform _rows; private TextMeshProUGUI _title; private TextMeshProUGUI _summary; private TextMeshProUGUI _checkLabel; private TextMeshProUGUI _closeLabel; private TextMeshProUGUI _backLabel; private Button _checkButton; private Button _backButton; private bool _open; private bool _built; private ModUpdateEntry _candidateEntry; internal static void Update() { if ((Object)(object)_current == (Object)null) { Attach(); } if ((Object)(object)_current == (Object)null) { return; } if (Object.op_Implicit((Object)(object)_current._mainMenuButton)) { _current._mainMenuButton.SetActive(MainMenuManager.IsInMenu && !PauseManager.IsPaused); _current.RefreshMenuButton(); } if (MainMenuManager.IsInMenu) { _current.AddMainMenuButton(); if (_current._open && !PauseManager.IsPaused) { _current.Hide(); } } if ((_current._built || _current.Setup()) && _current._open && Input.GetKeyDown((KeyCode)27)) { if (_current._candidateEntry != null) { _current.HideCandidates(); } else { _current.Hide(); } } } internal static void Attach() { //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) if (!Object.op_Implicit((Object)(object)_current)) { Transform hostParent = GetHostParent(); if (Object.op_Implicit((Object)(object)hostParent)) { GameObject val = new GameObject("ModUpdateChecker UI"); val.transform.SetParent(hostParent, false); _current = val.AddComponent(); _current.Setup(); } } } internal static void Open() { Attach(); if (Object.op_Implicit((Object)(object)_current)) { _current.Show(); } } internal static void Toggle() { if (Object.op_Implicit((Object)(object)_current) && _current._open) { _current.Hide(); } else { Open(); } } private static Transform GetHostParent() { CanvasManager val = GetStatic(typeof(CanvasManager), "_instance"); if (Object.op_Implicit((Object)(object)val)) { return ((Component)val).transform; } return PlayerUI.FXCanvasTrans; } private void AddMainMenuButton() { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_mainMenuButton)) { return; } CanvasManager obj = GetStatic(typeof(CanvasManager), "_instance"); List field = GetField>(obj, "_allMainMenuButtons"); TextMeshProUGUI field2 = GetField(obj, "_versionText"); if (!Object.op_Implicit((Object)(object)obj) || field == null || field.Count == 0 || !Object.op_Implicit((Object)(object)field[0]) || !Object.op_Implicit((Object)(object)field2)) { return; } Button val = FindMainMenuButton(field[0]); if (Object.op_Implicit((Object)(object)val)) { _mainMenuButton = Object.Instantiate(((Component)val).gameObject, ((TMP_Text)field2).transform.parent, false); ((Object)_mainMenuButton).name = "ModUpdateCheckerMainMenuButton"; _mainMenuButton.SetActive(true); DisableExtras(_mainMenuButton); Button val2 = UseButton(_mainMenuButton); TextMeshProUGUI text = GetText(_mainMenuButton); if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)text)) { Object.Destroy((Object)(object)_mainMenuButton); _mainMenuButton = null; return; } ((TMP_Text)text).text = I18n.Text("ui.main_menu_button"); ((UnityEvent)val2.onClick).AddListener(new UnityAction(OpenMenu)); (_mainMenuButton.GetComponent() ?? _mainMenuButton.AddComponent()).ignoreLayout = true; PlaceMainMenuButton(_mainMenuButton.GetComponent(), ((TMP_Text)field2).rectTransform); _mainMenuButton.transform.SetAsLastSibling(); } } private static Button FindMainMenuButton(GameObject page) { Button[] componentsInChildren = page.GetComponentsInChildren