private static PluginCatalog PopulateCatalog(IProgressMonitor progressMonitor, 
     IPluginLoader pluginLoader)
 {
     var pluginCatalog = new PluginCatalog();
     
     using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(45))
         pluginLoader.PopulateCatalog(pluginCatalog, subProgressMonitor);
     
     return pluginCatalog;
 }
Ejemplo n.º 2
0
        private void RegisterLoadedPlugins()
        {
            string configurationFilePath = runtimeSetup.ConfigurationFilePath;
            if (configurationFilePath != null)
            {
                FileInfo configurationFile = new FileInfo(configurationFilePath);
                if (configurationFile.Exists)
                {
                    var document = new XmlDocument();
                    document.Load(configurationFilePath);

                    var gallioElement = document.SelectSingleNode("/configuration/gallio") as XmlElement;
                    if (gallioElement != null)
                        LoadConfigurationData(gallioElement, pluginLoader, configurationFile.Directory);
                }

                pluginLoader.AddPluginPath(configurationFilePath);
            }
            else
            {
                XmlNode sectionData = (XmlNode)ConfigurationManager.GetSection(GallioSectionHandler.SectionName);
                if (sectionData != null)
                {
                    var gallioElement = sectionData as XmlElement;
                    if (gallioElement != null)
                        LoadConfigurationData(gallioElement, pluginLoader, new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory));
                }
            }

            foreach (string path in pluginDirectories)
                pluginLoader.AddPluginPath(path);

            var pluginCatalog = new PluginCatalog();
            pluginLoader.PopulateCatalog(pluginCatalog, NullProgressMonitor.CreateInstance());

            pluginCatalog.ApplyTo(registry);
        }