示例#1
0
 private void ParseLine(string line)
 {
     if (string.IsNullOrWhiteSpace(line))
     {
         return;
     }
     if (line.StartsWith("%%"))
     {
         ParseCommentLine(line);
     }
     else if (line.StartsWith("% "))
     {
         ParseHeaderLine(line);
     }
     else if (line.StartsWith("%_%"))
     {
         ParsePlayerLine(line);
     }
     else if (line.StartsWith("%Round:"))
     {
         _status           = EloFileReadStatus.Rounds;
         _roundBeingParsed = PartToInt(line, 9);
     }
     else
     {
         ParseResultLine(line);
     }
 }
示例#2
0
        private void ParseCommentLine(string line)
        {
            //%%Tournament: Stockholm EGP
            //%%Country: Sweden
            //%%Date: 12/06/2010
            //%%Sender: Henry

            if (line.StartsWith("%%Tournament:"))
            {
                Tournament.TournamentName = PartToString(line, "%%Tournament:".Length + 1);
            }
            else if (line.StartsWith("%%Country:"))
            {
                Tournament.Country = PartToString(line, "%%Country:".Length + 1);
            }
            else if (line.StartsWith("%%Date:"))
            {
                Tournament.TournamentDate = PartToString(line, "%%Date:".Length + 1);
            }
            else if (line.StartsWith("%%Sender:"))
            {
                Sender = PartToString(line, "%%Sender:".Length + 1);
            }
            else if (line.StartsWith("%%Added"))
            {
                _status = EloFileReadStatus.AddedResults;
            }
        }
示例#3
0
 private void ParseHeaderLine(string line)
 {
     if (line == "%        ID, NAME, Firstname, COUNTRY, score, disc-count")
     {
         _status = EloFileReadStatus.Players;
     }
     else
     {
         throw new ParsingExeption(string.Format("Unknown Header line: {0}", line));
     }
 }
示例#4
0
 public void ParseFile(string fileName)
 {
     _status = EloFileReadStatus.Started;
     _roundBeingParsed = 0;
     var fi = new FileInfo(fileName);
     var fs = fi.OpenText();
     while (!fs.EndOfStream)
     {
         var line = fs.ReadLine();
         ParseLine(line);
     }
 }
示例#5
0
        public void ParseFile(string fileName)
        {
            _status           = EloFileReadStatus.Started;
            _roundBeingParsed = 0;
            var fi = new FileInfo(fileName);
            var fs = fi.OpenText();

            while (!fs.EndOfStream)
            {
                var line = fs.ReadLine();
                ParseLine(line);
            }
        }
示例#6
0
        private void ParseCommentLine(string line)
        {
            //%%Tournament: Stockholm EGP
            //%%Country: Sweden
            //%%Date: 12/06/2010
            //%%Sender: Henry

            if(line.StartsWith("%%Tournament:"))
            {
                Tournament.TournamentName = PartToString(line, "%%Tournament:".Length+1);
            }
            else if (line.StartsWith("%%Country:"))
            {
                Tournament.Country = PartToString(line, "%%Country:".Length+1);
            }
            else if (line.StartsWith("%%Date:"))
            {
                Tournament.TournamentDate = PartToString(line, "%%Date:".Length+1);
            }
            else if (line.StartsWith("%%Sender:"))
            {
                Sender = PartToString(line, "%%Sender:".Length + 1);
            }
            else if (line.StartsWith("%%Added"))
            {
                _status = EloFileReadStatus.AddedResults;
            }
        }
示例#7
0
 private void ParseLine(string line)
 {
     if (string.IsNullOrWhiteSpace(line)) return;
     if (line.StartsWith("%%"))
     {
         ParseCommentLine(line);
     } else if (line.StartsWith("% "))
     {
         ParseHeaderLine(line);
     } else if (line.StartsWith("%_%"))
     {
         ParsePlayerLine(line);
     }
     else if (line.StartsWith("%Round:"))
     {
         _status = EloFileReadStatus.Rounds;
         _roundBeingParsed = PartToInt(line, 9);
     }
     else
     {
         ParseResultLine(line);
     }
 }
示例#8
0
 private void ParseHeaderLine(string line)
 {
     if (line == "%        ID, NAME, Firstname, COUNTRY, score, disc-count")
         _status = EloFileReadStatus.Players;
     else throw new ParsingExeption(string.Format("Unknown Header line: {0}", line));
 }