/// <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); } }
public WebBoolResult InvokeScraperAction(int scraperId, string itemId, string actionId) { IScraperPlugin service = GetScraper(scraperId); return(service.InvokeScraperAction(itemId, actionId)); }
public WebConfigResult GetConfig(int scraperId) { IScraperPlugin service = GetScraper(scraperId); return(service.GetConfigSettings()); }
public IList <WebScraperItem> GetUpdatedScraperItems(int scraperId, DateTime updated) { IScraperPlugin service = GetScraper(scraperId); return(service.GetUpdatedScraperItems(updated)); }
public IList <WebScraperAction> GetScraperActions(int scraperId) { IScraperPlugin service = GetScraper(scraperId); return(service.GetScraperActions()); }
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)); }
public WebScraperItem GetScraperItem(int scraperId, string itemId) { IScraperPlugin service = GetScraper(scraperId); return(service.GetScraperItem(itemId)); }
public WebBoolResult SetScraperInputRequest(int scraperId, string requestId, string matchId, string text) { IScraperPlugin service = GetScraper(scraperId); return(service.SetScraperInputRequest(requestId, matchId, text)); }
public IList <WebScraperInputRequest> GetAllScraperInputRequests(int scraperId) { IScraperPlugin service = GetScraper(scraperId); return(service.GetAllScraperInputRequests()); }
public WebScraperInfo GetScraperState(int scraperId) { IScraperPlugin service = GetScraper(scraperId); return(service.GetScraperState()); }
public WebBoolResult TriggerUpdate(int scraperId) { IScraperPlugin service = GetScraper(scraperId); return(service.TriggerUpdate()); }
public WebBoolResult ResumeScraper(int scraperId) { IScraperPlugin service = GetScraper(scraperId); return(service.ResumeScraper()); }