Пример #1
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============================================================");
 }
Пример #2
0
 private void RequestCompleteTicketFromAgent(IAsyncResult result1)
 {
     try
     {
         int num2 = 0;
         int num3 = 0;
         string str11 = "";
         string str12 = "";
         string str9 = "";
         string str7 = "";
         string str3 = "";
         string inputStr = "";
         string str4 = "";
         string str6 = "";
         string str13 = "";
         ArrayList list = new ArrayList();
         string str14 = "";
         string str = "";
         int num = 0;
         WebRequestStateEx2 asyncState = (WebRequestStateEx2) result1.AsyncState;
         WebRequest request = asyncState.get_Request();
         int num4 = 0;
         string str15 = null;
         str13 = CommonFunction.ConvertWebRequestToString(request, ref num4, ref str15);
         if (this.IsLoggedOut(ref str13))
         {
             base._isLoginSuccess = false;
             throw new Exception("Get Ticket Failed, Account Logged Out!");
         }
         this.WriteProgramLogger("Get SingBet Ticket Complete. (" + DateTime.Now.Subtract(base._datTicketStart).TotalMilliseconds.ToString() + "ms)");
         this.WriteBetlistLogger("Ticket: " + str13 + "\r\nActually selected: " + asyncState.get_MatchBetParentSite().get_SelectedMatch());
         this.ExtractInfoFromTicket(str13, asyncState.get_BetType(), ref str11, ref str12, ref str9, ref str4, ref str3, ref str7, ref inputStr, ref str6, ref num2, ref num3, ref str, ref list);
         this.WriteProgramLogger("Odds : " + str7);
         MatchBetNew item = new MatchBetNew();
         item.set_League(str4);
         item.set_SelectedMatch(str9);
         item.set_HDP(str3);
         item.set_OddsString(str7);
         item.set_MaxBetAmount(inputStr);
         item.set_HomeColor(asyncState.get_MatchBetParentSite().get_HomeColor());
         item.set_AwayColor(asyncState.get_MatchBetParentSite().get_AwayColor());
         item.set_BetCoverage(asyncState.get_MatchBetParentSite().get_BetCoverage());
         item.set_BetType(asyncState.get_MatchBetParentSite().get_BetType());
         item.set_BetFollowMethod(asyncState.get_MatchBetParentSite().get_BetFollowMethod());
         item.set_ID(asyncState.get_MatchBetParentSite().get_ID());
         item.set_MemberName(asyncState.get_MatchBetParentSite().get_MemberName());
         item.set_OddsType(base._objBetOddsType);
         if (asyncState.get_MatchChildSite().get_AwayName().ToUpper() == str12.ToUpper())
         {
             item.set_HomeName(str11);
             item.set_HomeScore(num2);
             item.set_AwayName(str12);
             item.set_AwayScore(num3);
         }
         else
         {
             item.set_HomeName(str12);
             item.set_HomeScore(num3);
             item.set_AwayName(str11);
             item.set_AwayScore(num2);
         }
         if (asyncState.get_BetAmount() == Conversions.ToDouble("-1"))
         {
             item.set_BetAmount(inputStr);
         }
         else
         {
             item.set_BetAmount(Conversions.ToString(asyncState.get_BetAmount()));
         }
         if (Conversion.Val(item.get_BetAmount()) > Conversion.Val(inputStr))
         {
             item.set_BetAmount(inputStr);
         }
         if (Conversion.Val(item.get_BetAmount()) > base._intMaxBetLimiter)
         {
             item.set_BetAmount(Conversions.ToString(base._intMaxBetLimiter));
         }
         if (base._isAutoAdjustToMinBetAmount && (Conversion.Val(item.get_BetAmount()) < Conversion.Val(str6)))
         {
             item.set_BetAmount(str6);
         }
         item.set_BetAmount(Conversions.ToString(Conversion.Int(Conversion.Val(item.get_BetAmount()))));
         if (asyncState.get_BetType() == EnumCollection.eBetType.HDP)
         {
             str14 = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(("gold=" + item.get_BetAmount() + "&uid=") + this._strUID + "&active=", list[1]), "&strong="), list[2]), "&line_type="), list[3]), "&gid="), list[4]), "&type="), list[5]), "&gnum="), list[6]), "&concede_r="), list[7]), "&radio_r="), list[8]), "&ioradio_r_h="), list[9]), "&gmax_single="), list[10]), "&gmin_single="), list[11]), "&singlecredit="), list[12]), "&singleorder="), list[13]), "&restsinglecredit="), list[14]), "&wagerstotal="), list[15]), "&restcredit="), list[0x10]), "&pay_type="), list[0x11]), "&odd_f_type="), list[0x12]));
         }
         else
         {
             str14 = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(("gold=" + item.get_BetAmount() + "&uid=") + this._strUID + "&active=", list[1]), "&line_type="), list[2]), "&gid="), list[3]), "&type="), list[4]), "&gnum="), list[5]), "&concede_h="), list[6]), "&radio_h="), list[7]), "&ioradio_r_h="), list[8]), "&gmax_single="), list[9]), "&gmin_single="), list[10]), "&singlecredit="), list[11]), "&singleorder="), list[12]), "&restsinglecredit="), list[13]), "&wagerstotal="), list[14]), "&restcredit="), list[15]), "&pay_type="), list[0x10]), "&odd_f_type="), list[0x11]));
         }
         this.WriteBetlistLogger("Bet Post: " + str14);
         if ((asyncState.get_AgentToClientBetObj() != null) && (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt() != null))
         {
             if (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_FollowOddsOption() == EnumCollection.eFollowOddsOption.HaltIfOddsLessThan)
             {
                 if (SpiderFunction.IsOddsALessThanOddsB(item.get_Odds(), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()))
                 {
                     this.WriteProgramLogger(string.Format("Odds Too Less ([{0}] < [{1}])", item.get_Odds(), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()));
                     item.set_Description(string.Format("Odds Too Less ([{0}] < [{1}])", item.get_Odds(), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()));
                     base._objBetListFailed.Add(item);
                     this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                     base._isBetting = false;
                     this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                     return;
                 }
             }
             else if (((asyncState.get_MatchBetParentSite().get_BetFollowMethod() == EnumCollection.eBetFollowMethod.Normal) & (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_FollowOddsOption() == EnumCollection.eFollowOddsOption.HaltIfOddsDifferentMoreThan)) && (SpiderFunction.GetOddsDiffSameSide(item.get_Odds(), asyncState.get_MatchBetParentSite().get_Odds()) > asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()))
             {
                 this.WriteProgramLogger(string.Format("Odds Different Too Much ([{0}] > [{1}])", SpiderFunction.GetOddsDiffSameSide(item.get_Odds(), asyncState.get_MatchBetParentSite().get_Odds()), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()));
                 item.set_Description(string.Format("Odds Different Too Much ([{0}] > [{1}])", SpiderFunction.GetOddsDiffSameSide(item.get_Odds(), asyncState.get_MatchBetParentSite().get_Odds()), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()));
                 base._objBetListFailed.Add(item);
                 this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                 base._isBetting = false;
                 this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                 return;
             }
         }
         if ((asyncState.get_MatchBetParentSite().get_HomeScore() == item.get_HomeScore()) & (asyncState.get_MatchBetParentSite().get_AwayScore() == item.get_AwayScore()))
         {
             if (!base._isPerMatchLimitEnabled | (base._isPerMatchLimitEnabled & base._objPerMatchLimitList.IsCanBet(item, (int) Math.Round(Conversion.Val(item.get_BetAmount())), ref num)))
             {
                 if (num < Conversion.Val(item.get_BetAmount()))
                 {
                     item.set_BetAmount(num.ToString());
                 }
                 this.RaiseEventGetTicketComplete(base._strName, true, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), item);
                 if (base._isAutoBetting)
                 {
                     if (base._isToTrySimilarHDP | (!base._isToTrySimilarHDP & (asyncState.get_MatchBetParentSite().get_HDP() == str3)))
                     {
                         this.WriteProgramLogger("Can Bet SingBet.");
                         this.Bet(request.RequestUri.ToString(), str14, str, item, asyncState.get_MatchParentSite(), asyncState.get_BetTarget());
                     }
                     else
                     {
                         base._isBetting = false;
                         this.WriteProgramLogger("Cannot Bet SingBet.");
                         this.WriteBetlistLogger(SpiderFunction.GenerateDetailedMatchInfo(asyncState.get_MatchBetParentSite(), asyncState.get_MatchBetChildSite(), "Failed Ticket HDP/ODDS Change", "SingAgent"));
                         item.set_Description("HDP/Odds Change");
                         base._objBetListFailed.Add(item);
                         this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                         this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                     }
                 }
                 else
                 {
                     base._isBetting = false;
                     this.WriteProgramLogger("Auto Bet OFF.");
                     item.set_Description("Auto Bet OFF.");
                     base._objBetListFailed.Add(item);
                     this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                     this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                 }
             }
             else
             {
                 base._isBetting = false;
                 this.WriteProgramLogger("Exceed Per Match Limit!");
                 item.set_Description("Exceed Per Match Limit!");
                 base._objBetListFailed.Add(item);
                 this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                 this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
             }
         }
         else
         {
             base._isBetting = false;
             this.WriteProgramLogger(string.Format("Score Changed [{0}-{1}] -> [{2}-{3}]", new object[] { asyncState.get_MatchBetParentSite().get_HomeScore(), asyncState.get_MatchBetParentSite().get_AwayScore(), item.get_HomeScore(), item.get_AwayScore() }));
             item.set_Description(string.Format("Score Changed [{0}-{1}] -> [{2}-{3}]", new object[] { asyncState.get_MatchBetParentSite().get_HomeScore(), asyncState.get_MatchBetParentSite().get_AwayScore(), item.get_HomeScore(), item.get_AwayScore() }));
             base._objBetListFailed.Add(item);
             this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
             this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
         }
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         base._isBetting = false;
         base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteTicketFromAgent: " + exception.Message);
         this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteTicketFromAgent: " + exception.Message);
         WebRequestStateEx2 ex2 = (WebRequestStateEx2) result1.AsyncState;
         this.RaiseEventGetTicketComplete(base._strName, true, ex2.get_BetTarget(), ex2.get_MatchParentSite(), ex2.get_MatchBetParentSite(), ex2.get_MatchChildSite(), ex2.get_MatchBetChildSite(), null);
         ProjectData.ClearProjectError();
     }
 }