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 AutoEnableSearchSettings v1.0.0
AutoEnableSearchSettings.dll
Decompiled 3 weeks agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("AutoEnableSearchSettings")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AutoEnableSearchSettings")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9456aed0-9825-4802-a058-aa3f5fa8b5f6")] [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 AutoEnableSearchSettings; [BepInPlugin("azumi.autoenablesearchsettings", "AutoEnableSearchSettings", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string ModGUID = "azumi.autoenablesearchsettings"; public const string ModName = "AutoEnableSearchSettings"; public const string ModVersion = "1.0.0"; internal static ManualLogSource Log; internal static ConfigEntry<bool> EnableDetectedMods; internal static ConfigEntry<bool> EnableChallengeMoon; private Harmony harmony; private void Awake() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; EnableDetectedMods = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableDetectedMods", true, "Automatically enable the 'With detected mods' checkbox."); EnableChallengeMoon = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableChallengeMoon", true, "Automatically enable the 'With challenge moon' checkbox."); harmony = new Harmony("azumi.autoenablesearchsettings"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"AutoEnableSearchSettings loaded successfully!"); } } [HarmonyPatch(typeof(SteamLobbyManager), "Update")] internal class SteamLobbyManagerUpdatePatch { private static readonly FieldInfo moddedField; private static readonly FieldInfo challengeField; private static readonly MethodInfo toggleModdedMethod; private static MethodInfo toggleChallengeMethod; static SteamLobbyManagerUpdatePatch() { moddedField = typeof(SteamLobbyManager).GetField("sortWithModdedClients", BindingFlags.Instance | BindingFlags.NonPublic); challengeField = typeof(SteamLobbyManager).GetField("sortWithChallengeMoons", BindingFlags.Instance | BindingFlags.NonPublic); toggleModdedMethod = typeof(SteamLobbyManager).GetMethod("ToggleSortWithModdedClients", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); toggleChallengeMethod = typeof(SteamLobbyManager).GetMethod("ToggleChallengeMoons", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (toggleChallengeMethod == null) { toggleChallengeMethod = typeof(SteamLobbyManager).GetMethod("ToggleSortWithChallengeMoons", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (toggleChallengeMethod == null) { toggleChallengeMethod = typeof(SteamLobbyManager).GetMethod("ToggleChallengeMoon", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } } private static void Postfix(SteamLobbyManager __instance) { if (moddedField != null && toggleModdedMethod != null) { bool flag = (bool)moddedField.GetValue(__instance); bool value = Plugin.EnableDetectedMods.Value; if (flag != value) { toggleModdedMethod.Invoke(__instance, null); Plugin.Log.LogInfo((object)$"Set 'With detected mods' to {value}"); } } if (challengeField != null && toggleChallengeMethod != null) { bool flag2 = (bool)challengeField.GetValue(__instance); bool value2 = Plugin.EnableChallengeMoon.Value; if (flag2 != value2) { toggleChallengeMethod.Invoke(__instance, null); Plugin.Log.LogInfo((object)$"Set 'With challenge moon' to {value2}"); } } } }