本文整理汇总了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;
}
示例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);
}