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


C# Category.Type方法代码示例

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


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

示例1: LoadCategories

        /// <summary>
        /// Request that the categories get loaded - we do this and then populate the LoadedCategories property
        /// </summary>
        /// <returns></returns>
        public List<Category> LoadCategories(Category parentCategory = null)
        {
            var result = new List<Category>();
            if (parentCategory == null)
            {
                result.Add(new Category { Name = "Catch up", SubCategoriesDiscovered = false, HasSubCategories = true, Other = "C~a27eef2528673410VgnVCM100000255212ac____" });
                //result.Add(new Category { Name = "Live TV", SubCategoriesDiscovered = false, HasSubCategories = false, Other = "L~Live_TV" });
                result.Add(new Category { Name = "Sky Movies", SubCategoriesDiscovered = false, HasSubCategories = true, Other = "R~7fc1acce88d77410VgnVCM1000000b43150a____" });
                result.Add(new Category { Name = "TV Box Sets", SubCategoriesDiscovered = false, HasSubCategories = true, Other = "B~9bb07a0acc5a7410VgnVCM1000000b43150a____" });
            }
            else
            {
                switch (parentCategory.Type())
                { 
                    case SkyGoCategoryData.CategoryType.CatchUp:
                        LoadCatchupInformation(parentCategory);
                        break;
                    default:
                        LoadSubCategories(parentCategory, parentCategory.Type() != SkyGoCategoryData.CategoryType.CatchUpSubCategory);
                        break;
                }
            }

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

示例2: LoadGeneralCategoryFromListItem

        /// <summary>
        /// Parse a list item node as a category
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static Category LoadGeneralCategoryFromListItem(this HtmlNode node, Category parentCategory)
        {
            var result = new Category();

            result.Name = node.GetNodeByClass("title").InnerText.Replace("&amp;", "&");
            var categoryInfoUrl = Properties.Resources._4OD_RootUrl + node.GetNodeByClass("promo-link").GetAttribute("href");

            var series = node.GetNodeByClass("series-info");
            if (series == null)
                series = node.GetNodeByClass("programme-count");

            result.Description = node.GetNodeByClass("synopsis").InnerText + (series == null ? string.Empty : " (" + series.InnerText + ")");
            result.ParentCategory = parentCategory;

            var image = node.GetNodeByClass("main-image");
            if (image == null)
                image = node.DescendantNodes().Where(x => !string.IsNullOrEmpty(x.GetAttribute("src"))).FirstOrDefault();
            if (image != null)
                result.Thumb = image.GetAttribute("src"); //Properties.Resources._4OD_RootUrl + 
            
            // Collections don't have sub categories
            if (parentCategory.Type() == _4ODCategoryData.CategoryType.GeneralCategory)
            {
                result.HasSubCategories = true;
                var id = node.GetAttribute("data-brandwst");
                result.Other = "P~" + node.GetAttribute("data-brandwst") + "~" + categoryInfoUrl.Replace("collections", "collection") + ".xml";
            }
            else
            {
                result.HasSubCategories = false;
                result.Other = "C~~" + categoryInfoUrl.Replace("collections", "collection") + ".xml";
            }


            return result;
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:41,代码来源:_4ODCategoryParser.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: LoadVideos

        /// <summary>
        /// Load the videos for this category - either from the cache, or loaded from the video info page in the site
        /// </summary>
        /// <param name="parentCategory"></param>
        /// <returns></returns>
        public List<VideoInfo> LoadVideos(Category parentCategory)
        {
            if (parentCategory.Type() == SkyGoCategoryData.CategoryType.LiveTv)
            {
                var channels = Properties.Resources.SkyGo_LiveTvListingUrl.GetChannelsFromURL();
                return channels;
            }

            if (_cachedVideos.Where(x => x.Value.Contains("*" + parentCategory.Other + parentCategory.Name + "*")).Count() > 0)
                return _cachedVideos.Where(x => x.Value.Contains("*" + parentCategory.Other + parentCategory.Name + "*")).Select(x => x.Key).ToList();
            return LoadGeneralVideos(parentCategory);
        }
开发者ID:QuarterP,项目名称:mp-onlinevideos2,代码行数:17,代码来源:SkyGoInformationConnector.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

示例7: DiscoverSubCategories

 /// <summary>
 /// Build the sub category list
 /// </summary>
 /// <param name="parentCategory"></param>
 /// <returns></returns>
 public List<Category> DiscoverSubCategories(Category parentCategory)
 {
    switch(parentCategory.Type())
    {
        case _4ODCategoryData.CategoryType.GeneralCategory:
        case _4ODCategoryData.CategoryType.Collection:
            parentCategory.SubCategories = LoadGeneralCategory(parentCategory);
            break;
        case _4ODCategoryData.CategoryType.Programme:
            parentCategory.SubCategories = _4ODCategoryParser.LoadProgrammeInfo(parentCategory);
            break;
        case _4ODCategoryData.CategoryType.CatchUp:
            parentCategory.SubCategories = _4ODCategoryParser.LoadCatchUpDays(parentCategory);
            break;
    }
    return parentCategory.SubCategories;
 }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:22,代码来源:_4ODInformationConnector.cs

示例8: LoadVideos

        /// <summary>
        /// Video list
        /// </summary>
        /// <param name="parentCategory"></param>
        /// <returns></returns>
        public List<VideoInfo> LoadVideos(Category parentCategory)
        {
            switch (parentCategory.Type())
            {
                case _4ODCategoryData.CategoryType.Programme:
                    return _4ODVideoParser.LoadGeneralVideos(parentCategory);
                case _4ODCategoryData.CategoryType.Collection:
                    return _4ODVideoParser.LoadCollectionVideos(parentCategory);
                case  _4ODCategoryData.CategoryType.CatchUp:
                    return _4ODVideoParser.LoadCatchUpVideos(parentCategory);
            }

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


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