Exemplo n.º 1
0
        public ScraperService()
        {
            scrapers = new Dictionary<int, Plugin<IScraperPlugin>>();
            var pluginLoader = new PluginLoader();
            pluginLoader.AddRequiredMetadata("Id");
            pluginLoader.AddRequiredMetadata("Name");

            // first argument is directory name in source tree, second one in installed tree
            //pluginLoader.AddFromTree("PlugIns", "Extensions");
            pluginLoader.AddFromTreeMatch(@"PlugIns\MPExtended.PlugIns.Scrapers.*", @"Plugins\Scrapers");
            var plugins = pluginLoader.GetPlugins<IScraperPlugin>();

            foreach (var plugin in plugins)
            {
                Log.Debug("Loaded scraper plugin {0}", plugin.Metadata["Name"]);
                int id = (int)plugin.Metadata["Id"];
                scrapers.Add(id, plugin);

                if (Configuration.Scraper.AutoStart != null &&
                    Configuration.Scraper.AutoStart.Contains(id))
                {
                    Log.Debug("Auto-Starting plugin " + plugin.Metadata["Name"]);
                    plugin.Value.StartScraper();
                }
            }
        }
Exemplo n.º 2
0
        public ScraperService()
        {
            scrapers = new Dictionary <int, Plugin <IScraperPlugin> >();
            var pluginLoader = new PluginLoader();

            pluginLoader.AddRequiredMetadata("Id");
            pluginLoader.AddRequiredMetadata("Name");

            // first argument is directory name in source tree, second one in installed tree
            //pluginLoader.AddFromTree("PlugIns", "Extensions");
            pluginLoader.AddFromTreeMatch(@"PlugIns\MPExtended.PlugIns.Scrapers.*", @"Plugins\Scrapers");
            var plugins = pluginLoader.GetPlugins <IScraperPlugin>();

            foreach (var plugin in plugins)
            {
                Log.Debug("Loaded scraper plugin {0}", plugin.Metadata["Name"]);
                int id = (int)plugin.Metadata["Id"];
                scrapers.Add(id, plugin);

                if (Configuration.Scraper.AutoStart != null &&
                    Configuration.Scraper.AutoStart.Contains(id))
                {
                    Log.Debug("Auto-Starting plugin " + plugin.Metadata["Name"]);
                    plugin.Value.StartScraper();
                }
            }
        }
Exemplo n.º 3
0
 private void LoadServices()
 {
     var loader = new PluginLoader();
     loader.AddFromTreeMatch(@"Services\MPExtended.Services.*", "MPExtended.Services.*.dll", @"Plugins\Services");
     loader.AddRequiredMetadata("ServiceName");
     services = loader.GetPlugins<IService>();
     wcfServices = loader.GetPlugins<IWcfService>();
 }
Exemplo n.º 4
0
 private void LoadServices()
 {
     var loader = new PluginLoader();
     loader.AddDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), false);
     loader.AddFromTreeMatch(@"Services\MPExtended.Services.*", "MPExtended.Services.*.dll", @"Plugins\Services");
     loader.AddRequiredMetadata("ServiceName");
     services = loader.GetPlugins<IService>();
     wcfServices = loader.GetPlugins<IWcfService>();
 }
Exemplo n.º 5
0
        private void LoadServices()
        {
            var loader = new PluginLoader();

            loader.AddDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), false);
            loader.AddFromTreeMatch(@"Services\MPExtended.Services.*", "MPExtended.Services.*.dll", @"Plugins\Services");
            loader.AddRequiredMetadata("ServiceName");
            services    = loader.GetPlugins <IService>();
            wcfServices = loader.GetPlugins <IWcfService>();
        }