/// <summary> /// 取得篮球每节比分 /// </summary> /// <param name="Types">1一节,2二节,3上半场,4第三节</param> /// <param name="p_TPRtime">联赛时间</param> /// <param name="p_id">比赛ID</param> /// <returns></returns> public string DJBf(int Types, DateTime p_TPRtime, int p_id) { string bfstat = "未"; if (p_TPRtime < DateTime.Now) { bfstat = "0:0"; string p_xml = GetSourceTextByUrl("http://bf.titan007.com/nba/today.xml", "GB2312"); TPR3.Model.guess.Tempbakbf n = new TPR3.Model.guess.Tempbakbf(); using (XmlReaderExtend reader = new XmlReaderExtend(p_xml)) { while (reader.ReadToFollowing("h")) { string p_str = reader.GetElementValue(); string[] Temp = Regex.Split(p_str, @"\^"); int id = 0; id = Convert.ToInt32(Temp[0]); if (id == p_id) { if (Types == 0)//全场比分 { bfstat = Temp[11] + "-" + Temp[12]; } else if (Types == 1) { bfstat = Temp[13] + "-" + Temp[14]; } else if (Types == 2) { bfstat = Temp[15] + "-" + Temp[16]; } else if (Types == 3) { bfstat = (Utils.ParseInt(Temp[13]) + Utils.ParseInt(Temp[15])) + "-" + (Utils.ParseInt(Temp[14]) + Utils.ParseInt(Temp[16])); } else if (Types == 4) { bfstat = Temp[17] + "-" + Temp[18]; } break; } } } } if (bfstat == "-") { bfstat = "未"; } return(bfstat); }
/// <summary> /// 取得篮球进行第几节 /// </summary> /// <param name="p_TPRtime">联赛时间</param> /// <param name="p_id">比赛ID</param> /// <returns></returns> public string LqOutJie(DateTime p_TPRtime, int p_id) { string bfstat = ""; if (p_TPRtime < DateTime.Now) { string p_xml = GetSourceTextByUrl("http://bf.titan007.com/nba/today.xml", "GB2312"); TPR3.Model.guess.Tempbakbf n = new TPR3.Model.guess.Tempbakbf(); using (XmlReaderExtend reader = new XmlReaderExtend(p_xml)) { while (reader.ReadToFollowing("h")) { string p_str = reader.GetElementValue(); string[] Temp = Regex.Split(p_str, @"\^"); int id = 0; id = Convert.ToInt32(Temp[0]); if (id == p_id) { //取第几节 string jie = OutJie(Temp[5]); string remaintime = Temp[6]; if (remaintime != "") { bfstat = jie + "(" + remaintime + "')"; } else { bfstat = jie; } break; } } } } return(bfstat); }