Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            // var path = textBoxPathRunner.Text;

            //inBox.Text = PathMgr.UrlForYearMp(year);
            // var siteDownloader = new SiteDownloader { Url = path };
            // siteDownloader.Download();
            // File.WriteAllText(PathMgr.FileForRunnerMp(path), siteDownloader.Content);
            // Log("path " + path + " has been downloaded");
            // Application.DoEvents();
            if (openFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var paths = openFileDialog1.FileNames;

            foreach (var path in paths)
            {
                try
                {
                    var siteContent = File.ReadAllText(path);// PathMgr.FileForRunnerMp(path));

                    textResults.Text = siteContent;
                    var         rows         = Parser.ReadRowsOfTables(siteContent);
                    List <Race> competitions = new List <Race>();
                    foreach (var z in rows)
                    {
                        var zzz = Parser.ParseCol(z);
                        var cc  = RaceBuilder.CreateFromStartList(zzz, z);
                        if (cc != null && cc.IsMaraton)
                        {
                            competitions.Add(cc);
                        }
                    }

                    //printResult(zz, year);
                }
                catch (Exception ex)
                {
                    Log(ex.ToString());
                }
                Log("Path " + path + " has been analyzed");

                Application.DoEvents();
            }
        }
Beispiel #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();
            }
        }