Beispiel #1
0
        public static Hashtable GetHashTableIdMark(List <objMatch> Odd_SboList, List <objMatch> Odd_IbetList, bool live)
        {
            Hashtable Output = new Hashtable();

            foreach (objMatch Odd_Sbo in Odd_SboList)
            {
                foreach (objMatch Odd_Ibet in Odd_IbetList)
                {
                    if (live)
                    {
                    }
                    else
                    {
                        if (Convert.ToDateTime(Odd_Sbo.TimeNonLive) < Convert.ToDateTime(Odd_Ibet.TimeNonLive))
                        {
                            continue;
                        }
                    }
                    if (UtilSoccer.ChuanTenLeauge_Sbo(Odd_Sbo.LeaugeName) == UtilSoccer.ChuanTenLeauge_Ibet(Odd_Ibet.LeaugeName))
                    {
                        if (UtilSoccer.ChuanTenTeam_Sbo(Odd_Sbo.HomeName) == UtilSoccer.ChuanTenTeam_Ibet(Odd_Ibet.HomeName) && UtilSoccer.ChuanTenTeam_Sbo(Odd_Sbo.AwayName) == UtilSoccer.ChuanTenTeam_Ibet(Odd_Ibet.AwayName))
                        {
                            if (UtilSoccer.formatkeo(Odd_Sbo.hdp) == UtilSoccer.formatkeo(Odd_Ibet.hdp) && Odd_Sbo.BetType == Odd_Ibet.BetType)
                            {
                                Output.Add(Odd_Sbo.IdKeo, Odd_Ibet.IdKeo);
                                break;
                            }
                        }
                    }
                }
            }
            return(Output);
        }
        public static string CompareByHash(List <objMatch> Ibet, List <objMatch> Sbo, double profitmin)
        {
            string result = "";

            HashIbet.Clear();
            HashSbo.Clear();
            foreach (objMatch ObjIbet in Ibet)
            {
                string key = string.Format("{0},{1},{2},{3}", ObjIbet.HomeName, ObjIbet.AwayName, ObjIbet.hdp, ObjIbet.BetType);
                if (!HashIbet.Contains(key))
                {
                    HashIbet.Add(key, ObjIbet);
                }
            }
            foreach (objMatch ObjSbo in Sbo)
            {
                string key = string.Format("{0},{1},{2},{3}", ObjSbo.HomeName, ObjSbo.AwayName, ObjSbo.hdp, ObjSbo.BetType);
                if (!HashSbo.Contains(key))
                {
                    HashSbo.Add(key, ObjSbo);
                }
            }

            ICollection keySbos = HashSbo.Keys;

            foreach (string keySbo in keySbos)
            {
                if (HashIbet.ContainsKey(keySbo))
                {
                    string OddSbo1   = ((objMatch)HashSbo[keySbo]).Odd1;
                    string OddSbo2   = ((objMatch)HashSbo[keySbo]).Odd2;
                    string OddIbet1  = ((objMatch)HashIbet[keySbo]).Odd1;
                    string OddIbet2  = ((objMatch)HashIbet[keySbo]).Odd2;
                    double LeagueOdd = UtilSoccer.profit_odd(OddSbo1, OddSbo2);
                    string IdKeoSbo  = ((objMatch)HashSbo[keySbo]).IdKeo;
                    string IdKeoIbet = ((objMatch)HashIbet[keySbo]).IdKeo;
                    string HomeName  = ((objMatch)HashIbet[keySbo]).HomeName;
                    string AwayName  = ((objMatch)HashIbet[keySbo]).AwayName;
                    string Keo       = ((objMatch)HashIbet[keySbo]).hdp;
                    string BetType   = ((objMatch)HashSbo[keySbo]).BetType;
                    string Score     = ((objMatch)HashIbet[keySbo]).Score;
                    string Time      = ((objMatch)HashIbet[keySbo]).TimeNonLive;
                    //Time = Time.Split(' ')[Time.Split(' ').Length - 1];
                    if (profit_odd(OddSbo1, OddIbet2) >= profitmin)
                    {
                        result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                    }
                    else if (profit_odd(OddSbo2, OddIbet1) >= profitmin)
                    {
                        result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                    }
                }
            }
            return(result);
        }
        public static string CompareUnder(List <objMatch> lstIbet)
        {
            string result = "";

            foreach (objMatch match in lstIbet)
            {
                try
                {
                    string key = string.Format("{0},{1},{2},{3}", match.HomeName, match.AwayName, match.hdp, match.BetType);
                    if ((match.BetType == "3" || match.BetType == "9") && int.Parse(match.TimeLive.Split(' ')[1]) <= 5)
                    {
                        if (!hsIbetUnder.Contains(key))
                        {
                            hsIbetUnder.Add(key, match);
                        }
                    }
                    else if ((match.BetType == "3" || match.BetType == "9") && int.Parse(match.TimeLive.Split(' ')[1]) >= 30)
                    {
                        if (hsIbetUnder.Contains(key))
                        {
                            if (((objMatch)hsIbetUnder[key]).Score == match.Score)
                            {
                                string Odd1      = match.Odd1;
                                string Odd2      = match.Odd2;
                                double LeagueOdd = UtilSoccer.profit_odd(Odd1, Odd2);
                                string IdKeoIbet = match.IdKeo;
                                string HomeName  = match.HomeName;
                                string AwayName  = match.AwayName;
                                string Keo       = match.hdp;
                                string BetType   = match.BetType;
                                string Score     = match.Score;
                                string Time      = match.TimeLive;
                                result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + Odd1 + "/" + Odd2 + ",h/a," + IdKeoIbet + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd(Odd1, Odd2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                            }
                            hsIbetUnder.Remove(key);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            return(result);
        }
        public static void CompareMinus(List <objMatch> lstIbet)
        {
            string result = "";

            foreach (objMatch match in lstIbet)
            {
                try
                {
                    string key = string.Format("{0},{1},{2},{3}", match.HomeName, match.AwayName, match.hdp, match.BetType);
                    if ((float.Parse(match.Odd1) < 0 || float.Parse(match.Odd2) < 0) && match.hdp != "")
                    {
                        if (!hsIbetMinus.Contains(key))
                        {
                            hsIbetMinus.Add(key, match);
                            string Odd1      = match.Odd1;
                            string Odd2      = match.Odd2;
                            double LeagueOdd = UtilSoccer.profit_odd(Odd1, Odd2);
                            string IdKeoIbet = match.IdKeo;
                            string HomeName  = match.HomeName;
                            string AwayName  = match.AwayName;
                            string Keo       = match.hdp;
                            string BetType   = match.BetType;
                            string Score     = match.Score;
                            string Time      = match.TimeLive;
                            string home_away = "";
                            if (float.Parse(match.Odd1) < 0)
                            {
                                home_away = "a/h";
                            }
                            else
                            {
                                home_away = "h/a";
                            }
                            result = HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + Odd1 + "/" + Odd2 + "," + home_away + "," + IdKeoIbet + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd(Odd1, Odd2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
        public List <objMatch> getMatchOddNonLive()
        {
            try
            {
                lst.Clear();
                string DataOddSboNonLive = http.Fetch(mainLink + "/web-root/restricted/odds-display/today-data.aspx?od-param=2,1,1,1,2,2,2,2,3,1&fi=1&v=0&dl=3", HttpHelper.HttpMethod.Get, null, null);
                string leagueDataNonLive = "[" + Util.GetSubstringByString(DataOddSboNonLive, "[[[", "]],[[") + "]";
                leagueDataNonLive = leagueDataNonLive.Replace("],[", "]\n[");
                string str_LeaugeSbo = "", str_TeamSbo = "";
                if (str_LeaugeSbo == "")
                {
                    hsLeagueNonLive.Clear();
                    foreach (string league in leagueDataNonLive.Split('\n'))
                    {
                        string leagueTemp     = league.Replace("[", "").Replace("]", "").Replace("'", "");
                        string nameleagueTemp = UtilSoccer.ChuanTenLeauge_Sbo(leagueTemp.Split(',')[1]);
                        if (nameleagueTemp.IndexOf("SPECIFIC") != -1 || nameleagueTemp.IndexOf("CORNERS") != -1 || nameleagueTemp.IndexOf("BOOKING") != -1 || nameleagueTemp.IndexOf("FANTASY MATCH") != -1 || nameleagueTemp.IndexOf("WHICH TEAM") != -1 || nameleagueTemp.IndexOf("TOTAL GOALS") != -1 || nameleagueTemp.IndexOf("INJURY") != -1 || nameleagueTemp.IndexOf("WINNER") != -1)
                        {
                            continue;                                                                                                                                                                                                                                                                                                                                                                  //INJURY
                        }
                        hsLeagueNonLive.Add(leagueTemp.Split(',')[0], nameleagueTemp);
                        if (str_LeaugeSbo.IndexOf(nameleagueTemp) == -1)
                        {
                            str_LeaugeSbo += nameleagueTemp + ",";
                        }
                    }
                }

                string matchDataNonLive = "[" + Util.GetSubstringByString(DataOddSboNonLive, "]],[[", "]],[[") + "]";
                matchDataNonLive = matchDataNonLive.Replace("],[", "]\n[");
                hsMatchNonLive.Clear();
                foreach (string matchNonLive in matchDataNonLive.Split('\n'))
                {
                    string   matchTempNonLive     = matchNonLive.Replace("[", "").Replace("]", "").Replace("'", "");
                    string[] arr_matchTempNonLive = matchTempNonLive.Split(',');
                    string   idmatchNonLive       = Util.GetSubstringByStringLast(DataOddSboNonLive, "[", "," + arr_matchTempNonLive[0]);
                    try
                    {
                        hsMatchNonLive.Add(idmatchNonLive, hsLeagueNonLive[arr_matchTempNonLive[2]].ToString() + "," + arr_matchTempNonLive[3] + "," + arr_matchTempNonLive[4] + "," + arr_matchTempNonLive[7]);
                    }
                    catch
                    {
                        continue;
                    }
                    if (str_TeamSbo.IndexOf(UtilSoccer.ChuanTenTeam_Sbo(arr_matchTempNonLive[3])) == -1 || str_TeamSbo.IndexOf(UtilSoccer.ChuanTenTeam_Sbo(arr_matchTempNonLive[4])) == -1)
                    {
                        str_TeamSbo += UtilSoccer.ChuanTenTeam_Sbo(arr_matchTempNonLive[3]) + "-" + UtilSoccer.ChuanTenTeam_Sbo(arr_matchTempNonLive[4]) + ",";
                    }
                }

                string oddDataNonLive = "[[" + Util.GetSubstringByString(DataOddSboNonLive, ",,[[", "]]],,") + "]]]";
                foreach (string OddTempNonLive in oddDataNonLive.Split(new string[] { "]],[" }, StringSplitOptions.None))
                {
                    objMatch o           = new objMatch();
                    string   OddTemp     = OddTempNonLive.Replace("[", "").Replace("]", "").Replace("'", "");
                    string[] arr_OddTemp = OddTemp.Split(',');
                    string   infomatch   = "";
                    try
                    {
                        infomatch = hsMatchNonLive[arr_OddTemp[1]].ToString();
                    }
                    catch
                    {
                        continue;
                    }
                    o.LeaugeName  = infomatch.Split(',')[0];
                    o.HomeName    = infomatch.Split(',')[1];
                    o.AwayName    = infomatch.Split(',')[2];
                    o.TimeNonLive = infomatch.Split(',')[3];
                    if (o.TimeNonLive.Split('/').Length == 1)
                    {
                        o.TimeNonLive = o.TimeLive;
                    }

                    o.IdKeo   = arr_OddTemp[0];
                    o.Keo     = arr_OddTemp[5];
                    o.BetType = arr_OddTemp[2];
                    o.Odd1    = arr_OddTemp[6];
                    o.Odd2    = arr_OddTemp[7];

                    lst.Add(o);
                }
            }
            catch (Exception)
            {
                lst.Clear();
                return(lst);
            }
            return(lst);
        }
Beispiel #6
0
        private List <objMatch> convertStringToObjMatch(string input)
        {
            input = input.Replace("'", "");
            List <objMatch> lst = new List <objMatch>();
            string          LeaugeName = "", HomeName = "", AwayName = "";

            string[] dataMatch = input.Split(',');
            if (dataMatch[5] != "")
            {
                LeaugeName = UtilSoccer.ChuanTenLeauge_Ibet(dataMatch[5]);
            }
            if (LeaugeName.Contains("CORNERS") || LeaugeName.Contains("BOOKING") || LeaugeName.Contains("TEAM") || LeaugeName.Contains("MATCH"))
            {
                return(null);
            }
            if (dataMatch[6] != "")
            {
                HomeName = UtilSoccer.ChuanTenTeam_Ibet(dataMatch[6]);
                AwayName = UtilSoccer.ChuanTenTeam_Ibet(dataMatch[7]);
            }
            ///FT///
            objMatch o = new objMatch();

            o.LeaugeName = LeaugeName;
            o.HomeName   = HomeName;
            o.AwayName   = AwayName;
            o.IdKeo      = dataMatch[31];
            o.BetType    = "1";
            o.Keo        = dataMatch[32];
            o.Odd1       = dataMatch[33];
            o.Odd2       = dataMatch[34];
            if (dataMatch[35] == "a")
            {
                o.Keo = "-" + o.Keo;
            }
            o.Keo = UtilSoccer.formatkeo(o.Keo);
            if (o.IdKeo != "")
            {
                lst.Add(o);
            }

            ///OUFT///
            o            = new objMatch();
            o.LeaugeName = LeaugeName;
            o.HomeName   = HomeName;
            o.AwayName   = AwayName;
            o.IdKeo      = dataMatch[36];
            o.BetType    = "3";
            o.Keo        = dataMatch[37];
            o.Odd1       = dataMatch[38];
            o.Odd2       = dataMatch[39];
            if (dataMatch[35] == "a")
            {
                o.Keo = "-" + o.Keo;
            }
            o.Keo = UtilSoccer.formatkeo(o.Keo);
            if (o.IdKeo != "")
            {
                lst.Add(o);
            }

            ///HT///
            o            = new objMatch();
            o.LeaugeName = LeaugeName;
            o.HomeName   = HomeName;
            o.AwayName   = AwayName;
            o.IdKeo      = dataMatch[44];
            o.BetType    = "7";
            o.Keo        = dataMatch[45];
            o.Odd1       = dataMatch[46];
            o.Odd2       = dataMatch[47];
            if (dataMatch[48] == "a")
            {
                o.Keo = "-" + o.Keo;
            }
            o.Keo = UtilSoccer.formatkeo(o.Keo);
            if (o.IdKeo != "")
            {
                lst.Add(o);
            }

            ///HTOU///
            o            = new objMatch();
            o.LeaugeName = LeaugeName;
            o.HomeName   = HomeName;
            o.AwayName   = AwayName;
            o.IdKeo      = dataMatch[49];
            o.BetType    = "9";
            o.Keo        = dataMatch[50];
            o.Odd1       = dataMatch[51];
            o.Odd2       = dataMatch[52];
            if (dataMatch[48] == "a")
            {
                o.Keo = "-" + o.Keo;
            }
            o.Keo = UtilSoccer.formatkeo(o.Keo);
            if (o.IdKeo != "")
            {
                lst.Add(o);
            }

            return(lst);
        }
Beispiel #7
0
        public bool CheckLai(string Filter)
        {
            double oddsspreada = UtilSoccer.profit_odd(Odd1, Odd2);

            switch (Filter)
            {
            case "First_a":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.05)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.08)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "First_b":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.06)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.09)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.11)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.11)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "First_c":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.07)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "First_d":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.07)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Second_a":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.08)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Second_b":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.09)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.11)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.13)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.13)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Second_c":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.14)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.14)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Second_d":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.11)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.13)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.15)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.15)
                    {
                        return(false);
                    }
                    break;
                }
                break;
            }
            return(true);
        }
Beispiel #8
0
        private void btnCompareOddOldVersion_Click(object sender, EventArgs e)
        {
            btnCompareOddOldVersion.Enabled = false;
            if (radNonLive.Checked)
            {
                DataTable dtMinus = db.getMinus();
                foreach (DataRow dr in dtMinus.Rows)
                {
                    objCompare o           = UtilSoccer.convertStringToCompare(dr["data1"].ToString());
                    string     str_BetIbet = o.home + "," + o.away + "," + o.bettype + "," + o.hdp + "," + o.odd.Split('/')[1] + "," + o.keo.Split('/')[1] + "," + o.betid.Split('/')[1] + "," + o.score;
                    ticket     oIbet       = UtilSoccer.convertStringToTicket(str_BetIbet);
                    if (!hsIbetMinus.Contains(dr["keo"].ToString()))
                    {
                        hsIbetMinus.Add(dr["keo"].ToString(), oIbet);
                    }
                }

                Thread tNonLive = new Thread(delegate()
                {
                    string strCompareNonLiveTemp = "X";
                    int index               = 0;
                    int maxuser             = 10;
                    int minuser             = 0;
                    int count               = 0;
                    List <objMatch> lstIbet = new List <objMatch>();
                    List <objMatch> lstSbo  = new List <objMatch>();
                    int indexlogout         = -1;
                    int countLoop           = 0;
                    #region GetOdd
                    while (true)
                    {
                        countLoop++;
                        lblCountNonLive.Text = countLoop.ToString();
                        //Get Odd Ibet
                        try
                        {
                            lstIbet = BetManager.getBet("ibet" + index).getMatchOddNonLive(TimeLimit);
                        }
                        catch
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "ibet" + index + ": IBET NONLIVE NOT FOUND \n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            continue;
                        }
                        if (lstIbet.Count == 0)
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "ibet" + index + ": IBET NONLIVE NOT FOUND \n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            continue;
                        }
                        else if (lstIbet[0].Score == "Error")
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " Error" + "\n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            count = 0;
                            continue;
                        }
                        else if (lstIbet[0].Score == "Logout")
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " Logout" + "\n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            indexlogout    = index;
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            count = 0;
                            continue;
                        }
                        rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " ScanOdd" + "\n");

                        //Get Odd Sbo
                        lstSbo                       = BetManager.getBet("sbo0").getMatchOddNonLive(TimeLimit);
                        str_CompareNonLive           = UtilSoccer.CompareByHash(lstIbet, lstSbo, profitmin);
                        List <objCompare> lstCompare = UtilSoccer.convertCompareToList(str_CompareNonLive);
                        #region Minus
                        //if (lstIbet.Count > 0)
                        //{
                        //    if (lstCompare.Count > 0)
                        //    {
                        //        foreach (objCompare oCompare in lstCompare)
                        //        {
                        //            try
                        //            {
                        //                string str_BetSbo = oCompare.home + "," + oCompare.away + "," + oCompare.bettype + "," + oCompare.hdp + "," + oCompare.odd.Split('/')[0] + "," + oCompare.keo.Split('/')[0] + "," + oCompare.betid.Split('/')[0] + "," + oCompare.score;
                        //                string str_BetIbet = oCompare.home + "," + oCompare.away + "," + oCompare.bettype + "," + oCompare.hdp + "," + oCompare.odd.Split('/')[1] + "," + oCompare.keo.Split('/')[1] + "," + oCompare.betid.Split('/')[1] + "," + oCompare.score;

                        //                ticket oIbet = UtilSoccer.convertStringToTicket(str_BetIbet);
                        //                ticket oSbo = UtilSoccer.convertStringToTicket(str_BetSbo);

                        //                if (oIbet.odd < 0)
                        //                {
                        //                    string key = string.Format("{0},{1},{2},{3}", oCompare.home, oCompare.away, oCompare.hdp, oCompare.bettype);
                        //                    if (!hsIbetMinus.Contains(key))
                        //                    {
                        //                        hsIbetMinus.Add(key, oIbet);
                        //                        db.doInsertMinus(key, oCompare.ToString());
                        //                    }
                        //                }
                        //            }
                        //            catch
                        //            {

                        //            }
                        //        }
                        //    }

                        //    foreach (objMatch match in lstIbet)
                        //    {
                        //        try
                        //        {
                        //            string key = string.Format("{0},{1},{2},{3}", match.HomeName, match.AwayName, match.hdp, match.BetType);
                        //            if (hsIbetMinus.Contains(key))
                        //            {
                        //                if ((((ticket)hsIbetMinus[key]).choose == "h" && UtilSoccer.profit_odd(((ticket)hsIbetMinus[key]).odd.ToString(), match.Odd2) >= -0.03) || (((ticket)hsIbetMinus[key]).choose == "a" && UtilSoccer.profit_odd(((ticket)hsIbetMinus[key]).odd.ToString(), match.Odd1) >= -0.03))
                        //                {
                        //                    string Odd1 = match.Odd1;
                        //                    string Odd2 = match.Odd2;
                        //                    double LeagueOdd = UtilSoccer.profit_odd(Odd1, Odd2);
                        //                    string IdKeoIbet = match.IdKeo;
                        //                    string HomeName = match.HomeName;
                        //                    string AwayName = match.AwayName;
                        //                    string Keo = match.hdp;
                        //                    string BetType = match.BetType;
                        //                    string Score = match.Score;
                        //                    string Time = match.TimeLive;
                        //                    string home_away = "h/a";
                        //                    string result = HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + Odd1 + "/" + Odd2 + "," + home_away + "," + IdKeoIbet + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd(Odd1, Odd2) + "," + LeagueOdd + "," + Score + "," + Time + ",i\n";
                        //                    db.doUpdateMinus(key, result);
                        //                }
                        //                else
                        //                {
                        //                    db.doUpdateMinus(key, "");
                        //                }
                        //            }
                        //        }
                        //        catch
                        //        {

                        //        }
                        //    }

                        //    foreach (objMatch match in lstSbo)
                        //    {
                        //        try
                        //        {
                        //            string key = string.Format("{0},{1},{2},{3}", match.HomeName, match.AwayName, match.hdp, match.BetType);
                        //            if (hsIbetMinus.Contains(key))
                        //            {
                        //                if ((((ticket)hsIbetMinus[key]).choose == "h" && UtilSoccer.profit_odd(((ticket)hsIbetMinus[key]).odd.ToString(), match.Odd2) >= -0.03) || (((ticket)hsIbetMinus[key]).choose == "a" && UtilSoccer.profit_odd(((ticket)hsIbetMinus[key]).odd.ToString(), match.Odd1) >= -0.03))
                        //                {
                        //                    string Odd1 = match.Odd1;
                        //                    string Odd2 = match.Odd2;
                        //                    double LeagueOdd = UtilSoccer.profit_odd(Odd1, Odd2);
                        //                    string IdKeoSbo = match.IdKeo;
                        //                    string HomeName = match.HomeName;
                        //                    string AwayName = match.AwayName;
                        //                    string Keo = match.hdp;
                        //                    string BetType = match.BetType;
                        //                    string Score = match.Score;
                        //                    string Time = match.TimeLive;
                        //                    string home_away = "h/a";
                        //                    string result = HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + Odd1 + "/" + Odd2 + "," + home_away + "," + IdKeoSbo + "/" + IdKeoSbo + "," + UtilSoccer.profit_odd(Odd1, Odd2) + "," + LeagueOdd + "," + Score + "," + Time + ",s\n";
                        //                    db.doUpdateMinus(key, result);
                        //                }
                        //            }
                        //        }
                        //        catch
                        //        {

                        //        }
                        //    }
                        //}
                        #endregion
                        if (str_CompareNonLive != strCompareNonLiveTemp)
                        {
                            db.UpdateInfoCompare("a,a", str_CompareNonLive, false);
                            string timecomparenonlive = Title + DateTime.Now.ToLongTimeString() + Title;
                            rtb_CompareNonLive.Text   = Title + "NONLIVE" + Title + "\n" + str_CompareNonLive + "\n" + timecomparenonlive;
                            strCompareNonLiveTemp     = str_CompareNonLive;
                        }
                        //Get Match Compare
                        rtb_CompareMatch.Clear();
                        rtb_CompareMatch.Text += BetManager.getBet("ibet" + index).getTotalMatch() + "\n";
                        rtb_CompareMatch.Text += BetManager.getBet("sbo0").getTotalMatch() + "\n";

                        string strSboCompareNonLive  = BetManager.getBet("sbo0").getMatchs();
                        string strIbetCompareNonLive = BetManager.getBet("ibet" + index).getMatchs();
                        string SboIbetCompareNonLive = Util.GetSplitStringIntoString(strSboCompareNonLive, strIbetCompareNonLive);
                        int MatchCompareNonIve       = SboIbetCompareNonLive.Split(',').Length - 1;
                        rtb_CompareMatch.Text       += "COMPARE MATCH: " + MatchCompareNonIve.ToString() + "\n";

                        int KeoCompareNonLive  = str_CompareNonLive.Split('\n').Length - 1;
                        rtb_CompareMatch.Text += "COMPARE NONLIVE: " + KeoCompareNonLive.ToString() + "\n";
                        //Change
                        count++;
                        if (count == 5)
                        {
                            index++;
                            count = 0;
                        }
                        if (index == maxuser)
                        {
                            index = minuser;
                            count = 0;
                        }
                        Thread.Sleep(100);
                    }
                    #endregion
                });
                tNonLive.Start();
            }
            else if (radLive.Checked)
            {
                Thread tLive = new Thread(delegate()
                {
                    string strCompareLiveTemp  = "X";
                    string strCompareUnderTemp = "X";
                    int index   = 10;
                    int maxuser = 30;
                    int minuser = 10;
                    int count   = 0;
                    List <objMatch> listIbetLive = new List <objMatch>();
                    List <objMatch> listSboLive  = new List <objMatch>();
                    int indexlogout = -1;
                    int countLoop   = 0;
                    #region GetOdd
                    while (true)
                    {
                        countLoop++;
                        lblCountLive.Text = countLoop.ToString();

                        //Get Odd Ibet
                        try
                        {
                            listIbetLive = BetManager.getBet("ibet" + index).getMatchOddLive();
                        }
                        catch
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "ibet" + index + ": IBET LIVE NOT FOUND \n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            continue;
                        }
                        if (listIbetLive.Count == 0)
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "ibet" + index + ": IBET LIVE NOT FOUND \n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            continue;
                        }
                        else if (listIbetLive[0].Score == "Error")
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " Error" + "\n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            count = 0;
                            continue;
                        }//Error

                        else if (listIbetLive[0].Score == "Logout")
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " Logout" + "\n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            indexlogout    = index;
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            count = 0;
                            continue;
                        }

                        rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " ScanOdd" + "\n");

                        //Get Odd Sbo
                        listSboLive      = BetManager.getBet("sbo1").getMatchOddLive();
                        str_CompareLive  = UtilSoccer.CompareByHashLive(listIbetLive, listSboLive, profitmin);
                        str_CompareUnder = UtilSoccer.under_compare;
                        if (str_CompareLive != strCompareLiveTemp)
                        {
                            db.UpdateInfoCompare("a,a", str_CompareLive, true);
                            string timecomparelive = Title + DateTime.Now.ToLongTimeString() + Title;
                            rtb_CompareLive.Text   = Title + "LIVE" + Title + "\n" + str_CompareLive + "\n" + timecomparelive;
                            strCompareLiveTemp     = str_CompareLive;
                        }
                        if (str_CompareUnder != strCompareUnderTemp)
                        {
                            db.UpdateInfoCompare("under", str_CompareUnder, true);
                            string timecomparelive  = Title + DateTime.Now.ToLongTimeString() + Title;
                            rtb_CompareNonLive.Text = Title + "UNDER" + Title + "\n" + str_CompareUnder + "\n" + timecomparelive;
                            strCompareUnderTemp     = str_CompareUnder;
                        }


                        count++;
                        if (count == 5)
                        {
                            index++;
                            count = 0;
                        }
                        if (index == maxuser)
                        {
                            index = minuser;
                            count = 0;
                        }
                        Thread.Sleep(100);
                    }
                    #endregion
                });
                tLive.Start();
            }
        }
Beispiel #9
0
        public List <objMatch> getMatchOddLive()
        {
            try
            {
                lstLive.Clear();
                string DataOddSboLive = http.Fetch(mainLink + "/web-root/restricted/odds-display/today-data.aspx?od-param=2,1,1,1,2,2,2,2,3,1&fi=0&v=0&dl=3", HttpHelper.HttpMethod.Get, null, null);
                DataOddSboLive = DataOddSboLive.Replace("\\u200C", "");
                string leagueDataLive = "[" + Util.GetSubstringByString(DataOddSboLive, "[[[", "]],[[") + "]";
                leagueDataLive = leagueDataLive.Replace("],[", "]\n[");
                hsLeagueLive.Clear();
                foreach (string league in leagueDataLive.Split('\n'))
                {
                    string leagueTemp     = league.Replace("[", "").Replace("]", "").Replace("'", "");
                    string nameleagueTemp = UtilSoccer.ChuanTenLeauge_Sbo(leagueTemp.Split(',')[1]);
                    if (nameleagueTemp.IndexOf("SPECIFIC") != -1 || nameleagueTemp.IndexOf("CORNERS") != -1 || nameleagueTemp.IndexOf("BOOKING") != -1 ||
                        nameleagueTemp.IndexOf("FANTASY MATCH") != -1 || nameleagueTemp.IndexOf("WHICH TEAM") != -1 || nameleagueTemp.IndexOf("TOTAL GOALS") != -1 ||
                        nameleagueTemp.IndexOf("INJURY") != -1 || nameleagueTemp.IndexOf("WINNER") != -1)
                    {
                        continue;
                    }
                    hsLeagueLive.Add(leagueTemp.Split(',')[0], nameleagueTemp);
                }

                string matchDataLive = "[" + Util.GetSubstringByString(DataOddSboLive, "]],[[", "]],[[") + "]";
                matchDataLive = matchDataLive.Replace("],[", "]\n[");
                hsMatchLive.Clear();
                foreach (string matchLive in matchDataLive.Split('\n'))
                {
                    string   matchTempLive     = matchLive.Replace("[", "").Replace("]", "").Replace("'", "");
                    string[] arr_matchTempLive = matchTempLive.Split(',');
                    string   idmatchLive       = Util.GetSubstringByStringLast(DataOddSboLive, "[", "," + arr_matchTempLive[0]);
                    try
                    {
                        hsMatchLive.Add(idmatchLive, hsLeagueLive[arr_matchTempLive[2]].ToString() + "," + arr_matchTempLive[3] + "," + arr_matchTempLive[4] + "," + arr_matchTempLive[7]);
                    }
                    catch
                    {
                        continue;
                    }
                }
                string oddDataLive = "[[" + Util.GetSubstringByString(DataOddSboLive, ",,[[", "]]],,") + "]]]";

                foreach (string OddTempLive in oddDataLive.Split(new string[] { "]],[" }, StringSplitOptions.None))
                {
                    objMatch OddLive     = new objMatch();
                    string   OddTemp     = OddTempLive.Replace("[", "").Replace("]", "").Replace("'", "");
                    string[] arr_OddTemp = OddTemp.Split(',');
                    string   infomatch   = "";
                    try
                    {
                        infomatch = hsMatchLive[arr_OddTemp[1]].ToString();
                    }
                    catch
                    {
                        continue;
                    }
                    OddLive.LeaugeName = UtilSoccer.ChuanTenLeauge_Sbo(infomatch.Split(',')[0]);
                    OddLive.HomeName   = UtilSoccer.ChuanTenTeam_Sbo(infomatch.Split(',')[1]);
                    OddLive.AwayName   = UtilSoccer.ChuanTenTeam_Sbo(infomatch.Split(',')[2]);
                    OddLive.TimeLive   = infomatch.Split(',')[3];

                    OddLive.IdKeo   = arr_OddTemp[0];
                    OddLive.hdp     = UtilSoccer.formatkeo(arr_OddTemp[5]);
                    OddLive.BetType = arr_OddTemp[2];
                    OddLive.Odd1    = arr_OddTemp[6];
                    OddLive.Odd2    = arr_OddTemp[7];

                    lstLive.Add(OddLive);
                }
            }
            catch
            {
                lstLive.Clear();
                return(lstLive);
            }
            return(lstLive);
        }
        public List <objMatch> getMatchOddNonLive()
        {
            try
            {
                lst.Clear();
                string data = http.Fetch(mainHost + "/UnderOver.aspx?Market=t&DispVer=new", HttpHelper.HttpMethod.Get, mainLink, null);

                int    ik    = data.IndexOf("name=\"k");
                int    iv    = data.IndexOf("value=\"v");
                string kIbet = data.Substring(ik + 6, iv - ik - 8);
                string vIbet = data.Substring(iv + 7, iv - ik - 8);
                string CT    = Util.EscapeDataString(DateTime.Now.AddHours(-11).ToString());
                data = http.Fetch(mainHost + "/UnderOver_data.aspx?Market=t&Sport=1&DT=&RT=W&CT=" + CT + "&Game=0&OrderBy=0&OddsType=4&MainLeague=0&DispRang=0&" + kIbet + "=" + vIbet + "&key=dodds&_=1502509515441", HttpHelper.HttpMethod.Get, mainHost + "/UnderOver.aspx?Market=t&DispVer=new", null);
                string LeaugeName = "", HomeName = "", AwayName = "", Time = "";
                if (data == "")
                {
                    lst.Clear();
                    login();
                    return(lst);
                }
                else
                {
                    foreach (Match m in Regex.Matches(data, @"Nt\[\d+\]=\[.*\];"))
                    {
                        string strIbetMatch = m.Value.ToString().Replace("];", "");
                        strIbetMatch = Regex.Replace(strIbetMatch, @"Nt\[\d+\]=\[", "");
                        strIbetMatch = strIbetMatch.Replace("'", "");

                        string[] dataIbetMatch = strIbetMatch.Split(',');
                        if (dataIbetMatch[5] != "")
                        {
                            LeaugeName = UtilSoccer.ChuanTenLeauge_Ibet(dataIbetMatch[5]);
                        }
                        if (LeaugeName.Contains("CORNERS") || LeaugeName.Contains("BOOKING") || LeaugeName.Contains("TEAM") || LeaugeName.Contains("MATCH"))
                        {
                            continue;
                        }

                        if (dataIbetMatch[6] != "")
                        {
                            HomeName = UtilSoccer.ChuanTenTeam_Ibet(dataIbetMatch[6]);
                            AwayName = UtilSoccer.ChuanTenTeam_Ibet(dataIbetMatch[7]);
                        }
                        objMatch o;
                        if (dataIbetMatch[12] != "")
                        {
                            Time = dataIbetMatch[12].Split(' ')[dataIbetMatch[12].Split(' ').Length - 1];
                            Time = UtilSoccer.convertSoccerTime(Time);
                        }
                        ///FT///
                        try
                        {
                            o             = new objMatch();
                            o.TimeNonLive = Time;
                            o.LeaugeName  = LeaugeName;
                            o.HomeName    = HomeName;
                            o.AwayName    = AwayName;
                            o.IdKeo       = dataIbetMatch[31];
                            o.BetType     = "1";
                            o.Keo         = dataIbetMatch[32];
                            o.Odd1        = dataIbetMatch[33];
                            o.Odd2        = dataIbetMatch[34];
                            if (dataIbetMatch[35] == "a")
                            {
                                o.Keo = "-" + o.Keo;
                            }
                            o.Keo = UtilSoccer.formatkeo(o.Keo);
                            lst.Add(o);
                        }
                        catch
                        { }



                        ///OUFT///
                        try
                        {
                            o             = new objMatch();
                            o.TimeNonLive = Time;
                            o.LeaugeName  = LeaugeName;
                            o.HomeName    = HomeName;
                            o.AwayName    = AwayName;
                            o.IdKeo       = dataIbetMatch[36];
                            o.BetType     = "3";
                            o.Keo         = dataIbetMatch[37];
                            o.Odd1        = dataIbetMatch[38];
                            o.Odd2        = dataIbetMatch[39];
                            if (dataIbetMatch[35] == "a")
                            {
                                o.Keo = "-" + o.Keo;
                            }
                            o.Keo = UtilSoccer.formatkeo(o.Keo);
                            lst.Add(o);
                        }
                        catch
                        { }

                        ///HT///
                        try
                        {
                            o             = new objMatch();
                            o.TimeNonLive = Time;
                            o.LeaugeName  = LeaugeName;
                            o.HomeName    = HomeName;
                            o.AwayName    = AwayName;
                            o.IdKeo       = dataIbetMatch[44];
                            o.BetType     = "7";
                            o.Keo         = dataIbetMatch[45];
                            o.Odd1        = dataIbetMatch[46];
                            o.Odd2        = dataIbetMatch[47];
                            if (dataIbetMatch[48] == "a")
                            {
                                o.Keo = "-" + o.Keo;
                            }
                            o.Keo = UtilSoccer.formatkeo(o.Keo);
                            lst.Add(o);
                        }
                        catch { }
                        ///HTOU///
                        try
                        {
                            o             = new objMatch();
                            o.TimeNonLive = Time;
                            o.LeaugeName  = LeaugeName;
                            o.HomeName    = HomeName;
                            o.AwayName    = AwayName;
                            o.IdKeo       = dataIbetMatch[49];
                            o.BetType     = "9";
                            o.Keo         = dataIbetMatch[50];
                            o.Odd1        = dataIbetMatch[51];
                            o.Odd2        = dataIbetMatch[52];
                            if (dataIbetMatch[48] == "a")
                            {
                                o.Keo = "-" + o.Keo;
                            }
                            o.Keo = UtilSoccer.formatkeo(o.Keo);
                            lst.Add(o);
                        }
                        catch { }
                    }
                }
            }
            catch (Exception)
            {
                lst.Clear();
                return(lst);
            }
            return(lst);
        }
        public static string CompareByHashLive(List <objMatch> Ibet, List <objMatch> Sbo, double profitmin)
        {
            string result = "";

            under_compare = "";
            HashIbetLive.Clear();
            HashSboLive.Clear();
            //HashKeoDuoi.Clear();
            foreach (objMatch ObjIbet in Ibet)
            {
                string key = string.Format("{0},{1},{2},{3}", ObjIbet.HomeName, ObjIbet.AwayName, ObjIbet.hdp, ObjIbet.BetType);
                if (!HashIbetLive.Contains(key))
                {
                    HashIbetLive.Add(key, ObjIbet);
                }

                //if (ObjIbet.hdp.Trim() != "")
                //{
                //    try
                //    {
                //        if (float.Parse(ObjIbet.hdp) < 0 && !HashKeoDuoi.Contains(ObjIbet.HomeName))
                //            HashKeoDuoi.Add(ObjIbet.HomeName, ObjIbet.HomeName);
                //        else if (float.Parse(ObjIbet.hdp) >= 0 && !HashKeoDuoi.Contains(ObjIbet.AwayName))
                //            HashKeoDuoi.Add(ObjIbet.AwayName, ObjIbet.AwayName);
                //    }
                //    catch (Exception)
                //    {

                //    }
                //}
            }
            foreach (objMatch ObjSbo in Sbo)
            {
                string key = string.Format("{0},{1},{2},{3}", ObjSbo.HomeName, ObjSbo.AwayName, ObjSbo.hdp, ObjSbo.BetType);
                if (!HashSboLive.Contains(key))
                {
                    HashSboLive.Add(key, ObjSbo);
                }
            }

            ICollection keySbos = HashSboLive.Keys;

            foreach (string keySbo in keySbos)
            {
                try
                {
                    if (HashIbetLive.ContainsKey(keySbo))
                    {
                        string OddSbo1   = ((objMatch)HashSboLive[keySbo]).Odd1;
                        string OddSbo2   = ((objMatch)HashSboLive[keySbo]).Odd2;
                        string OddIbet1  = ((objMatch)HashIbetLive[keySbo]).Odd1;
                        string OddIbet2  = ((objMatch)HashIbetLive[keySbo]).Odd2;
                        double LeagueOdd = UtilSoccer.profit_odd(OddSbo1, OddSbo2);
                        string IdKeoSbo  = ((objMatch)HashSboLive[keySbo]).IdKeo;
                        string IdKeoIbet = ((objMatch)HashIbetLive[keySbo]).IdKeo;
                        string HomeName  = ((objMatch)HashIbetLive[keySbo]).HomeName;
                        string AwayName  = ((objMatch)HashIbetLive[keySbo]).AwayName;
                        string Keo       = ((objMatch)HashIbetLive[keySbo]).hdp;
                        string BetType   = ((objMatch)HashSboLive[keySbo]).BetType;
                        string Score     = ((objMatch)HashIbetLive[keySbo]).Score;
                        string Time      = ((objMatch)HashIbetLive[keySbo]).TimeLive;
                        //Time = Time.Split(' ')[Time.Split(' ').Length - 1];
                        if (profit_odd_new(OddSbo1, OddIbet2) >= profitmin)
                        {
                            result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                            try
                            {
                                if (int.Parse(Time.Split(' ')[1]) >= 25 && int.Parse(Time.Split(' ')[1]) <= 43)
                                {
                                    if (Time.Split(' ')[0].ToUpper().Contains("1H"))
                                    {
                                        if (BetType == "7" && float.Parse(Keo) >= 0)
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                        else if (BetType == "9")
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                    }
                                    else if (Time.Split(' ')[0].ToUpper().Contains("2H"))
                                    {
                                        if (BetType == "1" && float.Parse(Keo) >= 0)
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                        else if (BetType == "3")
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                    }
                                }
                            }
                            catch (Exception)
                            {
                                ;
                            }
                        }
                        else if (profit_odd_new(OddSbo2, OddIbet1) >= profitmin)
                        {
                            result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                            try
                            {
                                if (int.Parse(Time.Split(' ')[1]) >= 25 && int.Parse(Time.Split(' ')[1]) <= 43)
                                {
                                    if (Time.Split(' ')[0].ToUpper().Contains("1H"))
                                    {
                                        if (BetType == "7" && float.Parse(Keo) >= 0)
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                        else if (BetType == "9")
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                    }
                                    else if (Time.Split(' ')[0].ToUpper().Contains("2H"))
                                    {
                                        if (BetType == "1" && float.Parse(Keo) >= 0)
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                        else if (BetType == "3")
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                    }
                                }
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            return(result);
        }
        public List <objMatch> getMatchOddLive()
        {
            objMatch o;
            string   data = "";

            try
            {
                lstLive.Clear();
                data = http.Fetch(mainHost + "/UnderOver.aspx?Market=t&DispVer=new", HttpHelper.HttpMethod.Get, mainLink, null);
                if (data == "")
                {
                    o = new objMatch();
                    lstLive.Clear();
                    o.Score = "Logout";
                    lstLive.Add(o);
                    login();
                    return(lstLive);
                }
                int    ik    = data.IndexOf("name=\"k");
                int    iv    = data.IndexOf("value=\"v");
                string kIbet = data.Substring(ik + 6, iv - ik - 8);
                string vIbet = data.Substring(iv + 7, iv - ik - 8);
                string CT    = Util.EscapeDataString(DateTime.Now.AddHours(-11).ToString());
                data = http.Fetch(mainHost + "/UnderOver_data.aspx?Market=l&Sport=1&DT=&RT=W&CT=" + CT + "&Game=0&OrderBy=0&OddsType=4&MainLeague=0&DispRang=0&" + kIbet + "=" + vIbet + "&key=dodds&_=1502509515441", HttpHelper.HttpMethod.Get, mainHost + "/UnderOver.aspx?Market=t&DispVer=new", null);
                string LeaugeName = "", HomeName = "", AwayName = "", Time = "", Score = "";
                if (data == "")
                {
                    o = new objMatch();
                    lstLive.Clear();
                    o.Score = "Logout";
                    lstLive.Add(o);
                    login();
                    return(lstLive);
                }
                else
                {
                    foreach (Match m in Regex.Matches(data, @"Nl\[\d+\]=\[.*\];"))
                    {
                        string strIbetMatch = m.Value.ToString().Replace("];", "");
                        strIbetMatch = Regex.Replace(strIbetMatch, @"Nl\[\d+\]=\[", "");
                        strIbetMatch = strIbetMatch.Replace("'", "");

                        string[] dataIbetMatch = strIbetMatch.Split(',');
                        if (dataIbetMatch[5] != "")
                        {
                            LeaugeName = UtilSoccer.ChuanTenLeauge_Ibet(dataIbetMatch[5]);
                        }
                        if (LeaugeName.Contains("CORNERS") || LeaugeName.Contains("BOOKING") || LeaugeName.Contains("TEAM") || LeaugeName.Contains("WINNER") ||
                            LeaugeName.Contains("MATCH") || LeaugeName.Contains("SPECIFIC") || LeaugeName.Contains("SUBSTITUTION") ||
                            LeaugeName.Contains("GOAL KICK") || LeaugeName.Contains("OFFSIDE") || LeaugeName.Contains("THROW IN") ||
                            LeaugeName.Contains("FREE KICK") || LeaugeName.Contains("1st HALF vs 2nd HALF") || LeaugeName.Contains("RED CARD") ||
                            LeaugeName.Contains("OWN GOAL") || LeaugeName.Contains("PENALTY") || LeaugeName.Contains("TOTAL GOALS MINUTES") ||
                            LeaugeName.Contains("Injury"))
                        {
                            continue;
                        }

                        if (dataIbetMatch[6] != "")
                        {
                            HomeName = UtilSoccer.ChuanTenTeam_Ibet(dataIbetMatch[6]);
                            AwayName = UtilSoccer.ChuanTenTeam_Ibet(dataIbetMatch[7]);
                        }
                        if (dataIbetMatch[12] != "")
                        {
                            Time = dataIbetMatch[12].Replace("\\", "");
                        }
                        if (dataIbetMatch[21] != "" && dataIbetMatch[22] != "")
                        {
                            Score = dataIbetMatch[21] + "-" + dataIbetMatch[22];
                        }
                        ///FT///
                        try
                        {
                            o            = new objMatch();
                            o.Score      = Score;
                            o.TimeLive   = Time;
                            o.LeaugeName = LeaugeName;
                            o.HomeName   = HomeName;
                            o.AwayName   = AwayName;
                            if (Matchs.Contains(o.HomeName + "-" + o.AwayName) == false)
                            {
                                Matchs += o.HomeName + "-" + o.AwayName + ",";
                            }
                            o.IdKeo   = dataIbetMatch[31];
                            o.BetType = "1";
                            o.hdp     = dataIbetMatch[32];
                            o.Odd1    = dataIbetMatch[33];
                            o.Odd2    = dataIbetMatch[34];
                            if (dataIbetMatch[35] == "a")
                            {
                                o.hdp = "-" + o.hdp;
                            }
                            o.hdp = UtilSoccer.formatkeo(o.hdp);
                            lstLive.Add(o);
                        }
                        catch
                        { }



                        ///OUFT///
                        try
                        {
                            o            = new objMatch();
                            o.Score      = Score;
                            o.TimeLive   = Time;
                            o.LeaugeName = LeaugeName;
                            o.HomeName   = HomeName;
                            o.AwayName   = AwayName;
                            o.IdKeo      = dataIbetMatch[36];
                            o.BetType    = "3";
                            o.hdp        = dataIbetMatch[37];
                            o.Odd1       = dataIbetMatch[38];
                            o.Odd2       = dataIbetMatch[39];
                            if (dataIbetMatch[35] == "a")
                            {
                                o.hdp = "-" + o.hdp;
                            }
                            o.hdp = UtilSoccer.formatkeo(o.hdp);
                            lstLive.Add(o);
                        }
                        catch
                        { }

                        ///HT///
                        try
                        {
                            o            = new objMatch();
                            o.Score      = Score;
                            o.TimeLive   = Time;
                            o.LeaugeName = LeaugeName;
                            o.HomeName   = HomeName;
                            o.AwayName   = AwayName;
                            o.IdKeo      = dataIbetMatch[44];
                            o.BetType    = "7";
                            o.hdp        = dataIbetMatch[45];
                            o.Odd1       = dataIbetMatch[46];
                            o.Odd2       = dataIbetMatch[47];
                            if (dataIbetMatch[48] == "a")
                            {
                                o.hdp = "-" + o.hdp;
                            }
                            o.hdp = UtilSoccer.formatkeo(o.hdp);
                            lstLive.Add(o);
                        }
                        catch { }
                        ///HTOU///
                        try
                        {
                            o            = new objMatch();
                            o.Score      = Score;
                            o.TimeLive   = Time;
                            o.LeaugeName = LeaugeName;
                            o.HomeName   = HomeName;
                            o.AwayName   = AwayName;
                            o.IdKeo      = dataIbetMatch[49];
                            o.BetType    = "9";
                            o.hdp        = dataIbetMatch[50];
                            o.Odd1       = dataIbetMatch[51];
                            o.Odd2       = dataIbetMatch[52];
                            if (dataIbetMatch[48] == "a")
                            {
                                o.hdp = "-" + o.hdp;
                            }
                            o.hdp = UtilSoccer.formatkeo(o.hdp);
                            lstLive.Add(o);
                        }
                        catch { }
                    }
                }
            }
            catch (Exception)
            {
                o = new objMatch();
                lstLive.Clear();
                o.Score   = "Error";
                o.BetType = data;
                lstLive.Add(o);
                return(lstLive);
            }
            TotalMatch = "IBET MATCH: " + (Matchs.Split(',').Length - 1).ToString();
            return(lstLive);
        }