GetUserInput() static private method

static private GetUserInput ( ASF userInputType, string botName = SharedInfo.ASF, string extraInformation = null ) : string
userInputType ASF
botName string
extraInformation string
return string
Example #1
0
 internal static void Init()
 {
     if (string.IsNullOrEmpty(Program.GlobalConfig.WCFHost))
     {
         Program.GlobalConfig.WCFHost = Program.GetUserInput(ASF.EUserInputType.WCFHostname);
     }
 }
Example #2
0
        internal static void Init()
        {
            if (string.IsNullOrEmpty(Program.GlobalConfig.WCFHostname))
            {
                Program.GlobalConfig.WCFHostname = Program.GetUserInput(SharedInfo.EUserInputType.WCFHostname);
                if (string.IsNullOrEmpty(Program.GlobalConfig.WCFHostname))
                {
                    return;
                }
            }

            URL = "http://" + Program.GlobalConfig.WCFHostname + ":" + Program.GlobalConfig.WCFPort + "/ASF";
        }
Example #3
0
        internal static void Init()
        {
            if (string.IsNullOrEmpty(Program.GlobalConfig.WCFHost))
            {
                Program.GlobalConfig.WCFHost = Program.GetUserInput(ASF.EUserInputType.WCFHostname);
                if (string.IsNullOrEmpty(Program.GlobalConfig.WCFHost))
                {
                    return;
                }
            }

            URL = "net.tcp://" + Program.GlobalConfig.WCFHost + ":" + Program.GlobalConfig.WCFPort + "/ASF";
        }
Example #4
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
            });
        }
Example #5
0
        private async void OnLoggedOn(SteamUser.LoggedOnCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            EResult result = callback.Result;

            switch (result)
            {
            case EResult.AccountLogonDenied:
                AuthCode = Program.GetUserInput(SteamLogin, Program.EUserInputType.SteamGuard);
                break;

            case EResult.AccountLoginDeniedNeedTwoFactor:
                TwoFactorAuth = Program.GetUserInput(SteamLogin, Program.EUserInputType.TwoFactorAuthentication);
                break;

            case EResult.OK:
                Logging.LogGenericInfo(BotName, "Successfully logged on!");

                if (!SteamNickname.Equals("null"))
                {
                    SteamFriends.SetPersonaName(SteamNickname);
                }

                if (SteamParentalPIN.Equals("null"))
                {
                    SteamParentalPIN = Program.GetUserInput(BotName, Program.EUserInputType.SteamParentalPIN);
                }

                await ArchiWebHandler.Init(SteamClient, callback.WebAPIUserNonce, callback.VanityURL, SteamParentalPIN).ConfigureAwait(false);

                ulong clanID = SteamMasterClanID;
                if (clanID != 0)
                {
                    SteamFriends.JoinChat(clanID);
                }

                if (Statistics)
                {
                    SteamFriends.JoinChat(Program.ArchiSCFarmGroup);
                    await ArchiWebHandler.JoinClan(Program.ArchiSCFarmGroup).ConfigureAwait(false);
                }

                await CardsFarmer.StartFarming().ConfigureAwait(false);

                break;

            case EResult.Timeout:
            case EResult.TryAnotherCM:
                Logging.LogGenericWarning(BotName, "Unable to login to Steam: " + callback.Result + " / " + callback.ExtendedResult + ", retrying...");
                await Stop().ConfigureAwait(false);

                await Utilities.SleepAsync(CallbackSleep).ConfigureAwait(false);

                Start();
                break;

            default:
                Logging.LogGenericWarning(BotName, "Unable to login to Steam: " + callback.Result + " / " + callback.ExtendedResult);
                await Shutdown().ConfigureAwait(false);

                break;
            }
        }