private void formatScores(ref string data, ref MonospacedValues monoValues, EventFormat eventFormat, Scores scores) { if (eventFormat == EventFormat.Domination) data += scores.tps.ToString().PadRight(monoValues.tpsLength) + scores.diff.ToString().PadRight(monoValues.diffLength) + scores.vps.ToString().PadRight(monoValues.vpsLength); else if (eventFormat == EventFormat.Disparity) data += scores.diff.ToString().PadRight(monoValues.diffLength) + scores.vps.ToString().PadRight(monoValues.vpsLength) + scores.tps.ToString().PadRight(monoValues.tpsLength); else //if(tournament.Format == EventFormat.Victory) data += scores.vps.ToString().PadRight(monoValues.vpsLength) + scores.tps.ToString().PadRight(monoValues.tpsLength) + scores.diff.ToString().PadRight(monoValues.diffLength); }
// This will format results for monospaced results. Probably didn't need to be a function by itself since it is // only one use, but remains so that the ExportAs* functions all maintain the same logic. void formatResults(ref string data, List<MatchResult> results, MonospacedValues monoValues, Tournament tournament) { var rank = 1; foreach (var result in results) { if (chkExcludeForfeits.Checked && result.Forfeited) continue; var player = Config.Settings.GetPlayer(result.PlayerID); var rankString = result.Forfeited ? "F" : rank++.ToString(); data += rankString.PadRight(monoValues.rankLength) + player.Name.PadRight(monoValues.playerNameLength); if (chkShowFactions.Checked) data += (tournament.PlayerFaction[player.ID]).ToString().PadRight(monoValues.factionLength); if (tournament.Format == EventFormat.Domination) data += result.TournamentPoints.ToString().PadRight(monoValues.tpsLength) + result.Differential.ToString().PadRight(monoValues.diffLength) + result.VictoryPoints.ToString().PadRight(monoValues.vpsLength); else if (tournament.Format == EventFormat.Disparity) data += result.Differential.ToString().PadRight(monoValues.diffLength) + result.VictoryPoints.ToString().PadRight(monoValues.vpsLength) + result.TournamentPoints.ToString().PadRight(monoValues.tpsLength); else //if(tournament.Format == EventFormat.Victory) data += result.VictoryPoints.ToString().PadRight(monoValues.vpsLength) + result.TournamentPoints.ToString().PadRight(monoValues.tpsLength) + result.Differential.ToString().PadRight(monoValues.diffLength); data += "\r\n"; } }
private void formatTable(ref string data, MonospacedValues monoValues, TournamentRound round, Tournament tournament, int roundNumber) { var matchNumber = 1; foreach (var match in round.Matches) { var player1 = Config.Settings.GetPlayer(match.Players[0]); var player2 = match.Players.Count > 1 ? Config.Settings.GetPlayer(match.Players[1]) : null; data += roundNumber.ToString().PadRight(monoValues.roundLength) + matchNumber++.ToString().PadRight(monoValues.tableLength) + player1.Name.PadRight(monoValues.playerNameLength); if (chkShowFactions.Checked) data += tournament.PlayerFaction[player1.ID].ToString().PadRight(monoValues.factionLength); Scores scores; scores.vps = match.Results[player1.ID].VictoryPoints; scores.tps = match.Results[player1.ID].TournamentPoints; scores.diff = match.Results[player1.ID].Differential; formatScores(ref data, ref monoValues, tournament.Format, scores); if (player2 != null) { data += player2.Name.PadRight(monoValues.playerNameLength); if (chkShowFactions.Checked) data += tournament.PlayerFaction[player2.ID].ToString().PadRight(monoValues.factionLength); scores.vps = match.Results[player2.ID].VictoryPoints; scores.tps = match.Results[player2.ID].TournamentPoints; scores.diff = match.Results[player2.ID].Differential; formatScores(ref data, ref monoValues, tournament.Format, scores); } else data += ("BYE ROUND"); data += "\r\n"; } }