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


C# Category.IsTitleState方法代码示例

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


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

示例1: GetContextMenuEntries

 public override List<ContextMenuEntry> GetContextMenuEntries(Category selectedCategory, VideoInfo selectedItem)
 {
     List<ContextMenuEntry> result = new List<ContextMenuEntry>();
     if (enableAddRemoveMylist && selectedItem == null && selectedCategory.IsTitleState())
     {
         try
         {
             if (!string.IsNullOrEmpty(selectedCategory.GetTrackId()))
             {
                 string data = MyGetWebData(string.Format(bobUrl, ShaktiApi, BuildId, (selectedCategory as RssLink).Url, selectedCategory.GetTrackId(), latestAuthUrl));
                 JObject json = (JObject)JsonConvert.DeserializeObject(data);
                 if (json["isMovie"].Value<bool>() || json["isShow"].Value<bool>())
                 {
                     bool inPlayList = json["inPlayList"].Value<bool>();
                     ContextMenuEntry entry = new ContextMenuEntry() { DisplayText = (inPlayList ? "Remove from " : "Add to ") + "My List" };
                     result.Add(entry);
                 }
             }
         }
         catch { }
     }
     if (enableAddRemoveMylist && selectedItem != null && selectedItem.Other is SerializableDictionary<string,string>)
     {
         try
         {
             SerializableDictionary<string, string> other = selectedItem.Other as SerializableDictionary<string, string>;
             if (other.ContainsKey("TrackId") && other.ContainsKey("VideoId"))
             {
                 string data = MyGetWebData(string.Format(bobUrl, ShaktiApi, BuildId, other["VideoId"], other["TrackId"], latestAuthUrl));
                 JObject json = (JObject)JsonConvert.DeserializeObject(data);
                 if (json["isMovie"].Value<bool>() || json["isShow"].Value<bool>())
                 {
                     bool inPlayList = json["inPlayList"].Value<bool>();
                     ContextMenuEntry entry = new ContextMenuEntry() { DisplayText = (inPlayList ? "Remove from " : "Add to ") + "My List" };
                     result.Add(entry);
                 }
             }
         }
         catch { }
     }
     return result;
 }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:42,代码来源:NetfilxWebUtil.cs

示例2: DiscoverSubCategories


//.........这里部分代码省略.........
                string agid = HttpUtility.ParseQueryString(uri.Query).Get("agid");
                if (!string.IsNullOrEmpty(ShaktiApi) && !string.IsNullOrEmpty(BuildId) && !string.IsNullOrEmpty(agid))
                {
                    data = MyGetWebData(string.Format(genreUrl, ShaktiApi, BuildId, agid, 0, 50, BrowseSort));
                    JObject json = (JObject)JsonConvert.DeserializeObject(data);
                    foreach (JObject item in json["catalogItems"])
                    {
                        RssLink category = new RssLink()
                        {
                            Name = (string)item["title"],
                            Url = ((int)item["titleId"]).ToString(),
                            Thumb = (string)item["boxart"],
                            ParentCategory = parentCategory,
                            HasSubCategories = true,
                            Description = enableDesc && enableDescInListing ? GetTitleDescription(((int)item["titleId"]).ToString(), ((int)item["trackId"]).ToString()) : ""
                        };
                        category.SetState(NetflixUtils.TitleState);
                        if (enableDesc || enableAddRemoveMylist)
                            category.SetTrackId(((int)item["trackId"]).ToString());
                        parentCategory.SubCategories.Add(category);
                    }
                    if (parentCategory.SubCategories.Count >= 50)
                    {
                        NextPageCategory next = new NextPageCategory() { Url = string.Format(genreUrl, ShaktiApi, BuildId, agid, "START_INDEX", "STOP_INDEX", BrowseSort), ParentCategory = parentCategory };
                        next.SetState(NetflixUtils.TitleState);
                        next.SetStartIndex("51");
                        parentCategory.SubCategories.Add(next);
                    }
                }
            }
            #endregion

            #region Title
            else if (parentCategory.IsTitleState())
            {
                string data = MyGetWebData(movieUrl + (parentCategory as RssLink).Url);
                Regex rgx = new Regex(@"nf\.constants\.page\.contextData =(.*); }\(netflix\)\);");
                Match m = rgx.Match(data);
                if (m.Success)
                {
                    string jsonData = m.Groups[1].Value;
                    JObject json = (JObject)JsonConvert.DeserializeObject(jsonData);

                    #region Series
                    if ((bool)json["displayPage"]["data"]["isShow"])
                    {

                        #region Multiple seasons
                        if (data.Contains("class=\"seasonItem"))
                        {
                            HtmlDocument doc = new HtmlDocument();
                            doc.LoadHtml(data);
                            foreach (HtmlNode li in doc.DocumentNode.SelectNodes("//li[starts-with(@class, 'seasonItem')]"))
                            {
                                HtmlNode a = li.SelectSingleNode("a");
                                RssLink season = new RssLink()
                                {
                                    Name = "Season " + a.InnerText,
                                    Url = string.Format(seasonDetailsUrl, (parentCategory as RssLink).Url, a.GetAttributeValue("data-vid", "")),
                                    HasSubCategories = true,
                                    ParentCategory = parentCategory,
                                    Thumb = parentCategory.Thumb
                                };
                                season.SetState(NetflixUtils.EpisodesState);
                                parentCategory.SubCategories.Add(season);
                            }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:67,代码来源:NetfilxWebUtil.cs


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