Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<TeamModel> teams = teamFileName.FullFilePath().LoadFile().ConvertToTeamModels(peopleFileName);
- List<PrizeModel> prizes = prizeFileName.FullFilePath().LoadFile().ConvertToPrizeModels();
- List<MatchupModel> matchups = GlobalConfig.MatchupFile.FullFilePath().LoadFile().ConvertToMatchupModels();
- foreach (string line in lines)
- {
- string[] cols = line.Split(',');
- TournamentModel tm = new TournamentModel();
- tm.Id = int.Parse(cols[0]);
- tm.TournamentName = cols[1];
- tm.EntryFee = decimal.Parse(cols[2]);
- string[] teamIds = cols[3].Split('|');
- foreach (string id in teamIds)
- {
- tm.EnteredTeams.Add(teams.Where(x => x.Id == int.Parse(id)).First());
- }
- string[] prizeIds = cols[4].Split('|');
- foreach (string id in prizeIds)
- {
- tm.Prizes.Add(prizes.Where(x => x.Id == int.Parse(id)).First());
- }
- string[] rounds = cols[5].Split('|');
- List<MatchupModel> ms = new List<MatchupModel>();
- foreach (string round in rounds)
- {
- string[] msText = round.Split('^');
- foreach (string matchupModelTextId in msText)
- {
- ms.Add(matchups.Where(x => x.Id == int.Parse(matchupModelTextId)).First());
- }
- tm.Rounds.Add(ms);
- }
- output.Add(tm);
- }
- return output;
- }
- tm.EnteredTeams.Add(teams.Where(x => id != "null" && x.Id == int.Parse(id)).First());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement