Please disclose if your mod was created primarily 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 EnableConsole v0.4.0
EnableConsole.dll
Decompiled 2 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+54bc9a4a4f2fc1dcf53b5496c8f8bf94c964223a")] [assembly: AssemblyVersion("1.0.0.0")] namespace EnableConsole; [BepInPlugin("aedenthorn.EnableConsole", "Enable Console", "0.4.0")] public class BepInExPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(FejdStartup), "Start")] public static class FejdStartup_Start_Patch { public static void Postfix() { if (modEnabled.Value) { Console.SetConsoleEnabledForThisSession(); } } } [HarmonyPatch(typeof(Console), "SetConsoleEnabled")] public static class Console_SetConsoleEnabled_Patch { public static void Prefix(ref bool enabled) { if (modEnabled.Value) { enabled = true; } } } [HarmonyPatch(typeof(Terminal), "InputText")] public static class InputText_Patch { public static bool Prefix(Terminal __instance) { if (!modEnabled.Value) { return true; } string text = ((TMP_InputField)__instance.m_input).text; if (text.ToLower().Equals(typeof(BepInExPlugin).Namespace.ToLower() + " reset")) { ((BaseUnityPlugin)context).Config.Reload(); ((BaseUnityPlugin)context).Config.Save(); __instance.AddString(text); __instance.AddString(((BaseUnityPlugin)context).Info.Metadata.Name + " config reloaded"); return false; } return true; } } public static readonly bool isDebug = true; public static BepInExPlugin context; public Harmony harmony; public static ConfigEntry<bool> modEnabled; public static ConfigEntry<int> nexusID; public static int itemSize = 48; public static void Dbgl(string str = "", bool pref = true) { if (isDebug) { Debug.Log((object)((pref ? (typeof(BepInExPlugin).Namespace + " ") : "") + str)); } } public void Awake() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown context = this; nexusID = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 669, "Nexus mod ID for updates"); modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable this mod"); if (modEnabled.Value) { harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); harmony.PatchAll(); } } }