本文整理汇总了C#中Category.GetOtherAsString方法的典型用法代码示例。如果您正苦于以下问题:C# Category.GetOtherAsString方法的具体用法?C# Category.GetOtherAsString怎么用?C# Category.GetOtherAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category.GetOtherAsString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVideos
public override List<VideoInfo> GetVideos(Category category)
{
HasNextPage = false;
List<VideoInfo> videos;
if (category.Other is string && category.GetOtherAsString() == episodeVideosState)
{
currentVideoUrl = "";
currentVideoOffset = 0;
videos = GetVideos((category as RssLink).Url);
}
else
{
currentVideoUrl = (category as RssLink).Url;
currentVideoOffset = 0;
videos = GetVideos(string.Format(currentVideoUrl, currentVideoOffset));
HasNextPage = videos.Count > 19;
}
return videos;
}
示例2: GetVideos
public override List<VideoInfo> GetVideos(Category category)
{
HasNextPage = false;
if (category is SvtCategory)
{
return (category as SvtCategory).Videos;
}
else if (category.GetOtherAsString() != "isChannels")
{
currentVideosUrl = (category as RssLink).Url;
currentVideosPage = 1;
bool hasNext = false;
List<VideoInfo> videos = GetVideos(currentVideosUrl, currentVideosPage, out hasNext);
HasNextPage = hasNext;
return videos;
}
else
{
return GetChannelVideos();
}
}
示例3: GetVideos
public override List<VideoInfo> GetVideos(Category category)
{
if (category.Other is string && category.GetOtherAsString() == "forum")
throw new OnlineVideosException("Visit http://tinyurl.com/olv-hbonordic");
List<VideoInfo> videos = new List<VideoInfo>();
string url = ConstructUrl((category as RssLink).Url);
XmlDocument xDoc = HboWebCache.Instance.GetWebData<XmlDocument>(url, referer: BaseUrl, headers: ConstructNameValueCollection(), cache: false);
foreach (XmlElement item in xDoc.SelectNodes("//item"))
{
//I don't know how to select with namespace...
XmlNodeList medias = item.GetElementsByTagName("media:group")[0].ChildNodes;
XmlElement thumb = null;
foreach (XmlElement elt in medias)
{
if (elt.Name == "media:thumbnail")
{
thumb = elt;
break;
}
}
string title = item.GetElementsByTagName("title")[0].InnerText;
XmlNodeList episodeNodes = item.GetElementsByTagName("clearleap:episodeInSeason");
if (episodeNodes != null && episodeNodes.Count > 0)
{
string episode = episodeNodes[0].InnerText;
string season = item.GetElementsByTagName("clearleap:season")[0].InnerText;
string series = item.GetElementsByTagName("clearleap:series")[0].InnerText;
int s = 0;
int e = 0;
int.TryParse(episode, out e);
int.TryParse(season, out s);
title = series + " - " + s + "x" + (e > 9 ? e.ToString() : "0" + e.ToString()) + " " + title;
}
bool isSaved = false;
XmlNodeList savedAsset = item.GetElementsByTagName("clearleap:savedAsset");
if (savedAsset != null && savedAsset.Count > 0)
{
bool.TryParse(savedAsset[0].InnerText, out isSaved);
}
string other = @"{{""saved"":{0}, ""guid"":""{1}""}}";
XmlNodeList desc = item.GetElementsByTagName("description");
videos.Add(new VideoInfo()
{
Title = title,
Description = (desc != null && desc.Count > 0) ? desc[0].InnerText : string.Empty,
Thumb = (thumb != null) ? thumb.Attributes["url"].Value : "",
Other = string.Format(other, isSaved.ToString().ToLower(), item.GetElementsByTagName("guid")[0].InnerText)
});
}
return videos;
}
示例4: GetVideos
public override List<VideoInfo> GetVideos(Category category)
{
HasNextPage = false;
List<VideoInfo> videos;
if (cApiContentTypeTvSeries == category.GetOtherAsString())
{
CurrentSeriesVideoUrl = (category as RssLink).Url;
CurrentSeriesVideoOffset = 0;
CurrentSeriesCategoryName = category.Name;
videos = GetSeriesVideos();
}
else if (cApiContentTypeTvLive == category.GetOtherAsString())
{
videos = GetLiveVideos();
}
else if (cArchiveCategory == category.GetOtherAsString())
{
videos = GetArchiveVideos(category);
}
else
{
videos = new List<VideoInfo>();
string url = string.Format(cUrlProgramFormat, BaseUrl, (category as RssLink).Url, AppInfo.AppId, AppInfo.AppKey);
JObject json = GetWebData<JObject>(url);
JToken data = json["data"];
VideoInfo video = GetVideoInfoFromJsonData(data, false);
if (video != null)
{
videos.Add(video);
}
}
return videos;
}
示例5: DiscoverSubCategories
public override int DiscoverSubCategories(Category parentCategory)
{
string other = parentCategory.GetOtherAsString();
string url = baseUrl + (parentCategory as RssLink).Url;
if (string.IsNullOrEmpty(other))
{
parentCategory.SubCategories = DiscoverSubCategoriesFromListing(url);
}
else
{
string data = GetWebData(url);
Regex r = new Regex(@"showRowText"">(?<n>.*?)</div>.*?<a href=""(?<u>[^""]*?-" + other + @")""", RegexOptions.Singleline);
parentCategory.SubCategories = new List<Category>();
foreach (Match m in r.Matches(data))
{
RssLink cat = new RssLink()
{
Name = m.Groups["n"].Value,
Url = m.Groups["u"].Value,
HasSubCategories = other == "shows"
};
parentCategory.SubCategories.Add(cat);
}
}
parentCategory.SubCategories.ForEach(c => c.ParentCategory = parentCategory);
parentCategory.SubCategoriesDiscovered = parentCategory.SubCategories.Count() > 0;
return parentCategory.SubCategories.Count();
}