ArchiSteamFarm.Logging.OnUserInputEnd C# (CSharp) Метод

OnUserInputEnd() статический приватный Метод

static private OnUserInputEnd ( ) : void
Результат void
        internal static void OnUserInputEnd()
        {
            IsWaitingForUserInput = false;

            if (ConsoleLoggingRules.Count == 0) {
                return;
            }

            foreach (LoggingRule consoleLoggingRule in ConsoleLoggingRules.Where(consoleLoggingRule => !LogManager.Configuration.LoggingRules.Contains(consoleLoggingRule))) {
                LogManager.Configuration.LoggingRules.Add(consoleLoggingRule);
            }

            LogManager.ReconfigExistingLoggers();
        }

Usage Example

Пример #1
0
        internal static string GetUserInput(ASF.EUserInputType userInputType, string botName = SharedInfo.ASF)
        {
            if (userInputType == ASF.EUserInputType.Unknown)
            {
                return(null);
            }

            if (GlobalConfig.Headless)
            {
                ASF.ArchiLogger.LogGenericWarning(Strings.ErrorUserInputRunningInHeadlessMode);
                return(null);
            }

            string result;

            lock (ConsoleLock) {
                Logging.OnUserInputStart();
                switch (userInputType)
                {
                case ASF.EUserInputType.DeviceID:
                    Console.Write(Bot.FormatBotResponse(Strings.UserInputDeviceID, botName));
                    result = Console.ReadLine();
                    break;

                case ASF.EUserInputType.IPCHostname:
                    Console.Write(Bot.FormatBotResponse(Strings.UserInputIPCHost, botName));
                    result = Console.ReadLine();
                    break;

                case ASF.EUserInputType.Login:
                    Console.Write(Bot.FormatBotResponse(Strings.UserInputSteamLogin, botName));
                    result = Console.ReadLine();
                    break;

                case ASF.EUserInputType.Password:
                    Console.Write(Bot.FormatBotResponse(Strings.UserInputSteamPassword, botName));
                    result = Utilities.ReadLineMasked();
                    break;

                case ASF.EUserInputType.SteamGuard:
                    Console.Write(Bot.FormatBotResponse(Strings.UserInputSteamGuard, botName));
                    result = Console.ReadLine();
                    break;

                case ASF.EUserInputType.SteamParentalPIN:
                    Console.Write(Bot.FormatBotResponse(Strings.UserInputSteamParentalPIN, botName));
                    result = Utilities.ReadLineMasked();
                    break;

                case ASF.EUserInputType.TwoFactorAuthentication:
                    Console.Write(Bot.FormatBotResponse(Strings.UserInputSteam2FA, botName));
                    result = Console.ReadLine();
                    break;

                default:
                    ASF.ArchiLogger.LogGenericError(string.Format(Strings.WarningUnknownValuePleaseReport, nameof(userInputType), userInputType));
                    Console.Write(Bot.FormatBotResponse(string.Format(Strings.UserInputUnknown, userInputType), botName));
                    result = Console.ReadLine();
                    break;
                }

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

                Logging.OnUserInputEnd();
            }

            return(!string.IsNullOrEmpty(result) ? result.Trim() : null);
        }
All Usage Examples Of ArchiSteamFarm.Logging::OnUserInputEnd