/// <summary> /// Loads a a plugin from file. The assembly is searched for useable content and /// registered with the Editor /// </summary> /// <param name="filename"></param> public static void Load(string filename) { if (Host == null) return; var ext = Path.GetExtension(filename); if (File.Exists(filename) && (ext == ".exe" || ext == ".dll")) { var plugin = new Plugin(filename, Host); if (plugin.IsLoaded) { Plugins.Add(plugin); Entries.AddRange(plugin.GetEntries()); return; } } MessageBox.Show(String.Format("Plugin \"{0}\" failed to load.", filename), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
/// <summary> /// Unloads the given plugin and all associated registry entries /// </summary> /// <param name="plugin">Plugin to remove</param> public static void Unload(Plugin plugin) { foreach (var entry in plugin.GetEntries()) Entries.Remove(entry); Plugins.Remove(plugin); }