Attempt 2: Add minor debug to the new plugin loader

This commit is contained in:
Zontreck 2020-06-21 00:23:30 -07:00
parent 411b1155a3
commit 1476377f6b
2 changed files with 18 additions and 21 deletions

View file

@ -6,7 +6,7 @@ using System.Reflection;
[assembly: AssemblyCompany("ZNI")]
[assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
[assembly: AssemblyCopyright("© 2020 Tara Piccari")]
[assembly: AssemblyFileVersion("5.2.010")]
[assembly: AssemblyFileVersion("5.2.011")]
[assembly: AssemblyDescription("Second Life Bot - BotCore5")]
@ -15,7 +15,7 @@ namespace Bot.Assemble
public class ASMInfo
{
public static string BotName = "ZBotCore";
public static string BotVer = "5.2.010";
public static string BotVer = "5.2.011";
public static string GitPassword
{
get

View file

@ -291,20 +291,28 @@ namespace Bot
PluginActivator PA = new PluginActivator();
Assembly asm = PA.LoadLibrary(fi.FullName);
List<IProgram> plugins = PA.Activate(asm);
try
foreach(IProgram prog in plugins)
{
g_ZPrograms.AddRange(plugins);
}catch(Exception e) { }
try
{
Console.WriteLine("Plugin [" + prog.ProgramName + "] found (" + fi.FullName + ") loaded and activated");
prog.run(client, MH, CommandRegistry.Instance);
g_ZPrograms.Add(prog);
}catch(Exception e) { }
}
}
}
List<IProgram> main = new PluginActivator().Activate(Assembly.GetExecutingAssembly());
try
foreach (IProgram prog in main)
{
g_ZPrograms.AddRange(main);
try
{
Console.WriteLine("Plugin [" + prog.ProgramName + "] found (" + Assembly.GetExecutingAssembly().FullName + ") loaded and activated");
prog.run(client, MH, CommandRegistry.Instance);
g_ZPrograms.Add(prog);
}
catch (Exception e) { }
}
catch (Exception e) { }
CommandRegistry.Instance.LocateCommands();
@ -407,17 +415,6 @@ namespace Bot
try
{
foreach (IProgram pluginKvp in g_ZPrograms)
{
IProgram plugin = pluginKvp;
plugin.run(client, MH, registry); // simulate constructor and set up other things
client.Self.IM += plugin.onIMEvent;
Log.info(true, "Plugin: " + plugin.ProgramName + " activated");
if (File.Exists(plugin.ProgramName + ".json"))
plugin.LoadConfiguration(); // will throw an error if BlankBot tries to load config
}
Log.info(true, g_ZPrograms.Count.ToString() + " programs linked");
//if (g_ZPrograms.Count > 0) msg(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Default Program [" + conf.MainProgramDLL + "] has been loaded, " + programCount.ToString() + " plugin(s) loaded");
registry.LocateCommands();