本文整理汇总了C#中Category.RememberDiscoveredItems方法的典型用法代码示例。如果您正苦于以下问题:C# Category.RememberDiscoveredItems方法的具体用法?C# Category.RememberDiscoveredItems怎么用?C# Category.RememberDiscoveredItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category.RememberDiscoveredItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DiscoverSubCategories
//.........这里部分代码省略.........
HtmlNode pDesc = enableDesc ? episode.SelectSingleNode(".//p[@class = 'synopsis']") : null;
parentCategory.SubCategories.Add(new RssLink()
{
Name = season + (seqNum.Count() < 2 ? ("0" + seqNum) : seqNum) + " " + episode.SelectSingleNode("span[@class = 'episodeTitle']").InnerText,
Url = episode.GetAttributeValue("data-episodeid", ""),
ParentCategory = parentCategory,
Thumb = parentCategory.Thumb,
Description = pDesc != null ? pDesc.InnerText : "",
HasSubCategories = false
});
}
}
#endregion
#region Netflix title
else
{
data = MyGetWebData(string.Format(netflixOrgEpisodes, apiRoot, (parentCategory as RssLink).Url, latestAuthUrl));
rgx = new Regex(@"({""title"":[^$]*)");
m = rgx.Match(data);
if (m.Success)
{
data = m.Groups[1].Value;
json = (JObject)JsonConvert.DeserializeObject(data);
foreach (JArray seasonArray in json["episodes"])
{
foreach (JToken episode in seasonArray.Where(e => e["availableForED"] == null || e["availableForED"].Value<bool>()))
{
int e = (int)episode["episode"];
int s = (int)episode["season"];
RssLink cat = new RssLink()
{
Name = s + "x" + (e < 10 ? ("0" + e) : e.ToString()) + " " + (string)episode["title"],
ParentCategory = parentCategory,
Thumb = parentCategory.Thumb,
HasSubCategories = false,
Url = episode["episodeId"].ToString()
};
JToken stills = episode["stills"];
if (stills != null && stills.Count() > 0)
{
cat.Thumb = stills.Last()["url"].Value<string>();
}
if (enableDesc)
{
cat.Description = episode["synopsis"].Value<string>();
}
parentCategory.SubCategories.Add(cat);
}
}
parentCategory.SubCategories.Sort((c1, c2) => c1.Name.CompareTo(c2.Name));
}
#endregion
}
}
#endregion
#region Movies
else
{
parentCategory.SubCategories.Add(new RssLink() { Description = GetTitleDescription((parentCategory as RssLink).Url, parentCategory.GetTrackId()), Name = parentCategory.Name, Url = (parentCategory as RssLink).Url, Thumb = parentCategory.Thumb, ParentCategory = parentCategory, HasSubCategories = false });
}
#endregion
}
}
#endregion
#region Episodes
else
{
string jsonData = MyGetWebData((parentCategory as RssLink).Url);
JObject json = (JObject)JsonConvert.DeserializeObject(jsonData);
string data = (string)json["html"];
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(data);
HtmlNode docNode = doc.DocumentNode;
HtmlNode episodes = docNode.SelectSingleNode("//ul[@class = 'episodeList']");
foreach (HtmlNode episode in episodes.SelectNodes("li"))
{
string seqNum = episode.SelectSingleNode("span[@class = 'seqNum']").InnerText;
HtmlNode pDesc = enableDesc ? episode.SelectSingleNode(".//p[@class = 'synopsis']") : null;
parentCategory.SubCategories.Add(new RssLink()
{
Name = parentCategory.Name.Replace("Season", "") + "x" + (seqNum.Count() < 2 ? ("0" + seqNum) : seqNum) + " " + episode.SelectSingleNode("span[@class = 'episodeTitle']").InnerText,
Url = episode.GetAttributeValue("data-episodeid", ""),
ParentCategory = parentCategory,
Thumb = parentCategory.Thumb,
Description = pDesc != null ? pDesc.InnerText : "",
HasSubCategories = false
});
}
}
#endregion
parentCategory.SubCategoriesDiscovered = parentCategory.RememberDiscoveredItems() && parentCategory.SubCategories.Count > 0;
return parentCategory.SubCategories.Count;
}