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 Rcon Commands v1.2.0
RconCommands.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using rcon; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("RconCommands")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RconCommands")] [assembly: AssemblyTitle("RconCommands")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RconCommands { [BepInPlugin("rcon_commands", "Rcon Commands", "1.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class RconCommands : BaseUnityPlugin { public const string GUID = "rcon_commands"; public const string NAME = "Rcon Commands"; public const string VERSION = "1.2"; private rcon RCON; public void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) new Harmony("GUID").PatchAll(); } private void OnEnable() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown RCON = ((Component)this).GetComponent<rcon>(); RCON.OnUnknownCommand += new UnknownCommand(RCON_OnUnknownCommand); } private string RCON_OnUnknownCommand(string command, string[] args) { Output.Capturing = true; ((Terminal)Console.instance).TryRunCommand(command + " " + string.Join(" ", args), false, false); Output.Capturing = false; return string.Join("\n", Output.Captured); } } [HarmonyPatch] public class Output { public static List<string> Captured = new List<string>(); private static bool capturing; public static bool Capturing { get { return capturing; } set { if (value) { Captured.Clear(); } capturing = value; } } [HarmonyPatch(typeof(Terminal), "AddString", new Type[] { typeof(string) })] [HarmonyPostfix] private static void AddString(string text) { if (Capturing) { text = DateTime.Now.ToString(CultureInfo.InvariantCulture) + ": " + text; Captured.Add(text); } } [HarmonyPatch(typeof(ZLog), "Log")] [HarmonyPostfix] private static void Log(object o) { if (Capturing) { string item = $"{DateTime.Now.ToString(CultureInfo.InvariantCulture)}: {o}"; Captured.Add(item); } } } }