当前位置: 首页>>代码示例>>C#>>正文


C# XDocument.GetSeriesData方法代码示例

本文整理汇总了C#中System.Xml.Linq.XDocument.GetSeriesData方法的典型用法代码示例。如果您正苦于以下问题:C# XDocument.GetSeriesData方法的具体用法?C# XDocument.GetSeriesData怎么用?C# XDocument.GetSeriesData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Linq.XDocument的用法示例。


在下文中一共展示了XDocument.GetSeriesData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildShow

 private static Show BuildShow(XDocument doc)
 {
     return new Show {
         ID = doc.GetSeriesData("id"),
         ImdbID = doc.GetSeriesData("IMDB_ID"),
         Name = doc.GetSeriesData("SeriesName"),
         Language = doc.GetSeriesData("Language"),
         Network = doc.GetSeriesData("Network"),
         Description = doc.GetSeriesData("Overview"),
         Rating = string.IsNullOrWhiteSpace(doc.GetSeriesData("Rating"))
                         ? (double?)null
                         : Convert.ToDouble(doc.GetSeriesData("Rating"),
                                         System.Globalization.CultureInfo.InvariantCulture),
         RatingCount = string.IsNullOrWhiteSpace(doc.GetSeriesData("RatingCount"))
                             ? 0
                             : Convert.ToInt32(doc.GetSeriesData("RatingCount")),
         Runtime = string.IsNullOrWhiteSpace(doc.GetSeriesData("Runtime"))
                         ? (int?)null
                         : Convert.ToInt32(doc.GetSeriesData("Runtime")),
         Banner = doc.GetSeriesData("banner"),
         Fanart = doc.GetSeriesData("fanart"),
         LastUpdated = string.IsNullOrWhiteSpace(doc.GetSeriesData("lastupdated"))
                             ? (long?)null
                             : Convert.ToInt64(doc.GetSeriesData("lastupdated")),
         Poster = doc.GetSeriesData("poster"),
         Zap2ItID = doc.GetSeriesData("zap2it_id"),
         FirstAired = Utils.ParseDate(doc.GetSeriesData("FirstAired")),
         AirTime = string.IsNullOrWhiteSpace(doc.GetSeriesData("Airs_Time"))
                         ? (TimeSpan?)null
                         : Utils.ParseTime(doc.GetSeriesData("Airs_Time")),
         AirDay = string.IsNullOrWhiteSpace(doc.GetSeriesData("Airs_DayOfWeek"))
                         ? (DayOfWeek?)null
                         : (DayOfWeek)Enum.Parse(typeof(DayOfWeek), doc.GetSeriesData("Airs_DayOfWeek")),
         Status = string.IsNullOrWhiteSpace(doc.GetSeriesData("Status"))
                         ? Status.Unknown
                         : (Status)Enum.Parse(typeof(Status), doc.GetSeriesData("Status")),
         ContentRating = Utils.GetContentRating(doc.GetSeriesData("ContentRating")),
         Genres = new List<string>(doc.GetSeriesData("Genre").Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)),
         Actors = new List<string>(doc.GetSeriesData("Actors").Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)),
         Episodes = BuildEpisodes(doc)
     };
 }
开发者ID:Krusen,项目名称:TVDBSharp,代码行数:42,代码来源:Builder.cs

示例2: ShowBuilder

            public ShowBuilder(XDocument doc)
            {
                _show = doc.Root
                    .Elements("Series")
                    .Select(show => new Show
                    {
                        Id = int.Parse(show.Attribute("id").ToString()),
                        ImdbId = show.Attribute("IMDB_ID").ToString(),
                        Name = show.Attribute("SeriesName").ToString(),
                        Language = show.Attribute("Language").ToString(),
                        Network = show.Attribute("Network").ToString(),
                        Description = show.Attribute("Overview").ToString(),
                        Rating = string.IsNullOrWhiteSpace(show.Attribute("Rating").ToString())
                            ? (double?)null
                            : Convert.ToDouble(show.Attribute("Rating").ToString(), CultureInfo.InvariantCulture),
                        RatingCount = string.IsNullOrWhiteSpace(show.Attribute("RatingCount").ToString())
                            ? 0
                            : Convert.ToInt32(show.Attribute("RatingCount").ToString()),
                        Runtime = string.IsNullOrWhiteSpace(show.Attribute("Runtime").ToString())
                            ? 0
                            : Convert.ToInt32(show.Attribute("Runtime").ToString()),
                        Banner = GetBannerUri(show.Attribute("banner").ToString()),
                        Fanart = GetBannerUri(show.Attribute("fanart").ToString()),
                        LastUpdated = string.IsNullOrWhiteSpace(show.Attribute("lastupdated").ToString())
                            ? (long?)null
                            : Convert.ToInt64(show.Attribute("lastupdated").ToString()),
                        Poster = GetBannerUri(show.Attribute("poster").ToString()),
                        Zap2ItID = show.Attribute("zap2it_id").ToString(),
                        FirstAired = string.IsNullOrWhiteSpace(show.Attribute("FirstAired").ToString())
                            ? (DateTime?)null
                            : DateTime.ParseExact(show.Attribute("FirstAired").ToString(), "yyyy-MM-dd", CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal)
                    })
                    .FirstOrDefault();

                _show = new Show();
                _show.Id = int.Parse(doc.GetSeriesData("id"));
                _show.ImdbId = doc.GetSeriesData("IMDB_ID");
                _show.Name = doc.GetSeriesData("SeriesName");
                _show.Language = doc.GetSeriesData("Language");
                _show.Network = doc.GetSeriesData("Network");
                _show.Description = doc.GetSeriesData("Overview");
                _show.Rating = string.IsNullOrWhiteSpace(doc.GetSeriesData("Rating"))
                    ? (double?) null
                    : Convert.ToDouble(doc.GetSeriesData("Rating"),
                        System.Globalization.CultureInfo.InvariantCulture);
                _show.RatingCount = string.IsNullOrWhiteSpace(doc.GetSeriesData("RatingCount"))
                    ? 0
                    : Convert.ToInt32(doc.GetSeriesData("RatingCount"));
                _show.Runtime = string.IsNullOrWhiteSpace(doc.GetSeriesData("Runtime"))
                    ? (int?) null
                    : Convert.ToInt32(doc.GetSeriesData("Runtime"));
                _show.Banner = GetBannerUri(doc.GetSeriesData("banner"));
                _show.Fanart = GetBannerUri(doc.GetSeriesData("fanart"));
                _show.LastUpdated = string.IsNullOrWhiteSpace(doc.GetSeriesData("lastupdated"))
                    ? (long?) null
                    : Convert.ToInt64(doc.GetSeriesData("lastupdated"));
                _show.Poster = GetBannerUri(doc.GetSeriesData("poster"));
                _show.Zap2ItID = doc.GetSeriesData("zap2it_id");
                _show.FirstAired = string.IsNullOrWhiteSpace(doc.GetSeriesData("FirstAired"))
                    ? (DateTime?) null
                    : Utils.ParseDate(doc.GetSeriesData("FirstAired"));
                _show.AirTime = string.IsNullOrWhiteSpace(doc.GetSeriesData("Airs_Time"))
                    ? (TimeSpan?) null
                    : Utils.ParseTime(doc.GetSeriesData("Airs_Time"));
                _show.AirDay = string.IsNullOrWhiteSpace(doc.GetSeriesData("Airs_DayOfWeek"))
                    ? (Frequency?) null
                    : (Frequency) Enum.Parse(typeof (Frequency), doc.GetSeriesData("Airs_DayOfWeek"));
                _show.Status = string.IsNullOrWhiteSpace(doc.GetSeriesData("Status"))
                    ? Status.Unknown
                    : (Status) Enum.Parse(typeof (Status), doc.GetSeriesData("Status"));
                _show.ContentRating = Utils.GetContentRating(doc.GetSeriesData("ContentRating"));
                _show.Genres =
                    new List<string>(doc.GetSeriesData("Genre")
                        .Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries));
                _show.Actors =
                    new List<string>(doc.GetSeriesData("Actors")
                        .Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries));
                _show.Episodes = new EpisodesBuilder(doc).BuildEpisodes();
            }
开发者ID:Rigby93,项目名称:TVDBSharp,代码行数:79,代码来源:Builder.cs


注:本文中的System.Xml.Linq.XDocument.GetSeriesData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。