示例#1
0
 public void RetrievePlugins(PluginContainer container, IPluginHost host)
 {
     this.Compose(container, host);
 }
 private void ConfigurePlugins()
 {
     this.Logger.Info("Configuring plugins...");
     var loader = ObjectFactory.GetInstance<IPluginLoader>();
     var container = new PluginContainer(PluginContext.Host, loader);
     container.LoadPlugins();
 }
示例#3
0
        private void Compose(PluginContainer pluginContainer, IPluginHost host)
        {
            var catalog = new AggregateCatalog();
            var count = 0;
            foreach (var directory in Directory.GetDirectories(Repository))
            {
                Logger.DebugFormat("Found plugin in '{0}'", directory);
                catalog.Catalogs.Add(new DirectoryCatalog(directory));
                count++;
            }
            Logger.InfoFormat("Found {0} plugin(s) in the repository. (Validation not done)", count);

            var filteredCatatog = new FilteredCatalog(catalog, def => this.FilterPlugin(def));

            var container = new CompositionContainer(filteredCatatog);
            var composition = new CompositionBatch();
            composition.AddPart(pluginContainer);

            container.Compose(composition);
        }