public async Task<LoginResponse> LoginAsync(LoginDetails loginDetails)
        {
            loginDetails.ThrowIfNullArgument();

            var loginRequest = _requestFactories.LoginRequestFactory(loginDetails);
            var loginResponse = await loginRequest.PerformRequestAsync();
            RequestFactories.PhishingToken = loginResponse.PhishingToken;
            RequestFactories.SessionId = loginResponse.SessionId;

            return loginResponse;
        }
        public async Task<LoginResponse> LoginAsync(LoginDetails loginDetails)
        {
            loginDetails.ThrowIfNullArgument();

            try
            {
                return await _requestFactories.LoginRequestFactory(loginDetails).PerformRequestAsync();
            }
            catch (Exception e)
            {
                throw new FutException("Login failed", e);
            }
        }
        public async Task<LoginResponse> LoginMobileAsync(LoginDetails loginDetails, ITwoFactorCodeProvider twoFactorCodeProvider)
        {
            loginDetails.ThrowIfNullArgument();

            var loginRequest = _requestFactories.LoginMobileRequestFactory(loginDetails, twoFactorCodeProvider);
            var loginResponse = await loginRequest.PerformRequestAsync();
            RequestFactories.PhishingToken = loginResponse.PhishingToken;
            RequestFactories.SessionId = loginResponse.SessionId;
            RequestFactories.NucleusId = loginResponse.NucleusId;
            RequestFactories.PersonaId = loginResponse.PersonaId;

            return loginResponse;
        }
Esempio n. 4
0
        public async void DoRelog()
        {
            
            lblTimer.Text = @"";
            lblRelog.Text = @"Performing relog";
            WriteLog.DoWrite("Performing relog");
            Platform platform = Platform.Pc;
            switch (int.Parse(_account[3]))
            {
                case 0:
                    platform = Platform.Pc;
                    break;
                case 1:
                    platform = Platform.Ps3;
                    break;
                case 2:
                    platform = Platform.Ps4;
                    break;
                case 3:
                    platform = Platform.Xbox360;
                    break;
                case 4:
                    platform = Platform.XboxOne;
                    break;
            }

            
            try
            {
                CookieContainer cookie = CookieUtil.ReadCookiesFromDisk("cookies\\" + _account[0] + "_cookie.dat");
                Client = new FutClient(cookie);
                var loginDetails = new LoginDetails(_account[0], _account[1], _account[2], platform);
                await Client.LoginAsync(loginDetails, null);
                this.Close();
            }
            catch (Exception)
            {
                if (_i >= 5)
                {
                    WriteLog.DoWrite("Relog failed 5 times, exiting FutBud");
                    Application.Exit();
                }
                WriteLog.DoWrite("Relog failed");
                lblRelog.Text = (@"Relog failed");
                var start = DateTime.UtcNow;
                _endTime = start.AddMinutes(5);
                tmrCountdown.Enabled = true;
                _i++;
            }
        }