Пример #1
0
        public List<MatchBetNew> GenerateMemberBetlistFromText(string text1)
        {
            IEnumerator enumerator = null;
            List<MatchBetNew> list3 = new List<MatchBetNew>();
            ArrayList list2 = new ArrayList();
            ArrayList list4 = new ArrayList();
            int num3 = 0;
            string str = "";
            string str2 = "";
            string str3 = "";
            string str4 = "";
            string str5 = "";
            int num = 0;
            int num2 = 0;
            while (num3 > -1)
            {
                str2 = CommonFunction.substring(text1, num3, "<tr bgcolor", "</tr", ref num3).Trim();
                if (str2 != string.Empty)
                {
                    list2.Add(str2);
                }
            }
            try
            {
                enumerator = list2.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    str = Conversions.ToString(enumerator.Current);
                    bool flag = false;
                    MatchBetNew item = new MatchBetNew();
                    num3 = 0;
                    str2 = CommonFunction.substring(str, num3, "<td", "<td>", "</td>", ref num3).Replace("<br>", " ").Trim();
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    item.set_BetDate(str2);
                    item.set_MemberName(CommonFunction.substring(str, num3, "nowrap\">", "</", ref num3).Trim());
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    if (base._objMemberList.get_MemberRange() == EnumCollection.eMemberRange.AllMember)
                    {
                        item.set_BetFollowMethod(base._objMemberList.get_GlobalBetFollowMethod());
                    }
                    else
                    {
                        Member member = base._objMemberList.get_Item(item.get_MemberName());
                        if (member != null)
                        {
                            item.set_BetFollowMethod(member.get_BetFollowMethod());
                        }
                        else
                        {
                            item.set_BetFollowMethod(EnumCollection.eBetFollowMethod.Normal);
                        }
                    }
                    str2 = CommonFunction.substring(str, num3, "<td>", "<", ref num3).Trim().ToLower();
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    switch (str2)
                    {
                        case "1st half over/under":
                            item.set_GameType(EnumCollection.eGameType.Today);
                            item.set_BetType(EnumCollection.eBetType.OU);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FirstHalf);
                            break;

                        case "over/under":
                            item.set_GameType(EnumCollection.eGameType.Today);
                            item.set_BetType(EnumCollection.eBetType.OU);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FT);
                            break;

                        case "1st half asian handicap":
                            item.set_GameType(EnumCollection.eGameType.Today);
                            item.set_BetType(EnumCollection.eBetType.HDP);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FirstHalf);
                            break;

                        case "asian handicap":
                            item.set_GameType(EnumCollection.eGameType.Today);
                            item.set_BetType(EnumCollection.eBetType.HDP);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FT);
                            break;

                        case "1st half 1x2":
                            item.set_GameType(EnumCollection.eGameType.Today);
                            item.set_BetType(EnumCollection.eBetType.lX2);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FirstHalf);
                            break;

                        case "1x2":
                            item.set_GameType(EnumCollection.eGameType.Today);
                            item.set_BetType(EnumCollection.eBetType.lX2);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FT);
                            break;

                        case "1st half in-play over/under":
                            item.set_GameType(EnumCollection.eGameType.Running);
                            item.set_RunningStatus(EnumCollection.eRunningStatus.Running);
                            item.set_BetType(EnumCollection.eBetType.OU);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FirstHalf);
                            break;

                        case "in-play over/under":
                            item.set_GameType(EnumCollection.eGameType.Running);
                            item.set_RunningStatus(EnumCollection.eRunningStatus.Running);
                            item.set_BetType(EnumCollection.eBetType.OU);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FT);
                            break;

                        case "1st half in-play handicap":
                            item.set_GameType(EnumCollection.eGameType.Running);
                            item.set_RunningStatus(EnumCollection.eRunningStatus.Running);
                            item.set_BetType(EnumCollection.eBetType.HDP);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FirstHalf);
                            break;

                        case "in-play handicap":
                            item.set_GameType(EnumCollection.eGameType.Running);
                            item.set_RunningStatus(EnumCollection.eRunningStatus.Running);
                            item.set_BetType(EnumCollection.eBetType.HDP);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FT);
                            break;

                        case "1st half in-play 1x2":
                            item.set_GameType(EnumCollection.eGameType.Running);
                            item.set_RunningStatus(EnumCollection.eRunningStatus.Running);
                            item.set_BetType(EnumCollection.eBetType.lX2);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FirstHalf);
                            break;

                        case "in-play 1x2":
                            item.set_GameType(EnumCollection.eGameType.Running);
                            item.set_RunningStatus(EnumCollection.eRunningStatus.Running);
                            item.set_BetType(EnumCollection.eBetType.lX2);
                            item.set_BetCoverage(EnumCollection.eBetCoverage.FT);
                            break;
                    }
                    str2 = CommonFunction.substring(str, num3, "<br>", "<", ref num3).Replace("&nbsp;", "").Trim();
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    item.set_ID(str2);
                    str2 = CommonFunction.substring(str, num3, "fontBlueSteel", ">", "<", ref num3).Trim();
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    item.set_League(str2);
                    num = 0;
                    num2 = 0;
                    if ((item.get_GameType() == EnumCollection.eGameType.Running) && (item.get_BetType() != EnumCollection.eBetType.lX2))
                    {
                        str2 = CommonFunction.substring(str, num3, "Red'>", "<", ref num3).Trim();
                        if (num3 > -1)
                        {
                            List<string> list5 = new List<string>();
                            list5 = CommonFunction.SeperateStringBySymbol2(str2, "-");
                            if (list5.Count == 2)
                            {
                                num = (int) Math.Round(Conversion.Val(list5[0].Trim()));
                                num2 = (int) Math.Round(Conversion.Val(list5[1].Trim()));
                            }
                        }
                    }
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    if ((item.get_GameType() == EnumCollection.eGameType.Running) & (item.get_BetType() != EnumCollection.eBetType.lX2))
                    {
                        str2 = CommonFunction.substring(str, num3, "span>", "<", ref num3).Replace("&nbsp;", "").Trim();
                    }
                    else
                    {
                        str2 = CommonFunction.substring(str, num3, "span>", ">", "<", ref num3).Replace("&nbsp;", "").Trim();
                    }
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    str4 = str2;
                    if (item.get_BetType() != EnumCollection.eBetType.lX2)
                    {
                        str2 = CommonFunction.substring(str, num3, ">", "<", ref num3).Trim();
                        if (str2 != "vs")
                        {
                            item.set_HDP(str2.Replace("/", "-"));
                        }
                    }
                    else
                    {
                        item.set_HDP("0.0");
                        str2 = CommonFunction.substring(str, num3, ">", "<", ref num3).Trim();
                    }
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    str2 = CommonFunction.substring(str, num3, ">", "<", ref num3).Replace("&nbsp;", "").Trim();
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    str5 = str2;
                    MatchNew new3 = null;
                    new3 = SpiderFunction.FindMatchNewByTeamName(str4, str5, this._objMatchNameList);
                    if (new3 != null)
                    {
                        item.set_HomeName(new3.get_HomeName());
                        item.set_AwayName(new3.get_AwayName());
                    }
                    else
                    {
                        item.set_HomeName(str4);
                        item.set_AwayName(str5);
                    }
                    str2 = CommonFunction.substring(str, num3, "fontRedDark'>", "</span>", ref num3).Trim();
                    if (item.get_BetType() == EnumCollection.eBetType.lX2)
                    {
                        str2 = str2.Replace("(A)", "(H)");
                        int num4 = 0;
                        str3 = CommonFunction.substring("*" + str2, 0, "*", "(H)", ref num4);
                        if (str3 != string.Empty)
                        {
                            str2 = str3;
                        }
                    }
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    if (item.get_BetType() == EnumCollection.eBetType.OU)
                    {
                        List<string> list6 = CommonFunction.SeperateStringBySymbol2(str2, "&nbsp;");
                        if (list6.Count == 2)
                        {
                            item.set_SelectedMatch(list6[0].Trim());
                            item.set_HDP(list6[1].Replace("/", "-"));
                        }
                    }
                    else
                    {
                        item.set_SelectedMatch(str2);
                    }
                    str2 = CommonFunction.substring(str, num3, "'>", "<", ref num3).Trim();
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    item.set_OddsString(str2);
                    str2 = CommonFunction.substring(str, num3, "nowrap\">", "<", ref num3).Trim();
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    item.set_BetAmount(str2.Replace(",", ""));
                    str2 = CommonFunction.substring(str, num3, "<td nowrap=\"nowrap\">", "<", ref num3).Trim();
                    if (num3 <= -1)
                    {
                        continue;
                    }
                    item.set_IPAddress(str2);
                    item.set_OddsType(EnumCollection.eOddsType.Malay);
                    item.set_HDP(SportBookFunction.ConvertHDPDashedTypeWithZero(item.get_HDP()));
                    if (item.get_BetType() == EnumCollection.eBetType.HDP)
                    {
                        if (item.get_HDP() == "0.0")
                        {
                            item.set_HomeColor(Color.Blue);
                            item.set_AwayColor(Color.Blue);
                        }
                        else if (str4 == item.get_HomeName())
                        {
                            item.set_HomeColor(Color.Red);
                            item.set_AwayColor(Color.Blue);
                        }
                        else
                        {
                            item.set_HomeColor(Color.Blue);
                            item.set_AwayColor(Color.Red);
                        }
                    }
                    else
                    {
                        item.set_HomeColor(Color.Blue);
                        item.set_AwayColor(Color.Blue);
                    }
                    if (item.get_GameType() == EnumCollection.eGameType.Running)
                    {
                        if (str4 == item.get_HomeName())
                        {
                            item.set_HomeScore(num);
                            item.set_AwayScore(num2);
                        }
                        else
                        {
                            item.set_HomeScore(num2);
                            item.set_AwayScore(num);
                        }
                    }
                    if (item.get_BetCoverage() != EnumCollection.eBetCoverage.FT)
                    {
                        goto Label_098E;
                    }
                    switch (item.get_BetType())
                    {
                        case EnumCollection.eBetType.HDP:
                            if (item.get_SelectedMatch().ToLower() != item.get_AwayName().ToLower().Replace("(n)", "").Trim())
                            {
                                break;
                            }
                            item.set_BetTarget(EnumCollection.eBetTarget.FT_Away);
                            goto Label_0A78;

                        case EnumCollection.eBetType.OU:
                            if (item.get_SelectedMatch().ToLower() != "over")
                            {
                                goto Label_0962;
                            }
                            item.set_BetTarget(EnumCollection.eBetTarget.FT_Over);
                            goto Label_0A78;

                        default:
                            goto Label_0A78;
                    }
                    if (item.get_SelectedMatch().ToLower() == item.get_HomeName().ToLower().Replace("(n)", "").Trim())
                    {
                        item.set_BetTarget(EnumCollection.eBetTarget.FT_Home);
                    }
                    else
                    {
                        flag = true;
                    }
                    goto Label_0A78;
                Label_0962:
                    if (item.get_SelectedMatch().ToLower() == "under")
                    {
                        item.set_BetTarget(EnumCollection.eBetTarget.FT_Under);
                    }
                    else
                    {
                        flag = true;
                    }
                    goto Label_0A78;
                Label_098E:
                    switch (item.get_BetType())
                    {
                        case EnumCollection.eBetType.HDP:
                            if (item.get_SelectedMatch().ToLower() != item.get_AwayName().ToLower().Replace("(n)", "").Trim())
                            {
                                break;
                            }
                            item.set_BetTarget(EnumCollection.eBetTarget.Half_Away);
                            goto Label_0A78;

                        case EnumCollection.eBetType.OU:
                            if (item.get_SelectedMatch().ToLower() != "over")
                            {
                                goto Label_0A51;
                            }
                            item.set_BetTarget(EnumCollection.eBetTarget.Half_Over);
                            goto Label_0A78;

                        default:
                            goto Label_0A78;
                    }
                    if (item.get_SelectedMatch().ToLower() == item.get_HomeName().ToLower().Replace("(n)", "").Trim())
                    {
                        item.set_BetTarget(EnumCollection.eBetTarget.Half_Home);
                    }
                    else
                    {
                        flag = true;
                    }
                    goto Label_0A78;
                Label_0A51:
                    if (item.get_SelectedMatch().ToLower() == "under")
                    {
                        item.set_BetTarget(EnumCollection.eBetTarget.Half_Under);
                    }
                    else
                    {
                        flag = true;
                    }
                Label_0A78:
                    item.set_CreateDate(DateTime.Now);
                    item.set_Company(base._strAgentSiteName);
                    if (!flag && ((this._isToGrab1X2Odds & (item.get_BetType() == EnumCollection.eBetType.lX2)) | (!this._isToGrab1X2Odds & (item.get_BetType() != EnumCollection.eBetType.lX2))))
                    {
                        list3.Add(item);
                    }
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
            return list3;
        }
Пример #2
0
 public static string GenerateDetailedMatchInfo(MatchBetNew new1, string text1)
 {
     return ("\r\n============================================================\r\n" + text1 + "\r\n============================================================\r\nCompany: " + new1.get_Company() + "\r\nRef ID: " + new1.get_ID() + "\r\nMember: " + new1.get_MemberName() + "\r\nBetType: " + new1.get_BetType().ToString() + "\r\nGameType: " + new1.get_GameType().ToString() + "\r\nMatchTime: " + new1.get_MatchDate() + "\r\nScore: " + new1.get_HomeScore().ToString() + "-" + Conversions.ToString(new1.get_AwayScore()) + "\r\nLeague: " + new1.get_League() + "\r\nHome: " + new1.get_HomeName() + "\r\nAway: " + new1.get_AwayName() + "\r\nBet: " + new1.get_SelectedMatch() + "\r\nHDP: " + new1.get_HDP() + "\r\nOdds: " + Conversions.ToString(new1.get_Odds()) + "\r\nAmount: " + new1.get_BetAmount() + "\r\n============================================================");
 }
Пример #3
0
        private void GetTicketAndBetFromAgent(MatchBetNew new1, MatchNew new4, EnumCollection.eBetTarget target1, int num1, AgentToClientBet bet1)
        {
            MatchBetNew new3 = new MatchBetNew();
            MatchBetNew new2 = new MatchBetNew();
            try
            {
                string requestUriString = "";
                string str5 = "";
                base._isBetting = true;
                base._datTicketStart = DateTime.Now;
                requestUriString = base._strRootURL + "/english/index.php?p=bettingback&b=soccer|";
                if (new1.get_GameType() == EnumCollection.eGameType.Running)
                {
                    str5 = "r";
                }
                switch (target1)
                {
                    case EnumCollection.eBetTarget.FT_Home:
                        requestUriString = requestUriString + string.Format("{2}ah|{0}|a||||{1}", new4.get_FTHDP_ID(), this._strOddsText, str5);
                        break;

                    case EnumCollection.eBetTarget.FT_Away:
                        requestUriString = requestUriString + string.Format("{2}ah|{0}|b||||{1}", new4.get_FTHDP_ID(), this._strOddsText, str5);
                        break;

                    case EnumCollection.eBetTarget.FT_Over:
                        requestUriString = requestUriString + string.Format("{2}ou|{0}|over||||{1}", new4.get_FTOU_ID(), this._strOddsText, str5);
                        break;

                    case EnumCollection.eBetTarget.FT_Under:
                        requestUriString = requestUriString + string.Format("{2}ou|{0}|under||||{1}", new4.get_FTOU_ID(), this._strOddsText, str5);
                        break;

                    case EnumCollection.eBetTarget.Half_Home:
                        requestUriString = requestUriString + string.Format("{2}ahht|{0}|a||||{1}", new4.get_HalfHDP_ID(), this._strOddsText, str5);
                        break;

                    case EnumCollection.eBetTarget.Half_Away:
                        requestUriString = requestUriString + string.Format("{2}ahht|{0}|b||||{1}", new4.get_HalfHDP_ID(), this._strOddsText, str5);
                        break;

                    case EnumCollection.eBetTarget.Half_Over:
                        requestUriString = requestUriString + string.Format("{2}ouht|{0}|over||||{1}", new4.get_HalfOU_ID(), this._strOddsText, str5);
                        break;

                    case EnumCollection.eBetTarget.Half_Under:
                        requestUriString = requestUriString + string.Format("{2}ouht|{0}|under||||{1}", new4.get_HalfOU_ID(), this._strOddsText, str5);
                        break;
                }
                new3 = new1;
                new2 = new4.GenerateMatchBet(target1);
                HttpWebRequest request = (HttpWebRequest) WebRequest.Create(requestUriString);
                request.Timeout = 0x2710;
                request.Method = "GET";
                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 + "/english/index.php?p=user_main";
                request.ContentLength = 0L;
                request.KeepAlive = true;
                WebRequestStateEx2 state = new WebRequestStateEx2("GetTicketAndBetFromAgent", request, "", num1, new3.get_BetType(), target1, new MatchNew(), new3, new4, new2, bet1);
                ThreadPool.RegisterWaitForSingleObject(request.BeginGetResponse(new AsyncCallback(this.RequestCompleteTicketFromAgent), state).AsyncWaitHandle, new WaitOrTimerCallback(this.TimeoutCallBackEx2), state, 0x2710, true);
            }
            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, new4, new2, null);
                ProjectData.ClearProjectError();
            }
        }