private void Show(MaltaParkArticle article) { if (checkBox1.Checked) { string notifica = "Trovato '" + article.Title + "' e salvato in " + article.Id + ".txt"; notifyIcon1.Icon = SystemIcons.Information; notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(1000, "Salvataggio", notifica, ToolTipIcon.Info); } textBox1.Text += "****************\r\n" + article.ToString() + "\r\n"; }
private void timer1_Tick(object sender, EventArgs e) { if (counter == 0) { LogStatus("Starting Deep Search"); for (int i = 1; i <= DEEP; i++) { LogStatus(string.Format("Getting page {0}/{1}", i, DEEP)); string page = GetPage(i); HtmlNode section = GetSection(page); List <MaltaParkArticle> newlist = MaltaParkArticle.LoadFromSectionHtml(section); FillGeneral(newlist); LogStatus("Total article cached: " + GeneralList.Count); foreach (var article in GeneralList) { if (!article.Showed && article.MatchCriteria) { LogStatus("Found Matching Article ID:" + article.Id); Show(article); Save(article); article.Showed = true; } } } counter += 1; } else { LogStatus("Fetching First Page"); LogStatus("Getting page 1"); string page = GetPage(); HtmlNode section = GetSection(page); List <MaltaParkArticle> newlist = MaltaParkArticle.LoadFromSectionHtml(section); FillGeneral(newlist); LogStatus("Total article cached: " + GeneralList.Count); foreach (var article in GeneralList) { if (!article.Showed && article.MatchCriteria) { LogStatus("Found Matching Article ID:" + article.Id); Show(article); Save(article); article.Showed = true; } } } }
private void Save(MaltaParkArticle article) { File.WriteAllText(article.Id + ".txt", article.ToString()); }