private static string WriteTournamentResultToXMLFile(TournamentAnalyseResult tournamentResult) { //todo: XML File Path from AppSettings var xmlFileName = System.IO.Path.GetTempFileName().Replace(".tmp", ".xml"); var serializer = new XmlSerializer(typeof(TournamentAnalyseResult)); using (var stream = File.OpenWrite(xmlFileName)) { serializer.Serialize(stream, tournamentResult); } return(xmlFileName); }
public static TournamentAnalyseResult Process(string testFilePath) { var fileParseResults = ParseTheASCIIFile(testFilePath); if (fileParseResults.Errors.Any()) { return(new TournamentAnalyseResult(fileParseResults.Errors)); } var teamScores = AnalyseMatchResults(fileParseResults.MatchResults); var analyseResult = new TournamentAnalyseResult(teamScores); var xmlFilePath = WriteTournamentResultToXMLFile(analyseResult); analyseResult.XMLFilePath = xmlFilePath; return(analyseResult); }