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 RepoServerRefresh v1.0.1
repoServerRefresh.dll
Decompiled 9 months agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using MenuLib; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("repoServerRefresh")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("repoServerRefresh")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b614d822-f94f-4297-9508-8bc122e1194e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace repoServerRefresh; [BepInPlugin("Textured.ServerRefreshMod", "Server Refresh Mod", "1.0.0")] public class Loader : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action <>9__5_1; public static BuilderDelegate <>9__5_0; internal void <Awake>b__5_0(Transform parent) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Refresh Servers", (Action)delegate { MenuPageServerList val = Object.FindObjectOfType<MenuPageServerList>(); if ((Object)(object)val != (Object)null && !((MonoBehaviour)val).IsInvoking("StartRefresh")) { MethodInfo method = typeof(MenuPageServerList).GetMethod("GetServerList", BindingFlags.Instance | BindingFlags.NonPublic); ((MonoBehaviour)val).StopAllCoroutines(); ((MonoBehaviour)val).StartCoroutine(ForceServerRefresh(val)); mls.LogInfo((object)"Server list refresh triggered via button."); } }, parent, Vector2.zero); } internal void <Awake>b__5_1() { MenuPageServerList val = Object.FindObjectOfType<MenuPageServerList>(); if ((Object)(object)val != (Object)null && !((MonoBehaviour)val).IsInvoking("StartRefresh")) { MethodInfo method = typeof(MenuPageServerList).GetMethod("GetServerList", BindingFlags.Instance | BindingFlags.NonPublic); ((MonoBehaviour)val).StopAllCoroutines(); ((MonoBehaviour)val).StartCoroutine(ForceServerRefresh(val)); mls.LogInfo((object)"Server list refresh triggered via button."); } } } private const string modGUID = "Textured.ServerRefreshMod"; private const string modName = "Server Refresh Mod"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Textured.ServerRefreshMod"); internal static ManualLogSource mls; private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown mls = Logger.CreateLogSource("Textured.ServerRefreshMod"); mls.LogInfo((object)"Server Refresh Mod - Loaded"); harmony.PatchAll(); object obj = <>c.<>9__5_0; if (obj == null) { BuilderDelegate val = delegate(Transform parent) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Refresh Servers", (Action)delegate { MenuPageServerList val2 = Object.FindObjectOfType<MenuPageServerList>(); if ((Object)(object)val2 != (Object)null && !((MonoBehaviour)val2).IsInvoking("StartRefresh")) { MethodInfo method = typeof(MenuPageServerList).GetMethod("GetServerList", BindingFlags.Instance | BindingFlags.NonPublic); ((MonoBehaviour)val2).StopAllCoroutines(); ((MonoBehaviour)val2).StartCoroutine(ForceServerRefresh(val2)); mls.LogInfo((object)"Server list refresh triggered via button."); } }, parent, Vector2.zero); }; <>c.<>9__5_0 = val; obj = (object)val; } MenuAPI.AddElementToServerListMenu((BuilderDelegate)obj); } private static IEnumerator ForceServerRefresh(MenuPageServerList serverList) { foreach (Transform item in serverList.serverElementParent) { Transform child = item; Object.Destroy((Object)(object)((Component)child).gameObject); } Traverse roomListField = Traverse.Create((object)serverList).Field("roomList"); object roomListObj = roomListField.GetValue(); if (roomListObj is IList roomList) { roomList.Clear(); } Traverse.Create((object)serverList).Field("receivedList").SetValue((object)false); PhotonNetwork.Disconnect(); while ((int)PhotonNetwork.NetworkingClient.State != 14 && (int)PhotonNetwork.NetworkingClient.State > 0) { yield return null; } SteamManager.instance.SendSteamAuthTicket(); DataDirector.instance.PhotonSetRegion(); DataDirector.instance.PhotonSetVersion(); DataDirector.instance.PhotonSetAppId(); PhotonNetwork.ConnectUsingSettings(); while (!Traverse.Create((object)serverList).Field("receivedList").GetValue<bool>()) { yield return null; } ((MonoBehaviour)serverList).StartCoroutine("UpdatePage"); } }