From 469f6d0d95ad695fcfbba862aaf9c2b2f0ff56f5 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Wed, 20 Nov 2019 17:56:35 +0100 Subject: [PATCH] Closes #1513 --- ArchiSteamFarm/ASF.cs | 13 ++++--- ArchiSteamFarm/Bot.cs | 89 ++++++++++++++++++++++--------------------- 2 files changed, 52 insertions(+), 50 deletions(-) diff --git a/ArchiSteamFarm/ASF.cs b/ArchiSteamFarm/ASF.cs index a712b3c5e..4496fdb84 100644 --- a/ArchiSteamFarm/ASF.cs +++ b/ArchiSteamFarm/ASF.cs @@ -820,12 +820,8 @@ namespace ArchiSteamFarm { return true; } - internal enum EFileType : byte { - Config, - Database - } - - internal enum EUserInputType : byte { + [PublicAPI] + public enum EUserInputType : byte { Unknown, DeviceID, Login, @@ -834,5 +830,10 @@ namespace ArchiSteamFarm { SteamParentalCode, TwoFactorAuthentication } + + internal enum EFileType : byte { + Config, + Database + } } } diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index a4f3be675..4f60f4760 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -453,6 +453,51 @@ namespace ArchiSteamFarm { }; } + [PublicAPI] + public void SetUserInput(ASF.EUserInputType inputType, string inputValue) { + if ((inputType == ASF.EUserInputType.Unknown) || !Enum.IsDefined(typeof(ASF.EUserInputType), inputValue) || string.IsNullOrEmpty(inputValue)) { + ArchiLogger.LogNullError(nameof(inputType) + " || " + nameof(inputValue)); + } + + // This switch should cover ONLY bot properties + switch (inputType) { + case ASF.EUserInputType.DeviceID: + DeviceID = inputValue; + + break; + case ASF.EUserInputType.Login: + if (BotConfig != null) { + BotConfig.SteamLogin = inputValue; + } + + break; + case ASF.EUserInputType.Password: + if (BotConfig != null) { + BotConfig.DecryptedSteamPassword = inputValue; + } + + break; + case ASF.EUserInputType.SteamGuard: + AuthCode = inputValue; + + break; + case ASF.EUserInputType.SteamParentalCode: + if (BotConfig != null) { + BotConfig.SteamParentalCode = inputValue; + } + + break; + case ASF.EUserInputType.TwoFactorAuthentication: + TwoFactorCode = inputValue; + + break; + default: + ASF.ArchiLogger.LogGenericError(string.Format(Strings.WarningUnknownValuePleaseReport, nameof(inputType), inputType)); + + break; + } + } + internal void AddGamesToRedeemInBackground(IOrderedDictionary gamesToRedeemInBackground) { if ((gamesToRedeemInBackground == null) || (gamesToRedeemInBackground.Count == 0)) { ArchiLogger.LogNullError(nameof(gamesToRedeemInBackground)); @@ -1354,50 +1399,6 @@ namespace ArchiSteamFarm { return await ArchiHandler.SendTypingStatus(steamID).ConfigureAwait(false) == EResult.OK; } - internal void SetUserInput(ASF.EUserInputType inputType, string inputValue) { - if ((inputType == ASF.EUserInputType.Unknown) || string.IsNullOrEmpty(inputValue)) { - ArchiLogger.LogNullError(nameof(inputType) + " || " + nameof(inputValue)); - } - - // This switch should cover ONLY bot properties - switch (inputType) { - case ASF.EUserInputType.DeviceID: - DeviceID = inputValue; - - break; - case ASF.EUserInputType.Login: - if (BotConfig != null) { - BotConfig.SteamLogin = inputValue; - } - - break; - case ASF.EUserInputType.Password: - if (BotConfig != null) { - BotConfig.DecryptedSteamPassword = inputValue; - } - - break; - case ASF.EUserInputType.SteamGuard: - AuthCode = inputValue; - - break; - case ASF.EUserInputType.SteamParentalCode: - if (BotConfig != null) { - BotConfig.SteamParentalCode = inputValue; - } - - break; - case ASF.EUserInputType.TwoFactorAuthentication: - TwoFactorCode = inputValue; - - break; - default: - ASF.ArchiLogger.LogGenericError(string.Format(Strings.WarningUnknownValuePleaseReport, nameof(inputType), inputType)); - - break; - } - } - internal async Task Start() { if (KeepRunning) { return;