Ejemplo n.º 1
0
        private void printResult(List <Race> res, int year)
        {
            var sb = new StringBuilder();

            foreach (var z in res.Where(z => z.IsMaraton && !z.Name.StartsWith("#")))
            {
                sb.Append(
                    (z.DateOfTerm.HasValue ? z.DateOfTerm.Value.ToShortDateString() : "NODATE!") + "  "
                    + z.City + "  "
                    + z.StrDistances + "  "
                    + z.Name + "  "
                    + "" + System.Web.HttpUtility.HtmlDecode(z.Link)
                    + Environment.NewLine
                    + Environment.NewLine);
            }
            File.WriteAllText(PathMgr.FileForResultYearMp(year), sb.ToString());
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 3
0
 public string Save(int id, string serializedObj, string tableName)
 {
     System.IO.File.WriteAllText(PathMgr.SileSaveDb(tableName, id.ToString()), serializedObj);
     return("");
 }