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; }
//private void GetVideoPlayList(List<string> videoList) //{ // Dictionary<string, List<VideoDes>> tempPlayList = new Dictionary<string, List<VideoDes>>(); // foreach (var v in videoList)// // { // var fileName = xmlHelper.GetInnerTextfromXmlpara(v, "fileName"); // var dess = xmlHelper.GetInnerXmlsfromXmlpara(v, "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(fileName, videoDesList); // } // this.currentPlayList = tempPlayList; //} private void GetVideoPlayList(List<string> videoList) { //Dictionary<string, List<VideoDes>> tempPlayList = new Dictionary<string, List<VideoDes>>(); List<AssetPair> tempPlayList = new List<AssetPair>(); foreach (var v in videoList)// { var fileName = xmlHelper.GetInnerTextfromXmlpara(v, "fileName"); var dess = xmlHelper.GetInnerXmlsfromXmlpara(v, "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(fileName, videoDesList); AssetPair ap = new AssetPair(); ap.VideoName = fileName; ap.VideoDesList = videoDesList; tempPlayList.Add(ap); } this.currentPlayList = tempPlayList; }