コード例 #1
0
 public static void Tcp3()
 {
     try
     {
         string html = HtmlOperate.GetHtml("http://f.apiplus.net/pl3.xml");
         if (string.IsNullOrEmpty(html))
         {
             new LogExceptionDAL().Save("采集异常", "P3找不到开奖数据的关键字符");
         }
         else
         {
             XmlNodeList xmlNode = Public.GetXmlNode(html, "row");
             if (xmlNode == null)
             {
                 new LogExceptionDAL().Save("采集异常", "P3找不到开奖数据的关键字符");
             }
             else if (xmlNode.Count == 0)
             {
                 new LogExceptionDAL().Save("采集异常", "P3找不到开奖数据的关键字符");
             }
             else
             {
                 foreach (XmlNode xmlNode2 in xmlNode)
                 {
                     string innerText  = xmlNode2.Attributes["opentime"].InnerText;
                     string text       = xmlNode2.Attributes["expect"].InnerText;
                     string innerText2 = xmlNode2.Attributes["opencode"].InnerText;
                     if (string.IsNullOrEmpty(innerText) || string.IsNullOrEmpty(text) || string.IsNullOrEmpty(innerText2))
                     {
                         new LogExceptionDAL().Save("采集异常", "P3找不到开奖数据的关键字符");
                         break;
                     }
                     if (text.Length == 5)
                     {
                         text = "20" + text;
                     }
                     string text2 = text;
                     if (innerText2.Length == 5)
                     {
                         if (!new LotteryDataDAL().Exists(3003, text2))
                         {
                             if (!innerText2.Contains("255"))
                             {
                                 new LotteryDataDAL().Add(3003, text2, innerText2, DateTime.Now.ToString("yyyy-MM-dd") + " 20:30:00", "");
                                 Public.SetOpenListJson(3003);
                                 LotteryCheck.RunOfIssueNum(3003, text2);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "P3获取开奖数据出错,错误代码:" + ex.Message);
     }
 }
コード例 #2
0
ファイル: YouleToOther.cs プロジェクト: longphui/ffyule
 public static void DataToOther(int lotteryId)
 {
     try
     {
         string html1 = HtmlOperate.GetHtml(string.Format(Config.DefaultUrlYoule, (object)lotteryId));
         if (string.IsNullOrEmpty(html1))
         {
             new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符1" + (object)lotteryId);
         }
         else
         {
             XmlNodeList xmlNode1 = Public.GetXmlNode(html1, "row");
             if (xmlNode1 == null)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符2" + (object)lotteryId);
             }
             else if (xmlNode1.Count == 0)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符3" + (object)lotteryId);
             }
             else
             {
                 foreach (XmlNode xmlNode2 in xmlNode1)
                 {
                     string innerText1 = xmlNode2.Attributes["opentime"].InnerText;
                     string innerText2 = xmlNode2.Attributes["expect"].InnerText;
                     string innerText3 = xmlNode2.Attributes["opencode"].InnerText;
                     if (string.IsNullOrEmpty(innerText1) || string.IsNullOrEmpty(innerText2) || string.IsNullOrEmpty(innerText3))
                     {
                         new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符4" + (object)lotteryId);
                         break;
                     }
                     bool   flag  = true;
                     string html2 = HtmlOperate.GetHtml(ConfigurationManager.AppSettings["RootUrl"].ToString() + "/Data/lottery" + (object)lotteryId + ".xml");
                     if (!string.IsNullOrEmpty(html2))
                     {
                         foreach (XmlNode xmlNode3 in Public.GetXmlNode(html2, "row"))
                         {
                             if (xmlNode3.Attributes["expect"].InnerText.Equals(innerText2))
                             {
                                 flag = false;
                             }
                         }
                     }
                     if (flag)
                     {
                         string str = innerText2;
                         if (!new LotteryDataDAL().Exists(lotteryId, str))
                         {
                             string[] strArray = innerText3.Split(',');
                             string   Number   = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                             new LotteryDataDAL().Add(lotteryId, str, Number, innerText1, string.Join(",", strArray));
                             Public.SetOpenListJson(lotteryId);
                             LotteryCheck.RunOfIssueNum(lotteryId, str);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "采集主站获取开奖数据出错,错误代码:" + ex.Message);
     }
 }
コード例 #3
0
 public static void DataToOther(int lotteryId)
 {
     try
     {
         string html = HtmlOperate.GetHtml(string.Format(Config.DefaultUrlYoule, lotteryId));
         if (string.IsNullOrEmpty(html))
         {
             new LogExceptionDAL().Save("采集异常[YouleToOther3d]", "采集主站找不到开奖数据的关键字符1");
         }
         else
         {
             XmlNodeList xmlNode = Public.GetXmlNode(html, "row");
             if (xmlNode == null)
             {
                 new LogExceptionDAL().Save("采集异常[YouleToOther3d]", "采集主站找不到开奖数据的关键字符2");
             }
             else if (xmlNode.Count == 0)
             {
                 new LogExceptionDAL().Save("采集异常[YouleToOther3d]", "采集主站找不到开奖数据的关键字符3");
             }
             else
             {
                 foreach (XmlNode xmlNode2 in xmlNode)
                 {
                     string innerText  = xmlNode2.Attributes["opentime"].InnerText;
                     string innerText2 = xmlNode2.Attributes["expect"].InnerText;
                     string innerText3 = xmlNode2.Attributes["opencode"].InnerText;
                     if (string.IsNullOrEmpty(innerText) || string.IsNullOrEmpty(innerText2) || string.IsNullOrEmpty(innerText3))
                     {
                         new LogExceptionDAL().Save("采集异常[YouleToOther3d]", "采集主站找不到开奖数据的关键字符4");
                         break;
                     }
                     bool   flag  = true;
                     string text  = ConfigurationManager.AppSettings["RootUrl"].ToString();
                     string html2 = HtmlOperate.GetHtml(string.Concat(new object[]
                     {
                         text,
                         "/Data/lottery",
                         lotteryId,
                         ".xml"
                     }));
                     if (!string.IsNullOrEmpty(html2))
                     {
                         XmlNodeList xmlNode3 = Public.GetXmlNode(html2, "row");
                         foreach (XmlNode xmlNode4 in xmlNode3)
                         {
                             string innerText4 = xmlNode4.Attributes["expect"].InnerText;
                             if (innerText4.Equals(innerText2))
                             {
                                 flag = false;
                             }
                         }
                     }
                     if (flag)
                     {
                         string text2 = innerText2;
                         if (!new LotteryDataDAL().Exists(lotteryId, text2))
                         {
                             string[] array = innerText3.Split(new char[]
                             {
                                 ','
                             });
                             int    num    = (Convert.ToInt32(array[0]) + Convert.ToInt32(array[1]) + Convert.ToInt32(array[2]) + Convert.ToInt32(array[3]) + Convert.ToInt32(array[4]) + Convert.ToInt32(array[5]) + Convert.ToInt32(array[6])) % 10;
                             int    num2   = (Convert.ToInt32(array[7]) + Convert.ToInt32(array[8]) + Convert.ToInt32(array[9]) + Convert.ToInt32(array[10]) + Convert.ToInt32(array[11]) + Convert.ToInt32(array[12]) + Convert.ToInt32(array[13])) % 10;
                             int    num3   = (Convert.ToInt32(array[14]) + Convert.ToInt32(array[15]) + Convert.ToInt32(array[16]) + Convert.ToInt32(array[17]) + Convert.ToInt32(array[18]) + Convert.ToInt32(array[19])) % 10;
                             string number = string.Concat(new object[]
                             {
                                 num,
                                 ",",
                                 num2,
                                 ",",
                                 num3
                             });
                             new LotteryDataDAL().Add(lotteryId, text2, number, innerText, string.Join(",", array));
                             Public.SetOpenListJson(lotteryId);
                             LotteryCheck.RunOfIssueNum(lotteryId, text2);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "采集主站获取开奖数据出错,错误代码:" + ex.Message);
     }
 }
コード例 #4
0
 public static void DataToOther(int lotteryId)
 {
     try
     {
         string html = HtmlOperate.GetHtml(string.Format(Config.DefaultUrlYoule, lotteryId));
         if (string.IsNullOrEmpty(html))
         {
             new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
         }
         else
         {
             XmlNodeList xmlNode = Public.GetXmlNode(html, "row");
             if (xmlNode == null)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
             }
             else if (xmlNode.Count == 0)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
             }
             else
             {
                 foreach (XmlNode xmlNode2 in xmlNode)
                 {
                     string innerText  = xmlNode2.Attributes["opentime"].InnerText;
                     string innerText2 = xmlNode2.Attributes["expect"].InnerText;
                     string innerText3 = xmlNode2.Attributes["opencode"].InnerText;
                     if (string.IsNullOrEmpty(innerText) || string.IsNullOrEmpty(innerText2) || string.IsNullOrEmpty(innerText3))
                     {
                         new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
                         break;
                     }
                     bool   flag  = true;
                     string text  = ConfigurationManager.AppSettings["RootUrl"].ToString();
                     string html2 = HtmlOperate.GetHtml(string.Concat(new object[]
                     {
                         text,
                         "/Data/lottery",
                         lotteryId,
                         ".xml"
                     }));
                     if (!string.IsNullOrEmpty(html2))
                     {
                         XmlNodeList xmlNode3 = Public.GetXmlNode(html2, "row");
                         foreach (XmlNode xmlNode4 in xmlNode3)
                         {
                             string innerText4 = xmlNode4.Attributes["expect"].InnerText;
                             if (innerText4.Equals(innerText2))
                             {
                                 flag = false;
                             }
                         }
                     }
                     if (flag)
                     {
                         string text2 = innerText2;
                         if (!new LotteryDataDAL().Exists(lotteryId, text2))
                         {
                             new LotteryDataDAL().Add(lotteryId, text2, innerText3, innerText, innerText3);
                             Public.SetOpenListJson(lotteryId);
                             LotteryCheck.RunOfIssueNum(lotteryId, text2);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "采集主站获取开奖数据出错,错误代码:" + ex.Message);
     }
 }
コード例 #5
0
        public static string GetJson(string loid)
        {
            string shtml = HtmlOperate.GetHtml(ConfigurationManager.AppSettings["CollectUrl"].ToString() + "/Data/hisStory.xml?" + (object)new Random().Next(1, 1000));

            if (!string.IsNullOrEmpty(shtml))
            {
                foreach (XmlNode xmlNode in Public.GetXmlNode(shtml, "row"))
                {
                    string innerText1 = xmlNode.Attributes["code"].InnerText;
                    string innerText2 = xmlNode.Attributes["expect"].InnerText;
                    string str1       = xmlNode.Attributes["opencode"].InnerText.Replace("+", ",");
                    switch (loid)
                    {
                    case "1001":
                        if ("cqssc".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            shtml = "[{\"title\": \"" + (innerText2.Substring(0, 8) + "-" + innerText2.Substring(8)) + "\",\"number\": \"" + str1 + "\"}]";
                            break;
                        }
                        break;

                    case "1003":
                        if ("xjssc".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            shtml = "[{\"title\": \"" + (innerText2.Substring(0, 8) + "-" + innerText2.Substring(9)) + "\",\"number\": \"" + str1 + "\"}]";
                            break;
                        }
                        break;

                    case "1007":
                        if ("tjssc".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            shtml = "[{\"title\": \"" + (innerText2.Substring(0, 8) + "-" + innerText2.Substring(8)) + "\",\"number\": \"" + str1 + "\"}]";
                            break;
                        }
                        break;

                    case "1008":
                        if ("ynssc".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            shtml = "[{\"title\": \"" + (innerText2.Substring(0, 8) + "-" + innerText2.Substring(8)) + "\",\"number\": \"" + str1 + "\"}]";
                            break;
                        }
                        break;

                    case "2001":
                        if ("sd11x5".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            shtml = "[{\"title\": \"" + (innerText2.Substring(0, 8) + "-" + innerText2.Substring(8)) + "\",\"number\": \"" + str1 + "\"}]";
                            break;
                        }
                        break;

                    case "2002":
                        if ("gd11x5".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            shtml = "[{\"title\": \"" + (innerText2.Substring(0, 8) + "-" + innerText2.Substring(8)) + "\",\"number\": \"" + str1 + "\"}]";
                            break;
                        }
                        break;

                    case "2003":
                        if ("sh11x5".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            shtml = "[{\"title\": \"" + (innerText2.Substring(0, 8) + "-" + innerText2.Substring(8)) + "\",\"number\": \"" + str1 + "\"}]";
                            break;
                        }
                        break;

                    case "2004":
                        if ("jx11x5".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            shtml = "[{\"title\": \"" + (innerText2.Substring(0, 8) + "-" + innerText2.Substring(8)) + "\",\"number\": \"" + str1 + "\"}]";
                            break;
                        }
                        break;

                    case "1010":
                        if ("krkeno".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            string[] strArray = str1.Split(',');
                            string   str2     = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                            shtml = "[{\"title\": \"" + innerText2 + "\",\"number\": \"" + str2 + "\"}]";
                            break;
                        }
                        break;

                    case "1012":
                        if ("sgkeno".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            string[] strArray = str1.Split(',');
                            string   str2     = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                            shtml = "[{\"title\": \"" + innerText2 + "\",\"number\": \"" + str2 + "\"}]";
                            break;
                        }
                        break;

                    case "1013":
                        if ("twbingo".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            string[] strArray = str1.Split(',');
                            string   str2     = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                            shtml = "[{\"title\": \"" + innerText2 + "\",\"number\": \"" + str2 + "\"}]";
                            break;
                        }
                        break;

                    case "3004":
                        if ("krkeno".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            string[] strArray = str1.Split(',');
                            string   str2     = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3]) + Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[7]) + Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11]) + Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13])) % 10) + "," + (object)((Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15]) + Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                            shtml = "[{\"title\": \"" + innerText2 + "\",\"number\": \"" + str2 + "\"}]";
                            break;
                        }
                        break;

                    case "3001":
                        if ("shssl".Equals(xmlNode.Attributes["code"].InnerText))
                        {
                            shtml = "[{\"title\": \"" + (innerText2.Substring(0, 8) + "-" + innerText2.Substring(8)) + "\",\"number\": \"" + str1 + "\"}]";
                            break;
                        }
                        break;
                    }
                }
            }
            return(shtml);
        }
コード例 #6
0
        public static void CqSsc()
        {
            try
            {
                string html = HtmlOperate.GetHtml(Config.DefaultUrl);
                if (!string.IsNullOrEmpty(html))
                {
                    XmlNodeList xmlNode = Public.GetXmlNode(html, "row");
                    if (xmlNode == null)
                    {
                        (new LogExceptionDAL()).Save("采集异常", "采集找不到开奖数据的关键字符2");
                    }
                    else if (xmlNode.Count != 0)
                    {
                        foreach (XmlNode xmlNodes in xmlNode)
                        {
                            string innerText  = xmlNodes.Attributes["code"].InnerText;
                            string str        = xmlNodes.Attributes["expect"].InnerText;
                            string str1       = xmlNodes.Attributes["opencode"].InnerText.Replace("+", ",");
                            string innerText1 = xmlNodes.Attributes["opentime"].InnerText;
                            if (string.IsNullOrEmpty(innerText1) || string.IsNullOrEmpty(str) || string.IsNullOrEmpty(str1))
                            {
                                (new LogExceptionDAL()).Save("采集异常", "采集找不到开奖数据的关键字符4");
                                return;
                            }
                            else
                            {
                                bool   flag  = true;
                                string html1 = HtmlOperate.GetHtml(string.Concat(ConfigurationManager.AppSettings["RootUrl"].ToString(), "/Data/hisStory.xml"));
                                if (!string.IsNullOrEmpty(html1))
                                {
                                    foreach (XmlNode xmlNode1 in Public.GetXmlNode(html1, "row"))
                                    {
                                        string innerText2 = xmlNode1.Attributes["code"].InnerText;
                                        string str2       = xmlNode1.Attributes["expect"].InnerText;
                                        if (!innerText2.Equals(innerText) || !str2.Equals(str))
                                        {
                                            continue;
                                        }
                                        flag = false;
                                    }
                                }
                                if (!flag || str1.Contains("255"))
                                {
                                    continue;
                                }
                                string str3 = innerText;
                                switch (str3)
                                {
                                case "cqssc":
                                {
                                    string str4 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 9 || (new LotteryDataDAL()).Exists(1001, str4))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(1001, str4, str1, innerText1, "");
                                    Public.SetOpenListJson(1001);
                                    LotteryCheck.RunOfIssueNum(1001, str4);
                                    break;
                                }

                                case "xjssc":
                                {
                                    string str5 = string.Concat(str.Substring(0, 8), "-", str.Substring(9));
                                    if (str1.Length != 9 || (new LotteryDataDAL()).Exists(1003, str5))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(1003, str5, str1, innerText1, "");
                                    Public.SetOpenListJson(1003);
                                    LotteryCheck.RunOfIssueNum(1003, str5);
                                    break;
                                }

                                case "tjssc":
                                {
                                    string str6 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 9 || (new LotteryDataDAL()).Exists(1007, str6))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(1007, str6, str1, innerText1, "");
                                    Public.SetOpenListJson(1007);
                                    LotteryCheck.RunOfIssueNum(1007, str6);
                                    break;
                                }

                                case "twbingo":
                                {
                                    if ((new LotteryDataDAL()).Exists(1013, str))
                                    {
                                        continue;
                                    }
                                    string[] strArrays = str1.Split(new char[] { ',' });
                                    int      num       = (Convert.ToInt32(strArrays[0]) + Convert.ToInt32(strArrays[1]) + Convert.ToInt32(strArrays[2]) + Convert.ToInt32(strArrays[3])) % 10;
                                    int      num1      = (Convert.ToInt32(strArrays[4]) + Convert.ToInt32(strArrays[5]) + Convert.ToInt32(strArrays[6]) + Convert.ToInt32(strArrays[7])) % 10;
                                    int      num2      = (Convert.ToInt32(strArrays[8]) + Convert.ToInt32(strArrays[9]) + Convert.ToInt32(strArrays[10]) + Convert.ToInt32(strArrays[11])) % 10;
                                    int      num3      = (Convert.ToInt32(strArrays[12]) + Convert.ToInt32(strArrays[13]) + Convert.ToInt32(strArrays[14]) + Convert.ToInt32(strArrays[15])) % 10;
                                    int      num4      = (Convert.ToInt32(strArrays[16]) + Convert.ToInt32(strArrays[17]) + Convert.ToInt32(strArrays[18]) + Convert.ToInt32(strArrays[19])) % 10;
                                    string   str7      = string.Concat(new object[] { num, ",", num1, ",", num2, ",", num3, ",", num4 });
                                    (new LotteryDataDAL()).Add(1013, str, str7, innerText1, string.Join(",", strArrays));
                                    Public.SetOpenListJson(1013);
                                    LotteryCheck.RunOfIssueNum(1013, str);
                                    break;
                                }

                                case "sd11x5":
                                {
                                    string str8 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 14 || (new LotteryDataDAL()).Exists(2001, str8))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(2001, str8, str1, innerText1, "");
                                    Public.SetOpenListJson(2001);
                                    LotteryCheck.RunOfIssueNum(2001, str8);
                                    break;
                                }

                                case "gd11x5":
                                {
                                    string str9 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 14 || (new LotteryDataDAL()).Exists(2002, str9))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(2002, str9, str1, innerText1, "");
                                    Public.SetOpenListJson(2002);
                                    LotteryCheck.RunOfIssueNum(2002, str9);
                                    break;
                                }

                                case "sh11x5":
                                {
                                    string str10 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 14 || (new LotteryDataDAL()).Exists(2003, str10))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(2003, str10, str1, innerText1, "");
                                    Public.SetOpenListJson(2003);
                                    LotteryCheck.RunOfIssueNum(2003, str10);
                                    break;
                                }

                                case "jx11x5":
                                {
                                    string str11 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 14 || (new LotteryDataDAL()).Exists(2004, str11))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(2004, str11, str1, innerText1, "");
                                    Public.SetOpenListJson(2004);
                                    LotteryCheck.RunOfIssueNum(2004, str11);
                                    break;
                                }

                                case "krkeno":
                                {
                                    if ((new LotteryDataDAL()).Exists(1017, str))
                                    {
                                        continue;
                                    }
                                    string[] strArrays1 = str1.Split(new char[] { ',' });
                                    int      num5       = (Convert.ToInt32(strArrays1[0]) + Convert.ToInt32(strArrays1[1]) + Convert.ToInt32(strArrays1[2]) + Convert.ToInt32(strArrays1[3])) % 10;
                                    int      num6       = (Convert.ToInt32(strArrays1[4]) + Convert.ToInt32(strArrays1[5]) + Convert.ToInt32(strArrays1[6]) + Convert.ToInt32(strArrays1[7])) % 10;
                                    int      num7       = (Convert.ToInt32(strArrays1[8]) + Convert.ToInt32(strArrays1[9]) + Convert.ToInt32(strArrays1[10]) + Convert.ToInt32(strArrays1[11])) % 10;
                                    int      num8       = (Convert.ToInt32(strArrays1[12]) + Convert.ToInt32(strArrays1[13]) + Convert.ToInt32(strArrays1[14]) + Convert.ToInt32(strArrays1[15])) % 10;
                                    int      num9       = (Convert.ToInt32(strArrays1[16]) + Convert.ToInt32(strArrays1[17]) + Convert.ToInt32(strArrays1[18]) + Convert.ToInt32(strArrays1[19])) % 10;
                                    string   str12      = string.Concat(new object[] { num5, ",", num6, ",", num7, ",", num8, ",", num9 });
                                    (new LotteryDataDAL()).Add(1017, str, str12, innerText1, string.Join(",", strArrays1));
                                    Public.SetOpenListJson(1017);
                                    LotteryCheck.RunOfIssueNum(1017, str);
                                    break;
                                }

                                case "xdlkl8":
                                {
                                    string str13 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if ((new LotteryDataDAL()).Exists(1011, str13))
                                    {
                                        continue;
                                    }
                                    string[] strArrays2 = str1.Split(new char[] { ',' });
                                    int      num10      = (Convert.ToInt32(strArrays2[0]) + Convert.ToInt32(strArrays2[1]) + Convert.ToInt32(strArrays2[2]) + Convert.ToInt32(strArrays2[3])) % 10;
                                    int      num11      = (Convert.ToInt32(strArrays2[4]) + Convert.ToInt32(strArrays2[5]) + Convert.ToInt32(strArrays2[6]) + Convert.ToInt32(strArrays2[7])) % 10;
                                    int      num12      = (Convert.ToInt32(strArrays2[8]) + Convert.ToInt32(strArrays2[9]) + Convert.ToInt32(strArrays2[10]) + Convert.ToInt32(strArrays2[11])) % 10;
                                    int      num13      = (Convert.ToInt32(strArrays2[12]) + Convert.ToInt32(strArrays2[13]) + Convert.ToInt32(strArrays2[14]) + Convert.ToInt32(strArrays2[15])) % 10;
                                    int      num14      = (Convert.ToInt32(strArrays2[16]) + Convert.ToInt32(strArrays2[17]) + Convert.ToInt32(strArrays2[18]) + Convert.ToInt32(strArrays2[19])) % 10;
                                    string   str14      = string.Concat(new object[] { num10, ",", num11, ",", num12, ",", num13, ",", num14 });
                                    (new LotteryDataDAL()).Add(1011, str13, str14, innerText1, string.Join(",", strArrays2));
                                    Public.SetOpenListJson(1011);
                                    LotteryCheck.RunOfIssueNum(1011, str13);
                                    break;
                                }

                                case "phkeno":
                                {
                                    if ((new LotteryDataDAL()).Exists(1015, str))
                                    {
                                        continue;
                                    }
                                    string[] strArrays3 = str1.Split(new char[] { ',' });
                                    int      num15      = (Convert.ToInt32(strArrays3[0]) + Convert.ToInt32(strArrays3[1]) + Convert.ToInt32(strArrays3[2]) + Convert.ToInt32(strArrays3[3])) % 10;
                                    int      num16      = (Convert.ToInt32(strArrays3[4]) + Convert.ToInt32(strArrays3[5]) + Convert.ToInt32(strArrays3[6]) + Convert.ToInt32(strArrays3[7])) % 10;
                                    int      num17      = (Convert.ToInt32(strArrays3[8]) + Convert.ToInt32(strArrays3[9]) + Convert.ToInt32(strArrays3[10]) + Convert.ToInt32(strArrays3[11])) % 10;
                                    int      num18      = (Convert.ToInt32(strArrays3[12]) + Convert.ToInt32(strArrays3[13]) + Convert.ToInt32(strArrays3[14]) + Convert.ToInt32(strArrays3[15])) % 10;
                                    int      num19      = (Convert.ToInt32(strArrays3[16]) + Convert.ToInt32(strArrays3[17]) + Convert.ToInt32(strArrays3[18]) + Convert.ToInt32(strArrays3[19])) % 10;
                                    string   str15      = string.Concat(new object[] { num15, ",", num16, ",", num17, ",", num18, ",", num19 });
                                    (new LotteryDataDAL()).Add(1015, str, str15, innerText1, string.Join(",", strArrays3));
                                    Public.SetOpenListJson(1015);
                                    LotteryCheck.RunOfIssueNum(1015, str);
                                    break;
                                }

                                case "bjpk10":
                                {
                                    if ((new LotteryDataDAL()).Exists(4001, str))
                                    {
                                        continue;
                                    }
                                    if ((int)str1.Split(new char[] { ',' }).Length != 10)
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(4001, str, str1, innerText1, "");
                                    Public.SetOpenListJson(4001);
                                    LotteryCheck.RunOfIssueNum(4001, str);
                                    break;
                                }

                                default:
                                {
                                    if (str3 != "shssl")
                                    {
                                        continue;
                                    }
                                    string str16 = string.Concat(str.Substring(0, 8), "-", str.Substring(8));
                                    if (str1.Length != 5 || (new LotteryDataDAL()).Exists(3001, str16))
                                    {
                                        continue;
                                    }
                                    (new LotteryDataDAL()).Add(3001, str16, str1, innerText1, "");
                                    Public.SetOpenListJson(3001);
                                    LotteryCheck.RunOfIssueNum(3001, str16);
                                    break;
                                }
                                }
                            }
                        }
                        string str17 = string.Concat(ConfigurationManager.AppSettings["DataUrl"].ToString(), "hisStory.xml");
                        DirFile.CreateFolder(DirFile.GetFolderPath(false, str17));
                        StreamWriter streamWriter = new StreamWriter(str17, false, Encoding.UTF8);
                        streamWriter.Write(html);
                        streamWriter.Close();
                    }
                    else
                    {
                        (new LogExceptionDAL()).Save("采集异常", "采集找不到开奖数据的关键字符3");
                    }
                }
                else
                {
                    (new LogExceptionDAL()).Save("采集异常", "采集找不到开奖数据的关键字符1");
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                (new LogExceptionDAL()).Save("采集异常", string.Concat("采集获取开奖数据出错,错误代码111:", exception.Message));
            }
        }
コード例 #7
0
ファイル: DefaultToOther.cs プロジェクト: longphui/ffyule
        public static void CqSsc()
        {
            try
            {
                string html1 = HtmlOperate.GetHtml(Config.DefaultUrl);
                if (string.IsNullOrEmpty(html1))
                {
                    new LogExceptionDAL().Save("采集异常", "采集找不到开奖数据的关键字符1");
                }
                else
                {
                    XmlNodeList xmlNode1 = Public.GetXmlNode(html1, "row");
                    if (xmlNode1 == null)
                    {
                        new LogExceptionDAL().Save("采集异常", "采集找不到开奖数据的关键字符2");
                    }
                    else if (xmlNode1.Count == 0)
                    {
                        new LogExceptionDAL().Save("采集异常", "采集找不到开奖数据的关键字符3");
                    }
                    else
                    {
                        foreach (XmlNode xmlNode2 in xmlNode1)
                        {
                            string innerText1 = xmlNode2.Attributes["code"].InnerText;
                            string innerText2 = xmlNode2.Attributes["expect"].InnerText;
                            string Number1    = xmlNode2.Attributes["opencode"].InnerText.Replace("+", ",");
                            string innerText3 = xmlNode2.Attributes["opentime"].InnerText;
                            if (string.IsNullOrEmpty(innerText3) || string.IsNullOrEmpty(innerText2) || string.IsNullOrEmpty(Number1))
                            {
                                new LogExceptionDAL().Save("采集异常", "采集找不到开奖数据的关键字符4");
                                return;
                            }
                            bool   flag  = true;
                            string html2 = HtmlOperate.GetHtml(ConfigurationManager.AppSettings["RootUrl"].ToString() + "/Data/hisStory.xml");
                            if (!string.IsNullOrEmpty(html2))
                            {
                                foreach (XmlNode xmlNode3 in Public.GetXmlNode(html2, "row"))
                                {
                                    string innerText4 = xmlNode3.Attributes["code"].InnerText;
                                    string innerText5 = xmlNode3.Attributes["expect"].InnerText;
                                    if (innerText4.Equals(innerText1) && innerText5.Equals(innerText2))
                                    {
                                        flag = false;
                                    }
                                }
                            }
                            if (flag && !Number1.Contains("255"))
                            {
                                switch (innerText1)
                                {
                                case "bjpk10":
                                    if (!new LotteryDataDAL().Exists(4001, innerText2))
                                    {
                                        if (Number1.Split(',').Length == 10)
                                        {
                                            new LotteryDataDAL().Add(4001, innerText2, Number1, innerText3, "");
                                            Public.SetOpenListJson(4001);
                                            LotteryCheck.RunOfIssueNum(4001, innerText2);
                                            continue;
                                        }
                                        continue;
                                    }
                                    continue;

                                case "cqssc":
                                    string str1 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 9 && !new LotteryDataDAL().Exists(1001, str1))
                                    {
                                        new LotteryDataDAL().Add(1001, str1, Number1, innerText3, "");
                                        Public.SetOpenListJson(1001);
                                        LotteryCheck.RunOfIssueNum(1001, str1);
                                        continue;
                                    }
                                    continue;

                                case "gd11x5":
                                    string str2 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 14 && !new LotteryDataDAL().Exists(2002, str2))
                                    {
                                        new LotteryDataDAL().Add(2002, str2, Number1, innerText3, "");
                                        Public.SetOpenListJson(2002);
                                        LotteryCheck.RunOfIssueNum(2002, str2);
                                        continue;
                                    }
                                    continue;

                                case "jx11x5":
                                    string str3 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 14 && !new LotteryDataDAL().Exists(2004, str3))
                                    {
                                        new LotteryDataDAL().Add(2004, str3, Number1, innerText3, "");
                                        Public.SetOpenListJson(2004);
                                        LotteryCheck.RunOfIssueNum(2004, str3);
                                        continue;
                                    }
                                    continue;

                                case "krkeno":
                                    if (!new LotteryDataDAL().Exists(1017, innerText2))
                                    {
                                        string[] strArray = Number1.Split(',');
                                        string   Number2  = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                                        new LotteryDataDAL().Add(1017, innerText2, Number2, innerText3, string.Join(",", strArray));
                                        Public.SetOpenListJson(1017);
                                        LotteryCheck.RunOfIssueNum(1017, innerText2);
                                        continue;
                                    }
                                    continue;

                                case "phkeno":
                                    if (!new LotteryDataDAL().Exists(1015, innerText2))
                                    {
                                        string[] strArray = Number1.Split(',');
                                        string   Number2  = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                                        new LotteryDataDAL().Add(1015, innerText2, Number2, innerText3, string.Join(",", strArray));
                                        Public.SetOpenListJson(1015);
                                        LotteryCheck.RunOfIssueNum(1015, innerText2);
                                        continue;
                                    }
                                    continue;

                                case "sd11x5":
                                    string str4 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 14 && !new LotteryDataDAL().Exists(2001, str4))
                                    {
                                        new LotteryDataDAL().Add(2001, str4, Number1, innerText3, "");
                                        Public.SetOpenListJson(2001);
                                        LotteryCheck.RunOfIssueNum(2001, str4);
                                        continue;
                                    }
                                    continue;

                                case "sh11x5":
                                    string str5 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 14 && !new LotteryDataDAL().Exists(2003, str5))
                                    {
                                        new LotteryDataDAL().Add(2003, str5, Number1, innerText3, "");
                                        Public.SetOpenListJson(2003);
                                        LotteryCheck.RunOfIssueNum(2003, str5);
                                        continue;
                                    }
                                    continue;

                                case "shssl":
                                    string str6 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 5 && !new LotteryDataDAL().Exists(3001, str6))
                                    {
                                        new LotteryDataDAL().Add(3001, str6, Number1, innerText3, "");
                                        Public.SetOpenListJson(3001);
                                        LotteryCheck.RunOfIssueNum(3001, str6);
                                        continue;
                                    }
                                    continue;

                                case "tjssc":
                                    string str7 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (Number1.Length == 9 && !new LotteryDataDAL().Exists(1007, str7))
                                    {
                                        new LotteryDataDAL().Add(1007, str7, Number1, innerText3, "");
                                        Public.SetOpenListJson(1007);
                                        LotteryCheck.RunOfIssueNum(1007, str7);
                                        continue;
                                    }
                                    continue;

                                case "twbingo":
                                    if (!new LotteryDataDAL().Exists(1013, innerText2))
                                    {
                                        string[] strArray = Number1.Split(',');
                                        string   Number2  = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                                        new LotteryDataDAL().Add(1013, innerText2, Number2, innerText3, string.Join(",", strArray));
                                        Public.SetOpenListJson(1013);
                                        LotteryCheck.RunOfIssueNum(1013, innerText2);
                                        continue;
                                    }
                                    continue;

                                case "xdlkl8":
                                    string str8 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(8);
                                    if (!new LotteryDataDAL().Exists(1011, str8))
                                    {
                                        string[] strArray = Number1.Split(',');
                                        string   Number2  = ((Convert.ToInt32(strArray[0]) + Convert.ToInt32(strArray[1]) + Convert.ToInt32(strArray[2]) + Convert.ToInt32(strArray[3])) % 10).ToString() + "," + (object)((Convert.ToInt32(strArray[4]) + Convert.ToInt32(strArray[5]) + Convert.ToInt32(strArray[6]) + Convert.ToInt32(strArray[7])) % 10) + "," + (object)((Convert.ToInt32(strArray[8]) + Convert.ToInt32(strArray[9]) + Convert.ToInt32(strArray[10]) + Convert.ToInt32(strArray[11])) % 10) + "," + (object)((Convert.ToInt32(strArray[12]) + Convert.ToInt32(strArray[13]) + Convert.ToInt32(strArray[14]) + Convert.ToInt32(strArray[15])) % 10) + "," + (object)((Convert.ToInt32(strArray[16]) + Convert.ToInt32(strArray[17]) + Convert.ToInt32(strArray[18]) + Convert.ToInt32(strArray[19])) % 10);
                                        new LotteryDataDAL().Add(1011, str8, Number2, innerText3, string.Join(",", strArray));
                                        Public.SetOpenListJson(1011);
                                        LotteryCheck.RunOfIssueNum(1011, str8);
                                        continue;
                                    }
                                    continue;

                                case "xjssc":
                                    string str9 = innerText2.Substring(0, 8) + "-" + innerText2.Substring(9);
                                    if (Number1.Length == 9 && !new LotteryDataDAL().Exists(1003, str9))
                                    {
                                        new LotteryDataDAL().Add(1003, str9, Number1, innerText3, "");
                                        Public.SetOpenListJson(1003);
                                        LotteryCheck.RunOfIssueNum(1003, str9);
                                        continue;
                                    }
                                    continue;

                                default:
                                    continue;
                                }
                            }
                        }
                        string str = ConfigurationManager.AppSettings["DataUrl"].ToString() + "hisStory.xml";
                        DirFile.CreateFolder(DirFile.GetFolderPath(false, str));
                        StreamWriter streamWriter = new StreamWriter(str, false, Encoding.UTF8);
                        streamWriter.Write(html1);
                        streamWriter.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                new LogExceptionDAL().Save("采集异常", "采集获取开奖数据出错,错误代码111:" + ex.Message);
            }
        }
コード例 #8
0
        public static string GetJson(string loid)
        {
            Random random = new Random();
            string arg    = ConfigurationManager.AppSettings["CollectUrl"].ToString();
            string text   = HtmlOperate.GetHtml(arg + "/Data/hisStory.xml?" + random.Next(1, 1000));

            if (!string.IsNullOrEmpty(text))
            {
                XmlNodeList xmlNode = Public.GetXmlNode(text, "row");
                foreach (XmlNode xmlNode2 in xmlNode)
                {
                    string innerText = xmlNode2.Attributes["code"].InnerText;
                    string text2     = xmlNode2.Attributes["expect"].InnerText;
                    string text3     = xmlNode2.Attributes["opencode"].InnerText.Replace("+", ",");
                    switch (loid)
                    {
                    case "1001":
                        if ("cqssc".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            text2 = text2.Substring(0, 8) + "-" + text2.Substring(8);
                            text  = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text3,
                                "\"}]"
                            });
                        }
                        break;

                    case "1003":
                        if ("xjssc".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            text2 = text2.Substring(0, 8) + "-" + text2.Substring(9);
                            text  = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text3,
                                "\"}]"
                            });
                        }
                        break;

                    case "1007":
                        if ("tjssc".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            text2 = text2.Substring(0, 8) + "-" + text2.Substring(8);
                            text  = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text3,
                                "\"}]"
                            });
                        }
                        break;

                    case "1008":
                        if ("ynssc".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            text2 = text2.Substring(0, 8) + "-" + text2.Substring(8);
                            text  = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text3,
                                "\"}]"
                            });
                        }
                        break;

                    case "2001":
                        if ("sd11x5".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            text2 = text2.Substring(0, 8) + "-" + text2.Substring(8);
                            text  = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text3,
                                "\"}]"
                            });
                        }
                        break;

                    case "2002":
                        if ("gd11x5".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            text2 = text2.Substring(0, 8) + "-" + text2.Substring(8);
                            text  = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text3,
                                "\"}]"
                            });
                        }
                        break;

                    case "2003":
                        if ("sh11x5".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            text2 = text2.Substring(0, 8) + "-" + text2.Substring(8);
                            text  = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text3,
                                "\"}]"
                            });
                        }
                        break;

                    case "2004":
                        if ("jx11x5".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            text2 = text2.Substring(0, 8) + "-" + text2.Substring(8);
                            text  = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text3,
                                "\"}]"
                            });
                        }
                        break;

                    case "1010":
                        if ("krkeno".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            string[] array = text3.Split(new char[]
                            {
                                ','
                            });
                            int    num2  = (Convert.ToInt32(array[0]) + Convert.ToInt32(array[1]) + Convert.ToInt32(array[2]) + Convert.ToInt32(array[3])) % 10;
                            int    num3  = (Convert.ToInt32(array[4]) + Convert.ToInt32(array[5]) + Convert.ToInt32(array[6]) + Convert.ToInt32(array[7])) % 10;
                            int    num4  = (Convert.ToInt32(array[8]) + Convert.ToInt32(array[9]) + Convert.ToInt32(array[10]) + Convert.ToInt32(array[11])) % 10;
                            int    num5  = (Convert.ToInt32(array[12]) + Convert.ToInt32(array[13]) + Convert.ToInt32(array[14]) + Convert.ToInt32(array[15])) % 10;
                            int    num6  = (Convert.ToInt32(array[16]) + Convert.ToInt32(array[17]) + Convert.ToInt32(array[18]) + Convert.ToInt32(array[19])) % 10;
                            string text4 = string.Concat(new object[]
                            {
                                num2,
                                ",",
                                num3,
                                ",",
                                num4,
                                ",",
                                num5,
                                ",",
                                num6
                            });
                            text = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text4,
                                "\"}]"
                            });
                        }
                        break;

                    case "1012":
                        if ("sgkeno".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            string[] array = text3.Split(new char[]
                            {
                                ','
                            });
                            int    num2  = (Convert.ToInt32(array[0]) + Convert.ToInt32(array[1]) + Convert.ToInt32(array[2]) + Convert.ToInt32(array[3])) % 10;
                            int    num3  = (Convert.ToInt32(array[4]) + Convert.ToInt32(array[5]) + Convert.ToInt32(array[6]) + Convert.ToInt32(array[7])) % 10;
                            int    num4  = (Convert.ToInt32(array[8]) + Convert.ToInt32(array[9]) + Convert.ToInt32(array[10]) + Convert.ToInt32(array[11])) % 10;
                            int    num5  = (Convert.ToInt32(array[12]) + Convert.ToInt32(array[13]) + Convert.ToInt32(array[14]) + Convert.ToInt32(array[15])) % 10;
                            int    num6  = (Convert.ToInt32(array[16]) + Convert.ToInt32(array[17]) + Convert.ToInt32(array[18]) + Convert.ToInt32(array[19])) % 10;
                            string text4 = string.Concat(new object[]
                            {
                                num2,
                                ",",
                                num3,
                                ",",
                                num4,
                                ",",
                                num5,
                                ",",
                                num6
                            });
                            text = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text4,
                                "\"}]"
                            });
                        }
                        break;

                    case "1013":
                        if ("twbingo".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            string[] array = text3.Split(new char[]
                            {
                                ','
                            });
                            int    num2  = (Convert.ToInt32(array[0]) + Convert.ToInt32(array[1]) + Convert.ToInt32(array[2]) + Convert.ToInt32(array[3])) % 10;
                            int    num3  = (Convert.ToInt32(array[4]) + Convert.ToInt32(array[5]) + Convert.ToInt32(array[6]) + Convert.ToInt32(array[7])) % 10;
                            int    num4  = (Convert.ToInt32(array[8]) + Convert.ToInt32(array[9]) + Convert.ToInt32(array[10]) + Convert.ToInt32(array[11])) % 10;
                            int    num5  = (Convert.ToInt32(array[12]) + Convert.ToInt32(array[13]) + Convert.ToInt32(array[14]) + Convert.ToInt32(array[15])) % 10;
                            int    num6  = (Convert.ToInt32(array[16]) + Convert.ToInt32(array[17]) + Convert.ToInt32(array[18]) + Convert.ToInt32(array[19])) % 10;
                            string text4 = string.Concat(new object[]
                            {
                                num2,
                                ",",
                                num3,
                                ",",
                                num4,
                                ",",
                                num5,
                                ",",
                                num6
                            });
                            text = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text4,
                                "\"}]"
                            });
                        }
                        break;

                    case "3004":
                        if ("krkeno".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            string[] array = text3.Split(new char[]
                            {
                                ','
                            });
                            int    num2  = (Convert.ToInt32(array[0]) + Convert.ToInt32(array[1]) + Convert.ToInt32(array[2]) + Convert.ToInt32(array[3]) + Convert.ToInt32(array[4]) + Convert.ToInt32(array[5]) + Convert.ToInt32(array[6])) % 10;
                            int    num3  = (Convert.ToInt32(array[7]) + Convert.ToInt32(array[8]) + Convert.ToInt32(array[9]) + Convert.ToInt32(array[10]) + Convert.ToInt32(array[11]) + Convert.ToInt32(array[12]) + Convert.ToInt32(array[13])) % 10;
                            int    num4  = (Convert.ToInt32(array[14]) + Convert.ToInt32(array[15]) + Convert.ToInt32(array[16]) + Convert.ToInt32(array[17]) + Convert.ToInt32(array[18]) + Convert.ToInt32(array[19])) % 10;
                            string text4 = string.Concat(new object[]
                            {
                                num2,
                                ",",
                                num3,
                                ",",
                                num4
                            });
                            text = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text4,
                                "\"}]"
                            });
                        }
                        break;

                    case "3001":
                        if ("shssl".Equals(xmlNode2.Attributes["code"].InnerText))
                        {
                            text2 = text2.Substring(0, 8) + "-" + text2.Substring(8);
                            text  = string.Concat(new string[]
                            {
                                "[{\"title\": \"",
                                text2,
                                "\",\"number\": \"",
                                text3,
                                "\"}]"
                            });
                        }
                        break;
                    }
                }
            }
            return(text);
        }
コード例 #9
0
 public static void DataToOther(int lotteryId)
 {
     try
     {
         string html1 = HtmlOperate.GetHtml(string.Format(Config.DefaultUrlYoule, (object)lotteryId));
         if (string.IsNullOrEmpty(html1))
         {
             new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
         }
         else
         {
             XmlNodeList xmlNode1 = Public.GetXmlNode(html1, "row");
             if (xmlNode1 == null)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
             }
             else if (xmlNode1.Count == 0)
             {
                 new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
             }
             else
             {
                 foreach (XmlNode xmlNode2 in xmlNode1)
                 {
                     string innerText1 = xmlNode2.Attributes["opentime"].InnerText;
                     string innerText2 = xmlNode2.Attributes["expect"].InnerText;
                     string innerText3 = xmlNode2.Attributes["opencode"].InnerText;
                     if (string.IsNullOrEmpty(innerText1) || string.IsNullOrEmpty(innerText2) || string.IsNullOrEmpty(innerText3))
                     {
                         new LogExceptionDAL().Save("采集异常", "采集主站找不到开奖数据的关键字符");
                         break;
                     }
                     bool   flag  = true;
                     string html2 = HtmlOperate.GetHtml(ConfigurationManager.AppSettings["RootUrl"].ToString() + "/Data/lottery" + (object)lotteryId + ".xml");
                     if (!string.IsNullOrEmpty(html2))
                     {
                         foreach (XmlNode xmlNode3 in Public.GetXmlNode(html2, "row"))
                         {
                             if (xmlNode3.Attributes["expect"].InnerText.Equals(innerText2))
                             {
                                 flag = false;
                             }
                         }
                     }
                     if (flag)
                     {
                         string str = innerText2;
                         if (!new LotteryDataDAL().Exists(lotteryId, str))
                         {
                             new LotteryDataDAL().Add(lotteryId, str, innerText3, innerText1, innerText3);
                             Public.SetOpenListJson(lotteryId);
                             LotteryCheck.RunOfIssueNum(lotteryId, str);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new LogExceptionDAL().Save("采集异常", "采集主站获取开奖数据出错,错误代码:" + ex.Message);
     }
 }