Example #1
0
        /// <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);
        }
Example #2
0
        /// <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);
        }
Example #3
0
 public void SetAutoLeague(int[] date, int space)
 {
     CheckNumberOfTeams(teams, 5);
     league = new TRound.League(teams, referees);
     league.AutoSchedule(date, space);
 }
Example #4
0
 public ForbiddenAutoScheduleException(TRound.League league) : base(league)
 {
 }
Example #5
0
 public NotEnoughTeamsLeftNumber(TRound.League league, TTeam.ITeam team) : base(league)
 {
     this.team = team;
 }
Example #6
0
 public AlreadyPlayingInLeagueException(TRound.League league, TMatch.Match match) : base(league)
 {
     this.match = match;
 }
Example #7
0
 public ImpossibleScheduleException(TRound.League league) : base(league)
 {
 }
Example #8
0
 public LeagueRuntimeException(TRound.League league)
 {
     this.league = league;
 }