CSharpTradeOffers.Web.Web.RetryDoLogin C# (CSharp) Method

RetryDoLogin() public method

Retries the DoLogin method until success or fail conditions have been met.
public RetryDoLogin ( System.TimeSpan retryWait, int retryLimit, string username, string password, string machineAuth = "", IUserInputOutputHandler userInputOutput = null ) : Account
retryWait System.TimeSpan The TimeSpan in which to wait between requests.
retryLimit int The max number of requests to perform before failing.
username string Username to use
password string Password to use
machineAuth string Steam machine auth string. /// You should save Web.SteamMachineAuth after the code has been entered and the request has /// been successful and pass it to DoLogin in future attempts to login. /// This field can be left blank, but if the account is SteamGuard protected /// it will ask you for a new code every time.
userInputOutput IUserInputOutputHandler
return Account
        public Account RetryDoLogin(TimeSpan retryWait, int retryLimit, string username, string password,
            string machineAuth = "", IUserInputOutputHandler userInputOutput = null)
        {
            if (userInputOutput == null) userInputOutput = new ConsoleInputOutput();

            int retries = 0;
            Account account = null;
            do
            {
                try
                {
                    account = DoLogin(username, password, machineAuth, userInputOutput);
                }
                catch (WebException)
                {
                    retries++;
                    if (retries == retryLimit) throw;
                    Thread.Sleep(retryWait);
                }
            } while (account == null);
            return account;
        }