示例#1
0
 /// <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();
     }
 }
示例#2
0
        //happlebao todo prevent plugin initial when plugin is disabled
        public static void DisablePlugin(PluginPair plugin)
        {
            var actionKeywords = plugin.Metadata.ActionKeywords;

            if (actionKeywords == null || actionKeywords.Count == 0 || actionKeywords[0] == Query.GlobalPluginWildcardSign)
            {
                GlobalPlugins.Remove(plugin);
            }
            else
            {
                foreach (var actionkeyword in plugin.Metadata.ActionKeywords)
                {
                    NonGlobalPlugins.Remove(actionkeyword);
                }
            }
            AllPlugins.Remove(plugin);
        }