Example #1
0
 //=============================================================
 //    Public constructors
 //=============================================================
 /// <summary>
 /// Creates instance of this class with given parameters.
 /// </summary>
 /// <param name="title">Series title.</param>
 /// <param name="year">Year of release.</param>
 /// <param name="genres">Series genres.</param>
 /// <param name="seasons">Series seasons.</param>
 /// <exception cref="System.ArgumentNullException">Thrown when title is null.</exception>
 /// <exception cref="System.ArgumentException">Thrown when:
 /// Genres or seasons contains null element(s).
 /// Title is empty.</exception>
 public Series(string title, int year, string[] genres, Season[] seasons)
     : this(title, year, genres)
 {
     if (Utils.HasNullItems(seasons))
     {
         throw new ArgumentException("seasons contains null element(s).", "seasons");
     }
     if (seasons != null)
     {
         _seasons = seasons;
     }
 }
Example #2
0
        private Season[] GetSeasons(TvShow show)
        {
            if (show.NumberOfSeasons == 0) return new Season[0];

            var seasons = new Season[show.NumberOfSeasons];

            int index = show.NumberOfSeasons != show.Seasons.Count ? 1 : 0;
            for (int i = index; i < show.Seasons.Count; i++)
            {
                var currentSeason = show.Seasons[i];
                seasons[currentSeason.SeasonNumber - 1] = new Season(currentSeason.SeasonNumber, GetEpisodes(show.Id, currentSeason));
            }

            return seasons;
        }