public void PubThirdTable(HtmlDocument htmlDoc, lotterydetail lotterydetail, string gameCode) { var ThirdTablenode = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[2]; var ThirdTable_trnode = ThirdTablenode.SelectNodes("tr"); int trIndex = 1; foreach (HtmlNode item3 in ThirdTable_trnode) //循环第二个table的tr { int lnode = ThirdTable_trnode.Count() + 1; if (2 < trIndex && trIndex < lnode) { IEnumerable <HtmlNode> getTdList = item3.SelectNodes("td"); int tdIndex = 1; var jq4LotteryDetails = new LotteryDetails(); var ttcx4Detail = new ttcx4Details(); foreach (var tdItem in getTdList) { switch (tdIndex) { case 1: jq4LotteryDetails.openPrize = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 2: jq4LotteryDetails.openWinNumber = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 3: jq4LotteryDetails.openSingleBonus = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; } tdIndex = tdIndex + 1; } lotterydetail.openLotteryDetails.Add(jq4LotteryDetails); } trIndex = trIndex + 1; } }
public void PubSecondTable(HtmlDocument htmlDoc, lotterydetail lotterydetail, string gameCode) { var SecondTablenode = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[1]; var SecondTable_trnode = SecondTablenode.SelectNodes("tr"); int trIndex = 1; foreach (HtmlNode item3 in SecondTable_trnode) //循环第二个table的tr { int lnode = SecondTable_trnode.Count(); int minLnode = 0; if (gameCode == "ttcx4") { minLnode = 1; lnode = 3; } else if (gameCode == "pls" || gameCode == "sfc" || gameCode == "jq4" || gameCode == "zc6" || gameCode == "qxc" || gameCode == "plw" || gameCode == "qlc" || gameCode == "ssq") { minLnode = 2; lnode = SecondTable_trnode.Count(); } else { minLnode = 2; lnode = SecondTable_trnode.Count() + 1; } if (minLnode < trIndex && trIndex < lnode) { IEnumerable <HtmlNode> getTdList = item3.SelectNodes("td"); int tdIndex = 1; var jq4LotteryDetails = new LotteryDetails(); var ttcx4Detail = new ttcx4Details(); if (gameCode == "ttcx4") { foreach (var tdItem in getTdList) { switch (tdIndex) { case 1: ttcx4Detail.Betting = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 2: ttcx4Detail.openPrize = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 3: ttcx4Detail.openCode = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 4: ttcx4Detail.directlySelection = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 5: ttcx4Detail.GroupSelection24 = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 6: ttcx4Detail.GroupSelection12 = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 7: ttcx4Detail.GroupSelection6 = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 8: ttcx4Detail.GroupSelection4 = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; } tdIndex = tdIndex + 1; } lotterydetail.ttcx4Details.Add(ttcx4Detail); } else { foreach (var tdItem in getTdList) { switch (tdIndex) { case 1: jq4LotteryDetails.openPrize = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 2: jq4LotteryDetails.openWinNumber = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; case 3: jq4LotteryDetails.openSingleBonus = Regex.Replace(tdItem.InnerHtml, @"\s", ""); break; } tdIndex = tdIndex + 1; } } lotterydetail.openLotteryDetails.Add(jq4LotteryDetails); } trIndex = trIndex + 1; } }