Restructure

This commit is contained in:
Zontreck 2019-12-20 17:38:55 -07:00
parent 437cc0e0e1
commit da91200c74
16 changed files with 43 additions and 110 deletions

38
PluginActivator.cs Normal file
View file

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Bot
{
public class PluginActivator
{
public Assembly LoadedASM = null;
public void LoadLibrary(string DLL)
{
LoadedASM = Assembly.LoadFrom(DLL);
}
public List<IProgram> Activate(Assembly asm)
{
List<IProgram> Plugins = new List<IProgram>();
foreach (Type A in asm.GetTypes())
{
Type check = A.GetInterface("IProgram");
if (check == null)
{
//return null;
}
else
{
IProgram plugin = Activator.CreateInstance(A) as IProgram;
Plugins.Add(plugin);
}
}
return Plugins;
}
}
}