private Comm.CommFetchOptions Login_SW_New() { try { if (this.opts != null) { string data = this.GetGameData("user", "GetUserInfo", false); this.GameVitalsUpdate(data); if (data.Contains("{\"status\":1")) return this.opts; } string DataInfo = "{\"userName\":\"" + Utils.GetAppSetting("Login_Account").Trim() + "\",\"userPassword\":\"" + Utils.GetAppSetting("Login_Password").Trim() + "\",\"gameName\":\"SGZJ-ANDROID-CHS\",\"udid\":\"01:23:45:67:89:0a\",\"idfa\":\"\",\"clientType\":\"" + this.Login_Device.ToLower() + "\",\"releaseChannel\":\"\",\"locale\":\"en\"}"; string EncodedDataInfo = Convert.ToBase64String(Encoding.UTF8.GetBytes(DataInfo)); //Utils.Chatter(EncodedDataInfo); this.opts = new Comm.CommFetchOptions(); this.opts.UserAgent = Comm.CommFetchOptions.UserAgentModes.AIR; this.opts.WantCookies = true; this.opts.Method = Comm.CommFetchOptions.Methods.GET; Comm.Download("http://pp.fantasytoyou.com/pp/start.do?locale=EN&gameName=SGZJ-ANDROID-CHS", ref this.opts); this.opts.Method = Comm.CommFetchOptions.Methods.POST; this.opts.XMLHttpRequest = true; this.opts.POST_Data = "{\"serviceName\":\"checkUserActivedBase64Json\",\"callPara\":\"" + EncodedDataInfo + "\"}"; this.PassportLoginJSON = Utils.CStr(Comm.Download("http://pp.fantasytoyou.com/pp/httpService.do", ref this.opts)); Regex regex = new Regex(@"\\[uU]([0-9A-F]{4})", RegexOptions.IgnoreCase); this.PassportLoginJSON = regex.Replace(this.PassportLoginJSON, match => ((char)int.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString()); Utils.Logger(this.PassportLoginJSON); //Utils.Chatter(this.PassportLoginJSON); Utils.Logger(); JObject login = JObject.Parse(this.PassportLoginJSON); this.GAME_URL = login["returnObjs"]["GS_IP"].ToString(); this.opts = new Comm.CommFetchOptions(); this.opts.XMLHttpRequest = false; this.opts.WantCookies = true; this.opts.Method = Comm.CommFetchOptions.Methods.POST; this.opts.DataType_JSON = false; this.opts.UserAgent = Comm.CommFetchOptions.UserAgentModes.AIR; this.opts.Referer = Comm.CommFetchOptions.Referers.Custom; this.opts.CustomRefererURL = "app:/assets/CardMain.swf"; this.opts.POST_Data = ""; this.opts.POST_Data += "Origin=googleplayer&"; this.opts.POST_Data += "PP_source=" + (login["returnObjs"]["source"].ToString()) + "&"; this.opts.POST_Data += "PP_friendCode=" + (login["returnObjs"]["friendCode"].ToString()) + "&"; this.opts.POST_Data += "PP_G_TYPE=" + (login["returnObjs"]["G_TYPE"].ToString()) + "&"; this.opts.POST_Data += "PP_LOGIN_TYPE=" + (login["returnObjs"]["LOGIN_TYPE"].ToString()) + "&"; this.opts.POST_Data += "PP_initialUName=" + (login["returnObjs"]["initialUName"].ToString()) + "&"; this.opts.POST_Data += "PP_GS_NAME=" + (login["returnObjs"]["GS_NAME"].ToString()) + "&"; this.opts.POST_Data += "Password="******"returnObjs"]["U_ID"].ToString()) + "&"; this.opts.POST_Data += "PP_key=" + (login["returnObjs"]["key"].ToString()) + "&"; this.opts.POST_Data += "PP_timestamp=" + (login["returnObjs"]["timestamp"].ToString()) + "&"; this.opts.POST_Data += "PP_GS_DESC=" + (login["returnObjs"]["GS_DESC"].ToString()) + "&"; this.opts.POST_Data += "PP_GS_CHAT_IP=" + (login["returnObjs"]["GS_CHAT_IP"].ToString()) + "&"; this.opts.POST_Data += "Udid=" + ("01:23:45:67:89:0a").ToUpper() + "&"; this.opts.POST_Data += "newguide=1&"; this.opts.POST_Data += "time=" + (login["returnObjs"]["timestamp"].ToString()) + "&"; this.opts.POST_Data += "PP_GS_PORT=" + (login["returnObjs"]["GS_PORT"].ToString()) + "&"; this.opts.POST_Data += "key=" + (login["returnObjs"]["key"].ToString()) + "&"; this.opts.POST_Data += "PP_GS_IP=" + (login["returnObjs"]["GS_IP"].ToString()) + "&"; this.opts.POST_Data += "PP_GS_ID=" + (login["returnObjs"]["GS_ID"].ToString()) + "&"; this.opts.POST_Data += "DeviceToken=&"; this.opts.POST_Data += "PP_U_ID=" + (login["returnObjs"]["U_ID"].ToString()) + "&"; this.opts.POST_Data += "PP_userName="******"returnObjs"]["userName"].ToString()) + "&"; this.opts.POST_Data += "PP_GS_CHAT_PORT=" + (login["returnObjs"]["GS_CHAT_PORT"].ToString()) + "&"; this.opts.POST_Data += "IDFA=&"; this.opts.POST_Data += "UserName="******"returnObjs"]["source"].ToString()); this.opts.POST_Data = this.opts.POST_Data.Replace("_", "%5F"); this.opts.POST_Data = this.opts.POST_Data.Replace(":", "%3A"); this.opts.POST_Data = this.opts.POST_Data.Replace("/", "%2F"); this.opts.POST_Data = this.opts.POST_Data.Replace(".", "%2E"); this.opts.POST_Data = this.opts.POST_Data.Replace("-", "%2D"); this.opts.POST_Data = this.opts.POST_Data.Replace("[", "%5B"); this.opts.POST_Data = this.opts.POST_Data.Replace("]", "%5D"); Utils.Logger("<b>POST'ing:</b> " + this.opts.POST_Data); string login2 = Utils.CStr(Comm.Download(GAME_URL + "login.php?do=PassportLogin&v=" + this.seq_id.ToString() + TAG_SW, ref this.opts)); regex = new Regex(@"\\[uU]([0-9A-F]{4})", RegexOptions.IgnoreCase); login2 = regex.Replace(login2, match => ((char)int.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString()); Utils.Logger(login2); Utils.Logger(); this.PassportLoginJSON += login2; this.seq_id++; frmMain.AuthSerial++; this.Game_CDN_URL = JObject.Parse(this.GetGameData(ref this.opts, "login", "cdnurl", false))["data"]["cdnurl"].ToString().Replace("\\/", "/"); return this.opts; } catch (Exception ex) { Utils.Logger(Errors.GetAllErrorDetails(ex)); } return null; }
public static Image DownloadImage(string sURL, ref byte[] b_output) { Image i = new Bitmap(1, 1); try { bool success = false; byte[] b = null; Comm.CommFetchOptions options = new Comm.CommFetchOptions() { WantCookies = true, TimeOut = 15 }; for (int retries = 0; retries < 3; retries++) { options.LastException = null; b = Comm.Download(sURL, ref options); if ((b.Length > 100) && (options.LastException == null)) break; } if (options.LastException != null) throw options.LastException; #region Test that the image data is valid try { using (MemoryStream ms_download_data = new MemoryStream(b)) { ms_download_data.Position = 0L; using (Bitmap bmp = new Bitmap(ms_download_data)) { string message = string.Empty; if ((bmp.Width > 10) && (bmp.Height > 10)) { i = (Bitmap)(bmp.Clone()); success = true; } } } b_output = b; } catch { if (!success) // ignore any GDI+ issues with disposed objects if we did manage to load the image correctly throw; } #endregion } catch { } return i; }
private Comm.CommFetchOptions Login_SW(string language_to_use = "ZH_CN") { try { if (this.opts != null) { string data = this.GetGameData("user", "GetUserInfo", false); this.GameVitalsUpdate(data); if (data.Contains("{\"status\":1")) return this.opts; } this.opts = new Comm.CommFetchOptions(); this.opts.WantCookies = true; this.opts.Method = Comm.CommFetchOptions.Methods.POST; this.opts.DataType_JSON = false; this.opts.UserAgent = Comm.CommFetchOptions.UserAgentModes.AIR; this.opts.Referer = Comm.CommFetchOptions.Referers.Custom; this.opts.CustomRefererURL = "app:/assets/CardMain.swf"; this.opts.POST_Data = "{\"callPara\":{\"userId\":null,\"udid\":\"" + Utils.GetAppSetting("Login_Account").Trim().ToUpper() + "\",\"accessToken\":null,\"loginType\":null,\"idfa\":\"\",\"gameName\":\"SGZJ-ANDROID-CHS\"},\"serviceName\":\"startGameJson\"}"; this.PassportLoginJSON = Utils.CStr(Comm.Download("http://pp.fantasytoyou.com/pp/httpService.do", ref this.opts)); Regex regex = new Regex(@"\\[uU]([0-9A-F]{4})", RegexOptions.IgnoreCase); this.PassportLoginJSON = regex.Replace(this.PassportLoginJSON, match => ((char)int.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString()); Utils.Logger(this.PassportLoginJSON); Utils.Logger(); JObject login = JObject.Parse(this.PassportLoginJSON); this.GAME_URL = login["returnObjs"]["GS_IP"].ToString(); string time = login["returnObjs"]["timestamp"].ToString(); string key = login["returnObjs"]["key"].ToString(); string uid = login["returnObjs"]["U_ID"].ToString(); this.opts = new Comm.CommFetchOptions(); this.opts.WantCookies = true; this.opts.Method = Comm.CommFetchOptions.Methods.POST; this.opts.DataType_JSON = false; this.opts.UserAgent = Comm.CommFetchOptions.UserAgentModes.AIR; this.opts.Referer = Comm.CommFetchOptions.Referers.Custom; this.opts.CustomRefererURL = "app:/assets/CardMain.swf"; string UserName = Utils.GetAppSetting("Login_Account").Trim().ToLower(); this.opts.POST_Data = "Password="******"&" + "Devicetoken=&" + "UserName="******"&" + "Origin=&" + "Udid=" + UserName.Trim().Replace(":", "%3A").ToUpper() + "&" + "time=" + time + "&" + "key=" + key; Utils.Logger("<b>POST'ing:</b> " + this.opts.POST_Data); string login2 = Utils.CStr(Comm.Download(GAME_URL + "login.php?do=PassportLogin&v=" + this.seq_id.ToString() + TAG_SW, ref this.opts)); regex = new Regex(@"\\[uU]([0-9A-F]{4})", RegexOptions.IgnoreCase); login2 = regex.Replace(login2, match => ((char)int.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString()); Utils.Logger(login2); Utils.Logger(); this.PassportLoginJSON += login2; this.seq_id++; frmMain.AuthSerial++; return this.opts; } catch (Exception ex) { Utils.Logger(Errors.GetAllErrorDetails(ex)); } return null; }
private Comm.CommFetchOptions Login_ER() { try { if (this.opts != null) { string data = this.GetGameData("user", "GetUserInfo", false); this.GameVitalsUpdate(data); if (data.Contains("{\"status\":1")) return this.opts; } this.opts = new Comm.CommFetchOptions(); this.opts.Method = Comm.CommFetchOptions.Methods.POST; this.opts.POST_Data = "mac=00:00:00:00&imte=0000000000000&androidid=0000000000000000&advertiser=sohu%24%24sohu_mken¶ms=efun&referrer=&loginName=" + System.Web.HttpUtility.UrlEncode(Utils.GetAppSetting("Login_Account").Trim()) + "&loginPwd=" + System.Web.HttpUtility.UrlEncode(Utils.GetAppSetting("Login_Password").Trim()) + "×tamp=140595581630&gameCode=mken&systemVersion=4.4.2&deviceType=samsung%20%20SM-N900V&appPlatform=e00009&languge=en_US&signature="; string slogin = Utils.CStr(Comm.Download("http://login.efun.com/standard_login.shtml", ref this.opts)); Utils.Logger("<b>HTTP request:</b> " + "http://login.efun.com/standard_login.shtml"); Utils.Logger("<b>POST'ing:</b> " + this.opts.POST_Data); Utils.Logger(slogin); Utils.Logger(); JObject jlogin = JObject.Parse(slogin); this.opts = new Comm.CommFetchOptions(); this.opts.Method = Comm.CommFetchOptions.Methods.POST; this.opts.POST_Data = ""; this.opts.POST_Data += "timestamp=" + jlogin["timestamp"].ToString(); this.opts.POST_Data += "&sign=" + jlogin["sign"].ToString(); this.opts.POST_Data += "&Udid=00%3A00%3A00%3A00%3A00%3A00"; this.opts.POST_Data += "&plat=EFUN%5FEN"; this.opts.POST_Data += "&newguide=1"; this.opts.POST_Data += "&IDFA="; this.opts.POST_Data += "&userid=" + jlogin["userid"].ToString(); this.PassportLoginJSON = Utils.CStr(Comm.Download("http://ermaster.vsplay.com/mpassport.php?do=plogin&v=12345" + TAG_ER, ref this.opts)); Regex regex = new Regex(@"\\[uU]([0-9A-F]{4})", RegexOptions.IgnoreCase); this.PassportLoginJSON = regex.Replace(this.PassportLoginJSON, match => ((char)int.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString()); Utils.Logger("<b>HTTP request:</b> " + "http://ermaster.vsplay.com/mpassport.php?do=plogin&v=12345" + TAG_ER); Utils.Logger("<b>POST'ing:</b> " + this.opts.POST_Data); Utils.Logger(this.PassportLoginJSON); Utils.Logger(); JObject login = JObject.Parse(this.PassportLoginJSON); this.GAME_URL = login["data"]["current"]["GS_IP"].ToString(); this.opts = new Comm.CommFetchOptions(); this.opts.XMLHttpRequest = false; this.opts.WantCookies = true; this.opts.Method = Comm.CommFetchOptions.Methods.POST; this.opts.DataType_JSON = false; this.opts.UserAgent = Comm.CommFetchOptions.UserAgentModes.AIR; this.opts.Referer = Comm.CommFetchOptions.Referers.Custom; this.opts.CustomRefererURL = "app:/assets/CardMain.swf"; this.opts.POST_Data = ""; this.opts.POST_Data += "time=" + Utils.CInt(login["data"]["uinfo"]["time"]).ToString(); this.opts.POST_Data += "&uin=" + Utils.CInt(login["data"]["uinfo"]["uin"]).ToString(); this.opts.POST_Data += "&plat=EFUN%5FEN"; this.opts.POST_Data += "&IDFA="; this.opts.POST_Data += "&nick=" + login["data"]["uinfo"]["nick"].ToString(); this.opts.POST_Data += "&sign=" + login["data"]["uinfo"]["sign"].ToString(); this.opts.POST_Data += "&Devicetoken="; this.opts.POST_Data += "&access%5Ftoken=" + login["data"]["uinfo"]["access_token"].ToString(); this.opts.POST_Data += "&Udid=00%3A00%3A00%3A00%3A00%3A00"; this.opts.POST_Data += "&Origin=efun%5Fen"; this.opts.POST_Data += "&newguide=1"; this.opts.POST_Data += "&MUid=" + Utils.CInt(login["data"]["uinfo"]["MUid"]).ToString(); this.opts.POST_Data += "&ppsign=" + login["data"]["uinfo"]["ppsign"].ToString(); this.opts.POST_Data = this.opts.POST_Data.Replace("_", "%5F"); this.opts.POST_Data = this.opts.POST_Data.Replace(":", "%3A"); this.opts.POST_Data = this.opts.POST_Data.Replace("/", "%2F"); this.opts.POST_Data = this.opts.POST_Data.Replace(".", "%2E"); this.opts.POST_Data = this.opts.POST_Data.Replace("-", "%2D"); this.opts.POST_Data = this.opts.POST_Data.Replace("[", "%5B"); this.opts.POST_Data = this.opts.POST_Data.Replace("]", "%5D"); string login2 = Utils.CStr(Comm.Download(GAME_URL + "login.php?do=mpLogin&v=" + this.seq_id.ToString() + TAG_ER, ref this.opts)); regex = new Regex(@"\\[uU]([0-9A-F]{4})", RegexOptions.IgnoreCase); login2 = regex.Replace(login2, match => ((char)int.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString()); Utils.Logger("<b>HTTP request:</b> " + GAME_URL + "login.php?do=mpLogin&v=" + this.seq_id.ToString() + TAG_ER); Utils.Logger("<b>POST'ing:</b> " + this.opts.POST_Data); Utils.Logger(login2); Utils.Logger(); if (login2.Contains("\"status\":0,")) return null; this.PassportLoginJSON += login2; this.seq_id++; frmMain.AuthSerial++; this.Game_CDN_URL = JObject.Parse(this.GetGameData(ref this.opts, "login", "cdnurl", false))["data"]["cdnurl"].ToString().Replace("\\/", "/"); return this.opts; } catch (Exception ex) { Utils.Logger(Errors.GetAllErrorDetails(ex)); } return null; }
private Comm.CommFetchOptions Login_EK() { if (this.opts != null) { string data = this.GetGameData(ref this.opts, "user", "GetUserInfo", false); if (data.Contains("{\"status\":1")) return this.opts; this.GameVitalsUpdate(data); } string Udid = ""; // unique device ID (MAC address) this.Login_ARC_UIN = Login_EK_GetARCID(); this.opts = new Comm.CommFetchOptions(); this.opts.WantCookies = true; this.opts.Method = Comm.CommFetchOptions.Methods.POST; this.opts.DataType_JSON = false; this.opts.UserAgent = Comm.CommFetchOptions.UserAgentModes.AIR; this.opts.Referer = Comm.CommFetchOptions.Referers.Custom; this.opts.CustomRefererURL = "app:/assets/CardMain.swf"; this.opts.POST_Data = "plat=pwe&" + "Udid=" + Udid + "&" + "uin=" + Login_ARC_UIN + "&" + "nickName=" + Login_ARC_UIN; Utils.Logger("<b>POST'ing:</b> " + this.opts.POST_Data); string result = Utils.CStr(Comm.Download("http://master.ek.ifreeteam.com/mpassport.php?do=plogin&v=" + this.seq_id.ToString() + TAG_EK, ref this.opts)); this.seq_id++; frmMain.AuthSerial++; Regex regex = new Regex(@"\\[uU]([0-9A-F]{4})", RegexOptions.IgnoreCase); result = regex.Replace(result, match => ((char)int.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString()); Utils.Logger(result); this.PassportLoginJSON = result; Utils.Logger(); if (!result.Contains("\"status\":1,")) return null; this.GAME_URL = "http://s1.ek.ifreeteam.com/"; try { GAME_URL = JObject.Parse(this.PassportLoginJSON)["data"]["current"]["GS_IP"].ToString(); } catch { } string MUid = Utils.ChopperBlank(result, "\"MUid\":\"", "\"").Trim(); string time = Utils.ChopperBlank(result, "\"time\":", ",").Trim(); string sign = Utils.ChopperBlank(result, "\"sign\":\"", "\"").Trim(); string ppsign = Utils.ChopperBlank(result, "\"ppsign\":\"", "\"").Trim(); string access_token = Utils.ChopperBlank(result, "\"access_token\":\"", "\"").Trim(); // The server always returns AuthType 1 now (used to be random AuthType 1-6), so this loop may not be required anymore. // We were using the loop to keep cycling until we found an AuthType we could handle. for (int i = 0; i < 10; i++) { this.opts = new Comm.CommFetchOptions(); this.opts.WantCookies = true; this.opts.Method = Comm.CommFetchOptions.Methods.POST; this.opts.DataType_JSON = false; this.opts.UserAgent = Comm.CommFetchOptions.UserAgentModes.AIR; this.opts.Referer = Comm.CommFetchOptions.Referers.Custom; this.opts.CustomRefererURL = "app:/assets/CardMain.swf"; this.opts.POST_Data = "Devicetoken=&" + "time=" + time + "&" + "plat=pwe&" + "access%5Ftoken=" + access_token + "&" + "MUid=" + MUid + "&" + "ppsign=" + ppsign + "&" + "nick=" + Login_ARC_UIN + "&" + "Udid=" + Udid + "&" + "sign=" + sign + "&" + "uin=" + Login_ARC_UIN + "&" + "Origin=%5FARC"; Utils.Logger("<b>POST'ing:</b> " + this.opts.POST_Data); result = Utils.CStr(Comm.Download(this.GAME_URL + "login.php?do=mpLogin&v=" + this.seq_id.ToString() + TAG_EK, ref this.opts)); this.seq_id++; frmMain.AuthSerial++; regex = new Regex(@"\\[uU]([0-9A-F]{4})", RegexOptions.IgnoreCase); result = regex.Replace(result, match => ((char)int.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString()); Utils.Logger(result); Utils.Logger(); if (!result.Contains("\"status\":1,")) return null; this.Game_CDN_URL = "http://s1.ek.ifreeteam.com/"; try { this.Game_CDN_URL = JObject.Parse(result)["data"]["cdnurl"].ToString(); } catch { } try { frmMain.AuthType = Utils.CInt(JObject.Parse(result)["data"]["AuthType"].ToString()); } catch { } try { frmMain.AuthSerial = Utils.CLng(JObject.Parse(result)["data"]["AuthSerial"].ToString()); } catch { } //Utils.DebugLogger("AuthType: " + frmMain.AuthType.ToString()); //Utils.DebugLogger("AuthSerial: " + frmMain.AuthSerial.ToString()); if (frmMain.AuthType == 1 || frmMain.AuthType == 3 /* || frmMain.AuthType == 4 */) break; } return this.opts; }
public string Login_EK_GetARCID(string user_override, string pass_override) { if (this.login_done_arc && !string.IsNullOrEmpty(this.Login_ARC_UIN)) return this.Login_ARC_UIN; if (string.IsNullOrEmpty(Utils.GetAppSetting("Login_Password").Trim())) { Utils.Chatter("Your game login password is blank."); return null; } bool captcha_required_forced = false; this.opts = new Comm.CommFetchOptions(); captcha_resetter: this.opts.WantCookies = true; this.opts.Method = Comm.CommFetchOptions.Methods.GET; this.opts.UserAgent = Comm.CommFetchOptions.UserAgentModes.Chrome; string ARC_Login_Form = Utils.CStr(Comm.Download("http://mobile.arcgames.com/user/login?gameid=51&sdkvcode=1.3.6&platform=android&androidos=18", ref this.opts)); string user_field_name = Utils.ChopperBlank(ARC_Login_Form, " id=\"un\" name=\"", "\""); if (!Utils.ValidText(user_field_name)) user_field_name = Utils.ChopperBlank(Utils.ChopperBlank(ARC_Login_Form, "Username", "</div>"), "name=\"", "\""); string pass_field_name = Utils.ChopperBlank(ARC_Login_Form, " id=\"pw\" name=\"", "\""); if (!Utils.ValidText(pass_field_name)) pass_field_name = Utils.ChopperBlank(Utils.ChopperBlank(ARC_Login_Form, "Password", "</div>"), "name=\"", "\""); bool captcha_required = !ARC_Login_Form.Contains("class=\"js-captcha-wrap\" style=\"display:none") || captcha_required_forced; string captcha_field_name = Utils.ChopperBlank(ARC_Login_Form, " id=\"captcha_login\" name=\"", "\""); string captcha_answer = ""; if (captcha_required) { string captcha_source = Utils.ChopperBlank(Utils.ChopperBlank(Utils.ChopperBlank(ARC_Login_Form, "<div class=\"js-captcha-wrap\"", "</div>"), "<img", "/>"), "src='", "'").Trim(); if (!captcha_source.StartsWith("http")) { if (!captcha_source.StartsWith("/")) captcha_source = "http://mobile.arcgames.com/" + captcha_source; else captcha_source = "http://mobile.arcgames.com" + captcha_source; } using (frmEKARCCAPTCHA captcha_solve = new frmEKARCCAPTCHA()) { captcha_solve.cc = this.opts.CookieContainerGet(); captcha_solve.SetImage(captcha_source); if (captcha_solve.ShowDialog() == System.Windows.Forms.DialogResult.OK) captcha_answer = captcha_solve.Answer; this.opts.CookieContainerSet(captcha_solve.cc); } if (!Utils.ValidText(captcha_answer)) return null; } this.opts.Method = Comm.CommFetchOptions.Methods.POST; this.opts.Referer = Comm.CommFetchOptions.Referers.Custom; this.opts.CustomRefererURL = "http://mobile.arcgames.com/user/login?gameid=51&sdkvcode=1.3.6&platform=android&androidos=18"; if (captcha_required) { this.opts.POST_Data = user_field_name + "=" + System.Web.HttpUtility.UrlEncode(user_override.Trim()) + "&" + pass_field_name + "=" + System.Web.HttpUtility.UrlEncode(pass_override.Trim()) + "&" + captcha_field_name + "=" + System.Web.HttpUtility.UrlEncode(captcha_answer.Trim()) + ""; } else { this.opts.POST_Data = user_field_name + "=" + System.Web.HttpUtility.UrlEncode(user_override.Trim()) + "&" + pass_field_name + "=" + System.Web.HttpUtility.UrlEncode(pass_override.Trim()) + ""; } string result = Utils.CStr(Comm.Download("http://mobile.arcgames.com/user/login/?gameid=51", ref this.opts)); Regex regex = new Regex(@"\\[uU]([0-9A-F]{4})", RegexOptions.IgnoreCase); result = regex.Replace(result, match => ((char)int.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString()); Utils.Logger("<b>ARC login result:</b> " + result); Utils.Logger(); if (!result.Replace(" ", "").Contains("\"result\":true")) { string msg = ""; if (result.Contains("\"msg\":\"")) msg = Utils.ChopperBlank(result, "\"msg\":\"", "\""); if (!captcha_required_forced && msg.ToLower().Contains("captcha")) { captcha_required_forced = true; goto captcha_resetter; } Utils.Chatter("The ARC gateway login failed. Check your username and password."); Utils.Chatter(); Utils.Chatter("If you continue to see this message and are sure your login details are correct, then Perfect World may have changed how the login gateway works, which will require an update from EK Unleashed."); if (Utils.ValidText(msg)) { Utils.Chatter(); Utils.Chatter("Server responded with error: " + msg.Trim()); } return null; } try { Utils.Chatter("ARC login: "******"loginstatus"].ToString().Split(new char[] { ':' })[1]; this.Login_ARC_DeviceToken = ARC_Login_Data["loginstatus"].ToString().Split(new char[] { ':' })[3]; } catch { } //this.Login_ARC_UIN = Utils.ChopperBlank(result, "user:"******":"); if (Utils.ValidText(this.Login_ARC_UIN)) { this.login_done_arc = true; return this.Login_ARC_UIN; } return null; }
public static string PageFetch(string sURL, Comm.CommFetchOptions options) { options.WantCookies = true; return(Utils.CStr(Comm.Download(sURL, options))); }