Esempio n. 1
0
        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;
            })));
        }
Esempio n. 2
0
        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;
            })));
        }