Esempio n. 1
0
        /// <summary>
        ///     This example demonstrates the retrieval and display of an episode.
        /// </summary>
        public static void Print(Episode episode)
        {
            Console.WriteLine("{0}:\t{1}", "IMDB ID", episode.ImdbId);
            Console.WriteLine("{0}:\t{1}", "ID", episode.Id);
            Console.WriteLine("{0}:\t{1}", "Language", episode.Language);
            Console.WriteLine("{0}:\t{1}", "Last update", episode.LastUpdated);
            Console.WriteLine("{0}:\t{1}", "Title", episode.Title);
            Console.WriteLine("{0}:\t{1}", "Rating", episode.Rating);
            Console.WriteLine("{0}:\t{1}", "# Votes", episode.RatingCount);
            Console.WriteLine("{0}:\t{1}", "Description", episode.Description);
            Console.WriteLine("{0}:\t{1}", "Director", episode.Director);
            Console.WriteLine("{0}:\t{1}", "EpisodeNumber", episode.EpisodeNumber);
            Console.WriteLine("{0}:\t{1}", "SeasonNumber", episode.SeasonNumber);
            Console.WriteLine("{0}:\t{1}", "Filename", episode.EpisodeImage);
            Console.WriteLine("{0}:\t{1}", "Series ID", episode.SeriesId);
            Console.WriteLine("{0}:\t{1}", "Season ID", episode.SeasonId);
            Console.WriteLine("{0}:\t{1}", "Thumbnail Height", episode.ThumbHeight);
            Console.WriteLine("{0}:\t{1}", "Thumbnail Width", episode.ThumbHeight);

            Console.Write("Gueststars:\t");
            foreach (var element in episode.GuestStars)
            {
                Console.Write(element);
            }

            Console.Write("Writers:\t");
            foreach (var element in episode.Writers)
            {
                Console.Write(element);
            }
        }
Esempio n. 2
0
 public EpisodeBuilder(XElement episodeNode)
 {
     _episode = new Episode
     {
         Id = int.Parse(episodeNode.GetXmlData("id")),
         Title = episodeNode.GetXmlData("EpisodeName"),
         Description = episodeNode.GetXmlData("Overview"),
         EpisodeNumber = int.Parse(episodeNode.GetXmlData("EpisodeNumber")),
         Director = episodeNode.GetXmlData("Director"),
         EpisodeImage = GetBannerUri(episodeNode.GetXmlData("filename")),
         FirstAired =
             string.IsNullOrWhiteSpace(episodeNode.GetXmlData("FirstAired"))
                 ? (DateTime?) null
                 : Utils.ParseDate(episodeNode.GetXmlData("FirstAired")),
         GuestStars =
             new List<string>(episodeNode.GetXmlData("GuestStars")
                 .Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)),
         ImdbId = episodeNode.GetXmlData("IMDB_ID"),
         Language = episodeNode.GetXmlData("Language"),
         LastUpdated =
             string.IsNullOrWhiteSpace(episodeNode.GetXmlData("lastupdated"))
                 ? 0L
                 : Convert.ToInt64(episodeNode.GetXmlData("lastupdated")),
         Rating =
             string.IsNullOrWhiteSpace(episodeNode.GetXmlData("Rating"))
                 ? (double?) null
                 : Convert.ToDouble(episodeNode.GetXmlData("Rating"),
                     System.Globalization.CultureInfo.InvariantCulture),
         RatingCount =
             string.IsNullOrWhiteSpace(episodeNode.GetXmlData("RatingCount"))
                 ? 0
                 : Convert.ToInt32(episodeNode.GetXmlData("RatingCount")),
         SeasonId = int.Parse(episodeNode.GetXmlData("seasonid")),
         SeasonNumber = int.Parse(episodeNode.GetXmlData("SeasonNumber")),
         SeriesId = int.Parse(episodeNode.GetXmlData("seriesid")),
         ThumbHeight =
             string.IsNullOrWhiteSpace(episodeNode.GetXmlData("thumb_height"))
                 ? (int?) null
                 : Convert.ToInt32(episodeNode.GetXmlData("thumb_height")),
         ThumbWidth =
             string.IsNullOrWhiteSpace(episodeNode.GetXmlData("thumb_width"))
                 ? (int?) null
                 : Convert.ToInt32(episodeNode.GetXmlData("thumb_width")),
         TmsExport = episodeNode.GetXmlData("tms_export"),
         Writers =
             new List<string>(episodeNode.GetXmlData("Writer")
                 .Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries))
     };
 }
Esempio n. 3
0
            public List<Episode> BuildEpisodes()
            {
                var result = new List<Episode>();

                foreach (var episode in _doc.Descendants("Episode")) {
                    var ep = new Episode {
                        ID = episode.GetXmlData("id"),
                        Title = episode.GetXmlData("EpisodeName"),
                        Description = episode.GetXmlData("Overview"),
                        EpisodeNumber =
                            string.IsNullOrWhiteSpace(episode.GetXmlData("EpisodeNumber"))
                                ? (int?) null
                                : Convert.ToInt32(episode.GetXmlData("EpisodeNumber")),
                        Director = episode.GetXmlData("Director"),
                        FileName = episode.GetXmlData("filename"),
                        FirstAired =
                            string.IsNullOrWhiteSpace(episode.GetXmlData("FirstAired"))
                                ? (DateTime?) null
                                : Utils.ParseDate(episode.GetXmlData("FirstAired")),
                        GuestStars = new List<string>(episode.GetXmlData("GuestStars").Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)),
                        ImdbID = episode.GetXmlData("IMDB_ID"),
                        Language = episode.GetXmlData("Language"),
                        LastUpdated =
                            string.IsNullOrWhiteSpace(episode.GetXmlData("lastupdated"))
                                ? 0L
                                : Convert.ToInt64(episode.GetXmlData("lastupdated")),
                        Rating =
                            string.IsNullOrWhiteSpace(episode.GetXmlData("Rating"))
                                ? (double?) null
                                : Convert.ToDouble(episode.GetXmlData("Rating"),
                                                   System.Globalization.CultureInfo.InvariantCulture),
                        RatingCount =
                            string.IsNullOrWhiteSpace(episode.GetXmlData("RatingCount"))
                                ? 0
                                : Convert.ToInt32(episode.GetXmlData("RatingCount")),
                        SeasonID = episode.GetXmlData("seasonid"),
                        SeasonNumber =
                            string.IsNullOrWhiteSpace(episode.GetXmlData("SeasonNumber"))
                                ? (int?) null
                                : Convert.ToInt32(episode.GetXmlData("SeasonNumber")),
                        SeriesID = episode.GetXmlData("seriesid"),
                        ThumbHeight =
                            string.IsNullOrWhiteSpace(episode.GetXmlData("thumb_height"))
                                ? (int?) null
                                : Convert.ToInt32(episode.GetXmlData("thumb_height")),
                        ThumbWidth =
                            string.IsNullOrWhiteSpace(episode.GetXmlData("thumb_width"))
                                ? (int?) null
                                : Convert.ToInt32(episode.GetXmlData("thumb_width")),
                        TmsExport = episode.GetXmlData("tms_export"),
                        Writers = new List<string>(episode.GetXmlData("Writer").Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
                    };

                    result.Add(ep);
                }

                return result;
            }