From 42e94c42894f08c03332f6fe9fc9fa44fa3458bb Mon Sep 17 00:00:00 2001 From: Citrinate Date: Sun, 17 Mar 2024 13:35:37 -0400 Subject: [PATCH] Remove ASFE features --- CS2Interface/AdapterBridge.cs | 42 ----------------------------------- CS2Interface/CS2Interface.cs | 9 -------- 2 files changed, 51 deletions(-) delete mode 100644 CS2Interface/AdapterBridge.cs diff --git a/CS2Interface/AdapterBridge.cs b/CS2Interface/AdapterBridge.cs deleted file mode 100644 index d80af9c..0000000 --- a/CS2Interface/AdapterBridge.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Reflection; -using ArchiSteamFarm.Core; -using ArchiSteamFarm.Steam; - -// ASFEnhanced Adapter https://github.com/chr233/ASFEnhanceAdapterDemoPlugin - -namespace CS2Interface; -internal static class AdapterBridge { - public static bool InitAdapter(string pluginName, string pluginId, string? cmdPrefix, string? repoName, MethodInfo? cmdHandler) { - try { - var adapterEndpoint = Assembly.Load("ASFEnhance").GetType("ASFEnhance._Adapter_.Endpoint"); - var registerModule = adapterEndpoint?.GetMethod("RegisterModule", BindingFlags.Static | BindingFlags.Public); - var pluinVersion = Assembly.GetExecutingAssembly().GetName().Version; - - if (registerModule != null && adapterEndpoint != null) { - var result = registerModule?.Invoke(null, new object?[] { pluginName, pluginId, cmdPrefix, repoName, pluinVersion, cmdHandler }); - - if (result is string str) { - if (str == pluginName) { - return true; - } else { - ASF.ArchiLogger.LogGenericWarning(str); - } - } - } - } catch (Exception) { - ASF.ArchiLogger.LogGenericDebug("Could not find ASFEnhance plugin"); - } - - return false; - } - - internal static string? Response(Bot bot, EAccess access, ulong steamID, string message, string[] args) { - // ASFEnhance wants to intercept commands meant for this plugin, for the purpose of it's DisabledCmds config setting. - // Seems buggy though: https://github.com/Citrinate/FreePackages/issues/28 - // Therefore I'm feeding it this dummy response function, as ASFEnhance requires that cmdHandler not be null. - // This disables DisabledCmds support, but should not effect PLUGINSUPDATE command support - - return null; - } -} diff --git a/CS2Interface/CS2Interface.cs b/CS2Interface/CS2Interface.cs index 319724d..6a12f2d 100644 --- a/CS2Interface/CS2Interface.cs +++ b/CS2Interface/CS2Interface.cs @@ -8,7 +8,6 @@ using SteamKit2; using System.Collections.Concurrent; using System.Text.Json; -using System.Reflection; namespace CS2Interface { [Export(typeof(IPlugin))] @@ -20,14 +19,6 @@ public sealed class CS2Interface : IASF, IBotModules, IBotSteamClient, IBotComma public Task OnLoaded() { ASF.ArchiLogger.LogGenericInfo("Counter-Strike 2 Interface ASF Plugin by Citrinate"); GameData.Update(); - - // ASFEnhanced Adapter https://github.com/chr233/ASFEnhanceAdapterDemoPlugin - var flag = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; - var handler = typeof(AdapterBridge).GetMethod(nameof(AdapterBridge.Response), flag); - const string pluginId = nameof(CS2Interface); - const string cmdPrefix = "CS2INTERFACE"; - const string repoName = "Citrinate/CS2Interface"; - AdapterBridge.InitAdapter(Name, pluginId, cmdPrefix, repoName, handler); return Task.CompletedTask; }