private void OnLoggedOn(SteamKit.SteamUser.LoggedOnCallback callback) { if (callback.Result == EResult.OK) { SuggestedCellId = callback.CellID; _clientReadyEvent.Set(); } else { if (callback.Result == EResult.AccountLogonDenied || callback.Result == EResult.AccountLoginDeniedNeedTwoFactor) { if (callback.Result == EResult.AccountLogonDenied) { EmailAuthCode = _codesProvider.GetEmailAuthenticationCode(Credentials); } else { TwoFactorCode = _codesProvider.GetTwoFactorAuthenticationCode(Credentials); } InternalClient.Connect(); } else { FaultException = new SteamLogonException(callback.Result); _clientFaultedEvent.Set(); } } }
void OnLoggedOn(SK.SteamUser.LoggedOnCallback callback) { bool isSteamGuard = callback.Result == SK.EResult.AccountLogonDenied; bool is2FA = callback.Result == SK.EResult.AccountLoginDeniedNeedTwoFactor; if (isSteamGuard || is2FA) { Console.WriteLine("This account is SteamGuard protected!"); } if (callback.Result != SK.EResult.OK) { IsConnected = false; if (callback.Result == SK.EResult.AccountLogonDenied) { throw new AuthenticationException("Unable to logon to Steam: This account is SteamGuard protected."); } throw new AuthenticationException($"Unable to logon to Steam: {callback.Result} / {callback.ExtendedResult}"); } CurrentUser.SteamId = new SteamUserId(steamUser.SteamID); CurrentUser.IsScammer = GetScammerStatus(CurrentUser.SteamId.SteamId32); LoggedIn?.Invoke(this, null); }