private void RequestCompleteFullOdds(IAsyncResult result1) { try { Match match = new Match(); Match match2 = new Match(); WebRequest request = ((WebRequestState) result1.AsyncState).Request; int num = 0; string str2 = null; string str = CommonFunction.ConvertWebRequestToString(request, ref num, ref str2); base._strLatestFullOddsSource = str; base._intSingleSpiderMS = (int) Math.Round(DateTime.Now.Subtract(base._datLatestSpiderStepStart).TotalMilliseconds); this.AddAndUpdateAverageSpiderMS(base._intSingleSpiderMS); if (num == 200) { if (str.Length <= 10) { if (base._objPostList.Count > 0) { base._isWaitingNextInternalSpiderStep = true; } throw new Exception("Server return empty odds!"); } if (this.IsLoggedOut(ref str)) { base._isLoginSuccess = false; throw new Exception("Get Odds failed, account has been logged out!"); } if (base._objPostList.Count > 0) { base._objRawOddsLogger.write(str); if (base._objPostList[0].get_Value() == ("s11StakeType=AH&s11OddsType=" + this._strOddFType + "&s11ViewType=1&i13MarketType=1&s00SportIDList=0&s00LeagueList=&s00MatchNoList=&d00DateRefresh=&i12PageNo=1&i13EMDate=1000")) { base._strOddsRawEarly = str; } else if (base._objPostList[0].get_Value().Contains("s11StakeType=RB")) { base._strOddsRawRunning = str; } else if (base._objPostList[0].get_Value().Contains("s11StakeType=AH&")) { base._strOddsRawToday = str; } base._objPostList.RemoveAt(0); } if (base._objPostList.Count > 0) { base._isWaitingNextInternalSpiderStep = true; } else { if (base._isToGetOddsLite | base._isToInclude1X2Odds) { if (base._strOddsRawRunning.Length > 0) { this.UpdateLeagueListFromText(base._strOddsRawRunning); base._strOddsRawRunning = string.Format("[{0}]", base._strOddsRawRunning.Substring(0, base._strOddsRawRunning.Length - 1)); base._objMatchLiteListRunning = this.GenerateFullOddsLiteFromText(base._strOddsRawRunning, base._isToGetRunningOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds, base._isToInclude1X2Odds); } if (base._strOddsRawToday.Length > 0) { this.UpdateLeagueListFromText(base._strOddsRawToday); base._strOddsRawToday = string.Format("[{0}]", base._strOddsRawToday.Substring(0, base._strOddsRawToday.Length - 1)); base._objMatchLiteListToday = this.GenerateFullOddsLiteFromText(base._strOddsRawToday, base._isToGetRunningOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds, base._isToInclude1X2Odds); } if (base._strOddsRawEarly.Length > 0) { base._strOddsRawEarly = string.Format("[{0}]", base._strOddsRawEarly.Substring(0, base._strOddsRawEarly.Length - 1)); base._objMatchLiteListEarly = this.GenerateFullOddsLiteFromText(base._strOddsRawEarly, base._isToGetRunningOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds, base._isToInclude1X2Odds); } base._objMatchLiteListFull.Clear(); if (base._isToGetRunningOdds) { base._objMatchLiteListFull.AddRange(base._objMatchLiteListRunning); } if (base._isToGetTodayOdds) { base._objMatchLiteListFull.AddRange(base._objMatchLiteListToday); } if (base._isToGetEarlyOdds) { base._objMatchLiteListFull.AddRange(base._objMatchLiteListEarly); } } else { if (base._strOddsRawRunning.Length > 0) { this.UpdateLeagueListFromText(base._strOddsRawRunning); base._strOddsRawRunning = string.Format("[{0}]", base._strOddsRawRunning.Substring(0, base._strOddsRawRunning.Length - 1)); base._objMatchListRunning = this.GenerateFullOddsFromText(base._strOddsRawRunning, base._isToGetRunningOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds); } if (base._strOddsRawToday.Length > 0) { this.UpdateLeagueListFromText(base._strOddsRawToday); base._strOddsRawToday = string.Format("[{0}]", base._strOddsRawToday.Substring(0, base._strOddsRawToday.Length - 1)); base._objMatchListToday = this.GenerateFullOddsFromText(base._strOddsRawToday, base._isToGetRunningOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds); } if (base._strOddsRawEarly.Length > 0) { base._strOddsRawEarly = string.Format("[{0}]", base._strOddsRawEarly.Substring(0, base._strOddsRawEarly.Length - 1)); base._objMatchListEarly = this.GenerateFullOddsFromText(base._strOddsRawEarly, base._isToGetRunningOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds); } base._objMatchListFull.Clear(); if (base._isToGetRunningOdds) { base._objMatchListFull.AddRange(base._objMatchListRunning); } if (base._isToGetTodayOdds) { base._objMatchListFull.AddRange(base._objMatchListToday); } if (base._isToGetEarlyOdds) { base._objMatchListFull.AddRange(base._objMatchListEarly); } } base._strOddsRawRunning = string.Empty; base._strOddsRawToday = string.Empty; base._strOddsRawEarly = string.Empty; base._datLatestSpiderSuccess = DateTime.Now; base._intSpiderMS = (int) Math.Round(this._datLatestSpiderSuccess.Subtract(base._datLatestSpiderStart).TotalMilliseconds); base._intGoodSpiderRequest++; base._intSpiderErrorCountCurrent = 0; base._isGettingFullOdds = false; this.RaiseProgramLogEventWrapper("Get odds done! (" + this._intSpiderMS.ToString() + "ms, " + base._objMatchListFull.Count.ToString() + " matches)"); this.RaiseEventSpiderFullOddsComplete(base._strName, true); } } else { base._isLoginSuccess = false; throw new Exception("Status Code: " + num.ToString() + ". Get Odds failed, account has been logged out!"); } } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; base._isGettingFullOdds = false; base._strOddsRawFull = string.Empty; base._intBadSpiderRequest++; base._intSpiderErrorCountCurrent++; if (base._intSpiderErrorCountCurrent >= base._intSpiderErrorCountLimit) { base._isLoginSuccess = false; base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteFullOdds: Get Odds failed, account has been logged out!"); this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteFullOdds: Get Odds failed, account has been logged out!"); } base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteFullOdds: " + exception.Message); this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteFullOdds: " + exception.Message); this.RaiseEventSpiderFullOddsComplete(base._strName, false); ProjectData.ClearProjectError(); } }
private void RequestCompleteFullOdds(IAsyncResult result1) { string str = ""; try { Match match = new Match(); Match match2 = new Match(); WebRequest request = ((WebRequestState) result1.AsyncState).Request; int num = 0; string str2 = null; str = CommonFunction.ConvertWebRequestToString(request, ref num, ref str2); base._strLatestFullOddsSource = str; base._intSingleSpiderMS = (int) Math.Round(DateTime.Now.Subtract(base._datLatestSpiderStepStart).TotalMilliseconds); this.AddAndUpdateAverageSpiderMS(base._intSingleSpiderMS); if (num == 200) { if (this.IsLoggedOut(ref str)) { base._isLoginSuccess = false; throw new Exception("Get Odds failed, account has been logged out!"); } if (base._objPostList.Count > 0) { base._objRawOddsLogger.write(str); if (base._objPostList[0].get_Name().Contains("FT_future")) { base._strOddsRawEarly = base._strOddsRawEarly + str; } else if (base._objPostList[0].get_Name().Contains("rtype=re")) { base._strOddsRawRunning = base._strOddsRawRunning + str; } else { base._strOddsRawToday = base._strOddsRawToday + str; } base._objPostList.RemoveAt(0); } if (base._objPostList.Count > 0) { base._isWaitingNextInternalSpiderStep = true; } else { if (base._isToGetOddsLite | base._isToInclude1X2Odds) { if (base._strOddsRawRunning.Length > 0) { this.ExtractAccountInfoMaxCreditFromText(base._strOddsRawRunning, ref this._decAccountCredit, ref this._strAccountCurrency); base._objMatchLiteListRunning = this.GenerateFullOddsLiteFromText(base._strOddsRawRunning, base._isToGetRunningOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds, base._isToInclude1X2Odds); } if (base._strOddsRawToday.Length > 0) { this.ExtractAccountInfoMaxCreditFromText(base._strOddsRawToday, ref this._decAccountCredit, ref this._strAccountCurrency); base._objMatchLiteListToday = this.GenerateFullOddsLiteFromText(base._strOddsRawToday, base._isToGetTodayOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds, base._isToInclude1X2Odds); } if (base._strOddsRawEarly.Length > 0) { this.ExtractAccountInfoMaxCreditFromText(base._strOddsRawEarly, ref this._decAccountCredit, ref this._strAccountCurrency); base._objMatchLiteListEarly = this.GenerateFullOddsLiteFromText(base._strOddsRawEarly, base._isToGetRunningOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds, base._isToInclude1X2Odds); } base._objMatchLiteListFull.Clear(); if (base._isToGetRunningOdds) { base._objMatchLiteListFull.AddRange(base._objMatchLiteListRunning.ToArray()); } if (base._isToGetTodayOdds) { base._objMatchLiteListFull.AddRange(base._objMatchLiteListToday.ToArray()); } if (base._isToGetEarlyOdds) { base._objMatchLiteListFull.AddRange(base._objMatchLiteListEarly.ToArray()); } } else { if (base._strOddsRawRunning.Length > 0) { this.ExtractAccountInfoMaxCreditFromText(base._strOddsRawRunning, ref this._decAccountCredit, ref this._strAccountCurrency); base._objMatchListRunning = this.GenerateFullOddsFromText(base._strOddsRawRunning, base._isToGetRunningOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds); } if (base._strOddsRawToday.Length > 0) { this.ExtractAccountInfoMaxCreditFromText(base._strOddsRawToday, ref this._decAccountCredit, ref this._strAccountCurrency); base._objMatchListToday = this.GenerateFullOddsFromText(base._strOddsRawToday, base._isToGetTodayOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds); } if (base._strOddsRawEarly.Length > 0) { this.ExtractAccountInfoMaxCreditFromText(base._strOddsRawEarly, ref this._decAccountCredit, ref this._strAccountCurrency); base._objMatchListEarly = this.GenerateFullOddsFromText(base._strOddsRawEarly, base._isToGetRunningOdds, base._isToGetTodayOdds, base._isToGetEarlyOdds, base._isToIncludeFirstHalfOdds); } base._objMatchListFull.Clear(); if (base._isToGetRunningOdds) { base._objMatchListFull.AddRange(base._objMatchListRunning.ToArray()); } if (base._isToGetTodayOdds) { base._objMatchListFull.AddRange(base._objMatchListToday.ToArray()); } if (base._isToGetEarlyOdds) { base._objMatchListFull.AddRange(base._objMatchListEarly.ToArray()); } } base._strOddsRawToday = string.Empty; base._strOddsRawEarly = string.Empty; base._datLatestSpiderSuccess = DateTime.Now; base._intSpiderMS = (int) Math.Round(this._datLatestSpiderSuccess.Subtract(base._datLatestSpiderStart).TotalMilliseconds); base._intGoodSpiderRequest++; base._intSpiderErrorCountCurrent = 0; base._isGettingFullOdds = false; this.RaiseProgramLogEventWrapper("Get odds done! (" + this._intSpiderMS.ToString() + "ms, " + base._objMatchListFull.Count.ToString() + " matches)"); this.RaiseEventSpiderFullOddsComplete(base._strName, true); } } else { base._isLoginSuccess = false; throw new Exception("Status Code: " + num.ToString() + ". Get Odds failed, account has been logged out!"); } } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; if (exception.Message.Contains("Conversion")) { CommonFunction.Log(str); } base._isGettingFullOdds = false; base._strOddsRawFull = string.Empty; base._intBadSpiderRequest++; base._intSpiderErrorCountCurrent++; if (base._intSpiderErrorCountCurrent >= base._intSpiderErrorCountLimit) { base._isLoginSuccess = false; base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteFullOdds: Get Odds failed, account has been logged out!"); this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteFullOdds: Get Odds failed, account has been logged out!"); } base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteFullOdds: " + exception.Message); this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteFullOdds: " + exception.Message); this.RaiseEventSpiderFullOddsComplete(base._strName, false); ProjectData.ClearProjectError(); } }
private void RequestCompleteLoginCheckIn(IAsyncResult result1) { try { Match match = new Match(); Match match2 = new Match(); int num2 = 0; string str2 = null; WebRequestState state = (WebRequestState)result1.AsyncState; CommonFunction.ConvertWebRequestToString(state.Request, ref num2, ref str2); } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteLoginCheckIn: " + exception.Message); this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteLoginCheckIn: " + exception.Message); ProjectData.ClearProjectError(); } }