/// <summary>
        /// Open a scraper config. We get the scraper information about the config form from the service, then use
        /// reflection to load the neccessary dll files.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miOpenConfig_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                WebScraper scraper = (WebScraper)lvScrapers.SelectedItem;
                if (scraper != null)
                {
                    System.Windows.Forms.Application.EnableVisualStyles();
                    WebConfigResult scraperDll = Proxy.GetConfig(scraper.ScraperId);


                    if (File.Exists(scraperDll.DllPath))
                    {
                        ProxyDomain pd           = new ProxyDomain();
                        Assembly    assembly     = pd.GetAssembly(scraperDll.DllPath);
                        String      assemblyName = scraperDll.PluginAssemblyName;

                        IScraperPlugin plugin = (IScraperPlugin)assembly.CreateInstance(assemblyName);
                        NativeAssemblyLoader.SetSearchDirectory(Path.GetFullPath(Path.GetDirectoryName(scraperDll.DllPath)));

                        Form config = plugin.CreateConfig();

                        WebScraperState before = Proxy.GetScraperState(scraper.ScraperId).ScraperState;
                        if (before == WebScraperState.Running)
                        {
                            bool result = Proxy.PauseScraper(scraper.ScraperId);
                        }

                        config.ShowDialog();


                        if (before == WebScraperState.Running)
                        {
                            bool result = Proxy.ResumeScraper(scraper.ScraperId);
                        }
                    }
                    else
                    {
                        Log.Warn("Couldn't load scraper config, {0} doesn't exist", scraperDll.DllPath);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error starting scraper config", ex);
            }
        }
Exemple #2
0
        public WebBoolResult InvokeScraperAction(int scraperId, string itemId, string actionId)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.InvokeScraperAction(itemId, actionId));
        }
Exemple #3
0
        public WebConfigResult GetConfig(int scraperId)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.GetConfigSettings());
        }
Exemple #4
0
        public IList <WebScraperItem> GetUpdatedScraperItems(int scraperId, DateTime updated)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.GetUpdatedScraperItems(updated));
        }
Exemple #5
0
        public IList <WebScraperAction> GetScraperActions(int scraperId)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.GetScraperActions());
        }
Exemple #6
0
        public WebBoolResult AddItemToScraper(int scraperId, string title, WebMediaType type, int?provider, string itemId, int?offset)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.AddItemToScraper(title, type, provider, itemId, offset));
        }
Exemple #7
0
        public WebScraperItem GetScraperItem(int scraperId, string itemId)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.GetScraperItem(itemId));
        }
Exemple #8
0
        public WebBoolResult SetScraperInputRequest(int scraperId, string requestId, string matchId, string text)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.SetScraperInputRequest(requestId, matchId, text));
        }
Exemple #9
0
        public IList <WebScraperInputRequest> GetAllScraperInputRequests(int scraperId)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.GetAllScraperInputRequests());
        }
Exemple #10
0
        public WebScraperInfo GetScraperState(int scraperId)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.GetScraperState());
        }
Exemple #11
0
        public WebBoolResult TriggerUpdate(int scraperId)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.TriggerUpdate());
        }
Exemple #12
0
        public WebBoolResult ResumeScraper(int scraperId)
        {
            IScraperPlugin service = GetScraper(scraperId);

            return(service.ResumeScraper());
        }