public override void Login(object o, DoWorkEventArgs e) { string str = ""; Bitmap bitmap = new Bitmap(1, 1); string str5 = ""; string str3 = ""; string str2 = ""; string str4 = ""; int num = 13; try { base._isLoggingIn = true; base._isLoginSuccess = false; base._objCore.get_CookieList().Clear(); base._objMatchDetailsListPrevious = null; base._objMatchDetailsListCurrent.Clear(); base._objMatchGroupList.Clear(); base._objNewMemberBetList.Clear(); base._objMemberCreditList.Clear(); base._objmemberListPrevious = new MemberList(); base._intBadSpiderRequest = 0; base._intGoodSpiderRequest = 0; base._intMemberListSpiderFailCount = 0; str = base._strLoginURL; string changeUrl = ""; if (!this.IsLoginFailCountOK(ref changeUrl)) { base._strLoginURL = changeUrl; str = changeUrl; this.WriteProgramLogger("Change URL (" + base._strLoginURL + ")..."); } this.WriteProgramLogger("Checking Login Info..."); if ((base._strAccountID == string.Empty) | (base._strAccountPassword == string.Empty)) { base._strLoginError = "Username or Password Error!"; throw new Exception(base._strLoginError); } if (str.Substring(str.Length - 1, 1) == "/") { str = str.Substring(0, str.Length - 1); } this.WriteProgramLogger("Accessing Website ("+ str + ")..."); base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str, "", ""), ref str5, ref str3); if (str3 != null) { base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + str3, "", ""), ref str5, ref str3); } this.WriteProgramLogger("Getting Captcha URL..."); str2 = "fromPage=default"; int num2 = 0; str3 = CommonFunction.substring(base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "/ImgTextRefresh.aspx", str, str2.Length, ""), str2, ref str5, ref str3), 0, "updateImgText('", "'", ref num2).Trim(); if (str3 == string.Empty) { base._strLoginError = "Captcha URL not found!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Checking Validation Code..."); WebResponse response = null; string str9 = null; HttpWebResponse response2 = (HttpWebResponse)response; response = response2; bitmap = new Bitmap(base._objCore.GetStreamAutoCookie(this.GenerateGetRequest(str + str3, str, ""), ref str9, ref response2)); if (response != null) { response.Close(); } CaptchaBreaker breaker = new CaptchaBreaker(bitmap, Path.Combine(CommonFunction.GetAppPath(), @"Data\SBOBetAgent\NN.dat"), base._strImageStep, base._strObjectStep); if (breaker.get_Result().Length != 4) { base._strLoginError = "Verification Code Error!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Login User (" + base._strAccountID + ") ..."); str2 = "username="******"&password="******"&vcode=" + breaker.get_Result() + "&lang=en&page=default"; str4 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "/processlogin.aspx", str, str2.Length, ""), str2, ref str5, ref str3); if (str4.Contains("default.aspx?e=")) { num2 = 0; string str10 = CommonFunction.substring(str4, 0, "default.aspx?e=", "&", ref num2).Trim(); if (str10 == "1") { base._strLoginError = "Username is empty"; } else if (str10 == "2") { base._strLoginError = "Password is empty"; } else if (str10 == "3") { base._strLoginError = "Password must be at least 6 chars"; } else if (str10 == "4") { base._strLoginError = "Invalid validation code"; } else if (str10 == "5") { base._strLoginError = "IP Address not valid"; } else if (str10 == "10") { base._strLoginError = "Your username as password is not valid"; } else { base._strLoginError = "Login failed - Unknown error"; } throw new Exception(base._strLoginError); } this.WriteProgramLogger("Accessing Welcome Page..."); num2 = 0; str5 = CommonFunction.substring(str4, 0, "name='f' action='", "'", ref num2).Trim(); num2 = 0; string str6 = CommonFunction.substring(str4, 0, "name='id' value='", "'", ref num2).Trim(); num2 = 0; string str7 = CommonFunction.substring(str4, 0, "name='key' value='", "'", ref num2).Trim(); num2 = 0; string str8 = CommonFunction.substring(str4, 0, "name='lang' value='", "'", ref num2).Trim(); if ((((str5 == string.Empty) | (str6 == string.Empty)) | (str7 == string.Empty)) | (str8 == string.Empty)) { base._strLoginError = "Error while accessing Welcome Page!"; throw new Exception(base._strLoginError); } str9 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(string.Format("{0}?id={1}&key={2}&lang={3}", new object[] { str5, str6, str7, str8 }), str + "/processlogin.aspx", ""), ref str9, ref str3); if (str.Contains(".com")) { num2 = 0; str = "ht" + CommonFunction.substring(str5, 0, "ht", ".com", ref num2) + ".com"; } else { num2 = 0; str = "http://" + CommonFunction.substring(str5, 0, "http://", "/", ref num2); if (str.Length > 0) { str.Substring(0, str.Length - 1); } } if (str3 == string.Empty) { base._strLoginError = "Main Page not found!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Accessing Welcome Process Page..."); str9 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + str3, str, ""), ref str9, ref str3); if (str3.ToLower().Contains("termscondition") | str3.ToLower().Contains("password.aspx")) { str9 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/webroot/restricted/tc/termsconditions.aspx?type=iom_audit", str + "/processlogin.aspx", ""), ref str9, ref str3); str9 = null; str4 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "/webroot/restricted/tc/termsconditions.aspx", str + "/webroot/restricted/tc/termsconditions.aspx?type=iom_audit", "agree=1".Length, ""), "agree=1", ref str9, ref str3); } if (str4.ToLower().Contains("password.aspx")) { base._strLoginError = "Password Expired! Please change new password from Internet Explorer and login again..."; throw new Exception(base._strLoginError); } else if (!str4.ToLower().Contains("home.aspx")) { base._strLoginError = "Login to Main Page Failed!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Accessing Home Page..."); str9 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + str3, str, ""), ref str9, ref str3); this.WriteProgramLogger("Fetching Account Info..."); base._objMatchDetailsListPrevious = null; base._objMatchDetailsListCurrent.Clear(); base._objMatchGroupList.Clear(); base._objNewMemberBetList.Clear(); base._objMemberCreditList.Clear(); base._intBadSpiderRequest = 0; base._intGoodSpiderRequest = 0; base._strRootURL = str; base._objCookieList = base._objCore.get_CookieList(); this.StartGeneralProcessTimer(); this.WriteProgramLogger("Fetching Agent Credit Balance..."); str9 = null; string str11 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(base._strRootURL + "/webroot/restricted/account/balance_new.aspx", base._strRootURL + "/webroot/restricted/homeleft.aspx", ""), ref str9, ref str11); this.ExtractAgentCreditFromText(str4, ref this._strAccountCurrency, ref this._decAccountCashBalance, ref this._decAccountTotalBalance, ref this._decAccountTotalOutstanding, ref this._decAccountTotalOutstanding, ref this._decAccountTotalCredit); base._objRole = this.GetAgentRoleByText(str4); str11 = null; str9 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(base._strRootURL + "/webroot/restricted/HomeTop.aspx", base._strRootURL + "/webroot/restricted/home.aspx", ""), ref str11, ref str9); num2 = 0; base._strAccountCurrency = CommonFunction.substring(str4, 0, "icon-cur.gif", ">", "<", ref num2).Trim(); this.WriteProgramLogger("Fetching Other Info..."); base._strWinLossReportRaw = this.GetMemberWinLossReport(); this.WriteProgramLogger("Fetching Member URL List..."); List<string> memberListURL = this.GetMemberListURL(false); if (memberListURL != null) { base._objMemberURLList = memberListURL; } base._objBGWorkerLogin.ReportProgress(100, "Login OK."); base._isLoginSuccess = true; base._isLoggingIn = false; base._objBGWorkerInfoSpider = new BackgroundWorker(); base._objBGWorkerInfoSpider.WorkerReportsProgress = true; base._objBGWorkerInfoSpider.DoWork += new DoWorkEventHandler(this.GeneralSpiderProcess); //base._objBGWorkerInfoSpider.ProgressChanged += new ProgressChangedEventHandler(this.UpdateGeneralSpiderProcess); } catch (Exception ex) { base._isLoggingIn = false; base._intLoginFailCount++; try { base._objBGWorkerLogin.ReportProgress(0, base._strLoginError); }catch(Exception ex1) { this.WriteProgramLogger(ex1.Message); } if (base._strLoginError != ex.Message) { this.WriteProgramLogger(ex.Message + " Exception Info:" + ex.StackTrace); } } }
public override void Login(object o, DoWorkEventArgs e) { string str = ""; Bitmap bitmap = new Bitmap(1, 1); string str5 = ""; string str3 = ""; string str2 = ""; string str4 = ""; try { base._isLoggingIn = true; base._isLoginSuccess = false; base._objCore.get_CookieList().Clear(); base._objMatchDetailsListPrevious = null; base._objMatchDetailsListCurrent.Clear(); base._objMatchGroupList.Clear(); base._objNewMemberBetList.Clear(); base._objMemberCreditList.Clear(); base._objmemberListPrevious = new MemberList(); base._intBadSpiderRequest = 0; base._intGoodSpiderRequest = 0; str = base._strLoginURL; string changeUrl = ""; if (!this.IsLoginFailCountOK(ref changeUrl)) { base._strLoginURL = changeUrl; str = changeUrl; this.WriteProgramLogger("Change URL (" + base._strLoginURL + ")..."); } this.WriteProgramLogger("Checking Login Info..."); if ((base._strAccountID == string.Empty) | (base._strAccountPassword == string.Empty)) { base._strLoginError = "Username or Password Error!"; throw new Exception(base._strLoginError); } if (str.Substring(str.Length - 1, 1) == "/") { str = str.Substring(0, str.Length - 1); } this.WriteProgramLogger("Accessing Website(" + this._strLoginURL + " )"); base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str, "", ""), ref str5, ref str3); if ((str3 != null) && !str3.Contains("SignIn.aspx")) { base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + str3, "", ""), ref str5, ref str3); } str3 = str5; int num = 0; str = str + "/" + CommonFunction.substring(str3, 0, "/", "SignIn", ref num); base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "SignIn.aspx", "", ""), ref str5, ref str3); this.WriteProgramLogger("Checking Validation Code..."); WebResponse response = null; string str7 = null; HttpWebResponse response2 = (HttpWebResponse) response; response = response2; bitmap = new Bitmap(base._objCore.GetStreamAutoCookie(this.GenerateGetRequest(str + "Handlers/Captcha.ashx", str + "SignIn.aspx", ""), ref str7, ref response2)); if (response != null) { response.Close(); } CaptchaBreaker breaker = new CaptchaBreaker(bitmap, Path.Combine(CommonFunction.GetAppPath(), @"Data\IBCBetAgent\NN.dat"), base._strImageStep, base._strObjectStep); this.WriteProgramLogger("captcha data is " + breaker.get_Result()); if (breaker.get_Result().Length != 4) { base._strLoginError = "Verification Code Error!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Login User (" + base._strAccountID + ") ..."); str2 = "hidLanguage=en-US&txtUserName="******"&txtPassWord="******"&txtCaptcha=" + breaker.get_Result(); // modify Aorta 2010.12.09 //str4 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str.Replace("http:", "https:") + "SignIn.aspx", str, str2.Length, ""), str2, ref str5, ref str3); str4 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "SignIn.aspx", str, str2.Length, ""), str2, ref str5, ref str3); if (str4.Contains("errMsg")) { num = 0; base._strLoginError = CommonFunction.substring(str4, 0, "'errMsg':'", "'", ref num); throw new Exception(base._strLoginError); } this.WriteProgramLogger("Account Info Correct."); num = 0; str3 = CommonFunction.substring(str4, 0, "href=\"", "\">", ref num).Trim(); if (str3 == string.Empty) { base._strLoginError = "Login URL not found!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Redirect to Login URL..."); str5 = str; str3 = str3.Replace("&", "&"); num = 0; str = "http://" + CommonFunction.substring(str3, 0, "http://", ".com", ref num) + ".com"; str7 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str3, str5, ""), ref str7, ref str3); if (string.IsNullOrEmpty(str3)) { base._strLoginError = "Authorization URL not found!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Redirect to Authorization URL"); str3 = str3.Replace("&", "&"); str7 = null; // 此行容易出错 str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + str3, str5, ""), ref str7, ref str3); if (!str3.Contains("Index.aspx")) { base._strLoginError = "Index Web Page Not Found!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Redirect to Index Page..."); str3 = str + str3; num = 0; str = "http://" + CommonFunction.substring(str3, 0, "http://", "Index.aspx", ref num); // Start Andy 2011.08.04 针对agent网站发生变化,屏蔽以下代码 /*** string result = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str3, str5, ""), ref str5, ref str3); if (!String.IsNullOrEmpty(result) && !result.ToLower().Contains("creditbalance")) { base._strLoginError = "Agent Credit Balance Web Page Not Found!"; throw new Exception(base._strLoginError); } ****/ // End Andy this.WriteProgramLogger("Fetching Account Info..."); base._objMatchDetailsListPrevious = null; base._objMatchDetailsListCurrent.Clear(); base._objMatchGroupList.Clear(); base._objNewMemberBetList.Clear(); base._objMemberCreditList.Clear(); base._intBadSpiderRequest = 0; base._intGoodSpiderRequest = 0; base._strRootURL = str; base._objCookieList = base._objCore.get_CookieList(); this.WriteProgramLogger(" Fetching Agent Credit Balance..."); str7 = null; string str8 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(base._strRootURL + "_MemberInfo/CreditBalance/CreditBalance.aspx?siteload=1", base._strRootURL + "Index.aspx", ""), ref str7, ref str8); this.ExtractAgentCreditFromText(str4, ref this._strAccountCurrency, ref this._decAccountCashBalance, ref this._decAccountTotalBalance, ref this._decAccountAgentOutstanding, ref this._decAccountTotalOutstanding, ref this._decAccountAgentCredit, ref this._decAccountTotalCredit); base._objRole = this.GetAgentRoleByText(str4); if (base._objRole == EnumCollection.eMemberPosition.Senior) { this._isToGetIndividualMemberBet = false; } else { this._isToGetIndividualMemberBet = true; } this.WriteProgramLogger("Fetching Header..."); str8 = null; str7 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(base._strRootURL + "_Header/Header.aspx", base._strRootURL + "Index.aspx", ""), ref str8, ref str7); this.CheckServerDate(str4); this.WriteProgramLogger("Fetching Menu..."); //str8 = null; //str7 = null; //str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(base._strRootURL + "_Menu/Menu.aspx", base._strRootURL + "Index.aspx", ""), ref str8, ref str7); //if ((base._objRole != EnumCollection.eMemberPosition.Senior) & str4.Contains("CreditBalance.aspx")) //{ // this._isToGetIndividualMemberBet = true; //} //else //{ // this._isToGetIndividualMemberBet = false; //} //if (this._isToGetIndividualMemberBet) //{ // this.WriteProgramLogger("Fetching Member Credit Balance..."); // str8 = null; // str7 = null; // str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(base._strRootURL + "MemberInfo/CreditBalance.aspx", base._strRootURL + "_Menu/Menu.aspx", ""), ref str8, ref str7); // base._objMemberCreditList = this.GenerateMemberCreditListFromText(str4); // this.WriteProgramLogger("Fetching Member URL List..."); // base._objMemberURLList = this.GetMemberListURL(); //} base._objMemberURLList = this.getMemberOutstandingLists(); base._objBGWorkerLogin.ReportProgress(100, "Login OK."); base._isLoginSuccess = true; base._isLoggingIn = false; if (_isLoginSuccess) { this.StartGeneralProcessTimer(); base._objBGWorkerInfoSpider = new BackgroundWorker(); base._objBGWorkerInfoSpider.WorkerReportsProgress = true; base._objBGWorkerInfoSpider.DoWork += new DoWorkEventHandler(this.GeneralSpiderProcess); // start Aorta //base._objBGWorkerInfoSpider.ProgressChanged += new ProgressChangedEventHandler(this.UpdateGeneralSpiderProcess); //base._objBGWorkerInfoSpider.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.GeneralSpiderProcessComplete); // end Aorta } } catch (Exception ex) { base._isLoggingIn = false; base._intLoginFailCount++; try { base._objBGWorkerLogin.ReportProgress(0,base._strLoginError); } catch (Exception e1) { this.WriteProgramLogger(e1.Message); } if (base._strLoginError != ex.Message) { this.WriteProgramLogger(ex.Message + " Exception Info:" + ex.StackTrace); } } }
public override void Login(object o, DoWorkEventArgs e) { string str = ""; Bitmap bitmap = new Bitmap(1, 1); string str5 = ""; string str3 = ""; string str2 = ""; string str4 = ""; int num = 0x13; try { base._isLoggingIn = true; base._isLoginSuccess = false; base._objCore.get_CookieList().Clear(); base._objMatchDetailsListPrevious = null; base._objMatchDetailsListCurrent.Clear(); base._objMatchGroupList.Clear(); base._objNewMemberBetList.Clear(); base._objMemberCreditList.Clear(); base._objMemberURLList.Clear(); this._objMatchNameList = new List<MatchNew>(); this._strMainReportURL = ""; this._strMainReportRootURL = ""; this._strUID = ""; this._strDateFrom = ""; this._strDateTo = ""; base._intBadSpiderRequest = 0; base._intGoodSpiderRequest = 0; str = base._strLoginURL; base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((1.0 / ((double) num)) * 100.0)), "Login Status: Checking Login Info..."); if ((base._strAccountID == string.Empty) | (base._strAccountPassword == string.Empty)) { base._strLoginError = "Username or Password Error!"; throw new Exception(); } if (str.Substring(str.Length - 1, 1) == "/") { str = str.Substring(0, str.Length - 1); } base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((2.0 / ((double) num)) * 100.0)), "Login Status: Accessing Website..."); str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str, "", ""), ref str5, ref str3); if (str3 != null) { base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((3.0 / ((double) num)) * 100.0)), "Login Status: Redirecting (1)..."); base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str3, "", ""), ref str5, ref str3); } if (str3 != null) { base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((4.0 / ((double) num)) * 100.0)), "Login Status: Redirecting (2)..."); base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str3, "", ""), ref str5, ref str3); } int num2 = 0; str = "http" + CommonFunction.substring(str.ToLower(), 0, "http", ".net", ref num2) + ".net/"; base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((5.0 / ((double) num)) * 100.0)), "Login Status: Accessing Main Page..."); str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "manager/mgr_email.asp", str, ""), ref str5, ref str3); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((6.0 / ((double) num)) * 100.0)), "Login Status: Checking Validation Code..."); string str8 = null; bitmap = new Bitmap(base._objCore.GetStreamAutoCookie(this.GenerateGetRequest(str + "inc/GetCode.asp", str + "manager/mgr_email.asp", ""), ref str8)); CaptchaBreaker breaker = new CaptchaBreaker(bitmap, Path.Combine(CommonFunction.GetAppPath(), @"Data\SB188Agent\NN.dat"), base._strImageStep, base._strObjectStep); if (breaker.get_Result().Length != 4) { base._strLoginError = "Verification Code Error!"; throw new Exception(); } base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((7.0 / ((double) num)) * 100.0)), "Login Status: Login User (" + base._strAccountID + ") ..."); string str6 = ""; switch (base._objRole) { case EnumCollection.eMemberPosition.Senior: str6 = "1"; break; case EnumCollection.eMemberPosition.Master: str6 = "2"; break; case EnumCollection.eMemberPosition.Agent: str6 = "3"; break; } str2 = "hidLang=1&radMgrGroup=" + str6 + "&txtLoginCode=" + HttpUtility.UrlEncode(base._strAccountID) + "&txtLoginPwd=" + HttpUtility.UrlEncode(base._strAccountPassword) + "&vCode=" + breaker.get_Result() + "&btnEnter.x=0&btnEnter.y=0"; str4 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "manager/mgr_login_proc.asp", str + "manager/mgr_email.asp", str2.Length, ""), str2, ref str5, ref str3); if (!str3.Contains("LoginID=")) { num2 = 0; string str9 = CommonFunction.substring(str3, 0, "hidErrorCode=", "&", ref num2).Trim(); if (str9 == "-11") { base._strLoginError = "Account Freeze."; } else if (str9 == "-12") { base._strLoginError = "Please Contact Upline to Reset Login ID."; } else if (str9 == "-1") { base._strLoginError = "Invalid User ID."; } else { base._strLoginError = "Unknown Error."; } throw new Exception(); } base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((8.0 / ((double) num)) * 100.0)), "Login Status: Accessing Front Menu..."); str8 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "manager/menu/menu_fr.asp?LoginID=" + base._strAccountID, str + "manager/mgr_email.asp", ""), ref str8, ref str3); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((9.0 / ((double) num)) * 100.0)), "Login Status: Accessing Head Menu..."); str8 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "manager/menu/menu_head.asp?LoginID=" + base._strAccountID, str + "manager/menu/menu_fr.asp?LoginID=" + base._strAccountID, ""), ref str8, ref str3); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((10.0 / ((double) num)) * 100.0)), "Login Status: Accessing Main Body..."); str8 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "manager/menu/menu_main.asp", str + "manager/menu/menu_fr.asp?LoginID=" + base._strAccountID, ""), ref str8, ref str3); base._objMatchDetailsListPrevious = null; base._objMatchDetailsListCurrent.Clear(); base._objMatchGroupList.Clear(); base._objNewMemberBetList.Clear(); base._objMemberCreditList.Clear(); base._intBadSpiderRequest = 0; base._intGoodSpiderRequest = 0; base._strRootURL = str; base._objCookieList = base._objCore.get_CookieList(); this.StartGeneralProcessTimer(); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((11.0 / ((double) num)) * 100.0)), "Login Status: Fetching Agent Credit Balance..."); str8 = null; string str10 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(base._strRootURL + "manager/mysetting/agent_mysetting.asp", base._strRootURL + "manager/menu/menu_head.asp?LoginID=" + base._strAccountID, ""), ref str8, ref str10); this.ExtractAgentCreditFromText(str4, ref this._strAccountCurrency, ref this._decAccountTotalCredit, ref this._decAccountTotalBalance); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((12.0 / ((double) num)) * 100.0)), "Login Status: Fetching Agent ID..."); str10 = null; str8 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(base._strRootURL + "manager/member/member_main.asp", base._strRootURL + "manager/menu/menu_head.asp?LoginID=" + base._strAccountID, ""), ref str10, ref str8); num2 = 0; this._strAgentID = CommonFunction.substring(str4, 0, "optAgent", "value='", "'", ref num2).Trim(); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((13.0 / ((double) num)) * 100.0)), "Login Status: Fetching Member List..."); str2 = "hidMemberCode=&hidMemberID=&hidPageFlag=1&hidUptFlag=&hidUptValue=&hidRefreshFlag=1&optAgent=" + this._strAgentID + "&optActive=-1&optSort=MemberCode&optPgNo=1&txtMemCodeLike="; str10 = null; str8 = null; str4 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(base._strRootURL + "manager/member/member_main.asp", base._strRootURL + "manager/member/member_main.asp", str2.Length, ""), str2, ref str10, ref str8); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((14.0 / ((double) num)) * 100.0)), "Login Status: Getting Main Report URL..."); str10 = null; base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(base._strRootURL + "manager/report/report_mgr_redirect.asp", base._strRootURL + "manager/menu/menu_head.asp", ""), ref str10, ref this._strMainReportURL); this._strMainReportURL = this._strMainReportURL.ToLower(); if (!this._strMainReportURL.Contains("http")) { this._strMainReportURL = base._strRootURL + "manager" + this._strMainReportURL.Replace("..", ""); } num2 = 0; this._strMainReportRootURL = "http" + CommonFunction.substring(this._strMainReportURL, 0, "http", "/report_mgr_s", ref num2); str10 = null; str8 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(this._strMainReportURL, base._strRootURL + "manager/menu/menu_head.asp", ""), ref str10, ref str8); str10 = null; str8 = null; string str11 = null; string str12 = null; string str13 = null; this.ExtractReportMenuInfo(str4, ref this._strDateFrom, ref this._strDateTo, ref str10, ref str8, ref str11, ref str12, ref str13); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((15.0 / ((double) num)) * 100.0)), "Login Status: Getting UID..."); str13 = null; str12 = null; str4 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(base._strRootURL + "manager/soccer/mgr_soccer_main.asp", base._strRootURL + "manager/soccer/mgr_soccer_main.asp", ""), ref str13, ref str12); num2 = 0; this._strUID = CommonFunction.substring(str4, 0, "uid=", "&", ref num2).Trim(); if (this._strUID == string.Empty) { base._strLoginError = "UID not found!"; throw new Exception(); } base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((16.0 / ((double) num)) * 100.0)), "Login Status: Getting All Match Name..."); this.UpdateMatchNameList(); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((17.0 / ((double) num)) * 100.0)), "Login Status: Getting Member URL List..."); this.UpdateMemberURLList(); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((18.0 / ((double) num)) * 100.0)), "Login Status: Getting Other Info..."); base._strWinLossReportRaw = this.GetMemberWinLossReport(); base._objBGWorkerInfoSpider = new BackgroundWorker(); base._objBGWorkerInfoSpider.DoWork += new DoWorkEventHandler(this.GeneralSpiderProcess); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) ((19.0 / ((double) num)) * 100.0)), "Login Status: Login OK."); base._isLoginSuccess = true; base._isLoggingIn = false; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; base._isLoggingIn = false; if (base._strLoginError == string.Empty) { base._strLoginError = exception.Message; } base._objBGWorkerLogin.ReportProgress(0, "Login Status: " + base._strLoginError); ProjectData.ClearProjectError(); } base._isLoggingIn = false; }
protected override void Login(object o, DoWorkEventArgs e) { string str = ""; bool flag = false; int num2 = 14; try { string str11 = ""; string str7 = ""; string str6 = ""; string str9 = ""; string str8 = ""; string str5 = ""; base._isLoggingIn = true; base._objBetListFailed.Clear(); base._objBetListLive.Clear(); base._objBetListAll.Clear(); base._objMatchLiteListFull.Clear(); base._objMatchLiteListRunning.Clear(); base._objMatchLiteListToday.Clear(); base._objMatchLiteListEarly.Clear(); base._objMatchListFull.Clear(); base._objMatchListRunning.Clear(); base._objMatchListToday.Clear(); base._objMatchListEarly.Clear(); base._objMatchListSelected.Clear(); base._objCore.get_CookieList().Clear(); base._objCookieList.Clear(); base._isGettingFullOdds = false; base._isGettingPartOdds = false; base._isBetting = false; base._isLoginSuccess = false; base._isFirstGetOddsDone = false; base._strLoginError = ""; base._strLoginStatus = ""; base._intGoodSpiderRequest = 0; base._intBadSpiderRequest = 0; base._intSpiderErrorCountCurrent = 0; base._intSpiderRunningCoolDownSec = 0; base._intSpiderTodayCoolDownSec = 0; base._intSpiderEarlyCoolDownSec = 0; base._intSpiderSpecialCoolDownSec = 0; base._intSpiderOddEvenCoolDownSec = 0; base._intSpiderOutRightCoolDownSec = 0; base._intSpiderTotalGoalCoolDownSec = 0; base._intSpiderCorrectScoreCoolDownSec = 0; base._intSingleSpiderMS = 0; base._objSpiderMSRecordList.Clear(); base._intAverageSpiderMS = 0; str = base._strLoginURL; base._intTimeoutCount = 0; if (!this.IsLoginFailCountOK(ref str5)) { base._strLoginURL = str5; str = str5; this.WriteProgramLogger("Change URL (" + base._strLoginURL + ")..."); } this.WriteProgramLogger("Checking Login Info..."); if ((base._strAccountID == string.Empty) | (base._strAccountPassword == string.Empty)) { base._strLoginError = "Username or Password Error!"; throw new Exception(base._strLoginError); } if (str.Substring(str.Length - 1, 1) == "/") { str = str.Substring(0, str.Length - 1); } this.WriteProgramLogger("Accessing Website(" + str + "/default.aspx)..."); base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/default.aspx", "", ""), ref str11, ref str7); str9 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/hometop.aspx?ip=&p=", "", ""), ref str11, ref str7); int num3 = 0; string str4 = CommonFunction.substring(str9, 0, "input id=\"key\"", "value=\"", "\"", ref num3); num3 = 0; string str10 = CommonFunction.substring(str9, 0, "input id=\"tea\"", "value=\"", "\"", ref num3); if (str4 == string.Empty) { base._strLoginError = "Error while opening SBOBet!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Checking Validation Code..."); string str12 = null; Bitmap bitmap = new Bitmap(base._objCore.GetStreamAutoCookie(this.GenerateGetRequest(this.ExtractCaptchaURL(str9), str + "/hometop.aspx?ip=", ""), ref str12)); CaptchaBreaker breaker = new CaptchaBreaker(bitmap, Path.Combine(CommonFunction.GetAppPath(), @"Data\SBOBet\NN.dat"), base._strImageStep, base._strObjectStep); if (breaker.get_Result().Length != 4) { base._strLoginError = "Verification Code Error!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger(string.Format("Login User ({0})...", base._strAccountID)); str8 = str + "/processlogin.aspx"; str6 = "id=" + HttpUtility.UrlEncode(base._strAccountID) + "&password="******"&code=" + breaker.get_Result() + "&page=default&lang=en&key=" + str4 + "&tea=" + str10 + "&tzDiff=0"; str9 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "/processlogin.aspx", str + "/hometop.aspx?ip=", str6.Length, ""), str6, ref str11, ref str7); num3 = 0; str4 = CommonFunction.substring(str9, 0, "name='key'", "value='", "'", ref num3); num3 = 0; string str3 = CommonFunction.substring(str9, 0, "name='id'", "value='", "'", ref num3); if (!((str4 == string.Empty) | (str3 == string.Empty))) { goto Label_061C; } num3 = 0; str4 = CommonFunction.substring(str9, 0, "'error' value='", "'", ref num3); if (str4.Length > 0) { switch (str4.Substring(0, 1)) { case "6": base._strLoginError = "Username/Password Error!"; goto Label_0616; case "5": base._strLoginError = "Invalid Verification Code!"; goto Label_0616; case "1": base._strLoginError = "ID Cannot be Empty!"; goto Label_0616; case "2": base._strLoginError = "Password Cannot be Empty"; goto Label_0616; case "3": base._strLoginError = "Password must be at least 6 Characters!"; break; case "4": base._strLoginError = "Verification Code Cannot be Empty!"; break; } } Label_0616: throw new Exception(base._strLoginError); Label_061C: num3 = 0; str7 = CommonFunction.substring(str9, 0, "action='", "'", ref num3); num3 = 0; str = "http://" + CommonFunction.substring(str7, 0, "http://", "/welcome.aspx", ref num3); string str2 = base._strLoginURL.ToLower().Replace("http://", "").Replace(".com/", ".com"); base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str7 + "?key=" + str4 + "&id=" + str3 + "&lang=en&tzDiff=0&depositDay=0&redirect=true&ldomain=" + str2, str + "/hometop.aspx?ip=", ""), ref str11, ref str7); if (string.IsNullOrEmpty(str7)) { base._strLoginError = "Login Process Error!"; } else if (str7.Contains("process-welcome")) { this.WriteProgramLogger("Accessing Process Welcome Page..."); str9 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + str7, str8, ""), ref str11, ref str7); } // Modify Andy 密码过期时,请求处理 if (!str7.ToLower().Contains("loginname")) { this.WriteProgramLogger("Agreement Page Opened."); base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + str7, str8, "action=I+Agree".Length, ""), "action=I+Agree", ref str11, ref str7); //str9 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + str7, str8, ""), ref str11, ref str7); } // End Andy this._strLoginName = this.ExtractLoginNameFromURL(str + str7); if (this._strLoginName == string.Empty) { this._strLoginError = "Password expired,please modify your password!"; throw new Exception(this._strLoginError); } if (base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + str7, str8, ""), ref str11, ref str7).ToLower().Contains("logout")) { base._strLoginError = "Login Failed!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Getting Credit & Currency..."); str12 = null; string str14 = null; str9 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/webroot/restricted/account/balance.aspx?loginname=" + this._strLoginName, str + "/webroot/restricted/HomeLeft.aspx", ""), ref str12, ref str14); this.ExtractAccountInfoFromText(str9, ref this._decAccountCash, ref this._decAccountOutstanding, ref this._decAccountCredit, ref this._decAccountBetCredit, ref this._strAccountCurrency); base._objCookieList = base._objCore.get_CookieList(); base._strRootURL = str; this.WriteProgramLogger("Getting Top Frame..."); str14 = null; str12 = null; base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/webroot/restricted/HomeTop.aspx", str + "/webroot/restricted/HomeLeft.aspx", ""), ref str14, ref str12); this.WriteProgramLogger("Getting Left Frame..."); str14 = null; str12 = null; base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/webroot/restricted/HomeLeft.aspx", str + "/webroot/restricted/HomeLeft.aspx", ""), ref str14, ref str12); this.WriteProgramLogger("Getting Bet Credit..."); str14 = null; str12 = null; base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/webroot/restricted/betcredit.aspx", str + "/webroot/restricted/HomeLeft.aspx", ""), ref str14, ref str12); this.WriteProgramLogger("Getting Odds Type..."); str14 = null; str12 = null; str9 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/webroot/restricted/odds/main.aspx?page=3&sport=1", str + "/webroot/restricted/HomeLeft.aspx", ""), ref str14, ref str12); /***if (base._isToGetMatchResultList) { base._objBGWorkerLogin.ReportProgress((int)Math.Round((double)(1200.0 / ((double)num2))), "Getting Match Result..."); base._strRootURL = str; base._objMatchResultList = this.GetMatchResultListFromServer(); }***/ // add Aorta if (this.IsLoggedOut(ref str9)) { this._strLoginError = "Password expired,please modify your password!!"; throw new Exception(); } // end Aorta this.WriteProgramLogger("Selecting League..."); base._strRootURL = str; this.SelectLeagueBySelectedLeagueList(); flag = true; if (str9.Contains("changepassword")) { this.WriteProgramLogger("Login OK but Password Expired!"); } else { base._objBGWorkerLogin.ReportProgress(100, "Login OK!"); } base._isLoginSuccess = true; base._intLoginFailCount = 0; base._isLoggingIn = false; this.StartGeneralProcessTimer(); base._objBGWorkerInfoSpider = new BackgroundWorker(); base._objBGWorkerInfoSpider.WorkerReportsProgress = true; base._objBGWorkerInfoSpider.DoWork += new DoWorkEventHandler(this.GeneralSpiderProcess); //base._objBGWorkerInfoSpider.ProgressChanged += new ProgressChangedEventHandler(this.UpdateGeneralSpiderProcess); //base._objBGWorkerInfoSpider.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.GeneralSpiderProcessComplete); } catch (Exception ex) { base._isLoggingIn = false; base._intLoginFailCount++; try { base._objBGWorkerLogin.ReportProgress(0, base._strLoginError); } catch (Exception e1) { this.WriteProgramLogger(e1.Message); } if (base._strLoginError != ex.Message) { this.WriteProgramLogger(ex.Message + "Exception Error:" + ex.StackTrace); } } }
protected override void Login(object o, DoWorkEventArgs e) { string str = ""; bool flag = false; int num2 = 13; try { string str8 = ""; string str6 = ""; string str5 = ""; string str7 = ""; string str3 = ""; string str4 = ""; base._isLoggingIn = true; base._objBetListFailed.Clear(); base._objBetListLive.Clear(); base._objBetListAll.Clear(); base._objMatchLiteListFull.Clear(); base._objMatchLiteListRunning.Clear(); base._objMatchLiteListToday.Clear(); base._objMatchLiteListEarly.Clear(); base._objMatchListFull.Clear(); base._objMatchListRunning.Clear(); base._objMatchListToday.Clear(); base._objMatchListEarly.Clear(); base._objMatchListSelected.Clear(); base._objCore.get_CookieList().Clear(); base._objCookieList.Clear(); base._isGettingFullOdds = false; base._isGettingPartOdds = false; base._isBetting = false; base._isLoginSuccess = false; base._isFirstGetOddsDone = false; base._strLoginError = ""; base._strLoginStatus = ""; base._intGoodSpiderRequest = 0; base._intBadSpiderRequest = 0; base._intSpiderErrorCountCurrent = 0; base._isCanGetRunningOdds = false; base._isCanGetTodayOdds = false; base._isCanGetEarlyOdds = false; base._intSpiderRunningCoolDownSec = 0; base._intSpiderTodayCoolDownSec = 0; base._intSpiderEarlyCoolDownSec = 0; base._intSpiderSpecialCoolDownSec = 0; base._intSpiderOddEvenCoolDownSec = 0; base._intSpiderOutRightCoolDownSec = 0; base._intSpiderTotalGoalCoolDownSec = 0; base._intSpiderCorrectScoreCoolDownSec = 0; base._intTimeoutCount = 0; base._objSpiderMSRecordList.Clear(); if (!this.IsLoginFailCountOK(ref str4)) { base._strLoginURL = str4; str = str4; base._objBGWorkerLogin.ReportProgress(1, "Login Status: Change URL (" + base._strLoginURL + ")..."); } base._strAccountID = base._strAccountID.ToUpper(); str = base._strLoginURL; if (str.ToLower().Contains("slv")) { this._strWebsiteType = "SLV"; } base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (100.0 / ((double) num2))), "Login Status: Checking Login Info..."); if ((base._strAccountID == string.Empty) | (base._strAccountPassword == string.Empty)) { base._strLoginError = "Username or Password Error!"; throw new Exception(); } base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (200.0 / ((double) num2))), "Login Status: Accessing Website (" + str + ")..."); if (str.Substring(str.Length - 1, 1) == "/") { str = str.Substring(0, str.Length - 1); } str7 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str, "", ""), ref str8, ref str6); if (str6 != string.Empty) { base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (300.0 / ((double) num2))), "Login Status: Checking Redirection (" + str + str6 + ")..."); str7 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + str6, "", ""), ref str8, ref str6); } int num3 = 0; string str9 = CommonFunction.substring(str7, 0, "id=\"__VIEWSTATE\"", "value=\"", "\"", ref num3); num3 = 0; string str2 = CommonFunction.substring(str7, 0, "id=\"__EVENTVALIDATION\"", "value=\"", "\"", ref num3); if ((str9 == string.Empty) | (str2 == string.Empty)) { base._strLoginError = "Viewstate / EventValidation is Empty!"; throw new Exception(); } base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (400.0 / ((double) num2))), "Login Status: Checking Validation Code..."); HttpWebResponse response = null; string str10 = null; Bitmap bitmap = new Bitmap(base._objCore.GetStreamAutoCookie(this.GenerateGetRequest(str + "/Common/GetCaptcha.aspx", str + "/Login.aspx?ReturnUrl=%2fdefault.aspx", ""), ref str10, ref response)); if (response != null) { response.Close(); } CaptchaBreaker breaker = new CaptchaBreaker(bitmap, Path.Combine(CommonFunction.GetAppPath(), @"Data\SB188\NN.dat"), base._strImageStep, base._strObjectStep); if (breaker.get_Result().Length != 4) { base._strLoginError = "Verification Code Error!"; throw new Exception(); } base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (500.0 / ((double) num2))), string.Format("Login Status: Login User ({0})...", base._strAccountID)); str5 = string.Format("__VIEWSTATE={0}&__EVENTVALIDATION={1}&s21UserIdTextBox={2}&s21PassWordTextBox={3}&i14VerificationCodeTextBox={4}&LoginButton.x=0&LoginButton.y=0", new object[] { HttpUtility.UrlEncode(str9), HttpUtility.UrlEncode(str2), HttpUtility.UrlEncode(base._strAccountID), HttpUtility.UrlEncode(base._strAccountPassword), breaker.get_Result() }); str7 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "/Common/" + this._strWebsiteType + "/Login_" + this._strWebsiteType + ".aspx?ReturnUrl=%2fdefault.aspx", str + "/Login.aspx?ReturnUrl=%2fdefault.aspx", str5.Length, ""), str5, ref str8, ref str6); if (str6 == string.Empty) { num3 = 0; base._strLoginError = CommonFunction.substring(str7, 0, "class=\"warning\">", "</", ref num3).Replace("<span id=\"MessageLabel\">", "").Trim(); if (base._strLoginError == string.Empty) { base._strLoginError = str7; } throw new Exception(); } base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (600.0 / ((double) num2))), "Login Status: Login Account OK..."); if (!str6.ToUpper().Contains("DEFAULT.ASPX")) { num3 = 0; str3 = CommonFunction.substring(str7, 0, "class=\"warning\">", "</", ref num3); if (str3.Length > 0) { base._strLoginError = str3.Replace("<span id=\"MessageLabel\">", "").Trim(); } else { base._strLoginError = "Error not found!"; } throw new Exception(); } base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (700.0 / ((double) num2))), "Login Status: Accessing Main Page..."); str10 = null; string str11 = null; str7 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/Default.aspx", str + "/Common/" + this._strWebsiteType + "/Login_" + this._strWebsiteType + ".aspx?ReturnUrl=%2fdefault.aspx", ""), ref str10, ref str11); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (800.0 / ((double) num2))), "Login Status: Getting Credit & Currency..."); str11 = null; str10 = null; str7 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/Info/UserProfile.aspx?s21mc=" + base._strAccountID, str + "/Default.aspx", ""), ref str11, ref str10); this.ExtractAccountInfoFromText(str7, ref this._decAccountCredit, ref this._decAccountBetCredit, ref this._strAccountCurrency); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (900.0 / ((double) num2))), "Login Status: Getting Outstanding..."); str11 = null; str10 = null; str7 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/Info/OpenBet.aspx?s21mc=" + base._strAccountID, str + "/Default.aspx", ""), ref str11, ref str10); str11 = Conversions.ToString(base._decAccountOutstanding); this.ExtractOutstandingFromText(str7, ref str11); base._decAccountOutstanding = Conversions.ToDecimal(str11); base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (1000.0 / ((double) num2))), "Login Status: Getting Cash Balance..."); str5 = "s11NavAction=6"; str11 = null; str10 = null; str7 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "/MenuBet/TopNav.aspx", str + "/MenuBet/TopMenu_SLV.aspx", str5.Length, ""), str5, ref str11, ref str10); this.ExtractCashBalanceFromText(str7, ref this._decAccountCash); if (base._isToGetMatchResultList) { base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (1100.0 / ((double) num2))), "Login Status: Getting Match Result..."); base._strRootURL = str; base._objMatchResultList = this.GetMatchResultListFromServer(); } if (!base._objLeagueListSelected.get_IsSelectAll()) { base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (1200.0 / ((double) num2))), "Login Status: Selecting League..."); base._strRootURL = str; this.SelectLeagueBySelectedLeagueList(); } base._objCookieList = base._objCore.get_CookieList(); base._strRootURL = str; this.StartGeneralProcessTimer(); base._objBGWorkerInfoSpider = new BackgroundWorker(); base._objBGWorkerInfoSpider.WorkerReportsProgress = true; base._objBGWorkerInfoSpider.DoWork += new DoWorkEventHandler(this.GeneralSpiderProcess); flag = true; base._objBGWorkerLogin.ReportProgress((int) Math.Round((double) (1300.0 / ((double) num2))), "Login Status: Login OK!"); base._isLoginSuccess = true; base._intLoginFailCount = 0; base._isLoggingIn = false; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; base._isLoggingIn = false; if (base._strLoginError == string.Empty) { base._strLoginError = exception.Message; } base._intLoginFailCount++; base._objBGWorkerLogin.ReportProgress(0, "Login Status: " + base._strLoginError); ProjectData.ClearProjectError(); } base._isLoggingIn = false; }
protected override void Login(object o, DoWorkEventArgs e) { string str = ""; int num2 = 14; try { int num3; string str12 = ""; string str9 = ""; string str8 = ""; string str11 = ""; string str10 = ""; string str7 = ""; base._isLoggingIn = true; base._objBetListFailed.Clear(); base._objBetListLive.Clear(); base._objBetListAll.Clear(); base._objMatchListFull.Clear(); base._objCore.get_CookieList().Clear(); base._objCookieList.Clear(); base._isGettingFullOdds = false; base._isGettingPartOdds = false; base._isBetting = false; base._isLoginSuccess = false; base._isFirstGetOddsDone = false; base._strLoginError = ""; base._strLoginStatus = ""; base._intBadSpiderRequest = 0; base._intGoodSpiderRequest = 0; this._strEarlyUpdateTime = ""; this._strRunningUpdateTime = ""; this._strTodayUpdateTime = ""; base._intTimeoutCount = 0; this._intLogoutCount = 0; base._intSpiderRunningCoolDownSec = 0; base._intSpiderTodayCoolDownSec = 0; base._intSpiderEarlyCoolDownSec = 0; base._intSpiderSpecialCoolDownSec = 0; base._intSpiderOddEvenCoolDownSec = 0; base._intSpiderOutRightCoolDownSec = 0; base._intSpiderTotalGoalCoolDownSec = 0; base._intSpiderCorrectScoreCoolDownSec = 0; base._objSpiderMSRecordList.Clear(); str = base._strLoginURL; this.WriteProgramLogger("Checking Login Info..."); if (!this.IsLoginFailCountOK(ref str7)) { base._strLoginURL = str7; str = str7; this.WriteProgramLogger("Change URL (" + base._strLoginURL + ")..."); } if ((base._strAccountID == string.Empty) | (base._strAccountPassword == string.Empty)) { base._strLoginError = "Username or Password Error!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Accessing Website (" + str + ")..."); if (str.Substring(str.Length - 1, 1) == "/") { str = str.Substring(0, str.Length - 1); } base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str, "", ""), ref str12, ref str9); this.WriteProgramLogger("Checking Header..."); str11 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/head.aspx", str, ""), ref str12, ref str9); bool flag = false; if (str11.Contains("callSubmit(")) { flag = true; } this.WriteProgramLogger("Checking Validation Code..."); string str14 = null; Bitmap bitmap = new Bitmap(base._objCore.GetStreamAutoCookie(this.GenerateGetRequest(str + "/login_code.aspx?", str + "/login_code.aspx?", ""), ref str14)); CaptchaBreaker breaker = new CaptchaBreaker(bitmap, Path.Combine(CommonFunction.GetAppPath(), @"Data\IBCBet\NN.dat"), base._strImageStep, base._strObjectStep); if (breaker.get_Result().Length != 4) { base._strLoginError = "Verification Code Error!"; throw new Exception(base._strLoginError); } string str2 = ""; string str5 = ""; string str4 = ""; //if (flag) //{ str2 = this.CFS(base._strAccountPassword); str5 = CommonFunction.MD5Encrypt(str2.ToLower() + breaker.get_Result()); str4 = CommonFunction.MD5Encrypt(str2 + breaker.get_Result()); //} this.WriteProgramLogger(string.Format("Login User ({0})...", base._strAccountID)); string str6 = ""; if (!string.IsNullOrEmpty(str)) { str6 = str.Replace("http://", "").Replace("www.", ""); } if (!flag) { //str8 = "selLang=en&txtID=" + HttpUtility.UrlEncode(base._strAccountID) + "&txtPW=" + HttpUtility.UrlEncode(base._strAccountPassword) + "&txtCode=" + breaker.get_Result() + "&hidServerKey=" + str6 + "&submit=GO"; str8 = "selLang=en&txtID=" + HttpUtility.UrlEncode(base._strAccountID) + "&txtPW=" + HttpUtility.UrlEncode(str4) + "&txtCode=" + breaker.get_Result() + "&hidKey=&hidLowerCasePW=&hidServerKey=" + str6; } else { str8 = "selLang=en&txtID=" + HttpUtility.UrlEncode(base._strAccountID) + "&txtPW=" + HttpUtility.UrlEncode(str2) + "&txtCode=" + breaker.get_Result() + "&hidKey=" + HttpUtility.UrlEncode(str4) + "&hidLowerCasePW=" + HttpUtility.UrlEncode(str5) + "&hidServerKey=" + str6; } str11 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "/ProcessLogin.aspx", str + "/head.aspx", str8.Length, ""), str8, ref str12, ref str9); if (str11.Contains("alert(")) { num3 = 0; base._strLoginError = CommonFunction.substring(str11, 0, "alert('", "')", ref num3).Trim(); if (base._strLoginError.Contains("invalid code")) { bitmap.Save(Path.Combine(CommonFunction.GetAppPath(), @"Data\IBCBet\" + DateTime.Now.Millisecond.ToString() + ".jpg")); } base._strLoginError = "ProcessLogin Error!"; throw new Exception(base._strLoginError); } str10 = str + "/ProcessLogin.aspx"; num3 = 0; str9 = CommonFunction.substring(str11, 0, "location='", "'", ref num3).Trim(); if (str9 == string.Empty) { base._strLoginError = "Login Process Error!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Opening Agreement Page..."); str14 = null; str11 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str9, str10, ""), ref str12, ref str14); this.WriteProgramLogger("Agreement Page OK..."); str8 = "Accept=YES"; num3 = 0; str9 = CommonFunction.substring(base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str9, str + "/rulesalert.aspx", str8.Length, ""), str8, ref str12, ref str9), 0, "location='", "'", ref num3).Trim(); if (str9 == string.Empty) { base._strLoginError = "Login Process Error!"; throw new Exception(base._strLoginError); } this.WriteProgramLogger("Validate Login..."); num3 = 0; str = "http" + CommonFunction.substring(str9, 0, "http", ".com", ref num3) + ".com"; str11 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str9, str + "/rulesalert.aspx", ""), ref str12, ref str9); if (str9 == string.Empty) { base._strLoginError = "Login Process Error!"; throw new Exception(); } this.WriteProgramLogger("Getting Username..."); num3 = 0; string str13 = CommonFunction.substring(base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/main.aspx", str10, ""), ref str12, ref str9), 0, "UserName = \"", "\";", ref num3).Trim(); if (str13 != string.Empty) { base._strAccountID = str13; this._strSystemAccountID = str13; if (base._objAccountInfoList.get_SourceList().Count > 0) { base._objAccountInfoList.get_SourceList()[0].set_AccountID(base._strAccountID); base._objAccountInfoList.get_SourceList()[0].set_AccountPassword(base._strAccountPassword); } else { base._objAccountInfoList.get_SourceList().Add(new AccountInformation("", base._strAccountID, base._strAccountPassword)); } this.WriteProgramLogger("Getting Currency..."); str14 = null; string str15 = null; str11 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/LeftAllInOne.aspx", str + "/main.aspx", ""), ref str14, ref str15); num3 = 0; base._strAccountCurrency = CommonFunction.substring(str11, 0, "<span class=\"text_blue12B\">", "<", ref num3).Trim(); num3 = 0; string substring = CommonFunction.substring(str11,0,"<form action=\"mixcom/BetProcess_data.aspx\"","</form>",ref num3); string nameStr = "input type=\"hidden\" name=\""; string valueStr = "value=\""; int index = substring.LastIndexOf(nameStr); if(- 1 != index){ index += nameStr.Length; substring = substring.Substring(index, (substring.Length - index)); int split = substring.IndexOf("\""); this.key = substring.Substring(0,split); index = substring.IndexOf(valueStr); if (-1 != index) { index += valueStr.Length; substring = substring.Substring(index,(substring.Length - index)); index = substring.IndexOf("\""); this.value = substring.Substring(0, index); } } this.WriteProgramLogger("Getting Credit..."); str15 = null; str14 = null; str11 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "/leftAllInOneAccount_data.aspx", str + "/leftAllInOne.aspx", "accountUpdate=full".Length, ""), "accountUpdate=full", ref str15, ref str14); this.ExtractAccountInfoFromText(str11, ref this._decAccountCash, ref this._decAccountOutstanding, ref this._decAccountBetCredit, ref this._decAccountCredit); /***if (base._isToGetMatchResultList) { base._objBGWorkerLogin.ReportProgress((int)Math.Round((double)(1200.0 / ((double)num2))), "Getting Match Result..."); base._strRootURL = str; base._objMatchResultList = this.GetMatchResultListFromServer(); }***/ if (!base._objLeagueListSelected.get_IsSelectAll()) { this.WriteProgramLogger("Selecting League..."); base._strRootURL = str; this.SelectLeagueBySelectedLeagueList(); } } else { base._strLoginError = "Username Not Found!"; throw new Exception(base._strLoginError); } base._objBGWorkerLogin.ReportProgress(100, "Login OK!"); base._isLoginSuccess = true; base._intLoginFailCount = 0; base._isLoggingIn = false; if (base._isLoginSuccess) { base._isLoggingIn = false; base._objCookieList = base._objCore.get_CookieList(); base._strRootURL = str; this.StartGeneralProcessTimer(); base._objBGWorkerInfoSpider = new BackgroundWorker(); base._objBGWorkerInfoSpider.WorkerReportsProgress = true; base._objBGWorkerInfoSpider.DoWork += new DoWorkEventHandler(this.GeneralSpiderProcess); } } catch (Exception ex) { base._isLoggingIn = false; base._intLoginFailCount++; try { base._objBGWorkerLogin.ReportProgress(0,base._strLoginError); } catch (Exception e1) { this.WriteProgramLogger(e1.Message); } if (base._strLoginError != ex.Message) { this.WriteProgramLogger(ex.Message + " Exception Info:" + ex.StackTrace); } } }
protected override void Login(object o, DoWorkEventArgs e) { string str = ""; bool flag = false; try { string str6 = ""; string str4 = ""; string str3 = ""; string str5 = ""; base._isLoggingIn = true; base._objBetListFailed.Clear(); base._objBetListLive.Clear(); base._objBetListAll.Clear(); base._objMatchLiteListFull.Clear(); base._objMatchLiteListRunning.Clear(); base._objMatchLiteListToday.Clear(); base._objMatchLiteListEarly.Clear(); base._objMatchListFull.Clear(); base._objMatchListRunning.Clear(); base._objMatchListToday.Clear(); base._objMatchListEarly.Clear(); base._objMatchListSelected.Clear(); base._objCore.get_CookieList().Clear(); base._objCookieList.Clear(); base._isGettingFullOdds = false; base._isGettingPartOdds = false; base._isBetting = false; base._isLoginSuccess = false; base._isFirstGetOddsDone = false; base._strLoginError = ""; base._strLoginStatus = ""; base._intGoodSpiderRequest = 0; base._intBadSpiderRequest = 0; base._intSpiderErrorCountCurrent = 0; base._isCanGetRunningOdds = false; base._isCanGetTodayOdds = false; base._isCanGetEarlyOdds = false; base._intSpiderRunningCoolDownSec = 0; base._intSpiderTodayCoolDownSec = 0; base._intSpiderEarlyCoolDownSec = 0; base._intSpiderSpecialCoolDownSec = 0; base._intSpiderOddEvenCoolDownSec = 0; base._intSpiderOutRightCoolDownSec = 0; base._intSpiderTotalGoalCoolDownSec = 0; base._intSpiderCorrectScoreCoolDownSec = 0; base._intTimeoutCount = 0; base._objSpiderMSRecordList.Clear(); str = base._strLoginURL; base._objBGWorkerLogin.ReportProgress(6, "Login Status: Checking Login Info..."); if ((base._strAccountID == string.Empty) | (base._strAccountPassword == string.Empty)) { base._strLoginError = "Username or Password Error!"; throw new Exception(); } base._objBGWorkerLogin.ReportProgress(12, "Login Status: Accessing Website..."); if (str.Substring(str.Length - 1, 1) == "/") { str = str.Substring(0, str.Length - 1); } str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str, "", ""), ref str6, ref str4); base._objBGWorkerLogin.ReportProgress(0x12, "Login Status: Checking Redirection..."); if (str4 != string.Empty) { str = str4; str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str, "", ""), ref str6, ref str4); if (str.Substring(str.Length - 1, 1) == "/") { str = str.Substring(0, str.Length - 1); } } base._objBGWorkerLogin.ReportProgress(0x19, "Login Status: Accessing Header Frame..."); str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/login_header.php?invalid=&language=english", str, ""), ref str6, ref str4); base._objBGWorkerLogin.ReportProgress(0x1f, "Login Status: Accessing Left Frame..."); str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/login_left.php?language=english", str, ""), ref str6, ref str4); base._objBGWorkerLogin.ReportProgress(0x25, "Login Status: Accessing News Frame..."); str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/login_news.php?language=english", str, ""), ref str6, ref str4); base._objBGWorkerLogin.ReportProgress(0x2b, "Login Status: Accessing Main Frame..."); str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/login_main.php?language=english", str, ""), ref str6, ref str4); base._objBGWorkerLogin.ReportProgress(50, "Login Status: Checking Validation Code..."); string str7 = null; Bitmap bitmap = new Bitmap(base._objCore.GetStreamAutoCookie(this.GenerateGetRequest(str + "/draw_gd.php", str + "/login_header.php?invalid=&language=english", ""), ref str7)); CaptchaBreaker breaker = new CaptchaBreaker(bitmap, Path.Combine(CommonFunction.GetAppPath(), @"Data\BW3388\NN.dat"), base._strImageStep, base._strObjectStep); if (breaker.get_Result().Length != 4) { base._strLoginError = "Verification Code Error!"; throw new Exception(); } base._objBGWorkerLogin.ReportProgress(0x38, "Login Status: Accessing Left Frame..."); str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/login_left.php?p=getTotalCount&lo=", str + "/login_left.php?language=english", ""), ref str6, ref str4); base._objBGWorkerLogin.ReportProgress(0x3e, "Login Status: Accessing Index Frame..."); str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/index.php?p=getTotalCount&l&lo=", str + "/login_left.php?language=english", ""), ref str6, ref str4); base._objBGWorkerLogin.ReportProgress(0x44, string.Format("Login Status: Login User ({0})...", base._strAccountID)); str3 = string.Format("fr_language=english&fr_username={0}&fr_password={1}&fr_gdcode={2}&fr_submit=Enter", HttpUtility.UrlEncode(base._strAccountID), HttpUtility.UrlEncode(base._strAccountPassword), breaker.get_Result()); str5 = base._objCore.PostRequestAutoCookie(this.GeneratePostRequest(str + "/?p=login_action", str + "/login_header.php?invalid=&language=english", str3.Length, ""), str3, ref str6, ref str4); if ((str4 == string.Empty) | (str4.Length == 1)) { base._strLoginError = "Verification Code Error!"; throw new Exception(); } if (str4.ToLower().Contains("invalid=1")) { base._strLoginError = "Username/Password Error!"; throw new Exception(); } if (str4.Contains("change")) { base._strLoginError = "Password Expired! Please change your password."; throw new Exception(); } base._objBGWorkerLogin.ReportProgress(0x4a, "Login Status: Login Account OK..."); if (!str4.ToUpper().Contains("AGREEMENT")) { base._strLoginError = "Login Error!"; throw new Exception(); } base._objBGWorkerLogin.ReportProgress(0x51, "Login Status: Accessing Agreement page..."); str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/" + str4, str + "/login_header.php?invalid=&language=english", ""), ref str6, ref str4); base._objBGWorkerLogin.ReportProgress(0x57, "Login Status: Accessing English Agreement page..."); str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/?p=agreement_english", str + "/?p=agreement&language=english", ""), ref str6, ref str4); base._objBGWorkerLogin.ReportProgress(0x5d, "Login Status: Getting Credit & Currency..."); str5 = base._objCore.GetRequestAutoCookie(this.GenerateGetRequest(str + "/english/index.php?p=profile", str + "/english/index.php?p=system", ""), ref str6, ref str4); this.ExtractAccountInfoFromText(str5, ref this._decAccountCredit, ref this._decAccountBetCredit, ref this._strAccountCurrency); base._objCookieList = base._objCore.get_CookieList(); base._strRootURL = str; this.StartGeneralProcessTimer(); base._objBGWorkerInfoSpider = new BackgroundWorker(); base._objBGWorkerInfoSpider.WorkerReportsProgress = true; base._objBGWorkerInfoSpider.DoWork += new DoWorkEventHandler(this.GeneralSpiderProcess); flag = true; base._objBGWorkerLogin.ReportProgress(100, "Login Status: Login OK!"); base._isLoginSuccess = true; base._isLoggingIn = false; } catch (Exception exception1) { ProjectData.SetProjectError(exception1); Exception exception = exception1; base._isLoggingIn = false; if (base._strLoginError == string.Empty) { base._strLoginError = exception.Message; } base._objBGWorkerLogin.ReportProgress(0, "Login Status: " + base._strLoginError); ProjectData.ClearProjectError(); } base._isLoggingIn = false; }