From 504a66f8071c2eb40e3f21d9cac5cf9b22654935 Mon Sep 17 00:00:00 2001 From: Zontreck Date: Sun, 19 Apr 2020 23:04:35 -0700 Subject: [PATCH] fix: #1 Also fixes a bug where the bot would not scan for embedded IPrograms within the Bot.exe binary --- Program.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Program.cs b/Program.cs index e16b4c0..565dee1 100644 --- a/Program.cs +++ b/Program.cs @@ -12,6 +12,7 @@ using OpenMetaverse.Packets; using Bot.Assemble; using OpenMetaverse.Interfaces; using System.Security.Cryptography; +using System.Reflection; namespace Bot { @@ -259,6 +260,7 @@ namespace Bot MH.callbacks(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Updated to version " + BotStr + " - "+BotVer.ToString()); } + // Setup BotSession Singleton! BotSession.Instance.grid = client; BotSession.Instance.Logger = Log; @@ -368,13 +370,20 @@ namespace Bot registry = CommandRegistry.Instance; //ReloadGroupsCache(); Log.info(true, "MainProgram exists"); - + Assembly _s = Assembly.GetExecutingAssembly(); try { int programCount = 0; PluginActivator PA = new PluginActivator(); PA.LoadLibrary(conf.MainProgramDLL); + List plugins = PA.Activate(PA.LoadedASM); + List mainExe = PA.Activate(_s); + + foreach(IProgram plug in mainExe) + { + plugins.Add(plug); + } foreach (IProgram plugin in plugins) { @@ -385,7 +394,7 @@ namespace Bot programCount++; Log.info(true, "Plugin: " + plugin.ProgramName + " [" + PA.LoadedASM.FullName + "] added to g_ZPrograms"); - if (File.Exists(plugin.ProgramName + ".bdf")) + if (File.Exists(plugin.ProgramName + ".json")) plugin.LoadConfiguration(); // will throw an error if BlankBot tries to load config }