Пример #1
0
        private void OnSteamUserLoggedOn(SteamUser.LoggedOnCallback callback)
        {
            if (callback.Result == EResult.AccountLogonDenied)
            {
                //Account is Steam Guarded, but doesn't need 2FA, this is a blocking call, when it's done, we have completed this.
                RequestEmailAuthenticationCode();
                //now disconnect
                Disconnect();
                //and reconnect with the needed info.
                Login(m_SteamUserName, m_SteamPassword, SteamManager.SteamAPIKey);
            }
            else if (callback.Result == EResult.AccountLoginDeniedNeedTwoFactor)
            {
                //Account is Steam Guarded, and uses 2FA, this is a blocking call, when it's done, we have completed this.
                RequestTwoFactorAuthenticationCode();
                //now disconnect
                Disconnect();
                //and reconnect with the needed info.
                Login(m_SteamUserName, m_SteamPassword, SteamManager.SteamAPIKey);
            }
            else if (callback.Result != EResult.OK)
            {
                OnLogonFailure?.Invoke(this, string.Format("Unable to logon to Steam: {0} / {1}", callback.Result, callback.ExtendedResult));

                Disconnect();
            }
            else
            {
                OnLogonSuccess?.Invoke(this, string.Format("Successfully logged on!"));
            }
        }
Пример #2
0
        public void ParseMessage(object sender, ResponseInfo e)
        {
            switch (e.Command)
            {
            case "login":
                OnLogonSuccess?.Invoke(this, JsonConvert.DeserializeObject <LoginClass>(e.Data));

                break;

            case "err":
                OnError?.Invoke(this, e.Data);

                break;

            default:

                break;
            }
        }