/// <summary> /// Only for use by plugins during IPlugin.Install. Call Plugin.Install instead of this method, since plugins often must perform other initialization actions. /// Adds the specified plugin to AllPlugins, QuerystringPlugins, CachingSystems, ImageEncoders, and ImageBuilderExtensions, based /// on which interfaces the instance implements. For ICache and IEncoder, the plugin is inserted at the beginning of CachingSystems and ImageEncoders respectively. /// To reiterate, plugins may register event handlers and modify settings - thus you should use the plugin's method to uninstall them vs. using this method. /// Will not register a plugin that is already installed, unless it implements IMultiInstancePlugin. /// </summary> /// <param name="plugin"></param> public void add_plugin(IPlugin plugin) { if (!(plugin is IMultiInstancePlugin) && HasPlugin(plugin.GetType())) { AcceptIssue(new Issue("An instance of the specified plugin (" + plugin.GetType().ToString() + ") has already been registered.", "The plugin should implement IMultiInstancePlugin to support multiple instances.", IssueSeverity.Error)); return; } AllPlugins.Add(plugin); if (plugin is IQuerystringPlugin) { QuerystringPlugins.Add(plugin as IQuerystringPlugin); } if (plugin is IFileExtensionPlugin) { FileExtensionPlugins.Add(plugin as IFileExtensionPlugin); } if (plugin is ICache) { CachingSystems.AddFirst(plugin as ICache); } if (plugin is IEncoder) { ImageEncoders.AddFirst(plugin as IEncoder); } if (plugin is BuilderExtension) { ImageBuilderExtensions.Add(plugin as BuilderExtension); } if (plugin is IVirtualImageProvider) { VirtualProviderPlugins.Add(plugin as IVirtualImageProvider); } if (plugin is ISettingsModifier) { SettingsModifierPlugins.Add(plugin as ISettingsModifier); } if (plugin is ICurrentConfigProvider) { ConfigProviders.Add(plugin as ICurrentConfigProvider); } if (plugin is ILogManager) { LogManager = plugin as ILogManager; } if (plugin is ILicensedPlugin || plugin is ILicenseProvider) { FireLicensePluginsChange(); } }
/// <summary> /// For use only by plugins during .Uninstall. /// Removes the specified plugin from AllPlugins, QuerystringPlugins, CachingSystems, ImageEncoders, and ImageBuilderExtensions, based /// on which interfaces the instance implements. /// Plugins may register event handlers and modify settings - thus you should use the plugin's method to uninstall them vs. using this method. /// </summary> /// <param name="plugin"></param> public void remove_plugin(object plugin) { if (plugin is IPlugin) { AllPlugins.Remove(plugin as IPlugin); } if (plugin is IQuerystringPlugin) { QuerystringPlugins.Remove(plugin as IQuerystringPlugin); } if (plugin is IFileExtensionPlugin) { FileExtensionPlugins.Remove(plugin as IFileExtensionPlugin); } if (plugin is ICache) { CachingSystems.Remove(plugin as ICache); } if (plugin is IEncoder) { ImageEncoders.Remove(plugin as IEncoder); } if (plugin is BuilderExtension) { ImageBuilderExtensions.Remove(plugin as BuilderExtension); } if (plugin is IVirtualImageProvider) { VirtualProviderPlugins.Remove(plugin as IVirtualImageProvider); } if (plugin is ISettingsModifier) { SettingsModifierPlugins.Remove(plugin as ISettingsModifier); } if (plugin is ICurrentConfigProvider) { ConfigProviders.Remove(plugin as ICurrentConfigProvider); } if (plugin is ILogManager && LogManager == plugin) { LogManager = null; } if (plugin is ILicensedPlugin || plugin is ILicenseProvider) { FireLicensePluginsChange(); } }