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); } }
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; } }
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)); } }
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); } }
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; } }
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); } }
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)); }