Ejemplo n.º 1
0
        ////////////////////////////////////////////////////
        // CALLBACKS
        ////////////////////////////////////////////////////

        public override void OnConnected(SteamClient.ConnectedCallback callback)
        {
            _log.Debug("Successfully connected to Steam. Logging in...");

            byte[] hash = null;
            if (_sentry.Exists())
            {
                _log.Debug("Found previous Sentry file. Hashing it and sending it to Steam...");

                hash = _sentry.Hash();
            }
            else
            {
                _log.Debug("No Sentry file found. Titan will ask for a confirmation code...");
            }

            var loginID = RandomUtil.RandomUInt32();

            string loginKey = null;

            if (_loginKey.Exists())
            {
                loginKey = _loginKey.GetLastKey();
            }

            if (!Titan.Instance.Options.Secure)
            {
                _log.Debug("Logging in with Auth Code: {a} / 2FA Code {b} / Hash: {c} / LoginID: {d} / LoginKey: {e}",
                           _authCode, _2FactorCode, hash != null ? Convert.ToBase64String(hash) : null, loginID, loginKey);
            }

            _steamUser.LogOn(new SteamUser.LogOnDetails
            {
                Username               = JsonAccount.Username,
                Password               = loginKey == null ? JsonAccount.Password : null,
                AuthCode               = _authCode,
                TwoFactorCode          = _2FactorCode,
                SentryFileHash         = hash,
                LoginID                = loginID,
                ShouldRememberPassword = true,
                LoginKey               = loginKey
            });
        }