/// <summary> /// save leagues to json file (league.json) /// </summary> /// <param name="l"> league object</param> /// <param name="name">tournament name as string</param> public static void League(TRound.League l, string name = null) { IsNameAndObject(name, l, "TRound.League"); var path = Path(name); SerializeObject(path, "league.json", l); }
/// <summary> /// create league object if exist /// </summary> /// <param name="path">path to tournamne directory</param> /// <param name="referees">list of refeeres with is as key</param> /// <param name="teams">list of teams with is as key</param> /// <param name="tenum">tournament dyscypline enum</param> /// <returns> league object</returns> public static TRound.League League(string path, Dictionary <int, TPerson.Referee> referees, Dictionary <int, TTeam.ITeam> teams, TEnum.TournamentDyscypline tenum) { TRound.League l = new TRound.League(); if (File.ReadLines(path + "\\league.json").First() == "null") { throw new TException.FileIsEmpty(); } var json = JsonConvert.DeserializeObject <Dictionary <string, List <RoundTempl> > >(File.ReadAllText(path + "\\league.json"))["Rounds"]; List <TRound.Round> rL = new List <TRound.Round>(); RoundTempl elem; for (int i = 0; i < json.Count; i++) { elem = json[i]; rL.Add(Round(elem, tenum, referees, teams)); } l.Rounds = rL; return(l); }
public void SetAutoLeague(int[] date, int space) { CheckNumberOfTeams(teams, 5); league = new TRound.League(teams, referees); league.AutoSchedule(date, space); }
public ForbiddenAutoScheduleException(TRound.League league) : base(league) { }
public NotEnoughTeamsLeftNumber(TRound.League league, TTeam.ITeam team) : base(league) { this.team = team; }
public AlreadyPlayingInLeagueException(TRound.League league, TMatch.Match match) : base(league) { this.match = match; }
public ImpossibleScheduleException(TRound.League league) : base(league) { }
public LeagueRuntimeException(TRound.League league) { this.league = league; }