Esempio n. 1
0
 //=============================================================
 //    Public constructors
 //=============================================================
 /// <summary>
 /// Creates object of this class with given parameters.
 /// </summary>
 /// <param name="seasonNumber"></param>
 /// <param name="episodes"></param>
 /// <exception cref="System.ArgumentException">Thrown when episodes contains null item(s).</exception>
 public Season(int seasonNumber, Episode[] episodes)
 {
     if (Utils.HasNullItems(episodes))
     {
         throw new ArgumentException("episodes contains null elements(s).", "episodes");
     }
     Number = seasonNumber;
     _episodes = episodes ?? new Episode[0];
 }
Esempio n. 2
0
        private Episode[] GetEpisodes(int tvShowId, TvSeason season)
        {
            if (season.EpisodeCount == 0) return new Episode[0];

            var episodeList = new Episode[season.EpisodeCount];
            for (int i = 0; i < season.EpisodeCount; i++)
            {
                var episode = _client.GetTvEpisode(tvShowId, season.SeasonNumber, i + 1);

                ThrowIfCancelled();

                string sName = episode.Name ?? "Unknown";
                if (sName.Equals("")) sName = "Unknown";

                episodeList[i] = new Episode(sName, episode.EpisodeNumber, season.SeasonNumber);

                _seriesProgress.CurrentItemsCount++;
                ReportSeriesProgress();
            }

            return episodeList;
        }