Exemple #1
0
        /// <summary>
        /// 分页输出
        /// </summary>
        private string CreatePageList(RecommandNode recommand, IEnumerable <int> videos, NavFilter filter, VideoPars pars, bool isEx)
        {
            var xml = new XElement("vlist");

            xml.Add(new XElement("nav_id", recommand.Id),
                    new XElement("nav_name", recommand.Language[filter.lang].Title),
                    new XElement("count", 0),
                    new XElement("page_count", 0)
                    );
            var count = videos.PageList(filter, pars, xml, isEx);

            xml.Element("count").SetValue(count);
            xml.Element("page_count").SetValue(PageUtils.PageCount(count, filter.c));
            return(xml.ToString(SaveOptions.DisableFormatting));
        }
Exemple #2
0
        /// <summary>
        /// 得到该推荐分类下的频道数
        /// </summary>
        private int GetChannelCount(RecommandNode node, VideoNodeKey key, NavFilter filter, List <Func <VideoBase, ExFilterBase, bool> > filters)
        {
            int count = 0;

            if (node.Channels.ContainsKey(key))
            {
                var cs = node.Channels[key];
                foreach (var c in cs)
                {
                    var result = true;
                    foreach (var f in filters)
                    {
                        result = result && f(ListCache.Instance.Dictionary[c], filter);
                    }
                    if (result)
                    {
                        count++;
                    }
                }
            }
            return(count);
        }
Exemple #3
0
 /// <summary>
 /// 分页输出
 /// </summary>
 private string CreatePageList(RecommandNode recommand, IEnumerable<int> videos, NavFilter filter, VideoPars pars, bool isEx)
 {
     var xml = new XElement("vlist");
     xml.Add(new XElement("nav_id", recommand.Id),
         new XElement("nav_name", recommand.Language[filter.lang].Title),
         new XElement("count", 0),
         new XElement("page_count", 0)
         );
     var count = videos.PageList(filter, pars, xml, isEx);
     xml.Element("count").SetValue(count);
     xml.Element("page_count").SetValue(PageUtils.PageCount(count, filter.c));
     return xml.ToString(SaveOptions.DisableFormatting);
 }
Exemple #4
0
 /// <summary>
 /// 得到该推荐分类下的频道数
 /// </summary>
 private int GetChannelCount(RecommandNode node, VideoNodeKey key, NavFilter filter, List<Func<VideoBase, ExFilterBase, bool>> filters)
 {
     int count = 0;
     if (node.Channels.ContainsKey(key))
     {
         var cs = node.Channels[key];
         foreach (var c in cs)
         {
             var result = true;
             foreach (var f in filters)
             {
                 result = result && f(ListCache.Instance.Dictionary[c], filter);
             }
             if (result)
                 count++;
         }
     }
     return count;
 }