fix: #1
Also fixes a bug where the bot would not scan for embedded IPrograms within the Bot.exe binary
This commit is contained in:
parent
58e593c898
commit
504a66f807
1 changed files with 11 additions and 2 deletions
13
Program.cs
13
Program.cs
|
@ -12,6 +12,7 @@ using OpenMetaverse.Packets;
|
||||||
using Bot.Assemble;
|
using Bot.Assemble;
|
||||||
using OpenMetaverse.Interfaces;
|
using OpenMetaverse.Interfaces;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Bot
|
namespace Bot
|
||||||
{
|
{
|
||||||
|
@ -259,6 +260,7 @@ namespace Bot
|
||||||
MH.callbacks(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Updated to version " + BotStr + " - "+BotVer.ToString());
|
MH.callbacks(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Updated to version " + BotStr + " - "+BotVer.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Setup BotSession Singleton!
|
// Setup BotSession Singleton!
|
||||||
BotSession.Instance.grid = client;
|
BotSession.Instance.grid = client;
|
||||||
BotSession.Instance.Logger = Log;
|
BotSession.Instance.Logger = Log;
|
||||||
|
@ -368,13 +370,20 @@ namespace Bot
|
||||||
registry = CommandRegistry.Instance;
|
registry = CommandRegistry.Instance;
|
||||||
//ReloadGroupsCache();
|
//ReloadGroupsCache();
|
||||||
Log.info(true, "MainProgram exists");
|
Log.info(true, "MainProgram exists");
|
||||||
|
Assembly _s = Assembly.GetExecutingAssembly();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int programCount = 0;
|
int programCount = 0;
|
||||||
PluginActivator PA = new PluginActivator();
|
PluginActivator PA = new PluginActivator();
|
||||||
PA.LoadLibrary(conf.MainProgramDLL);
|
PA.LoadLibrary(conf.MainProgramDLL);
|
||||||
|
|
||||||
List<IProgram> plugins = PA.Activate(PA.LoadedASM);
|
List<IProgram> plugins = PA.Activate(PA.LoadedASM);
|
||||||
|
List<IProgram> mainExe = PA.Activate(_s);
|
||||||
|
|
||||||
|
foreach(IProgram plug in mainExe)
|
||||||
|
{
|
||||||
|
plugins.Add(plug);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (IProgram plugin in plugins)
|
foreach (IProgram plugin in plugins)
|
||||||
{
|
{
|
||||||
|
@ -385,7 +394,7 @@ namespace Bot
|
||||||
programCount++;
|
programCount++;
|
||||||
|
|
||||||
Log.info(true, "Plugin: " + plugin.ProgramName + " [" + PA.LoadedASM.FullName + "] added to g_ZPrograms");
|
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
|
plugin.LoadConfiguration(); // will throw an error if BlankBot tries to load config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue