public void CreateScrapeSession(List <LoadManagerRule> rules, BillingCompanyInfo billingCompanyInfo) { Logging log = new Logging(); ReferenceGenerator refGen = new ReferenceGenerator(); string refNum = refGen.GenerateReference(); try { // Get scraping scripts per billing company log.LogMessage(Enumeration.LoggingPriority.Low, refNum, "Get scraping scripts per billing company"); BillingCompany getScrapingScripts = new BillingCompany(new BillingCompanyId(billingCompanyInfo.BillingCompanyId), billingCompanyInfo.BillingCompanyName); List <ScrapingScript> scrapingScripts = getScrapingScripts.GetScrapingScripts(); foreach (var scrapingScript in scrapingScripts) { // Process errors if (scrapingScript.ErrorCode == 91) { BrokenScript brokenScript = new BrokenScript(Enumeration.ErrorCode.BrokenScript, scrapingScript.ScriptSiteURL, DateTime.Now); } } // Call the 3rd party provider to perform the scrape log.LogMessage(Enumeration.LoggingPriority.Low, refNum, "Call the 3rd party provider to perform the scrape"); ScraperProvider scraperProvider = new ScraperProvider(); List <ScrapeData> scrapeData = scraperProvider.RequestScrape(); foreach (var data in scrapeData) { // Process errors if (data.ErrorCode == 91) { BillingCompanySiteDown siteDown = new BillingCompanySiteDown(Enumeration.ErrorCode.BillingCompanySiteDown, "", DateTime.Now); } else if (data.ErrorCode == 92) { CustomerActionRequired custActionReq = new CustomerActionRequired(Enumeration.ErrorCode.CustomerActionRequired, "", DateTime.Now); } else if (data.ErrorCode == 93) { IncorrectAccount incorrectAcc = new IncorrectAccount(Enumeration.ErrorCode.IncorrectAccount, "", DateTime.Now); } else if (data.ErrorCode == 94) { InvalidCredentials invalidCredentials = new InvalidCredentials(Enumeration.ErrorCode.InvalidCredentials, "", DateTime.Now); } } // Save scraped data to the Repo log.LogMessage(Enumeration.LoggingPriority.Low, refNum, "Save scraped data to the Repo"); ScrapeDataRepository scrapeDataRepo = new ScrapeDataRepository(); List <LoadManagerErrors> saveErrors = scrapeDataRepo.SaveScrapeData(scrapeData); foreach (var saveError in saveErrors) { // Process errors if (saveError.ErrorCode == 91) { UnableToCheckDataIntegrity unableToCheckDataIntegrity = new UnableToCheckDataIntegrity(Enumeration.ErrorCode.UnableToCheckDataIntegrity, saveError.Message, DateTime.Now); } } } catch (Exception ex) { // Process errors log.LogMessage(Enumeration.LoggingPriority.High, refNum, ex); } }
void getOptions() { Options options = Options.Instance; shownnameBox.Text = options.GetStringOption("shownname"); foreach (string language in Translator.Instance.GetLanguages()) { languageBox.Items.Add(language); } languageBox.Text = options.GetStringOption("language"); int selectedValue; startupComboBox.DataSource = Options.Instance.GetStartupOptions(out selectedValue);//.ToArray(); startupComboBox.SelectedValue = selectedValue; clickToDetailsCheckBox.Checked = Options.Instance.GetBoolOption("clicktodetails"); showSortPropertyBox.Checked = options.GetBoolOption("showsortvalue"); autoconfemuBox.Checked = options.GetBoolOption("autoconfemu"); stopMediaCheckBox.Checked = options.GetBoolOption("stopmediaplayback"); viewBox.SelectedIndex = options.GetIntOption("viewemus"); pcViewBox.SelectedIndex = options.GetIntOption("viewpcgames"); favouritesViewBox.SelectedIndex = options.GetIntOption("viewfavourites"); showFanArtCheckBox.Checked = options.GetBoolOption("showfanart"); fanartDelayBox.Value = options.GetIntOption("fanartdelay"); showGameArtCheckBox.Checked = options.GetBoolOption("showgameart"); gameArtDelayBox.Value = options.GetIntOption("gameartdelay"); showPrevVideoCheckBox.Checked = options.GetBoolOption("showvideopreview"); prevVidDelayBox.Value = options.GetIntOption("videopreviewdelay"); loopPrevVidCheckBox.Checked = options.GetBoolOption("loopvideopreview"); useEmuPrevVidCheckBox.Checked = options.GetBoolOption("defaultvideopreview"); stopEmuCheckBox.Checked = options.GetBoolOption("domap"); keyData = options.GetIntOption("mappedkeydata"); if (keyData > 0) { keyMapLabel.Text = Options.GetKeyDisplayString(keyData); } goodFiltersTextBox.Text = options.GetStringOption("goodmergefilters"); if (options.GetBoolOption("showgmdialogonce")) { showGMDialogCheckBox.CheckState = CheckState.Indeterminate; } else { showGMDialogCheckBox.CheckState = options.GetBoolOption("showgmdialog") ? CheckState.Checked : CheckState.Unchecked; } //submitGameInfoToServer.Checked = options.GetBoolOption("submitGameDetails"); //retrieveGameInfoToServer.Checked = options.GetBoolOption("retrieveGameDetials"); //communityServerAddress.Text = options.GetStringOption("communityServerAddress"); //communityServerErrorWaitTime.Value = options.GetIntOption("communityServerConnectionRetryTime"); autoRefreshGames.Checked = options.GetBoolOption("autorefreshgames"); autoImportCheckBox.Checked = options.GetBoolOption("autoimportgames"); exactMatchCheckBox.Checked = options.GetBoolOption("importexact"); approveTopCheckBox.Checked = options.GetBoolOption("importtop"); resizeThumbCheckBox.Checked = options.GetBoolOption("resizethumbs"); thoroughThumbCheckBox.Checked = options.GetBoolOption("thoroughthumbsearch"); thumbDirTextBox.Text = options.GetStringOption("thumblocation"); //validate threadcount int threadCount = options.GetIntOption("importthreadcount"); if (threadCount > 10) { threadCount = 10; updateAdvanced = true; } else if (threadCount < 1) { threadCount = 1; updateAdvanced = true; } threadCountUpDown.Value = threadCount; hashThreadUpDown.Maximum = threadCount; int hashThreads = options.GetIntOption("hashthreadcount"); if (hashThreads > threadCount) { hashThreads = threadCount; updateAdvanced = true; } else if (hashThreads < 1) { hashThreads = 1; updateAdvanced = true; } hashThreadUpDown.Value = hashThreads; //scraper checkbox List <string> ignoredScripts = new List <string>(); string[] optStr = Options.Instance.GetStringOption("ignoredscrapers").Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); ignoredScripts.AddRange(optStr); coversScraperComboBox.Items.Add("Use search result"); coversScraperComboBox.SelectedIndex = 0; screensScraperComboBox.Items.Add("Use search result"); screensScraperComboBox.SelectedIndex = 0; fanartScraperComboBox.Items.Add("Use search result"); fanartScraperComboBox.SelectedIndex = 0; foreach (Scraper script in ScraperProvider.GetScrapers(true)) { scraperListBox.Items.Add(script, !ignoredScripts.Contains(script.IdString)); coversScraperComboBox.Items.Add(script); screensScraperComboBox.Items.Add(script); int index = fanartScraperComboBox.Items.Add(script); if (script.IdString == options.GetStringOption("coversscraperid")) { coversScraperComboBox.SelectedIndex = index; } if (script.IdString == options.GetStringOption("screensscraperid")) { screensScraperComboBox.SelectedIndex = index; } if (script.IdString == options.GetStringOption("fanartscraperid")) { fanartScraperComboBox.SelectedIndex = index; } } }
public ThumbRetriever() { scraperProvider = new ScraperProvider(); scraperProvider.DoWork += new DoWorkDelegate(() => doWork); }