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


C# Category.CategoryId方法代码示例

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


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

示例1: LoadCatchUpVideos

        /// <summary>
        /// Load videos for the specified catch up category (day/channel)
        /// </summary>
        /// <param name="parentCategory"></param>
        /// <returns></returns>
        public static List<VideoInfo> LoadCatchUpVideos(Category parentCategory)
        {
            var doc = new HtmlDocument();
            var results = new List<VideoInfo>();
            var webRequest = (HttpWebRequest)WebRequest.Create(parentCategory.CategoryInformationPage());
            var webResponse = (HttpWebResponse)webRequest.GetResponse();

            if (webResponse.StatusCode != HttpStatusCode.OK)
                throw new OnlineVideosException("Unable to retrieve response for 4OD Catch Up Video from " + parentCategory.CategoryInformationPage() + ", received " + webResponse.StatusCode.ToString());

            doc.Load(webResponse.GetResponseStream());

            var node = doc.GetElementsByTagName("span").Where(x => x.GetAttribute("class").Contains("tx-" + parentCategory.CategoryId())).FirstOrDefault();

            if (node != null)
            {
                foreach (HtmlNode listItem in node.ParentNode.ParentNode.SelectSingleNode("ul").SelectNodes("li"))
                {
                    var item = new VideoInfo();
                    item.Title = listItem.GetNodeByClass("title").InnerText + (listItem.GetNodeByClass("series-info") == null ? string.Empty : " - " + listItem.GetNodeByClass("series-info").InnerText);
                    item.Description = listItem.GetNodeByClass("synopsis").InnerText;
                    item.Airdate = listItem.GetNodeByClass("txtime").InnerText;
                    //item.ImageUrl = Properties.Resources._4OD_RootUrl + listItem.SelectSingleNode("a/img").GetAttribute("src");
                    item.Thumb = listItem.SelectSingleNode("a/img").GetAttribute("src");
                    item.Other = MakeWebSafe(listItem.GetNodeByClass("title").InnerText) + "~" + listItem.SelectSingleNode("a").GetAttribute("href").Split('#')[1];
                    results.Add(item);
                }
            }

            return results;
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:36,代码来源:_4ODVideoParser.cs

示例2: LoadGeneralVideos

        /// <summary>
        /// Load general video info (videos we haven't cached)
        /// </summary>
        /// <param name="series"></param>
        /// <returns></returns>
        private List<VideoInfo> LoadGeneralVideos(Category series)
        {
            var result = new List<VideoInfo>();
            var tmpObj = Properties.Resources.SkyGo_SeriesInfoUrl(series.CategoryId()).GetLinksTokensFromUrl(SkyGoCategoryData.CategoryType.Video);
            foreach (var item in tmpObj)
            {
                if (item.GetValue("_rel") == "episode/episode")
                {
                    result.Add(item.VideoInfoFromToken());
                }
                   
            }

            return result;
        }
开发者ID:QuarterP,项目名称:mp-onlinevideos2,代码行数:20,代码来源:SkyGoInformationConnector.cs

示例3: LoadCatchupInformation

        /// <summary>
        /// Load information for catch up category - it's structured differently from other areas
        /// </summary>
        /// <param name="parentCategory"></param>
        private void LoadCatchupInformation(Category parentCategory)
        {
            var tmpObj = Properties.Resources.SkyGo_CatchUpCategoriesUrl.GetLinksTokensFromUrl(SkyGoCategoryData.CategoryType.CatchUp);

            foreach (var item in tmpObj)
            {
                if (item.GetValue("_rel") == "child/node")
                {
                    var categoryType = "CS~";

                    var catchUpItem = new Category();
                    catchUpItem.Name = item.GetValue("_title");
                    if (catchUpItem.Name == "Featured") continue;

                    var id = item.GetIdFromHrefValue();

                    if (!item.GetValue("_attributes").Contains("\"classifier\": \"page\"")) categoryType = "C1~";

                    catchUpItem.Other = categoryType + id;

                    if (catchUpItem.Type() != SkyGoCategoryData.CategoryType.CatchUpSubCategory)
                    {
                        // We have to do an extra lookup for the "All" sub category
                        var tmpObj2 = Properties.Resources.SkyGo_CatchUpSubItemsUrl(catchUpItem.CategoryId()).GetLinksTokensFromUrl(SkyGoCategoryData.CategoryType.CatchUp);
                        foreach (var thisLink in tmpObj2)
                        {
                            if (thisLink.GetValue("_title") == "All")
                            {

                                if (catchUpItem.Name == "Demand 5") categoryType = "CS~";
                                catchUpItem.Other = categoryType + thisLink.GetIdFromHrefValue();

                                break;
                            }
                        }
                    }
                    catchUpItem.HasSubCategories = true;
                    catchUpItem.SubCategoriesDiscovered = false;
                    catchUpItem.ParentCategory = parentCategory;
                    parentCategory.SubCategoriesDiscovered = true;
                    parentCategory.HasSubCategories = true;
                    parentCategory.SubCategories.Add(catchUpItem);
                }
            }
        }
开发者ID:QuarterP,项目名称:mp-onlinevideos2,代码行数:49,代码来源:SkyGoInformationConnector.cs

示例4: LoadThisCategory

        /// <summary>
        /// Load a specific category into the parentCategory
        /// </summary>
        /// <param name="parentCategory"></param>
        /// <param name="currentChar"></param>
        private void LoadThisCategory(Category parentCategory, string currentChar)
        {
            lock (parentCategory)
            {
                VideoInfo video = null;

                var tmpObj = (currentChar == "" ? Properties.Resources.SkyGo_CatchUpSubItemsUrl(parentCategory.CategoryId()) : Properties.Resources.SkyGo_AllListUrl(parentCategory.CategoryId(), currentChar)).GetLinksTokensFromUrl(parentCategory.Type());
                if (tmpObj == null) return;

                foreach (var item in tmpObj)
                {
                    Category thisItem = null;
                    if (item["title"] != null)
                    {   
                        var contentType = item.GetValue("contentType");
                        if (contentType == "MOVIE" || contentType == "STANDARD_VIDEO")
                        {
                            if (contentType == "MOVIE")
                                video = item.VideoInfoFromToken("movies");
                            else
                                video = item.VideoInfoFromToken();
                            _cachedVideos.Add(video, "");
                        }
                        else
                        {
                            thisItem = new Category();
                            thisItem.Description = item.GetValue("synopsis") + "\r\n" + item.GetStarring();
                            thisItem.Name = item.GetValue("title");
                            thisItem.Other = "C~" + item.GetValue("id");
                            thisItem.SubCategoriesDiscovered = false;
                            thisItem.HasSubCategories = item.GetValue("contentType") != "SERIES";
                            thisItem.Thumb = item.GetImage();
                        }

                        if (item["categories"] != null && parentCategory.Type() != SkyGoCategoryData.CategoryType.CatchUpSubCategory)
                        {

                            foreach (var categ in item["categories"])
                            {
                                var tmpCateg = parentCategory.SubCategories.Where(x => x.Name == categ.ToString()).FirstOrDefault();

                                if (tmpCateg == null)
                                {
                                    tmpCateg = new Category();
                                    parentCategory.SubCategories.Add(tmpCateg);
                                }

                                tmpCateg.Other = parentCategory.Other;
                                tmpCateg.Name = categ.ToString();
                                if (video != null) _cachedVideos[video] += "*" + tmpCateg.Other + tmpCateg.Name + "*"; 
                                tmpCateg.SubCategoriesDiscovered = true;
                                tmpCateg.HasSubCategories = (thisItem != null);
                                if (tmpCateg.SubCategories == null) tmpCateg.SubCategories = new List<Category>();
                                if (thisItem != null)
                                {
                                    if (thisItem.ParentCategory == null)
                                        thisItem.ParentCategory = tmpCateg;
                                    tmpCateg.SubCategories.Add(thisItem);
                                }
                            }
                        }
                        else
                        {
                            parentCategory.SubCategories.Add(thisItem);
                            thisItem.ParentCategory = parentCategory;
                        }
                            
                    }
                }

            }
        }
开发者ID:QuarterP,项目名称:mp-onlinevideos2,代码行数:77,代码来源:SkyGoInformationConnector.cs

示例5: LoadCatchUpDays

        /// <summary>
        /// Load the days for catch up
        /// </summary>
        /// <param name="parentCategory"></param>
        /// <returns></returns>
        public static List<Category> LoadCatchUpDays(Category parentCategory)
        {
            var doc = new HtmlDocument();
            var results = new List<Category>();
            var webRequest = (HttpWebRequest)WebRequest.Create(Properties.Resources._4OD_CatchUpUrl);
            var webResponse = (HttpWebResponse)webRequest.GetResponse();

            if (webResponse.StatusCode != HttpStatusCode.OK)
                throw new OnlineVideosException("Unable to retrieve response for 4OD Catch Up Category from " + Properties.Resources._4OD_CatchUpUrl + ", received " + webResponse.StatusCode.ToString());

            doc.Load(webResponse.GetResponseStream());

            // Load all the days from the page

            foreach(HtmlNode node in doc.GetElementsByTagName("a").Where(x=>x.GetAttribute("href").StartsWith("/programmes/4od/catchup/date/")))
            {
                var result = new ExtendedCategory();
                var dateParts = node.GetAttribute("href").Replace("/programmes/4od/catchup/date/", "").Split('/');
                var videoDate = new DateTime(Convert.ToInt32(dateParts[0]), Convert.ToInt32(dateParts[1]), Convert.ToInt32(dateParts[2]));
                result.Name = parentCategory.Name + " - " + videoDate.ToString("dd MMMM yyyy");
                result.SortValue = videoDate.ToString("yyyyMMdd");
                result.Other = "U~" + parentCategory.CategoryId() + "~" + Properties.Resources._4OD_RootUrl + node.GetAttribute("href");
                result.Thumb = parentCategory.Thumb;
                result.HasSubCategories = false;
                result.ParentCategory = parentCategory;
                results.Add(result);
            }
  
            return results;
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:35,代码来源:_4ODCategoryParser.cs

示例6: LoadGeneralCategory

 /// <summary>
 /// Load general categories from the 4OD api page
 /// </summary>
 /// <param name="parentCategory"></param>
 /// <returns></returns>
 private List<Category> LoadGeneralCategory(Category parentCategory)
 {
     var url = Properties.Resources._4OD_CategoryListUrl(string.IsNullOrEmpty(parentCategory.CategoryId()) ? string.Empty : parentCategory.CategoryId() + "/");
     if (parentCategory.Type() == _4ODCategoryData.CategoryType.Collection)
         url = Properties.Resources._4OD_CollectionListUrl;
     var result = LoadGeneralCategory(url, parentCategory);
     return result;
 }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:13,代码来源:_4ODInformationConnector.cs


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