Пример #1
0
            public void OnLogon(SteamUser.LoggedOnCallback e)
            {
                Log.Debug("Logged On Callback: {0}", e.Result);

                if (e.Result == EResult.OK)
                {
                    Bot._myUserNonce = e.WebAPIUserNonce;
                }
                else
                {
                    Log.Error("Login Error: {0}", e.Result);
                }

                if (e.Result == EResult.InvalidPassword)
                {
                    Log.Interface("Invalid password. Press enter to log in again.");
                    Program.PasswordRequestingBot = Bot;
                    Program.IsMaskedInput         = true;

                    while (Program.IsMaskedInput)
                    {
                        Thread.Sleep(2000);
                    }
                }

                if (e.Result == EResult.AccountLogonDenied)
                {
                    Log.Interface("This account is SteamGuard enabled. Enter the code via the 'auth' command.");

                    // try to get the steamguard auth code from the event callback
                    SteamGuardRequiredEventArgs eva = new SteamGuardRequiredEventArgs();
                    Bot._fireOnSteamGuardRequired(eva);
                    if (!string.IsNullOrEmpty(eva.SteamGuard))
                    {
                        Bot.logOnDetails.AuthCode = eva.SteamGuard;
                    }
                    else
                    {
                        Bot.logOnDetails.AuthCode = Console.ReadLine();
                    }
                }

                if (e.Result == EResult.InvalidLoginAuthCode)
                {
                    Log.Interface("The given SteamGuard code was invalid. Try again using the 'auth' command.");
                    Bot.logOnDetails.AuthCode = Console.ReadLine();
                }
            }