/// <summary> /// 从xml格式配置文件解析播放列表 /// </summary> private void ExtractPlayListFromConfig() { try { xmlHelper = new XmlHelper(playListXML); var videoList = xmlHelper.GetNodeGroupbyNodeName("video"); if (videoList.Count > 0) { GetVideoPlayList(videoList); } else//Only des { GetDesPlayList(); } } catch(Exception e) { Console.WriteLine("Extract PlayList error:" + e.Message); } }
private void GetDesPlayList() { //Dictionary<string, List<VideoDes>> tempPlayList = new Dictionary<string, List<VideoDes>>(); //xmlHelper = new XmlHelper(playListXML); //var dess = xmlHelper.GetInnerXmlsfromNode("des");//视频描述,xml格式 //List<VideoDes> videoDesList = new List<VideoDes>(); //foreach (var d in dess)//描述明细 //{ // VideoDes videoDes = new VideoDes(); // Dictionary<string, string> itemDic = new Dictionary<string, string>(); // var desInfo = xmlHelper.GetDicFromXmlpara(d); // foreach (var info in desInfo) // { // if (info.Key == "type") // { // videoDes.DesType = GetDesTypebyNo(desInfo["type"]); // } // else if (info.Key == "last") // { // videoDes.Duration = int.Parse(desInfo["last"].ToString()); // } // else // { // itemDic.Add(info.Key, info.Value); // } // } // videoDes.DesItems = itemDic; // videoDesList.Add(videoDes); //} //tempPlayList.Add("0", videoDesList); //this.currentPlayList = tempPlayList; //new //Dictionary<string, List<VideoDes>> tempPlayList = new Dictionary<string, List<VideoDes>>(); List<AssetPair> tempPlayList = new List<AssetPair>(); xmlHelper = new XmlHelper(playListXML); var dess = xmlHelper.GetInnerXmlsfromNode("des");//视频描述,xml格式 List<VideoDes> videoDesList = new List<VideoDes>(); foreach (var d in dess)//描述明细 { VideoDes videoDes = new VideoDes(); Dictionary<string, string> itemDic = new Dictionary<string, string>(); var desInfo = xmlHelper.GetDicFromXmlpara(d); foreach (var info in desInfo) { if (info.Key == "type") { videoDes.DesType = GetDesTypebyNo(desInfo["type"]); } else if (info.Key == "last") { videoDes.Duration = int.Parse(desInfo["last"].ToString()); } else { itemDic.Add(info.Key, info.Value); } } videoDes.DesItems = itemDic; videoDesList.Add(videoDes); } //tempPlayList.Add("0", videoDesList); AssetPair assetPair = new AssetPair(); assetPair.VideoDesList = videoDesList; assetPair.VideoName = "0"; tempPlayList.Add(assetPair); this.currentPlayList = tempPlayList; }
public CastPlan(string playListXML) { this.playListXML = playListXML; xmlHelper = new XmlHelper(playListXML); ExtractPlayListFromConfig(); }