Add a try clause to the plugin loader
This commit is contained in:
parent
e985c5fd12
commit
9e3d08ddcc
2 changed files with 20 additions and 12 deletions
|
@ -6,7 +6,7 @@ using System.Reflection;
|
||||||
[assembly: AssemblyCompany("ZNI")]
|
[assembly: AssemblyCompany("ZNI")]
|
||||||
[assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
|
[assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
|
||||||
[assembly: AssemblyCopyright("© 2020 Tara Piccari")]
|
[assembly: AssemblyCopyright("© 2020 Tara Piccari")]
|
||||||
[assembly: AssemblyFileVersion("5.2.012")]
|
[assembly: AssemblyFileVersion("5.2.013")]
|
||||||
[assembly: AssemblyDescription("Second Life Bot - BotCore5")]
|
[assembly: AssemblyDescription("Second Life Bot - BotCore5")]
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ namespace Bot.Assemble
|
||||||
public class ASMInfo
|
public class ASMInfo
|
||||||
{
|
{
|
||||||
public static string BotName = "ZBotCore";
|
public static string BotName = "ZBotCore";
|
||||||
public static string BotVer = "5.2.012";
|
public static string BotVer = "5.2.013";
|
||||||
public static string GitPassword
|
public static string GitPassword
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
28
Program.cs
28
Program.cs
|
@ -278,20 +278,28 @@ namespace Bot
|
||||||
FileInfo[] files = new DirectoryInfo(Directory.GetCurrentDirectory()).GetFiles();
|
FileInfo[] files = new DirectoryInfo(Directory.GetCurrentDirectory()).GetFiles();
|
||||||
foreach(FileInfo fi in files)
|
foreach(FileInfo fi in files)
|
||||||
{
|
{
|
||||||
if(fi.Extension.ToLower() == ".dll")
|
try
|
||||||
{
|
{
|
||||||
PluginActivator PA = new PluginActivator();
|
|
||||||
Assembly asm = PA.LoadLibrary(fi.FullName);
|
if (fi.Extension.ToLower() == ".dll")
|
||||||
List<IProgram> plugins = PA.Activate(asm);
|
|
||||||
foreach(IProgram prog in plugins)
|
|
||||||
{
|
{
|
||||||
try
|
PluginActivator PA = new PluginActivator();
|
||||||
|
Assembly asm = PA.LoadLibrary(fi.FullName);
|
||||||
|
List<IProgram> plugins = PA.Activate(asm);
|
||||||
|
foreach (IProgram prog in plugins)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Plugin [" + prog.ProgramName + "] found (" + fi.FullName + ") loaded and activated");
|
try
|
||||||
prog.run(client, MH, CommandRegistry.Instance);
|
{
|
||||||
g_ZPrograms.Add(prog);
|
Console.WriteLine("Plugin [" + prog.ProgramName + "] found (" + fi.FullName + ") loaded and activated");
|
||||||
}catch(Exception e) { }
|
prog.run(client, MH, CommandRegistry.Instance);
|
||||||
|
g_ZPrograms.Add(prog);
|
||||||
|
}
|
||||||
|
catch (Exception e) { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}catch(Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Could not load file: " + fi.FullName+" as a Bot Plugin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<IProgram> main = new PluginActivator().Activate(Assembly.GetExecutingAssembly());
|
List<IProgram> main = new PluginActivator().Activate(Assembly.GetExecutingAssembly());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue