Ejemplo n.º 1
0
        public static string GenerateDetailedMatchInfo(MatchNew new1, MatchBetNew new3, MatchBetNew new2, EnumCollection.eBetTarget target1, string text1, string text2)
        {
            string str4 = "";
            string str3 = "";
            double num = 0.0;
            switch (target1)
            {
                case EnumCollection.eBetTarget.FT_Home:
                    str3 = new1.get_FTHDP();
                    str4 = new1.get_FT_AwayOddsString();
                    num = new1.get_FTHDP_Commission();
                    break;

                case EnumCollection.eBetTarget.FT_Away:
                    str3 = new1.get_FTHDP();
                    str4 = new1.get_FT_HomeOddsString();
                    num = new1.get_FTHDP_Commission();
                    break;

                case EnumCollection.eBetTarget.FT_Over:
                    str3 = new1.get_FTOU();
                    str4 = new1.get_FT_UnderOddsString();
                    num = new1.get_FTOU_Commission();
                    break;

                case EnumCollection.eBetTarget.FT_Under:
                    str3 = new1.get_FTOU();
                    str4 = new1.get_FT_OverOddsString();
                    num = new1.get_FTOU_Commission();
                    break;

                case EnumCollection.eBetTarget.Half_Home:
                    str3 = new1.get_HalfHDP();
                    str4 = new1.get_Half_AwayOddsString();
                    num = new1.get_HalfHDP_Commission();
                    break;

                case EnumCollection.eBetTarget.Half_Away:
                    str3 = new1.get_HalfHDP();
                    str4 = new1.get_Half_HomeOddsString();
                    num = new1.get_HalfHDP_Commission();
                    break;

                case EnumCollection.eBetTarget.Half_Over:
                    str3 = new1.get_HalfOU();
                    str4 = new1.get_Half_UnderOddsString();
                    num = new1.get_HalfOU_Commission();
                    break;

                case EnumCollection.eBetTarget.Half_Under:
                    str3 = new1.get_HalfOU();
                    str4 = new1.get_Half_OverOddsString();
                    num = new1.get_HalfOU_Commission();
                    num = new1.get_HalfOU_Commission();
                    break;
            }
            return ("\r\n============================================================\r\n" + text1 + "\r\n============================================================\r\nLeague: " + new2.get_League() + "\r\nHome: " + new3.get_HomeName() + "\r\nAway: " + new3.get_AwayName() + "\r\nBet: " + new3.get_SelectedMatch() + "\r\nHDP: " + new3.get_HDP() + "\r\nOdd: " + new3.get_OddsString() + "\r\nNew HDP: " + new2.get_HDP() + "\r\nNew Odd: " + new2.get_OddsString() + "\r\n" + text2 + " HDP: " + str3 + "\r\n" + text2 + " Opponent Odd: " + str4 + "\r\n" + text2 + " Commission: " + num.ToString() + "\r\nAmount: " + new2.get_BetAmount() + "\r\n============================================================");
        }
Ejemplo n.º 2
0
        public void GetTicketAndBetFromAgent(MatchBetNew new4, MatchNew new1, EnumCollection.eBetTarget target1, int num1, AgentToClientBet bet1)
        {
            MatchBetNew new3 = new MatchBetNew();
            MatchBetNew new2 = new MatchBetNew();
            try
            {
                string requestUriString = "";
                string str5 = "";
                string str = "";
                string str3 = "";
                string str4 = "";
                base._isBetting = true;
                base._datTicketStart = DateTime.Now;
                requestUriString = base._strRootURL + "/BetProcess_Data.aspx";
                switch (target1)
                {
                    case EnumCollection.eBetTarget.FT_Home:
                        str = new1.get_FTHDP_ID();
                        str3 = new1.get_FT_HomeOddsString();
                        str4 = "h";
                        break;

                    case EnumCollection.eBetTarget.FT_Away:
                        str = new1.get_FTHDP_ID();
                        str3 = new1.get_FT_AwayOddsString();
                        str4 = "a";
                        break;

                    case EnumCollection.eBetTarget.FT_Over:
                        str = new1.get_FTOU_ID();
                        str3 = new1.get_FT_OverOddsString();
                        str4 = "h";
                        break;

                    case EnumCollection.eBetTarget.FT_Under:
                        str = new1.get_FTOU_ID();
                        str3 = new1.get_FT_UnderOddsString();
                        str4 = "a";
                        break;

                    case EnumCollection.eBetTarget.Half_Home:
                        str = new1.get_HalfHDP_ID();
                        str3 = new1.get_Half_HomeOddsString();
                        str4 = "h";
                        break;

                    case EnumCollection.eBetTarget.Half_Away:
                        str = new1.get_HalfHDP_ID();
                        str3 = new1.get_Half_AwayOddsString();
                        str4 = "a";
                        break;

                    case EnumCollection.eBetTarget.Half_Over:
                        str = new1.get_HalfOU_ID();
                        str3 = new1.get_Half_OverOddsString();
                        str4 = "h";
                        break;

                    case EnumCollection.eBetTarget.Half_Under:
                        str = new1.get_HalfOU_ID();
                        str3 = new1.get_Half_UnderOddsString();
                        str4 = "a";
                        break;
                    // add 1x2
                    case EnumCollection.eBetTarget.FT_1:
                        str = new1.get_FT1X2_ID();
                        str3 = new1.get_FT_1X2HomeOddsString().ToString();
                        str4 = "1";
                        break;
                    case EnumCollection.eBetTarget.FT_X:
                        str = new1.get_FT1X2_ID();
                        str3 = new1.get_FT_1X2AwayOddsString().ToString();
                        str4 = "X";
                        break;
                    case EnumCollection.eBetTarget.FT_2:
                        str = new1.get_FT1X2_ID();
                        str3 = new1.get_FT_1X2DrawOddsString().ToString();
                        str4 = "2";
                        break;
                    case EnumCollection.eBetTarget.Half_1:
                        str = new1.get_Half1X2_ID();
                        str3 = new1.get_Half_1X2HomeOddsString().ToString();
                        str4 = "1";
                        break;
                    case EnumCollection.eBetTarget.Half_X:
                        str = new1.get_Half1X2_ID();
                        str3 = new1.get_Half_1X2AwayOddsString().ToString(); ;
                        str4 = "X";
                        break;
                    case EnumCollection.eBetTarget.Half_2:
                        str = new1.get_Half1X2_ID();
                        str3 = new1.get_Half_1X2DrawOddsString().ToString(); ;
                        str4 = "2";
                        break;
                }
                str5 = "bp_Match=" + str + "_" + str4 + "_" + str3 + "&bp_ssport=&chk_BettingChange=4";
                // Add Andy 添加新值 2011.08.08
                StringBuilder sb = new StringBuilder(str5);
                sb.Append("&").Append(this.key);
                sb.Append("=").Append(this.value);
                str5 = sb.ToString();
                // End Andy

                new3 = new4;
                new2 = new1.GenerateMatchBet(target1);
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUriString);
                request.Timeout = 0x7530;
                request.Method = "POST";
                request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.16) Gecko/2009120208 Firefox/3.0.16";
                request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
                request.Headers.Add("Accept-Language", "en-gb,en;q=0.5");
                request.Headers.Add("Accept-Encoding", "gzip, deflate");
                request.Headers.Add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
                request.Headers["Cookie"] = base._objCookieList.ToString();
                request.Referer = base._strRootURL + "/LeftAllInOne.aspx";
                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = str5.Length;

                base._objBetListLogger.write("POST: " + str5);
                this.WriteProgramLogger("TWESTESST2.0: " + request.Address.ToString());
                Stream stream = request.GetRequestStream();
                byte[] bytes = Encoding.UTF8.GetBytes(str5);
                stream.Write(bytes, 0, str5.Length);
                stream.Close();
                this.WriteProgramLogger("TWESTESST2.1: " + request.Address.ToString());

                WebRequestStateEx2 state = new WebRequestStateEx2("GetTicketAndBetFromAgent", request, str5, num1, new3.get_BetType(), target1, new MatchNew(), new3, new1, new2, bet1);
                ThreadPool.RegisterWaitForSingleObject(request.BeginGetRequestStream(new AsyncCallback(this.RequestCompleteTicketFromAgent), state).AsyncWaitHandle, new WaitOrTimerCallback(this.TimeoutCallBackEx2), state, 0x7530, true);
                base.allDone.WaitOne();
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                base._isBetting = false;
                base._objErrorLogger.write(base._strName + ": EXCEPTION IN GetTicketAndBetFromAgent: " + exception.Message);
                this.WriteProgramLogger(base._strName + ": EXCEPTION IN GetTicketAndBetFromAgent: " + exception.Message);
                this.get__objBetQueueMonitor().SaveBetInfo(exception.Message, new4);
                this.RaiseEventGetTicketComplete(base._strName, false, target1, new MatchNew(), new3, new1, new2, null);
                ProjectData.ClearProjectError();
            }
        }
Ejemplo n.º 3
0
        private void GetTicketAndBetFromAgent(MatchBetNew new4, MatchNew new1, EnumCollection.eBetTarget target1, int num1, AgentToClientBet bet1)
        {
            MatchBetNew new3 = new MatchBetNew();
            MatchBetNew new2 = new MatchBetNew();
            try
            {
                string requestUriString = "";
                string str7 = "";
                string str5 = "1";
                string str6 = "1";
                base._isBetting = true;
                base._datTicketStart = DateTime.Now;
                requestUriString = base._strRootURL + "/MenuBet/BetSlipProc.aspx";
                switch (target1)
                {
                    case EnumCollection.eBetTarget.FT_Home:
                    case EnumCollection.eBetTarget.FT_Away:
                    case EnumCollection.eBetTarget.FT_Over:
                    case EnumCollection.eBetTarget.FT_Under:
                        if ((new1.get_FTHomeColor() == Color.Blue) & (new1.get_FTAwayColor() == Color.Red))
                        {
                            str5 = "0";
                        }
                        break;

                    case EnumCollection.eBetTarget.Half_Home:
                    case EnumCollection.eBetTarget.Half_Away:
                    case EnumCollection.eBetTarget.Half_Over:
                    case EnumCollection.eBetTarget.Half_Under:
                        if ((new1.get_HalfHomeColor() == Color.Blue) & (new1.get_HalfAwayColor() == Color.Red))
                        {
                            str5 = "0";
                        }
                        break;
                }
                if (new1.get_GameType() == EnumCollection.eGameType.Early)
                {
                    str6 = "2";
                }
                if (new1.get_GameType() == EnumCollection.eGameType.Running)
                {
                    switch (target1)
                    {
                        case EnumCollection.eBetTarget.FT_Home:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=H&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "RB", new1.get_FT_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_FTHDP()).ToString(), new1.get_FT_HomeOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.FT_Away:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=A&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "RB", new1.get_FT_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_FTHDP()).ToString(), new1.get_FT_AwayOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.FT_Over:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=H&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "RBOU", new1.get_FT_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_FTOU()).ToString(), new1.get_FT_OverOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.FT_Under:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=A&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "RBOU", new1.get_FT_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_FTOU()).ToString(), new1.get_FT_UnderOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.Half_Home:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=1&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "30", new1.get_Half_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_HalfHDP()).ToString(), new1.get_Half_HomeOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.Half_Away:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=2&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "30", new1.get_Half_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_HalfHDP()).ToString(), new1.get_Half_AwayOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.Half_Over:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=4&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "31", new1.get_Half_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_HalfOU()).ToString(), new1.get_Half_OverOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.Half_Under:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=5&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "31", new1.get_Half_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_HalfOU()).ToString(), new1.get_Half_UnderOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;
                    }
                }
                else
                {
                    switch (target1)
                    {
                        case EnumCollection.eBetTarget.FT_Home:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=H&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "AH", new1.get_FT_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_FTHDP()).ToString(), new1.get_FT_HomeOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.FT_Away:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=A&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "AH", new1.get_FT_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_FTHDP()).ToString(), new1.get_FT_AwayOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.FT_Over:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=H&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "OU", new1.get_FT_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_FTOU()).ToString(), new1.get_FT_OverOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.FT_Under:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=A&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "OU", new1.get_FT_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_FTOU()).ToString(), new1.get_FT_UnderOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.Half_Home:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=1&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "7", new1.get_Half_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_HalfHDP()).ToString(), new1.get_Half_HomeOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.Half_Away:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=2&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "7", new1.get_Half_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_HalfHDP()).ToString(), new1.get_Half_AwayOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.Half_Over:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=4&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "8", new1.get_Half_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_HalfOU()).ToString(), new1.get_Half_OverOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;

                        case EnumCollection.eBetTarget.Half_Under:
                            str7 = string.Format("s11Mode=SINGLE&i31SportID=0&s12StakeType={0}&s11Period=" + str6 + "&s13EventNo={1}&s21Home=" + str5 + "&s13Selection=5&s13Handicap={2}&s11OddsType=&s13Odds={3}&m00Stake=&m00MaxBet=&s11HoldMemberRB=&i13ScoreHome={4}&i13ScoreAway={5}&s11Action=GETBET", new object[] { "8", new1.get_Half_ID(), SportBookFunction.ConvertSBOBetHDPStyleToDouble(new1.get_HalfOU()).ToString(), new1.get_Half_UnderOddsString(), new1.get_HomeScore(), new1.get_AwayScore() });
                            goto Label_0B3C;
                    }
                }
            Label_0B3C:
                new3 = new4;
                new2 = new1.GenerateMatchBet(target1);
                HttpWebRequest request = (HttpWebRequest) WebRequest.Create(requestUriString);
                request.Timeout = 0x2710;
                request.Method = "POST";
                request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.16) Gecko/2009120208 Firefox/3.0.16";
                request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
                request.Headers.Add("Accept-Language", "en-gb,en;q=0.5");
                request.Headers.Add("Accept-Encoding", "gzip, deflate");
                request.Headers.Add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
                request.Headers["Cookie"] = base._objCookieList.ToString();
                request.Referer = base._strRootURL + "/MenuBet/LeftMenu.aspx";
                request.ContentType = "application/x-www-form-urlencoded";
                request.ContentLength = str7.Length;
                request.KeepAlive = true;
                WebRequestStateEx2 state = new WebRequestStateEx2("GetTicketAndBetFromAgent", request, str7, num1, new3.get_BetType(), target1, new MatchNew(), new3, new1, new2, bet1);
                ThreadPool.RegisterWaitForSingleObject(request.BeginGetRequestStream(new AsyncCallback(this.ReadCallBackTicket), state).AsyncWaitHandle, new WaitOrTimerCallback(this.TimeoutCallBackEx2), state, 0x2710, true);
                base.allDone.WaitOne();
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                base._isBetting = false;
                base._objErrorLogger.write(base._strName + ": EXCEPTION IN GetTicketAndBetFromAgent: " + exception.Message);
                this.WriteProgramLogger(base._strName + ": EXCEPTION IN GetTicketAndBetFromAgent: " + exception.Message);
                this.RaiseEventGetTicketComplete(base._strName, false, target1, new MatchNew(), new3, new1, new2, null);
                ProjectData.ClearProjectError();
            }
        }
Ejemplo n.º 4
0
        public List<MatchNew> GenerateFullOddsFromText(string text1, bool bb2, bool bb3, bool bb4, bool flag1)
        {
            List<MatchNew> list2 = new List<MatchNew>();
            EnumCollection.eOddsType malay = EnumCollection.eOddsType.Malay;
            string str2 = "";
            DateTime time2 = new DateTime();
            JsonPageList list3 = new JsonPageList();
            JsonPage current = new JsonPage();
            DateTime time = Conversions.ToDate(SpiderFunction.GetEarlyMarketStartTime(DateTime.Now));
            try
            {
                text1 = text1.Replace("\"1x2", "\"lx2");
                list3 = JsonConvert.DeserializeObject<JsonPageList>(text1);
                if ((list3 == null) || (list3.pages == null))
                {
                    return list2;
                }
                List<JsonPage>.Enumerator enumerator = list3.pages.GetEnumerator();
                try
                {
                    //enumerator;
                    while (enumerator.MoveNext())
                    {
                        current = enumerator.Current;
                        switch (current.otu.ToLower())
                        {
                            case "hk":
                                malay = EnumCollection.eOddsType.HK;
                                break;

                            case "malay":
                                malay = EnumCollection.eOddsType.Malay;
                                break;

                            case "indo":
                                malay = EnumCollection.eOddsType.Indo;
                                break;

                            case "euro":
                                malay = EnumCollection.eOddsType.Euro;
                                break;
                        }
                        if (current.events != null)
                        {
                            List<JsonMatch>.Enumerator enumerator2 = current.events.GetEnumerator();
                            try
                            {
                                //enumerator2;
                                while (enumerator2.MoveNext())
                                {
                                    JsonMatch match = enumerator2.Current;
                                    MatchNew item = new MatchNew();
                                    if (match.info.Count >= 0x13)
                                    {
                                        item.set_Type(EnumCollection.eMatchType.Match);
                                        item.set_Website("BW3388");
                                        if (match.info[5] != string.Empty)
                                        {
                                            str2 = match.info[5];
                                        }
                                        item.set_FT_ID(match.info[1]);
                                        item.set_Half_ID(match.info[1]);
                                        item.set_UniqueID(item.get_FT_ID() + "a");
                                        item.set_League(str2);
                                        item.set_HomeName(match.info[6]);
                                        item.set_AwayName(match.info[7]);
                                        if ((match.info[2].Length >= 5) & (match.info[3].Length >= 7))
                                        {
                                            bool flag;
                                            int year = DateTime.Now.Year;
                                            int num4 = (int) Math.Round(Conversion.Val(match.info[2].Substring(3, 2)));
                                            int num = (int) Math.Round(Conversion.Val(match.info[2].Substring(0, 2)));
                                            int num2 = (int) Math.Round(Conversion.Val(match.info[3].Substring(0, 2)));
                                            int num3 = (int) Math.Round(Conversion.Val(match.info[3].Substring(3, 2)));
                                            if (match.info[3].Substring(5, 2).ToLower() == "am")
                                            {
                                                flag = false;
                                            }
                                            else
                                            {
                                                flag = true;
                                            }
                                            time2 = CommonFunction.ConvertTimeToInternationalTime(year, num4, num, num2, num3, flag);
                                            if (match.info.Count >= 0x16)
                                            {
                                                item.set_GameType(EnumCollection.eGameType.Running);
                                                item.set_HomeScore((int) Math.Round(Conversion.Val(match.info[0x13])));
                                                item.set_AwayScore((int) Math.Round(Conversion.Val(match.info[20])));
                                                if (match.info[0x15].Length >= 4)
                                                {
                                                    item.set_RunningMinutes((int) Math.Round((double) (Conversion.Val(match.info[0x15].Substring(0, 1)) * Conversion.Val(match.info[0x15].Substring(3)))));
                                                }
                                            }
                                        }
                                    }
                                    item.set_MatchTime(time2);
                                    if (item.get_GameType() != EnumCollection.eGameType.Running)
                                    {
                                        if (SpiderFunction.IsEarlyMarket(time, item.get_MatchTime()))
                                        {
                                            item.set_GameType(EnumCollection.eGameType.Early);
                                        }
                                        else
                                        {
                                            item.set_GameType(EnumCollection.eGameType.Today);
                                        }
                                    }
                                    if (match.ah1.Count >= 8)
                                    {
                                        item.set_FTHDP_ID(match.ah1[7]);
                                        item.set_FTHDP(SportBookFunction.ConvertHDPDashedTypeWithZero(match.ah1[1].Replace("/", "-")));
                                        item.set_FT_HomeOddsString(match.ah1[2]);
                                        item.set_FT_AwayOddsString(match.ah1[3]);
                                        if (item.get_FTHDP() == "0.0")
                                        {
                                            item.set_FTHomeColor(Color.Blue);
                                            item.set_FTAwayColor(Color.Blue);
                                        }
                                        else if (match.ah1[4] == "b")
                                        {
                                            item.set_FTHomeColor(Color.Blue);
                                            item.set_FTAwayColor(Color.Red);
                                        }
                                        else
                                        {
                                            item.set_FTHomeColor(Color.Red);
                                            item.set_FTAwayColor(Color.Blue);
                                        }
                                        switch (malay)
                                        {
                                            case EnumCollection.eOddsType.HK:
                                                item.set_FT_HomeOddsString(SportBookFunction.ConvertHKToMalayOdds(item.get_FT_HomeOddsString()));
                                                item.set_FT_AwayOddsString(SportBookFunction.ConvertHKToMalayOdds(item.get_FT_AwayOddsString()));
                                                break;

                                            case EnumCollection.eOddsType.Euro:
                                                item.set_FT_HomeOddsString(SportBookFunction.ConvertEuroToMalayOdds(item.get_FT_HomeOddsString()));
                                                item.set_FT_AwayOddsString(SportBookFunction.ConvertEuroToMalayOdds(item.get_FT_AwayOddsString()));
                                                break;

                                            case EnumCollection.eOddsType.Indo:
                                                item.set_FT_HomeOddsString(SportBookFunction.ConvertIndoToMalayOdds(item.get_FT_HomeOddsString()));
                                                item.set_FT_AwayOddsString(SportBookFunction.ConvertIndoToMalayOdds(item.get_FT_AwayOddsString()));
                                                break;
                                        }
                                    }
                                    if (match.ou1.Count >= 7)
                                    {
                                        item.set_FTOU_ID(match.ou1[6]);
                                        item.set_FTOU(SportBookFunction.ConvertHDPDashedTypeWithZero(match.ou1[1].Replace("/", "-")));
                                        item.set_FT_OverOddsString(match.ou1[2]);
                                        item.set_FT_UnderOddsString(match.ou1[3]);
                                        switch (malay)
                                        {
                                            case EnumCollection.eOddsType.HK:
                                                item.set_FT_OverOddsString(SportBookFunction.ConvertHKToMalayOdds(item.get_FT_OverOddsString()));
                                                item.set_FT_UnderOddsString(SportBookFunction.ConvertHKToMalayOdds(item.get_FT_UnderOddsString()));
                                                break;

                                            case EnumCollection.eOddsType.Euro:
                                                item.set_FT_OverOddsString(SportBookFunction.ConvertEuroToMalayOdds(item.get_FT_OverOddsString()));
                                                item.set_FT_UnderOddsString(SportBookFunction.ConvertEuroToMalayOdds(item.get_FT_UnderOddsString()));
                                                break;

                                            case EnumCollection.eOddsType.Indo:
                                                item.set_FT_OverOddsString(SportBookFunction.ConvertIndoToMalayOdds(item.get_FT_OverOddsString()));
                                                item.set_FT_UnderOddsString(SportBookFunction.ConvertIndoToMalayOdds(item.get_FT_UnderOddsString()));
                                                break;
                                        }
                                    }
                                    if (flag1)
                                    {
                                        if (match.ahht1.Count >= 8)
                                        {
                                            item.set_HalfHDP_ID(match.ahht1[7]);
                                            item.set_HalfHDP(SportBookFunction.ConvertHDPDashedTypeWithZero(match.ahht1[1].Replace("/", "-")));
                                            item.set_Half_HomeOddsString(match.ahht1[2]);
                                            item.set_Half_AwayOddsString(match.ahht1[3]);
                                            if (item.get_HalfHDP() == "0.0")
                                            {
                                                item.set_HalfHomeColor(Color.Blue);
                                                item.set_HalfAwayColor(Color.Blue);
                                            }
                                            else if (match.ahht1[4] == "b")
                                            {
                                                item.set_HalfHomeColor(Color.Blue);
                                                item.set_HalfAwayColor(Color.Red);
                                            }
                                            else
                                            {
                                                item.set_HalfHomeColor(Color.Red);
                                                item.set_HalfAwayColor(Color.Blue);
                                            }
                                            switch (malay)
                                            {
                                                case EnumCollection.eOddsType.HK:
                                                    item.set_Half_HomeOddsString(SportBookFunction.ConvertHKToMalayOdds(item.get_Half_HomeOddsString()));
                                                    item.set_Half_AwayOddsString(SportBookFunction.ConvertHKToMalayOdds(item.get_Half_AwayOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Euro:
                                                    item.set_Half_HomeOddsString(SportBookFunction.ConvertEuroToMalayOdds(item.get_Half_HomeOddsString()));
                                                    item.set_Half_AwayOddsString(SportBookFunction.ConvertEuroToMalayOdds(item.get_Half_AwayOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Indo:
                                                    item.set_Half_HomeOddsString(SportBookFunction.ConvertIndoToMalayOdds(item.get_Half_HomeOddsString()));
                                                    item.set_Half_AwayOddsString(SportBookFunction.ConvertIndoToMalayOdds(item.get_Half_AwayOddsString()));
                                                    break;
                                            }
                                        }
                                        if (match.ouht1.Count >= 7)
                                        {
                                            item.set_HalfOU_ID(match.ouht1[6]);
                                            item.set_HalfOU(SportBookFunction.ConvertHDPDashedTypeWithZero(match.ouht1[1].Replace("/", "-")));
                                            item.set_Half_OverOddsString(match.ouht1[2]);
                                            item.set_Half_UnderOddsString(match.ouht1[3]);
                                            switch (malay)
                                            {
                                                case EnumCollection.eOddsType.HK:
                                                    item.set_Half_OverOddsString(SportBookFunction.ConvertHKToMalayOdds(item.get_Half_OverOddsString()));
                                                    item.set_Half_UnderOddsString(SportBookFunction.ConvertHKToMalayOdds(item.get_Half_UnderOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Euro:
                                                    item.set_Half_OverOddsString(SportBookFunction.ConvertEuroToMalayOdds(item.get_Half_OverOddsString()));
                                                    item.set_Half_UnderOddsString(SportBookFunction.ConvertEuroToMalayOdds(item.get_Half_UnderOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Indo:
                                                    item.set_Half_OverOddsString(SportBookFunction.ConvertIndoToMalayOdds(item.get_Half_OverOddsString()));
                                                    item.set_Half_UnderOddsString(SportBookFunction.ConvertIndoToMalayOdds(item.get_Half_UnderOddsString()));
                                                    break;
                                            }
                                        }
                                    }
                                    item.set_GlobalLastUpdate(DateTime.Now);
                                    list2.Add(item);
                                    if ((match.ah2.Count > 0) | (match.ou2.Count > 0))
                                    {
                                        MatchNew new3 = new MatchNew();
                                        new3.set_Type(EnumCollection.eMatchType.Match);
                                        new3.set_Website("BW3388");
                                        new3.set_FT_ID(item.get_FT_ID());
                                        new3.set_Half_ID(item.get_Half_ID());
                                        new3.set_UniqueID(item.get_FT_ID() + "b");
                                        new3.set_League(item.get_League());
                                        new3.set_HomeName(item.get_HomeName());
                                        new3.set_AwayName(item.get_AwayName());
                                        new3.set_AwayScore(item.get_AwayScore());
                                        new3.set_GameType(item.get_GameType());
                                        new3.set_MatchTime(item.get_MatchTime());
                                        new3.set_RunningMinutes(item.get_RunningMinutes());
                                        new3.set_RunningStatus(item.get_RunningStatus());
                                        if (match.ah2.Count >= 8)
                                        {
                                            new3.set_FTHDP_ID(match.ah2[7]);
                                            new3.set_FTHDP(SportBookFunction.ConvertHDPDashedTypeWithZero(match.ah2[1].Replace("/", "-")));
                                            new3.set_FT_HomeOddsString(match.ah2[2]);
                                            new3.set_FT_AwayOddsString(match.ah2[3]);
                                            if (new3.get_FTHDP() == "0.0")
                                            {
                                                new3.set_FTHomeColor(Color.Blue);
                                                new3.set_FTAwayColor(Color.Blue);
                                            }
                                            else if (match.ah2[4] == "b")
                                            {
                                                new3.set_FTHomeColor(Color.Blue);
                                                new3.set_FTAwayColor(Color.Red);
                                            }
                                            else
                                            {
                                                new3.set_FTHomeColor(Color.Red);
                                                new3.set_FTAwayColor(Color.Blue);
                                            }
                                            switch (malay)
                                            {
                                                case EnumCollection.eOddsType.HK:
                                                    new3.set_FT_HomeOddsString(SportBookFunction.ConvertHKToMalayOdds(new3.get_FT_HomeOddsString()));
                                                    new3.set_FT_AwayOddsString(SportBookFunction.ConvertHKToMalayOdds(new3.get_FT_AwayOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Euro:
                                                    new3.set_FT_HomeOddsString(SportBookFunction.ConvertEuroToMalayOdds(new3.get_FT_HomeOddsString()));
                                                    new3.set_FT_AwayOddsString(SportBookFunction.ConvertEuroToMalayOdds(new3.get_FT_AwayOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Indo:
                                                    new3.set_FT_HomeOddsString(SportBookFunction.ConvertIndoToMalayOdds(new3.get_FT_HomeOddsString()));
                                                    new3.set_FT_AwayOddsString(SportBookFunction.ConvertIndoToMalayOdds(new3.get_FT_AwayOddsString()));
                                                    break;
                                            }
                                        }
                                        if (match.ou2.Count >= 7)
                                        {
                                            new3.set_FTOU_ID(match.ou2[6]);
                                            new3.set_FTOU(SportBookFunction.ConvertHDPDashedTypeWithZero(match.ou2[1].Replace("/", "-")));
                                            new3.set_FT_OverOddsString(match.ou2[2]);
                                            new3.set_FT_UnderOddsString(match.ou2[3]);
                                            switch (malay)
                                            {
                                                case EnumCollection.eOddsType.HK:
                                                    new3.set_FT_OverOddsString(SportBookFunction.ConvertHKToMalayOdds(new3.get_FT_OverOddsString()));
                                                    new3.set_FT_UnderOddsString(SportBookFunction.ConvertHKToMalayOdds(new3.get_FT_UnderOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Euro:
                                                    new3.set_FT_OverOddsString(SportBookFunction.ConvertEuroToMalayOdds(new3.get_FT_OverOddsString()));
                                                    new3.set_FT_UnderOddsString(SportBookFunction.ConvertEuroToMalayOdds(new3.get_FT_UnderOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Indo:
                                                    new3.set_FT_OverOddsString(SportBookFunction.ConvertIndoToMalayOdds(new3.get_FT_OverOddsString()));
                                                    new3.set_FT_UnderOddsString(SportBookFunction.ConvertIndoToMalayOdds(new3.get_FT_UnderOddsString()));
                                                    break;
                                            }
                                        }
                                        new3.set_GlobalLastUpdate(DateTime.Now);
                                        list2.Add(new3);
                                    }
                                    if ((match.ah3.Count > 0) | (match.ou3.Count > 0))
                                    {
                                        MatchNew new4 = new MatchNew();
                                        new4.set_Type(EnumCollection.eMatchType.Match);
                                        new4.set_Website("BW3388");
                                        new4.set_FT_ID(item.get_FT_ID());
                                        new4.set_Half_ID(item.get_Half_ID());
                                        new4.set_UniqueID(item.get_FT_ID() + "c");
                                        new4.set_League(item.get_League());
                                        new4.set_HomeName(item.get_HomeName());
                                        new4.set_AwayName(item.get_AwayName());
                                        new4.set_AwayScore(item.get_AwayScore());
                                        new4.set_GameType(item.get_GameType());
                                        new4.set_MatchTime(item.get_MatchTime());
                                        new4.set_RunningMinutes(item.get_RunningMinutes());
                                        new4.set_RunningStatus(item.get_RunningStatus());
                                        if (match.ah3.Count >= 8)
                                        {
                                            new4.set_FTHDP_ID(match.ah3[7]);
                                            new4.set_FTHDP(SportBookFunction.ConvertHDPDashedTypeWithZero(match.ah3[1].Replace("/", "-")));
                                            new4.set_FT_HomeOddsString(match.ah3[2]);
                                            new4.set_FT_AwayOddsString(match.ah3[3]);
                                            if (new4.get_FTHDP() == "0.0")
                                            {
                                                new4.set_FTHomeColor(Color.Blue);
                                                new4.set_FTAwayColor(Color.Blue);
                                            }
                                            else if (match.ah3[4] == "b")
                                            {
                                                new4.set_FTHomeColor(Color.Blue);
                                                new4.set_FTAwayColor(Color.Red);
                                            }
                                            else
                                            {
                                                new4.set_FTHomeColor(Color.Red);
                                                new4.set_FTAwayColor(Color.Blue);
                                            }
                                            switch (malay)
                                            {
                                                case EnumCollection.eOddsType.HK:
                                                    new4.set_FT_HomeOddsString(SportBookFunction.ConvertHKToMalayOdds(new4.get_FT_HomeOddsString()));
                                                    new4.set_FT_AwayOddsString(SportBookFunction.ConvertHKToMalayOdds(new4.get_FT_AwayOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Euro:
                                                    new4.set_FT_HomeOddsString(SportBookFunction.ConvertEuroToMalayOdds(new4.get_FT_HomeOddsString()));
                                                    new4.set_FT_AwayOddsString(SportBookFunction.ConvertEuroToMalayOdds(new4.get_FT_AwayOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Indo:
                                                    new4.set_FT_HomeOddsString(SportBookFunction.ConvertIndoToMalayOdds(new4.get_FT_HomeOddsString()));
                                                    new4.set_FT_AwayOddsString(SportBookFunction.ConvertIndoToMalayOdds(new4.get_FT_AwayOddsString()));
                                                    break;
                                            }
                                        }
                                        if (match.ou3.Count >= 7)
                                        {
                                            new4.set_FTOU_ID(match.ou3[6]);
                                            new4.set_FTOU(SportBookFunction.ConvertHDPDashedTypeWithZero(match.ou3[1].Replace("/", "-")));
                                            new4.set_FT_OverOddsString(match.ou3[2]);
                                            new4.set_FT_UnderOddsString(match.ou3[3]);
                                            switch (malay)
                                            {
                                                case EnumCollection.eOddsType.HK:
                                                    new4.set_FT_OverOddsString(SportBookFunction.ConvertHKToMalayOdds(new4.get_FT_OverOddsString()));
                                                    new4.set_FT_UnderOddsString(SportBookFunction.ConvertHKToMalayOdds(new4.get_FT_UnderOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Euro:
                                                    new4.set_FT_OverOddsString(SportBookFunction.ConvertEuroToMalayOdds(new4.get_FT_OverOddsString()));
                                                    new4.set_FT_UnderOddsString(SportBookFunction.ConvertEuroToMalayOdds(new4.get_FT_UnderOddsString()));
                                                    break;

                                                case EnumCollection.eOddsType.Indo:
                                                    new4.set_FT_OverOddsString(SportBookFunction.ConvertIndoToMalayOdds(new4.get_FT_OverOddsString()));
                                                    new4.set_FT_UnderOddsString(SportBookFunction.ConvertIndoToMalayOdds(new4.get_FT_UnderOddsString()));
                                                    break;
                                            }
                                        }
                                        new4.set_GlobalLastUpdate(DateTime.Now);
                                        list2.Add(new4);
                                    }
                                }
                                continue;
                            }
                            finally
                            {
                                enumerator2.Dispose();
                            }
                        }
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                base._objErrorLogger.write(base._strName + ": EXCEPTION IN GenerateFullOddsFromText: " + exception.Message);
                this.WriteProgramLogger(base._strName + ": EXCEPTION IN GenerateFullOddsFromText: " + exception.Message);
                ProjectData.ClearProjectError();
            }
            return list2;
        }