This commit is contained in:
JustArchi
2019-11-20 17:56:35 +01:00
parent df519d3857
commit 469f6d0d95
2 changed files with 52 additions and 50 deletions

View File

@@ -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
}
}
}

View File

@@ -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;