Ejemplo n.º 1
0
        /// <summary>
        /// Installs plugins from stack to the collection
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <param name="group">The group.</param>
        /// <returns></returns>
        public int InstallTo(IAPlugInCollectionBase collection, plugInGroupEnum group, bool removeFromStack = true)
        {
            int c = 0;
            List <IPlugInCommonBase> toRemove = new List <IPlugInCommonBase>();

            foreach (IPlugInCommonBase plug in this[group])
            {
                c++;
                if (collection.IsEnabled)
                {
                    collection.installPlugIn(plug);
                    if (removeFromStack)
                    {
                        toRemove.Add(plug);
                    }
                    aceLog.log("[" + c.ToString("D3") + "] Plugin [" + plug.name + "] installed into [" + collection.name + "]:" + collection.GetType().Name, null, true);
                }
                else
                {
                    aceLog.log("[" + c.ToString("D3") + "] Plugin not [" + plug.name + "] installed - the collection is disabled [" + collection.name + "]:" + collection.GetType().Name, null, true);
                }
            }

            foreach (IPlugInCommonBase plug in toRemove)
            {
                IPlugInCommonBase p;
                this[group].TryTake(out p);
            }
            return(c);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deprecated
        /// </summary>
        /// <param name="plugin_className">Name of the plugin class.</param>
        /// <param name="loger">The loger.</param>
        /// <param name="collection">The collection.</param>
        /// <returns></returns>
        public static plugIn_base GetPluginInstance(string plugin_className, builderForLog loger, IAPlugInCollectionBase collection)
        {
            plugIn_base plug = null;

            if (imbWEMManager.settings.supportEngine.plugins.Keys.Contains(plugin_className))
            {
                plug = imbWEMManager.settings.supportEngine.plugins[plugin_className].getInstance()  as plugIn_base;


                if (plug is indexPlugIn_base)
                {
                    indexPlugIn_base plug_indexPlugIn_base = plug as indexPlugIn_base;
                    loger.log("Plugin instance [" + plug.name + "] for Index Engine created");
                }
                else if (plug is enginePlugIn_base)
                {
                    loger.log("Plugin instance [" + plug.name + "] for Crawl Job Engine created");
                    //imbWEMManager.index.plugins.installPlugIn(plug as IPlugInCommonBase);
                }
                else if (plug is crawlerPlugIn_base)
                {
                    loger.log("Plugin instance [" + plug.name + "] for Crawler created");
                    //imbWEMManager.index.plugins.installPlugIn(plug as IPlugInCommonBase);
                }
                else if (plug is reportPlugIn_base)
                {
                    loger.log("Plugin instance [" + plug.name + "] for Reporting created");
                    //    imbWEMManager.index.plugins.installPlugIn(plug as IPlugInCommonBase);
                }
                else
                {
                    loger.log("Plugin instance [" + plug.name + "] of unknown category created... ");
                }


                if (collection != null)
                {
                    collection.installPlugIn(plug);
                }
            }
            else
            {
                loger.AppendLine("Plugin [" + plugin_className + "] not found... ");
            }

            return(plug);
        }