public static string ResOnlyset(VideoNode video, DetailFilter filter, bool isEx)
        {
            var xml = new XElement("v");

            xml.Add(
                new XElement("vid", video.Main.ChannelID),
                new XElement("title", video.Language[filter.lang].ChannelName),
                new XElement("subtitle", video.Language[filter.lang].SubTitle),
                new XElement("type", video.Type),
                new XElement("imgurl", video.ResImage),
                new XElement("sloturl", ImplUtils.SlogImageJoin(video.SlotImage)),
                new XElement("state", video.State),
                new XElement("total_state", video.BKInfo.Episode),
                new XElement("mark", video.BKInfo.Score),
                new XElement("video_list_count", video.StateCount)
                );
            if (filter.ver <= 1)
            {
                CreateLinkVer1(video, filter, xml);
            }
            else
            {
                CreateLinkVer2(video, filter, xml, isEx);
            }
            return(xml.ToString(SaveOptions.DisableFormatting));
        }
        /// <summary>
        /// 一代播放串
        /// </summary>
        private static void CreateLinkVer1(VideoNode video, DetailFilter filter, XElement xml)
        {
            var link = new XElement("video_list",
                                    new XAttribute("maxBytes", video.Language[filter.lang].MaxBytes),
                                    new XAttribute("maxChars", video.Language[filter.lang].MaxChars),
                                    new XAttribute("isNumber", video.IsNumber)
                                    );

            if (video.ViceChannels == null)
            {
                throw new ApplicationException("该节目为二代节目,请将参数ver设置为2");
            }
            if (video.ViceChannels.Count > 0)
            {
                video.ViceChannels.PageDetailVer1(filter, link, xml);
                xml.Add(new XElement("video_list_page_count", PageUtils.PageCount(video.StateCount, filter.c)));
            }
            else
            {
                xml.Add(new XElement("countInPage", 1),
                        new XElement("page", 1),
                        new XElement("video_list_page_count", 1)
                        );
                link.Add(new XElement("video",
                                      new XAttribute("id", video.Main.ChannelID),
                                      new XAttribute("title", video.Language[filter.lang].ChannelName),
                                      BoxUtils.GetXmlCData(video.PlayLink)
                                      ));
            }
            xml.Add(link);
        }
Exemple #3
0
 public string DetailsOnlySet(DetailFilter filter)
 {
     try
     {
         var video = ListCache.Instance.Dictionary[filter.vid];
         return(DetailRespnseUtils.ResOnlyset(video, filter, false));
     }
     catch (KeyNotFoundException)
     {
         return(NoVideos());
     }
     catch (Exception ex)
     {
         return(BoxUtils.FormatErrorMsg(ex));
     }
 }
        public static string ResList(VideoNode video, DetailFilter filter, bool isEx)
        {
            var xml  = new XElement("v");
            var res  = VideoUtils.FormatStrArray(10, video.Main.VideoWidth, "|", video.Main.VideoHeight);
            var flag = video.Flags.FormatListToStr(SplitArray.Line);

            xml.Add(
                new XElement("vid", video.Main.ChannelID),
                new XElement("title", video.Language[filter.lang].ChannelName),
                new XElement("subtitle", video.Language[filter.lang].SubTitle),
                new XElement("type", video.Type),
                new XElement("catalog", video.Language[filter.lang].CatalogTags),
                new XElement("director", video.Language[filter.lang].Directors),
                new XElement("act", video.Language[filter.lang].Actors),
                new XElement("year", video.YearTags),
                new XElement("area", video.Language[filter.lang].AreaTags),
                new XElement("imgurl", video.ResImage),
                new XElement("sloturl", ImplUtils.SlogImageJoin(video.SlotImage)),
                new XElement("state", video.State),
                new XElement("total_state", video.BKInfo.Episode),
                new XElement("note", ""),
                new XElement("mark", video.BKInfo.Score),
                new XElement("hot", ImplUtils.ConvertHot(video.Hot)),
                new XElement("pv", video.PV),
                new XElement("bitrate", video.Main.BitRate),
                new XElement("resolution", res),
                new XElement("flag", flag),
                new XElement("duration", video.Main.TimeLength / 60),
                new XElement("content", BoxUtils.GetXmlCData(video.Language[filter.lang].Introduction)),
                new XElement("onlinetime", video.Main.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("video_list_count", video.StateCount)
                );
            if (filter.ver <= 1)
            {
                CreateLinkVer1(video, filter, xml);
            }
            else
            {
                CreateLinkVer2(video, filter, xml, isEx);
            }
            return(xml.ToString(SaveOptions.DisableFormatting));
        }
 /// <summary>
 /// Задаются параеметры фильтрации
 /// </summary>
 /// <param name="filter"></param>
 public void SetFilterParameters(DetailCollectionFilter filter)
 {
     for (int i = 0; i < filter.Filters.Length; i++)
     {
         DetailFilter detailFilter = filter.Filters[i];
         if (detailFilter is PartNumberFilter)
         {
             PartNumberFilterAppliance = true;
             textBoxPartMask.Text      = ((PartNumberFilter)detailFilter).Mask;
         }
         if (detailFilter is SerialNumberFilter)
         {
             SerialNumberFilterAppliance = true;
             textBoxSerialMask.Text      = ((SerialNumberFilter)detailFilter).Mask;
         }
         if (detailFilter is DetailConditionFilter)
         {
             DetailConditionFilter detailConditionFilter = (DetailConditionFilter)detailFilter;
             SatisfactoryChecked    = detailConditionFilter.SatisfactoryAcceptance;
             NotSatisfactoryChecked = detailConditionFilter.NotSatisfactoryAcceptance;
             NotificationChecked    = detailConditionFilter.NotificationAcceptance;
         }
         if (detailFilter is ATAChapterFilter)
         {
             SelectCheckListBoxATAChapterByFilter(((ATAChapterFilter)detailFilter).TypeAppliance);
         }
         if (detailFilter is MaintananceFilter)
         {
             MaintananceFilter maintananceFilter = (MaintananceFilter)detailFilter;
             OnConditionChecked          = maintananceFilter.OnConditionAcceptance;
             HardTimeChecked             = maintananceFilter.HardTimeAcceptance;
             ConditionMonitroringChecked = maintananceFilter.ConditionMonitoringAcceptance;
             UnknownChecked = maintananceFilter.UnknownAcceptance;
         }
     }
 }
        private static void CreateLinkVer2(VideoNode video, DetailFilter filter, XElement xml, bool isEx)
        {
            var vir = video.Virtuals == null ? 0 : 1;

            xml.Add(new XElement("virtual", vir));
            var first = video;

            if (vir == 1) //虚拟频道,取第一条子频道
            {
                first = ListCache.Instance.Dictionary[video.Groups[0]];
            }
            if (first.StateCount <= 1)    //不带分集的正常频道
            {
                //var first = ListCache.Instance.Dictionary[video.Groups[0]];
                var link = new XElement("video_list2",
                                        new XAttribute("maxBytes", first.Language[filter.lang].MaxBytes),
                                        new XAttribute("maxChars", first.Language[filter.lang].MaxChars),
                                        new XAttribute("isNumber", first.IsNumber)
                                        );
                xml.Add(new XElement("countInPage", 1),
                        new XElement("page", 1),
                        new XElement("video_list_page_count", 1)
                        );
                var p = new XElement("playlink2",
                                     new XAttribute("id", first.Main.ChannelID),
                                     new XAttribute("title", first.ChannelName),
                                     new XAttribute("duration", first.Main.TimeLength)
                                     //new XAttribute("start_point", 60.22),
                                     //new XAttribute("end_point", 289.22)
                                     );
                var maxbit = 0; var maxres = string.Empty;
                IEnumerable <int> groups = first.Groups;
                if (isEx && first.Groups.Count > 1)
                {
                    var filters = VideoNodesUtil.FormateTagFilter(filter);
                    groups = first.Groups.Where(v =>
                    {
                        var result   = true;
                        VideoNode gv = ListCache.Instance.Dictionary[v];
                        foreach (var f in filters)     //过滤不符合的子频道
                        {
                            result = result && f(gv, filter);
                        }
                        return(result);
                    });
                }
                foreach (var g in groups)
                {
                    VideoNode gv  = ListCache.Instance.Dictionary[g];
                    var       res = VideoUtils.FormatStrArray(10, gv.Main.VideoWidth, "|", gv.Main.VideoHeight);
                    if (maxbit < gv.Main.BitRate)
                    {
                        maxbit = gv.Main.BitRate;
                        maxres = res;
                    }
                    p.Add(new XElement("source",
                                       new XAttribute("mark", gv.Language[filter.lang].Mark),
                                       new XAttribute("bitrate", gv.Main.BitRate),
                                       new XAttribute("filelength", gv.Main.TimeLength * gv.Main.BitRate * (1024 / 8)),
                                       new XAttribute("resolution", res),
                                       BoxUtils.GetXmlCData(gv.PlayLink))
                          );
                }
                link.Add(p);
                xml.Add(link);
                if (xml.Element("bitrate") != null)
                {
                    xml.Element("bitrate").SetValue(maxbit);
                    xml.Element("resolution").SetValue(maxres);
                }
            }
            else
            {
                var maxbit             = 0;
                var maxres             = string.Empty;
                List <VideoNode> vices = null;
                if (isEx && first.Groups.Count > 1)   //扩展接口,过滤分组子频道
                {
                    var filters = VideoNodesUtil.FormateTagFilter(filter);
                    vices = first.Groups.Where(v =>
                    {
                        var result   = true;
                        VideoNode gv = ListCache.Instance.Dictionary[v];
                        var res      = VideoUtils.FormatStrArray(10, gv.Main.VideoWidth, "|", gv.Main.VideoHeight);
                        if (maxbit < gv.Main.BitRate)   //最大码率赋值给主频道
                        {
                            maxbit = gv.Main.BitRate;
                            maxres = res;
                        }
                        foreach (var f in filters)     //过滤不符合的子频道
                        {
                            result = result && f(gv, filter);
                        }
                        return(result);
                    }).Select(v => ListCache.Instance.Dictionary[v]).ToPerfectList();
                }
                else     //非扩展接口
                {
                    vices = first.Groups.Where(v =>
                    {
                        VideoNode gv = ListCache.Instance.Dictionary[v];
                        var res      = VideoUtils.FormatStrArray(10, gv.Main.VideoWidth, "|", gv.Main.VideoHeight);
                        if (maxbit < gv.Main.BitRate)
                        {
                            maxbit = gv.Main.BitRate;
                            maxres = res;
                        }
                        return(true);
                    }).Select(v => ListCache.Instance.Dictionary[v]).ToPerfectList();
                }
                if (vices.Count < 1)   //分组里没有子集
                {
                    xml.Add(new XElement("video_list_page_count", 0));
                    xml.Element("video_list_count").SetValue(0);
                    xml.Element("bitrate").SetValue(0);
                    xml.Element("resolution").SetValue(0);
                    return;
                }
                if (xml.Element("bitrate") != null)
                {
                    xml.Element("bitrate").SetValue(maxbit);
                    xml.Element("resolution").SetValue(maxres);
                }
                var link = new XElement("video_list2",
                                        new XAttribute("maxBytes", vices[0].Language[filter.lang].MaxBytes),
                                        new XAttribute("maxChars", vices[0].Language[filter.lang].MaxChars),
                                        new XAttribute("isNumber", vices[0].IsNumber)
                                        );
                xml.Add(new XElement("video_list_page_count", PageUtils.PageCount(video.StateCount, filter.c)));
                vices.PageDetailVer2(filter, link, xml, first.StateCount);
                xml.Add(link);
            }
            if (vir == 1)
            {
                IEnumerable <int> virtuals = video.Virtuals;
                if (isEx)
                {
                    var filters = VideoNodesUtil.FormateTagFilter(filter);
                    virtuals.Where(v =>
                    {
                        var result   = true;
                        VideoNode gv = ListCache.Instance.Dictionary[v];
                        foreach (var f in filters)     //过滤不符合的子频道
                        {
                            result = result && f(gv, filter);
                        }
                        return(result);
                    });
                }
                var virs = new XElement("virtual_list");
                foreach (var virid in virtuals)
                {
                    VideoNode virnode = ListCache.Instance.Dictionary[virid];
                    virs.Add(new XElement("virtual",
                                          new XAttribute("vid", virid),
                                          new XAttribute("title", virnode.ChannelName),
                                          new XAttribute("imgurl", virnode.ResImage)
                                          ));
                }
                xml.Add(virs);
            }
        }
        public static string ResWithoutset(VideoNode video, DetailFilter filter, bool isEx)
        {
            var xml  = new XElement("v");
            var res  = VideoUtils.FormatStrArray(10, video.Main.VideoWidth, "|", video.Main.VideoHeight);
            var flag = video.Flags.FormatListToStr(SplitArray.Line);

            xml.Add(
                new XElement("vid", video.Main.ChannelID),
                new XElement("title", video.Language[filter.lang].ChannelName),
                new XElement("subtitle", video.Language[filter.lang].SubTitle),
                new XElement("type", video.Type),
                new XElement("catalog", video.Language[filter.lang].CatalogTags),
                new XElement("director", video.Language[filter.lang].Directors),
                new XElement("act", video.Language[filter.lang].Actors),
                new XElement("year", video.YearTags),
                new XElement("area", video.Language[filter.lang].AreaTags),
                new XElement("imgurl", video.ResImage),
                new XElement("sloturl", ImplUtils.SlogImageJoin(video.SlotImage)),
                new XElement("state", video.State),
                new XElement("total_state", video.BKInfo.Episode),
                new XElement("note", ""),
                new XElement("mark", video.BKInfo.Score),
                new XElement("hot", video.Hot),
                new XElement("pv", video.PV),
                new XElement("bitrate", video.Main.BitRate),
                new XElement("resolution", res),
                new XElement("flag", flag),
                new XElement("duration", video.Main.TimeLength / 60),
                new XElement("content", BoxUtils.GetXmlCData(video.Language[filter.lang].Introduction)),
                new XElement("onlinetime", video.Main.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("video_list_count", video.StateCount)
                );
            if (filter.ver >= 2)
            {
                var vir = video.Virtuals == null ? 0 : 1;
                xml.Add(new XElement("virtual", vir));
                if (vir == 1)
                {
                    IEnumerable <int> virtuals = video.Virtuals;
                    if (isEx)
                    {
                        var filters = VideoNodesUtil.FormateTagFilter(filter);
                        virtuals.Where(v =>
                        {
                            var result   = true;
                            VideoNode gv = ListCache.Instance.Dictionary[v];
                            foreach (var f in filters)     //过滤不符合的子频道
                            {
                                result = result && f(gv, filter);
                            }
                            return(result);
                        });
                    }
                    var virs = new XElement("virtual_list");
                    foreach (var virid in virtuals)
                    {
                        VideoNode virnode = ListCache.Instance.Dictionary[virid];
                        virs.Add(new XElement("virtual",
                                              new XAttribute("vid", virid),
                                              new XAttribute("title", virnode.ChannelName),
                                              new XAttribute("imgurl", virnode.ResImage)
                                              ));
                    }
                    xml.Add(virs);
                }

                var maxbit = 0;
                var maxres = string.Empty;
                IEnumerable <int> vices = null;
                if (isEx)   //扩展接口,过滤分组子频道
                {
                    var filters = VideoNodesUtil.FormateTagFilter(filter);
                    vices = video.Groups.Where(v =>
                    {
                        var result   = true;
                        VideoNode gv = ListCache.Instance.Dictionary[v];
                        if (maxbit < gv.Main.BitRate)   //最大码率赋值给主频道
                        {
                            maxbit = gv.Main.BitRate;
                            maxres = VideoUtils.FormatStrArray(10, gv.Main.VideoWidth, "|", gv.Main.VideoHeight);
                        }
                        foreach (var f in filters)     //过滤不符合的子频道
                        {
                            result = result && f(gv, filter);
                        }
                        return(result);
                    });
                    var count = vices.Count();
                    if (count < 1)   //分组里没有子集
                    {
                        xml.Element("video_list_count").SetValue(0);
                        xml.Element("bitrate").SetValue(0);
                        xml.Element("resolution").SetValue(0);
                    }
                    else
                    {
                        xml.Element("bitrate").SetValue(maxbit);
                        xml.Element("resolution").SetValue(maxres);
                    }
                }
            }
            return(xml.ToString(SaveOptions.DisableFormatting));
        }
        /// <summary>
        /// Задаются параеметры фильтрации
        /// </summary>
        /// <param name="filter"></param>
        public void SetFilterParameters(DetailCollectionFilter filter)
        {
            dateAsOfChanged = false;
            for (int i = 0; i < filter.Filters.Length; i++)
            {
                DetailFilter detailFilter = filter.Filters[i];
                if (detailFilter is PartNumberFilter)
                {
                    PartNumberFilterAppliance = true;
                    textBoxPartMask.Text      = ((PartNumberFilter)detailFilter).Mask;
                }
                if (detailFilter is Core.Types.ReportFilters.SerialNumberFilter)
                {
                    SerialNumberFilterAppliance = true;
                    textBoxSerialMask.Text      = ((Core.Types.ReportFilters.SerialNumberFilter)detailFilter).Mask;
                }
                if (detailFilter is DetailConditionFilter)
                {
                    DetailConditionFilter detailConditionFilter = (DetailConditionFilter)detailFilter;
                    SatisfactoryChecked    = detailConditionFilter.SatisfactoryAcceptance;
                    NotSatisfactoryChecked = detailConditionFilter.NotSatisfactoryAcceptance;
                    NotificationChecked    = detailConditionFilter.NotificationAcceptance;
                }
                if (detailFilter is ATAChapterFilter)
                {
                    SelectCheckListBoxATAChapterByFilter(((ATAChapterFilter)detailFilter).TypeAppliance);
                }
                if (detailFilter is MaintananceFilter)
                {
                    MaintananceFilter maintananceFilter = (MaintananceFilter)detailFilter;
                    OnConditionChecked          = maintananceFilter.OnConditionAcceptance;
                    HardTimeChecked             = maintananceFilter.HardTimeAcceptance;
                    ConditionMonitroringChecked = maintananceFilter.ConditionMonitoringAcceptance;
                    UnknownChecked = maintananceFilter.UnknownAcceptance;
                }
                if (detailFilter is BaseDetailFilter)
                {
                    comboBoxComponent.SelectedItem = ((BaseDetailFilter)detailFilter).CurentBaseDetail.ToString();
                }

                if (detailFilter is HardTimeStatusFilter)
                {
                    comboReportType.SelectedItem = hardTimeStatus;
                }
                if (detailFilter is OnConditionStatusFilter)
                {
                    comboReportType.SelectedItem = onConditionStatus;
                }
                if (detailFilter is ConditionMonitoringStatusFilter)
                {
                    comboReportType.SelectedItem = cmStatus;
                }
                if (detailFilter is LLPFilter)
                {
                    comboReportType.SelectedItem = LLPStatus;
                }
                if (detailFilter is AvionicsInventoryFilter)
                {
                    comboReportType.SelectedItem = avionicsInventory;
                }
                if (detailFilter is LandingGearsFilter)
                {
                    comboReportType.SelectedItem = landingGearStatus;
                }
                if (detailFilter is EngineLLPFilter)
                {
                    comboReportType.SelectedItem = GetEngineLLPString(((EngineLLPFilter)detailFilter).CurentBaseDetail);
                }
            }
        }
 public bool IsDangerous() =>
 VoucherFilter.IsDangerous() && Range.IsDangerous() && DetailFilter.IsDangerous();
		public AllocationDiff()
		{
			_prevLog = new LogBase();
			_currLog = new LogBase();
			_prevG = new GraphBase();
			_currG = new GraphBase();

			ds = new DataSet();
			_prevbasedata = new Hashtable();
			_currbasedata = new Hashtable();
			

			basedataId = new Hashtable();
			Idbasedata = new Hashtable();
			basedatatable = new DataTable("basedatatbl");
			callertbl = new DataTable("caller");
			calleetbl = new DataTable("callee");
			typeAllocdataId = new Hashtable();
			ContriTocallertbl = new DataTable("ContriTocallertbl");
			ContriTocalleetbl = new DataTable("ContriTocalleetbl");
			MakeBaseDataTable(basedatatable);
			MakeCallTables(callertbl, true);
			MakeCallTables(calleetbl, false);
			MakeBaseDataTable(ContriTocallertbl);
			MakeBaseDataTable(ContriTocalleetbl);
			prevFilter = new DetailFilter();
			currFilter = new DetailFilter();
			prevTypedeFilter = new DetailFilter();
			currTypedeFilter = new DetailFilter();
		}
		private void getDetailFilter(ref DetailFilter df)
		{
#if(V_EXEC)
			double max = FormatSize(df.max);
			df.detail01 = Math.Round( (max / detail01D), 2);
			df.detail02 = Math.Round((max / (detail01D - 1)), 2);
			df.detail05 = Math.Round((max / (detail01D - 2)), 2);
			df.detail1 = Math.Round((max / (detail01D - 3)), 2);
			df.detail2 = Math.Round((max / (detail01D - 4)), 2);
			df.detail5 = Math.Round((max / (detail01D - 5)), 2);
			df.detail10 = Math.Round((max / (detail01D - 6)), 2);
#else
			ulong max = df.max;
			df.detail01 = max / detail01D;
			df.detail02 = max / (detail01D - 1);
			df.detail05 = max /(detail01D - 2);
			df.detail1 = max / (detail01D - 3);
			df.detail2 = max / (detail01D - 4);
			df.detail5 = max / (detail01D - 5);
			df.detail10 = max / (detail01D - 6);
#endif
		}
		private void getDetailFilter(ref DetailFilter df)
		{
			//DataRow[] r = basedatatable.Select("prevIncl = max(prevIncl)");
			//double max = (double)r[0][2];
#if(V_EXEC)
			double max = FormatSize(df.max);
			df.detail01 = Math.Round( (max / detail01D), 2);
			df.detail02 = Math.Round((max / (detail01D - 1)), 2);
			df.detail05 = Math.Round((max / (detail01D - 2)), 2);
			df.detail1 = Math.Round((max / (detail01D - 3)), 2);
			df.detail2 = Math.Round((max / (detail01D - 4)), 2);
			df.detail5 = Math.Round((max / (detail01D - 5)), 2);
			df.detail10 = Math.Round((max / (detail01D - 6)), 2);
#else
			ulong max = df.max;
			df.detail01 = max / detail01D;
			df.detail02 = max / (detail01D - 1);
			df.detail05 = max /(detail01D - 2);
			df.detail1 = max / (detail01D - 3);
			df.detail2 = max / (detail01D - 4);
			df.detail5 = max / (detail01D - 5);
			df.detail10 = max / (detail01D - 6);
#endif
		}
Exemple #13
0
        public static void PageDetailVer1(this List <ViceNode> vices, DetailFilter filter, XElement xml, XElement parent)
        {
            var all = vices.Count;

            if (filter.c != 0 && filter.s != 0) // 分页
            {
                parent.Add(new XElement("countInPage", filter.c),
                           new XElement("page", filter.s)
                           );
                var index = 0; var max = 0;
                index = (filter.s - 1) * filter.c;
                max   = index + filter.c;
                if (filter.order == "r")
                {
                    index = all - 1 - index;
                    max   = all - 1 - max;
                    if (max < -1)
                    {
                        max = -1;
                    }
                    for (var i = index; i > max; i--)
                    {
                        xml.Add(new XElement("video",
                                             new XAttribute("id", vices[i].ChannelId),
                                             new XAttribute("title", vices[i].Language[filter.lang].Title),
                                             BoxUtils.GetXmlCData(vices[i].PlayLink)
                                             ));
                    }
                }
                else
                {
                    if (max > all)
                    {
                        max = all;
                    }
                    for (var i = index; i < max; i++)
                    {
                        xml.Add(new XElement("video",
                                             new XAttribute("id", vices[i].ChannelId),
                                             new XAttribute("title", vices[i].Language[filter.lang].Title),
                                             BoxUtils.GetXmlCData(vices[i].PlayLink)
                                             ));
                    }
                }
            }
            else
            {
                if (filter.order == "r")
                {
                    for (var i = all - 1; i >= 0; i--)
                    {
                        xml.Add(new XElement("video",
                                             new XAttribute("id", vices[i].ChannelId),
                                             new XAttribute("title", vices[i].Language[filter.lang].Title),
                                             BoxUtils.GetXmlCData(vices[i].PlayLink)
                                             ));
                    }
                }
                else
                {
                    for (var i = 0; i < all; i++)
                    {
                        xml.Add(new XElement("video",
                                             new XAttribute("id", vices[i].ChannelId),
                                             new XAttribute("title", vices[i].Language[filter.lang].Title),
                                             BoxUtils.GetXmlCData(vices[i].PlayLink)
                                             ));
                    }
                }
            }
        }
Exemple #14
0
 public static void PageDetailVer2(this List <VideoNode> videos, DetailFilter filter, XElement xml, XElement parent, int all)
 {
     if (filter.c != 0 && filter.s != 0)
     {
         parent.Add(new XElement("countInPage", filter.c),
                    new XElement("page", filter.s)
                    );
         var index = 0; var max = 0;
         index = (filter.s - 1) * filter.c;
         max   = index + filter.c;
         if (filter.order == "r")
         {
             index = all - 1 - index;
             max   = all - 1 - max;
             if (max < -1)
             {
                 max = -1;
             }
             for (var i = index; i > max; i--)
             {
                 var p = new XElement("playlink2",
                                      new XAttribute("id", videos[0].ViceChannels[i].ChannelId),
                                      new XAttribute("title", videos[0].ViceChannels[i].Language[filter.lang].Title),
                                      new XAttribute("duration", videos[0].ViceChannels[i].Duration)
                                      //new XAttribute("start_point", 60.22),
                                      //new XAttribute("end_point", 289.22)
                                      );
                 foreach (var v in videos)
                 {
                     p.Add(new XElement("source",
                                        new XAttribute("mark", v.Language[filter.lang].Mark),
                                        new XAttribute("bitrate", v.Main.BitRate),
                                        new XAttribute("filelength", v.ViceChannels[i].Duration * v.Main.BitRate * (1024 / 8)),
                                        new XAttribute("resolution", VideoUtils.FormatStrArray(10, v.Main.VideoWidth, "|", v.Main.VideoHeight)),
                                        BoxUtils.GetXmlCData(v.ViceChannels[i].PlayLink)
                                        ));
                 }
                 xml.Add(p);
             }
         }
         else
         {
             if (max > all)
             {
                 max = all;
             }
             for (var i = index; i < max; i++)
             {
                 var p = new XElement("playlink2",
                                      new XAttribute("id", videos[0].ViceChannels[i].ChannelId),
                                      new XAttribute("title", videos[0].ViceChannels[i].Language[filter.lang].Title),
                                      new XAttribute("duration", videos[0].ViceChannels[i].Duration)
                                      //new XAttribute("start_point", 60.22),
                                      //new XAttribute("end_point", 289.22)
                                      );
                 foreach (var v in videos)
                 {
                     p.Add(new XElement("source",
                                        new XAttribute("mark", v.Language[filter.lang].Mark),
                                        new XAttribute("bitrate", v.Main.BitRate),
                                        new XAttribute("filelength", v.ViceChannels[i].Duration * v.Main.BitRate * (1024 / 8)),
                                        new XAttribute("resolution", VideoUtils.FormatStrArray(10, v.Main.VideoWidth, "|", v.Main.VideoHeight)),
                                        BoxUtils.GetXmlCData(v.ViceChannels[i].PlayLink)
                                        ));
                 }
                 xml.Add(p);
             }
         }
     }
     else
     {
         if (filter.order == "r")
         {
             for (var i = all - 1; i >= 0; i--)
             {
                 var p = new XElement("playlink2",
                                      new XAttribute("id", videos[0].ViceChannels[i].ChannelId),
                                      new XAttribute("title", videos[0].ViceChannels[i].Language[filter.lang].Title),
                                      new XAttribute("duration", videos[0].ViceChannels[i].Duration)
                                      //new XAttribute("start_point", 60.22),
                                      //new XAttribute("end_point", 289.22)
                                      );
                 foreach (var v in videos)
                 {
                     p.Add(new XElement("source",
                                        new XAttribute("mark", v.Language[filter.lang].Mark),
                                        new XAttribute("bitrate", v.Main.BitRate),
                                        new XAttribute("filelength", v.ViceChannels[i].Duration * v.Main.BitRate * (1024 / 8)),
                                        new XAttribute("resolution", VideoUtils.FormatStrArray(10, v.Main.VideoWidth, "|", v.Main.VideoHeight)),
                                        BoxUtils.GetXmlCData(v.ViceChannels[i].PlayLink)
                                        ));
                 }
                 xml.Add(p);
             }
         }
         else
         {
             for (var i = 0; i < all; i++)
             {
                 var p = new XElement("playlink2",
                                      new XAttribute("id", videos[0].ViceChannels[i].ChannelId),
                                      new XAttribute("title", videos[0].ViceChannels[i].Language[filter.lang].Title),
                                      new XAttribute("duration", videos[0].ViceChannels[i].Duration)
                                      //new XAttribute("start_point", 60.22),
                                      //new XAttribute("end_point", 289.22)
                                      );
                 foreach (var v in videos)
                 {
                     p.Add(new XElement("source",
                                        new XAttribute("mark", v.Language[filter.lang].Mark),
                                        new XAttribute("bitrate", v.Main.BitRate),
                                        new XAttribute("filelength", v.ViceChannels[i].Duration * v.Main.BitRate * (1024 / 8)),
                                        new XAttribute("resolution", VideoUtils.FormatStrArray(10, v.Main.VideoWidth, "|", v.Main.VideoHeight)),
                                        BoxUtils.GetXmlCData(v.ViceChannels[i].PlayLink)
                                        ));
                 }
                 xml.Add(p);
             }
         }
     }
 }