예제 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            var siteGot = @"http://ktg.hg.pl/komisja-tg/got/got.html";

            var siteDownloader = new SiteDownloader {
                Url = siteGot
            };

            siteDownloader.Download();
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            for (int year = 2017; year > 1976; year--)
            {
                inBox.Text = PathMgr.UrlForYearMp(year);
                var siteDownloader = new SiteDownloader {
                    Url = inBox.Text
                };
                siteDownloader.Download();
                File.WriteAllText(PathMgr.FileForYearMp(year), siteDownloader.Content);
                Log("Year " + year + " has been downloaded");
                Application.DoEvents();

                try
                {
                    var         siteContent  = File.ReadAllText(PathMgr.FileForYearMp(year));
                    var         rows         = Parser.ReadRowsOfTables(siteContent);
                    List <Race> competitions = new List <Race>();
                    foreach (var z in rows)
                    {
                        var zzz = Parser.ParseCol(z);
                        var cc  = RaceBuilder.CreateIfCan(zzz, z);
                        if (cc != null && cc.IsMaraton)
                        {
                            competitions.Add(cc);
                        }
                    }

                    printResult(competitions, year);
                }
                catch (Exception ex)
                {
                    Log(ex.ToString());
                }
                Log("Year " + year + " has been analyzed");
                Application.DoEvents();
            }
        }