private async void MapleIds_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { Log(string.Format("开始切换子号:{0},请稍后。", e.ClickedItem.Text)); await MapleIdService.ChangeMapleIds(this.MapleCookie, e.ClickedItem.Text, this.MapleConfig.DeveloperMode); Log($"{ e.ClickedItem.Text}切换成功,可以启动游戏。"); }
private async Task <bool> LoginBySelect(string accountGuidId) { return(await Task.Run(new Func <bool>(() => { this.MapleConfig.LoginData.ForEach(x => x.IsDefault = false); var account = this.MapleConfig.LoginData.First(x => x.Guid == accountGuidId); account.IsDefault = true; this.MapleConfig.DefaultNaverCookie = account.AccountCookieStr; this.MapleConfig.DefaultNaverNickName = account.AccountTag; this.MapleConfig.Save(); if (account == null) { Log("出现了不可能的错误,账号指定错误..."); return false; } Log($"准备启动{account.AccountTag}..."); var naverCookie = NaverIdService.ReLoginNaver(account.AccountCookieStr).Result; if (string.IsNullOrEmpty(naverCookie)) { Log($"{account.AccountTag}的登录失败。帮助提示1-1."); return false; } NaverIdService.ReLoadCookieContainer(naverCookie, ref this.MapleCookie); this.MapleEncPwd = MapleIdService.LoginMaple(this.MapleCookie, this.MapleConfig.DeveloperMode).Result; if (string.IsNullOrEmpty(this.MapleEncPwd)) { Log("冒险岛登录失败,请查看帮助提示2-1."); return false; } Log($" {account.AccountTag} 登录成功,愉快的冒险吧(●ˇ∀ˇ●)..."); if (!this.MapleConfig.CkNotLoadMapleIds) { var mapleIds = MapleIdService.LoadMapleIds(this.MapleCookie, this.MapleConfig.DeveloperMode).Result; this.BeginInvoke(new Action(() => { this.MapleIds.DropDownItems.Clear(); foreach (var idItem in mapleIds) { this.MapleIds.DropDownItems.Add(idItem); } this.MapleIds.Visible = true; })); } this.BeginInvoke(new Action(() => { this.DefaultAccount.Text = this.MapleConfig.DefaultNaverNickName; this.BtnStartGame.Enabled = true; })); return true; }))); }
private async Task Start() { await Task.Run(() => { Log("开始启动冒险岛,请稍后..."); this.MapleConfig.MapleStartStatus = 0; this.MapleConfig.Save(); var ip = MapleIdService.UpdateMapleCookie(this.MapleCookie, this.MapleConfig.DeveloperMode).Result; this.MapleEncPwd = MapleIdService.StartGame(this.MapleCookie, this.MapleConfig).Result; if (string.IsNullOrEmpty(this.MapleEncPwd)) { Log("冒险岛启动密钥获取失败,请重试。帮助提示2-2."); return; } Log("冒险岛启动成功,唤起游戏中..."); Stopwatch sw = new Stopwatch(); sw.Start(); while (this.MapleConfig.MapleStartStatus == 0) { this.MapleConfig.Reload(); switch (this.MapleConfig.MapleStartStatus) { case 1: Log("冒险岛游戏启动成功 (。・∀・)ノ"); break; case -1: Log("冒险岛启动失败,请查看帮助提示2-4."); break; case 2: Log("冒险岛启动异常。帮助提示2-3."); break; } Thread.Sleep(100); if (sw.ElapsedMilliseconds >= 10000) { Log("未检测到游戏启动,可尝试重新启动。"); sw.Stop(); break; } } this.MapleConfig.MapleStartStatus = 0; this.MapleConfig.Save(); }); }
private async Task <bool> Login() { return(await Task.Run(new Func <bool>(() => { Log($"准备启动{this.MapleConfig.DefaultNaverNickName}..."); var naverCookie = NaverIdService.ReLoginNaver(this.MapleConfig.DefaultNaverCookie).Result; if (string.IsNullOrEmpty(naverCookie)) { Log($"{this.MapleConfig.DefaultNaverNickName}的登录失败。请查看帮助提示1-1."); this.MapleConfig.DefaultNaverCookie = ""; this.MapleConfig.DefaultNaverNickName = ""; this.MapleConfig.Save(); return false; } NaverIdService.ReLoadCookieContainer(naverCookie, ref this.MapleCookie); this.MapleEncPwd = MapleIdService.LoginMaple(this.MapleCookie, this.MapleConfig.DeveloperMode).Result; if (string.IsNullOrEmpty(this.MapleEncPwd)) { Log("冒险岛登录失败,请查看帮助提示2-1."); return false; } Log($" {this.MapleConfig.DefaultNaverNickName} 登录成功,愉快的冒险吧(●ˇ∀ˇ●)..."); if (!this.MapleConfig.CkNotLoadMapleIds) { var mapleIds = MapleIdService.LoadMapleIds(this.MapleCookie, this.MapleConfig.DeveloperMode).Result; this.BeginInvoke(new Action(() => { this.MapleIds.DropDownItems.Clear(); foreach (var idItem in mapleIds) { this.MapleIds.DropDownItems.Add(idItem); } this.MapleIds.Visible = true; })); } this.BeginInvoke(new Action(() => { this.DefaultAccount.Text = this.MapleConfig.DefaultNaverNickName; this.BtnStartGame.Enabled = true; })); return true; }))); }