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 ServerConnect v1.0.7
ServerConnect.dll
Decompiled 3 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ServerConnect")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ServerConnect")] [assembly: AssemblyTitle("ServerConnect")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 ServerConnect { [BepInPlugin("zenox.serverconnect", "ServerConnect", "1.0.7")] public class ServerConnectPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(FejdStartup), "Awake")] private static class FejdStartup_Awake_Patch { private static void Postfix(FejdStartup __instance) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown if (!ServerButtonEnabled.Value) { return; } Button[] componentsInChildren = __instance.m_menuList.GetComponentsInChildren<Button>(true); if (componentsInChildren.Length != 0) { Button val = componentsInChildren[0]; Button val2 = Object.Instantiate<Button>(val, ((Component)val).transform.parent); ((Object)val2).name = "ServerConnectButton"; TMP_Text componentInChildren = ((Component)val2).GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.text = ServerButtonLabel.Value; } ((UnityEventBase)val2.onClick).RemoveAllListeners(); ((UnityEvent)val2.onClick).AddListener((UnityAction)delegate { ConnectToConfiguredServer(__instance); }); ((Component)val2).transform.SetSiblingIndex(0); } } } public const string PluginGUID = "zenox.serverconnect"; public const string PluginName = "ServerConnect"; public const string PluginVersion = "1.0.7"; public static ConfigEntry<bool> ServerButtonEnabled; public static ConfigEntry<string> ServerButtonLabel; public static ConfigEntry<string> ServerButtonAddress; public static ConfigEntry<string> ServerButtonPassword; private readonly Harmony harmony = new Harmony("zenox.serverconnect"); private void Awake() { ServerButtonEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("ServerButton", "Enabled", true, "If true, adds a button to the main menu that connects straight to the configured server with the configured password, skipping the server browser."); ServerButtonLabel = ((BaseUnityPlugin)this).Config.Bind<string>("ServerButton", "Label", "My Server", "Text shown on the main menu button."); ServerButtonAddress = ((BaseUnityPlugin)this).Config.Bind<string>("ServerButton", "Address", "127.0.0.1:2456", "Server address (ip:port) the button connects to."); ServerButtonPassword = ((BaseUnityPlugin)this).Config.Bind<string>("ServerButton", "Password", "changeme", "Password submitted automatically when connecting via the button."); harmony.PatchAll(Assembly.GetExecutingAssembly()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ServerConnect v1.0.7 loaded."); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } private static void ConnectToConfiguredServer(FejdStartup instance) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) typeof(FejdStartup).GetProperty("ServerPassword", BindingFlags.Static | BindingFlags.Public)?.SetValue(null, ServerButtonPassword.Value); ServerJoinData val = default(ServerJoinData); ((ServerJoinData)(ref val))..ctor(new ServerJoinDataDedicated(ServerButtonAddress.Value)); typeof(FejdStartup).GetMethod("ProceedJoinRequest", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(instance, new object[1] { val }); } } }