} //Cycles /// <summary> /// Scan thru the assembly for all types that match the types we are interested in. If we find one, /// then it is a plugin, create an instance of one and add to the appropriate collection. /// </summary> /// <param name="pluginAssembly"></param> private void loadFromAssembly(Assembly pluginAssembly) { try { foreach (Type type in pluginAssembly.GetTypes()) { //ARMPluginInterfaces.Utils.OutputDebugString("Found type:" + type.ToString()); if (type.GetInterface(typeof(IARMPlugin).ToString(), false) != null) { //if(type.GetCustomAttributes(typeof(PlugDisplayNameAttribute),false).Length!=1) //ARMPluginInterfaces.Utils.OutputDebugString("Activating type:" + type.ToString()); //create an instance of the plugin IARMPlugin plugin = (Activator.CreateInstance(type) as IARMPlugin); PluginItem pluginItem = new PluginItem(Path.GetFileName(pluginAssembly.CodeBase), plugin); mAvailablePlugins.Add(pluginItem); //call the plugins init method, pass this IARMHost interface //plugin.init(this); } //if } //foreach } catch (Exception ex) { ARMPluginInterfaces.Utils.OutputDebugString("Problems loading assembly:" + ex.Message); } }//loadFromAssembly
public void EnablePlugin(IARMPlugin plugin) { plugin.Init(this); this.onShutdown(); this.onLoad(); }
public PluginItem(string assembly, IARMPlugin armPlugin) { this.Assembly = assembly; this.armPlugin = armPlugin; this.Activated = false; }