Example #1
0
 internal static string GetUserInput(SharedInfo.EUserInputType userInputType, string botName = SharedInfo.ASF, string extraInformation = null)
 {
     return(null);            // TODO
 }
Example #2
0
        internal static string GetUserInput(SharedInfo.EUserInputType userInputType, string botName = SharedInfo.ASF, string extraInformation = null)
        {
            if (userInputType == SharedInfo.EUserInputType.Unknown)
            {
                return(null);
            }

            if (GlobalConfig.Headless || !Runtime.IsUserInteractive)
            {
                ASF.ArchiLogger.LogGenericWarning("Received a request for user input, but process is running in headless mode!");
                return(null);
            }

            string result;

            lock (ConsoleLock) {
                Logging.OnUserInputStart();
                switch (userInputType)
                {
                case SharedInfo.EUserInputType.DeviceID:
                    Console.Write("<" + botName + "> Please enter your Device ID (including \"android:\"): ");
                    break;

                case SharedInfo.EUserInputType.Login:
                    Console.Write("<" + botName + "> Please enter your login: "******"<" + botName + "> Please enter your password: "******"<" + botName + "> Please enter your full phone number (e.g. +1234567890): ");
                    break;

                case SharedInfo.EUserInputType.SMS:
                    Console.Write("<" + botName + "> Please enter SMS code sent on your mobile: ");
                    break;

                case SharedInfo.EUserInputType.SteamGuard:
                    Console.Write("<" + botName + "> Please enter the auth code sent to your email: ");
                    break;

                case SharedInfo.EUserInputType.SteamParentalPIN:
                    Console.Write("<" + botName + "> Please enter steam parental PIN: ");
                    break;

                case SharedInfo.EUserInputType.RevocationCode:
                    Console.WriteLine("<" + botName + "> PLEASE WRITE DOWN YOUR REVOCATION CODE: " + extraInformation);
                    Console.Write("<" + botName + "> Hit enter once ready...");
                    break;

                case SharedInfo.EUserInputType.TwoFactorAuthentication:
                    Console.Write("<" + botName + "> Please enter your 2 factor auth code from your authenticator app: ");
                    break;

                case SharedInfo.EUserInputType.WCFHostname:
                    Console.Write("<" + botName + "> Please enter your WCF hostname: ");
                    break;

                default:
                    Console.Write("<" + botName + "> Please enter not documented yet value of \"" + userInputType + "\": ");
                    break;
                }

                result = Console.ReadLine();

                if (!Console.IsOutputRedirected)
                {
                    Console.Clear();                     // For security purposes
                }

                Logging.OnUserInputEnd();
            }

            return(!string.IsNullOrEmpty(result) ? result.Trim() : null);
        }