} //ActivatePlugins /// <summary> /// Init the plugin Manager. /// Scan the Application directory for all assemblies. Pass each assembly off and determine if any /// plugins are present. We also scan this assembly for plugins (the swi handler is one) /// Once all plugins are loaded, call the Load delegate to let all plugins know the load process is complete. /// </summary> /// <param name="boardControl"></param> /// <param name="outputView"></param> public void Init(GUI.Views.PluginsUIView pluginsUIView, GUI.Views.IOutputView outputView, PluginPreferences pluginPreferences) { //make sure the static variables are initialized before initing the plugins. //some plugins add instructions and require this module initalized. // ArmAssembly.ArmInstructionTemplate.ForceInitialization(); //save the boardview and outputview interface mPluginsUIView = pluginsUIView; _outputView = outputView; try { //scan thru the dll's in the current directory and load each one. Then scan the loaded assembly and check //if any plugins of interest are in it. foreach (string file in Directory.GetFiles(System.Windows.Forms.Application.StartupPath, "*.dll")) { ARMPluginInterfaces.Utils.OutputDebugString("Found plugin dll:" + file); System.Reflection.Assembly pluginAssembly = System.Reflection.Assembly.LoadFrom(file); loadFromAssembly(pluginAssembly); }//foreach //attempt to load any plugins defined in the running .exe loadFromAssembly(System.Reflection.Assembly.GetCallingAssembly()); this.DeactivateAllPlugins(); this.ActivatePlugins(pluginPreferences.SettingsPlugins); }//try catch (BadImageFormatException ex) { ARMPluginInterfaces.Utils.OutputDebugString("Application attempted to load a incorrectly formatted DLL: " + ex.Message); } catch (Exception ex) { ARMPluginInterfaces.Utils.OutputDebugString("Application failed to load a plugin assembly: " + ex.Message); } }//init
}//InRange public void DefinePlugins(PluginPreferences preferences) { mPluginManager.DeactivateAllPlugins(); mPluginManager.ActivatePlugins(preferences.SettingsPlugins); }