Example #1
0
        private void OnConnected(SteamClient.ConnectedCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            if (callback.Result != EResult.OK)
            {
                Logging.LogGenericError(BotName, "Unable to connect to Steam: " + callback.Result);
                return;
            }

            Logging.LogGenericInfo(BotName, "Connected to Steam!");

            byte[] sentryHash = null;
            if (File.Exists(SentryFile))
            {
                byte[] sentryFileContent = File.ReadAllBytes(SentryFile);
                sentryHash = CryptoHelper.SHAHash(sentryFileContent);
            }

            string steamLogin = SteamLogin;

            if (string.IsNullOrEmpty(steamLogin) || steamLogin.Equals("null"))
            {
                steamLogin           = Program.GetUserInput(BotName, Program.EUserInputType.Login);
                Config["SteamLogin"] = steamLogin;
            }

            string steamPassword = SteamPassword;

            if (string.IsNullOrEmpty(steamPassword) || steamPassword.Equals("null"))
            {
                steamPassword           = Program.GetUserInput(BotName, Program.EUserInputType.Password);
                Config["SteamPassword"] = steamPassword;
            }

            SteamUser.LogOn(new SteamUser.LogOnDetails {
                Username       = steamLogin,
                Password       = steamPassword,
                AuthCode       = AuthCode,
                TwoFactorCode  = TwoFactorAuth,
                SentryFileHash = sentryHash
            });
        }