/// <summary> /// 处理足球走地XML(取进球的分钟数集合) /// </summary> /// <param name="p_xml">HTML文档</param> private IList <TPR.Model.guess.BaList> OnceHtml2(string p_xml) { IList <TPR.Model.guess.BaList> objonce = new List <TPR.Model.guess.BaList>(); if (!string.IsNullOrEmpty(p_xml)) { MatchCollection mc = Regex.Matches(p_xml, @"<tr class=font12 height=16 bgcolor=[\s\S]+?<img src=../bf_img/(1|7).gif>[\s\S]+?</td><td>", RegexOptions.Compiled | RegexOptions.IgnoreCase); if (mc.Count > 0) { string html = string.Empty; for (int i = 0; i < mc.Count; i++) { html += mc[i].Groups[0].Value; } //System.Web.HttpContext.Current.Response.Write(html); //System.Web.HttpContext.Current.Response.End(); MatchCollection mc1 = Regex.Matches(html, @"<font color=#FFFFFF>([\s\S]+?)'</font>", RegexOptions.Compiled | RegexOptions.IgnoreCase); if (mc1.Count > 0) { for (int i = 0; i < mc1.Count; i++) { TPR.Model.guess.BaList obj = new TPR.Model.guess.BaList(); obj.p_once = mc1[i].Groups[1].Value; objonce.Add(obj); } } } } return(objonce); }
/// <summary> /// 处理即时篮球比分XML /// </summary> /// <param name="p_html">HTML文档</param> private IList <TPR.Model.guess.BaList> OnceHtml1(string p_html, out int p_recordCount) { IList <TPR.Model.guess.BaList> objonce = new List <TPR.Model.guess.BaList>(); p_recordCount = 0; if (!string.IsNullOrEmpty(p_html)) { MatchCollection mc = Regex.Matches(p_html, @"<h>([\s\S].+?)</h>", RegexOptions.Compiled | RegexOptions.IgnoreCase); if (mc.Count > 0) { for (int i = 0; i < mc.Count; i++) { TPR.Model.guess.BaList obj = new TPR.Model.guess.BaList(); string[] sTemp = { }; sTemp = mc[i].Groups[0].Value.Split("^".ToCharArray()); obj.p_id = Convert.ToInt32(sTemp[0].Replace("<h><![CDATA[", "")); try { obj.p_result_temp1 = Convert.ToInt32(sTemp[3]); obj.p_result_temp2 = Convert.ToInt32(sTemp[4]); } catch { obj.p_result_temp1 = 0; obj.p_result_temp2 = 0; } objonce.Add(obj); p_recordCount++; } } } return(objonce); }
/// <summary> /// 处理足球完场比分 /// </summary> /// <param name="p_html">HTML文档</param> private IList <TPR.Model.guess.BaList> FootLiveoverHtml(string p_html, out int p_recordCount) { IList <TPR.Model.guess.BaList> objfoot = new List <TPR.Model.guess.BaList>(); p_recordCount = 0; if (!string.IsNullOrEmpty(p_html)) { MatchCollection mc = Regex.Matches(p_html, @"<tr class=font12 align=center bgColor=([\s\S]+?)>欧</a>", RegexOptions.Compiled | RegexOptions.IgnoreCase); if (mc.Count > 0) { for (int i = 0; i < mc.Count; i++) { TPR.Model.guess.BaList obj = new TPR.Model.guess.BaList(); string sID = "0"; string pattern = @"<a href=javascript: onclick='analysis([\s\S]+?)'>析</a>"; Match m1 = Regex.Match(mc[i].Groups[0].Value, pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase); if (m1.Success) { sID = m1.Groups[0].Value.Replace("<a href=javascript: onclick='analysis(", "").Replace(")'>析</a>", ""); } string sTime = "2010-1-1 11:11:11"; string pattern2 = @"</td><td>([\s\S]+?)</td><td class=style1>"; Match m2 = Regex.Match(mc[i].Groups[0].Value, pattern2, RegexOptions.Compiled | RegexOptions.IgnoreCase); if (m2.Success) { sTime = m2.Groups[1].Value; } int result1 = -1; int result2 = -1; string pattern3 = @"</td><td class=style1 style=([\s\S]+?)(\d*-\d*)</td><td align=left>"; Match m3 = Regex.Match(mc[i].Groups[0].Value, pattern3, RegexOptions.Compiled | RegexOptions.IgnoreCase); if (m2.Success) { string sTemp = Regex.Replace(m3.Groups[2].Value, @"<.+?>", "", RegexOptions.IgnoreCase); if (!string.IsNullOrEmpty(sTemp)) { result1 = Convert.ToInt32(sTemp.Split('-')[0]); result2 = Convert.ToInt32(sTemp.Split('-')[1]); } } obj.p_TPRtime = Convert.ToDateTime(sTime); obj.p_id = Convert.ToInt32(sID); obj.p_result_one = result1; obj.p_result_two = result2; objfoot.Add(obj); p_recordCount++; } } } return(objfoot); }
/// <summary> /// 处理足球标准盘XML /// </summary> /// <param name="p_html">HTML文档</param> private IList <TPR.Model.guess.BaList> FootbzHtml(string p_xml, out int p_recordCount) { IList <TPR.Model.guess.BaList> listFootbzs = new List <TPR.Model.guess.BaList>(); p_recordCount = 0; try { using (XmlReaderExtend reader = new XmlReaderExtend(p_xml)) { while (reader.ReadToFollowing("m")) { TPR.Model.guess.BaList obj = new TPR.Model.guess.BaList(); obj.p_id = Convert.ToInt32(reader.GetElementValue("i")); obj.p_TPRtime = Convert.ToDateTime(reader.GetElementValue("t").Split(",".ToCharArray())[0]); string[] saTemp = { }; saTemp = reader.GetElementValue("pl").Split(";".ToCharArray()); try { //SB:1/明升:9 if (Utils.GetTopDomain() == "tl88.cc" || Utils.GetTopDomain() == "168yy.cc") { obj.p_bzs_lu = Convert.ToDecimal(saTemp[9].Split(",".ToCharArray())[4]); obj.p_bzp_lu = Convert.ToDecimal(saTemp[9].Split(",".ToCharArray())[5]); obj.p_bzx_lu = Convert.ToDecimal(saTemp[9].Split(",".ToCharArray())[6]); } else { obj.p_bzs_lu = Convert.ToDecimal(saTemp[1].Split(",".ToCharArray())[4]); obj.p_bzp_lu = Convert.ToDecimal(saTemp[1].Split(",".ToCharArray())[5]); obj.p_bzx_lu = Convert.ToDecimal(saTemp[1].Split(",".ToCharArray())[6]); } } catch { obj.p_bzs_lu = 0; obj.p_bzp_lu = 0; obj.p_bzx_lu = 0; } listFootbzs.Add(obj); p_recordCount++; } return(listFootbzs); } } catch { return(null); } }
/// <summary> /// 处理篮球完场比分(搜索) /// </summary> /// <param name="p_html">HTML文档</param> private IList <TPR.Model.guess.BaList> BasketLiveoverHtml(string p_html, out int p_recordCount) { IList <TPR.Model.guess.BaList> objbasket = new List <TPR.Model.guess.BaList>(); p_recordCount = 0; if (!string.IsNullOrEmpty(p_html)) { MatchCollection mc = Regex.Matches(p_html, @"<h>([\s\S].+?)</h>", RegexOptions.Compiled | RegexOptions.IgnoreCase); if (mc.Count > 0) { for (int i = 0; i < mc.Count; i++) { TPR.Model.guess.BaList obj = new TPR.Model.guess.BaList(); string[] sTemp = { }; sTemp = mc[i].Groups[0].Value.Split("^".ToCharArray()); int Iswc = Convert.ToInt32(sTemp[5]); if (Iswc == -1) { obj.p_id = Convert.ToInt32(sTemp[0].Replace("<h><![CDATA[", "")); try { obj.p_TPRtime = Convert.ToDateTime(sTemp[4].Replace("<br>", "")); } catch { obj.p_TPRtime = Convert.ToDateTime("2010-1-1 11:11:11"); } try { obj.p_result_one = Convert.ToInt32(sTemp[11]); obj.p_result_two = Convert.ToInt32(sTemp[12]); } catch { obj.p_result_one = -1; obj.p_result_two = -1; } } else { obj.p_result_one = -1; obj.p_result_two = -1; } objbasket.Add(obj); p_recordCount++; } } } return(objbasket); }
/// <summary> /// 处理篮球XML /// </summary> /// <param name="p_html">HTML文档</param> private IList <TPR.Model.guess.BaList> BasketHtml(string p_xml, out int p_recordCount) { IList <TPR.Model.guess.BaList> listBaskets = new List <TPR.Model.guess.BaList>(); p_recordCount = 0; try { using (XmlReaderExtend reader = new XmlReaderExtend(p_xml)) { while (reader.ReadToFollowing("m")) { TPR.Model.guess.BaList obj = new TPR.Model.guess.BaList(); obj.p_id = Convert.ToInt32(reader.GetElementValue("i")); obj.p_title = reader.GetElementValue("le").Split(",".ToCharArray())[2]; obj.p_TPRtime = Convert.ToDateTime(reader.GetElementValue("t").Split(",".ToCharArray())[0]); obj.p_one = reader.GetElementValue("ta").Split(",".ToCharArray())[0]; obj.p_two = reader.GetElementValue("tb").Split(",".ToCharArray())[0]; if (Utils.Left(reader.GetElementValue("p"), 1) == "2") { obj.p_pn = 2; } else { obj.p_pn = 1; } string[] saTemp = { }; saTemp = reader.GetElementValue("pl").Split(";".ToCharArray()); try { obj.p_pk = Convert.ToDecimal(saTemp[2].Split(",".ToCharArray())[1]); obj.p_one_lu = Convert.ToDecimal(saTemp[2].Split(",".ToCharArray())[2]); obj.p_two_lu = Convert.ToDecimal(saTemp[2].Split(",".ToCharArray())[3]); } catch { obj.p_pk = 0; obj.p_one_lu = 0; obj.p_two_lu = 0; } try { obj.p_dx_pk = Convert.ToDecimal(saTemp[7].Split(",".ToCharArray())[1]); obj.p_big_lu = Convert.ToDecimal(saTemp[7].Split(",".ToCharArray())[2]); obj.p_small_lu = Convert.ToDecimal(saTemp[7].Split(",".ToCharArray())[3]); } catch { obj.p_dx_pk = 0; obj.p_big_lu = 0; obj.p_small_lu = 0; } listBaskets.Add(obj); p_recordCount++; } return(listBaskets); } } catch { return(null); } }