diff --git a/ArchiSteamFarm/ASF.cs b/ArchiSteamFarm/ASF.cs index 5c74b813a..ecc74e0f0 100644 --- a/ArchiSteamFarm/ASF.cs +++ b/ArchiSteamFarm/ASF.cs @@ -269,7 +269,7 @@ namespace ArchiSteamFarm { } if (botName.Equals(SharedInfo.ASF)) { - Program.ArchiLogger.LogGenericWarning(Strings.GlobalConfigChanged); + Program.ArchiLogger.LogGenericInfo(Strings.GlobalConfigChanged); await RestartOrExit().ConfigureAwait(false); return; } @@ -335,7 +335,7 @@ namespace ArchiSteamFarm { } if (botName.Equals(SharedInfo.ASF)) { - Program.ArchiLogger.LogGenericError(Strings.GlobalConfigRemoved); + Program.ArchiLogger.LogGenericError(Strings.ErrorGlobalConfigRemoved); Program.Exit(1); return; } @@ -358,7 +358,7 @@ namespace ArchiSteamFarm { } if (oldBotName.Equals(SharedInfo.ASF)) { - Program.ArchiLogger.LogGenericError(Strings.GlobalConfigRemoved); + Program.ArchiLogger.LogGenericError(Strings.ErrorGlobalConfigRemoved); Program.Exit(1); return; } @@ -401,11 +401,8 @@ namespace ArchiSteamFarm { DeviceID, Login, Password, - PhoneNumber, - SMS, SteamGuard, SteamParentalPIN, - RevocationCode, TwoFactorAuthentication, WCFHostname } diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index 54a71fa0a..ba713565f 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -1133,7 +1133,7 @@ namespace ArchiSteamFarm { bool result = await WebBrowser.UrlPostRetry(request, data, SteamCommunityURL).ConfigureAwait(false); if (!result) { - Bot.ArchiLogger.LogGenericInfo(Strings.Failed); + Bot.ArchiLogger.LogGenericWarning(Strings.WarningFailed); return false; } diff --git a/ArchiSteamFarm/BotConfig.cs b/ArchiSteamFarm/BotConfig.cs index 2abf1e85a..0150ba9c1 100644 --- a/ArchiSteamFarm/BotConfig.cs +++ b/ArchiSteamFarm/BotConfig.cs @@ -28,6 +28,7 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using ArchiSteamFarm.JSON; +using ArchiSteamFarm.Localization; using Newtonsoft.Json; namespace ArchiSteamFarm { @@ -160,7 +161,7 @@ namespace ArchiSteamFarm { return botConfig; } - Program.ArchiLogger.LogGenericWarning("Playing more than " + ArchiHandler.MaxGamesPlayedConcurrently + " games concurrently is not possible, only first " + ArchiHandler.MaxGamesPlayedConcurrently + " entries from GamesPlayedWhileIdle will be used"); + Program.ArchiLogger.LogGenericWarning(string.Join(Strings.WarningTooManyGamesToPlay, ArchiHandler.MaxGamesPlayedConcurrently, nameof(botConfig.GamesPlayedWhileIdle))); HashSet validGames = new HashSet(botConfig.GamesPlayedWhileIdle.Take(ArchiHandler.MaxGamesPlayedConcurrently)); botConfig.GamesPlayedWhileIdle.IntersectWith(validGames); diff --git a/ArchiSteamFarm/Events.cs b/ArchiSteamFarm/Events.cs index e6be33388..44c36e2dc 100644 --- a/ArchiSteamFarm/Events.cs +++ b/ArchiSteamFarm/Events.cs @@ -24,6 +24,7 @@ using System.Linq; using System.Threading.Tasks; +using ArchiSteamFarm.Localization; using SteamKit2; namespace ArchiSteamFarm { @@ -33,9 +34,9 @@ namespace ArchiSteamFarm { return; } - Program.ArchiLogger.LogGenericInfo("No bots are running, exiting"); + Program.ArchiLogger.LogGenericInfo(Strings.NoBotsAreRunning); await Task.Delay(5000).ConfigureAwait(false); - Program.Shutdown(); + Program.Exit(); } internal static void OnPersonaState(Bot bot, SteamFriends.PersonaStateCallback callback) { } diff --git a/ArchiSteamFarm/GlobalConfig.cs b/ArchiSteamFarm/GlobalConfig.cs index d09096ff9..bc8c9598b 100644 --- a/ArchiSteamFarm/GlobalConfig.cs +++ b/ArchiSteamFarm/GlobalConfig.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Net.Sockets; +using ArchiSteamFarm.Localization; using Newtonsoft.Json; namespace ArchiSteamFarm { @@ -135,24 +136,24 @@ namespace ArchiSteamFarm { case ProtocolType.Udp: break; default: - Program.ArchiLogger.LogGenericWarning("Configured SteamProtocol is invalid: " + globalConfig.SteamProtocol); + Program.ArchiLogger.LogGenericError(string.Format(Strings.ErrorConfigPropertyInvalid, nameof(globalConfig.SteamProtocol), globalConfig.SteamProtocol)); return null; } // User might not know what he's doing // Ensure that he can't screw core ASF variables if (globalConfig.MaxFarmingTime == 0) { - Program.ArchiLogger.LogGenericWarning("Configured MaxFarmingTime is invalid: " + globalConfig.MaxFarmingTime); + Program.ArchiLogger.LogGenericError(string.Format(Strings.ErrorConfigPropertyInvalid, nameof(globalConfig.MaxFarmingTime), globalConfig.MaxFarmingTime)); return null; } if (globalConfig.FarmingDelay == 0) { - Program.ArchiLogger.LogGenericWarning("Configured FarmingDelay is invalid: " + globalConfig.FarmingDelay); + Program.ArchiLogger.LogGenericError(string.Format(Strings.ErrorConfigPropertyInvalid, nameof(globalConfig.FarmingDelay), globalConfig.FarmingDelay)); return null; } if (globalConfig.HttpTimeout == 0) { - Program.ArchiLogger.LogGenericWarning("Configured HttpTimeout is invalid: " + globalConfig.HttpTimeout); + Program.ArchiLogger.LogGenericError(string.Format(Strings.ErrorConfigPropertyInvalid, nameof(globalConfig.HttpTimeout), globalConfig.HttpTimeout)); return null; } @@ -160,7 +161,7 @@ namespace ArchiSteamFarm { return globalConfig; } - Program.ArchiLogger.LogGenericWarning("Configured WCFPort is invalid: " + globalConfig.WCFPort); + Program.ArchiLogger.LogGenericError(string.Format(Strings.ErrorConfigPropertyInvalid, nameof(globalConfig.WCFPort), globalConfig.WCFPort)); return null; } diff --git a/ArchiSteamFarm/Localization/Strings.Designer.cs b/ArchiSteamFarm/Localization/Strings.Designer.cs index 1f3f1c95e..edb452352 100644 --- a/ArchiSteamFarm/Localization/Strings.Designer.cs +++ b/ArchiSteamFarm/Localization/Strings.Designer.cs @@ -88,6 +88,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Configured {0} property is invalid: {1}. + /// + internal static string ErrorConfigPropertyInvalid { + get { + return ResourceManager.GetString("ErrorConfigPropertyInvalid", resourceCulture); + } + } + /// /// Looks up a localized string similar to ASF V{0} has run into fatal exception before core logging module was even able to initialize!. /// @@ -126,6 +135,33 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Global config could not be loaded, please make sure that {0} exists and is valid! Follow setting up guide on the wiki if you're confused.. + /// + internal static string ErrorGlobalConfigNotLoaded { + get { + return ResourceManager.GetString("ErrorGlobalConfigNotLoaded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Global config file has been removed!. + /// + internal static string ErrorGlobalConfigRemoved { + get { + return ResourceManager.GetString("ErrorGlobalConfigRemoved", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Global database could not be loaded, if issue persists, please remove {0} in order to recreate database!. + /// + internal static string ErrorGlobalDatabaseNotLoaded { + get { + return ResourceManager.GetString("ErrorGlobalDatabaseNotLoaded", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} is invalid!. /// @@ -135,6 +171,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Refusing to execute this function due to invalid DeviceID in ASF 2FA!. + /// + internal static string ErrorMobileAuthenticatorInvalidDeviceID { + get { + return ResourceManager.GetString("ErrorMobileAuthenticatorInvalidDeviceID", resourceCulture); + } + } + /// /// Looks up a localized string similar to No bots are defined, did you forget to configure your ASF?. /// @@ -207,6 +252,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Received a request for user input, but process is running in headless mode!. + /// + internal static string ErrorUserInputRunningInHeadlessMode { + get { + return ResourceManager.GetString("ErrorUserInputRunningInHeadlessMode", resourceCulture); + } + } + /// /// Looks up a localized string similar to Refusing to handle the request because SteamOwnerID is not set!. /// @@ -216,6 +270,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to WCF service could not be started because of AddressAccessDeniedException! If you want to use WCF service provided by ASF, consider starting ASF as administrator, or giving proper permissions!. + /// + internal static string ErrorWCFAddressAccessDeniedException { + get { + return ResourceManager.GetString("ErrorWCFAddressAccessDeniedException", resourceCulture); + } + } + /// /// Looks up a localized string similar to Exiting.... /// @@ -225,15 +288,6 @@ namespace ArchiSteamFarm.Localization { } } - /// - /// Looks up a localized string similar to Failed!. - /// - internal static string Failed { - get { - return ResourceManager.GetString("Failed", resourceCulture); - } - } - /// /// Looks up a localized string similar to Global config file has been changed!. /// @@ -243,15 +297,6 @@ namespace ArchiSteamFarm.Localization { } } - /// - /// Looks up a localized string similar to Global config file has been removed!. - /// - internal static string GlobalConfigRemoved { - get { - return ResourceManager.GetString("GlobalConfigRemoved", resourceCulture); - } - } - /// /// Looks up a localized string similar to Ignoring trade: {0}. /// @@ -270,6 +315,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to No bots are running, exiting.... + /// + internal static string NoBotsAreRunning { + get { + return ResourceManager.GetString("NoBotsAreRunning", resourceCulture); + } + } + /// /// Looks up a localized string similar to Refreshing our session!. /// @@ -315,15 +369,6 @@ namespace ArchiSteamFarm.Localization { } } - /// - /// Looks up a localized string similar to Your {0} runtime version is too old!. - /// - internal static string RuntimeVersionTooOld { - get { - return ResourceManager.GetString("RuntimeVersionTooOld", resourceCulture); - } - } - /// /// Looks up a localized string similar to Starting.... /// @@ -478,11 +523,128 @@ namespace ArchiSteamFarm.Localization { } /// - /// Looks up a localized string similar to WCF service could not be started because of AddressAccessDeniedException! If you want to use WCF service provided by ASF, consider starting ASF as administrator, or giving proper permissions!. + /// Looks up a localized string similar to <{0}> Please enter your Device ID (including "android:"): . /// - internal static string WCFAddressAccessDeniedException { + internal static string UserInputDeviceID { get { - return ResourceManager.GetString("WCFAddressAccessDeniedException", resourceCulture); + return ResourceManager.GetString("UserInputDeviceID", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <{0}> Please enter your 2FA code from your Steam authenticator app: . + /// + internal static string UserInputSteam2FA { + get { + return ResourceManager.GetString("UserInputSteam2FA", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <{0}> Please enter SteamGuard auth code that was sent on your e-mail: . + /// + internal static string UserInputSteamGuard { + get { + return ResourceManager.GetString("UserInputSteamGuard", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <{0}> Please enter your Steam login: . + /// + internal static string UserInputSteamLogin { + get { + return ResourceManager.GetString("UserInputSteamLogin", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <{0}> Please enter Steam parental PIN: . + /// + internal static string UserInputSteamParentalPIN { + get { + return ResourceManager.GetString("UserInputSteamParentalPIN", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <{0}> Please enter your Steam password: . + /// + internal static string UserInputSteamPassword { + get { + return ResourceManager.GetString("UserInputSteamPassword", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <{0}> Please enter undocumented value of {1}: . + /// + internal static string UserInputUnknown { + get { + return ResourceManager.GetString("UserInputUnknown", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <{0}> Please enter your WCF host: . + /// + internal static string UserInputWCFHost { + get { + return ResourceManager.GetString("UserInputWCFHost", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed!. + /// + internal static string WarningFailed { + get { + return ResourceManager.GetString("WarningFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Received unknown confirmation type, please report this: {0}. + /// + internal static string WarningMobileAuthenticatorUnknownConfirmationType { + get { + return ResourceManager.GetString("WarningMobileAuthenticatorUnknownConfirmationType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ASF detected unsupported runtime version, program might NOT run correctly in current environment. You're running it at your own risk without support!. + /// + internal static string WarningRuntimeUnsupported { + get { + return ResourceManager.GetString("WarningRuntimeUnsupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your {0} runtime version is too old!. + /// + internal static string WarningRuntimeVersionTooOld { + get { + return ResourceManager.GetString("WarningRuntimeVersionTooOld", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Playing more than {0} games concurrently is not possible, only first {0} entries from {1} will be used!. + /// + internal static string WarningTooManyGamesToPlay { + get { + return ResourceManager.GetString("WarningTooManyGamesToPlay", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ignoring WCF command because --client wasn't specified: {0}. + /// + internal static string WarningWCFIgnoringCommand { + get { + return ResourceManager.GetString("WarningWCFIgnoringCommand", resourceCulture); } } @@ -504,6 +666,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to WCF response received: {0}. + /// + internal static string WCFResponseReceived { + get { + return ResourceManager.GetString("WCFResponseReceived", resourceCulture); + } + } + /// /// Looks up a localized string similar to Sending command: {0} to WCF server on {1}.... /// diff --git a/ArchiSteamFarm/Localization/Strings.resx b/ArchiSteamFarm/Localization/Strings.resx index 70224387e..506c67bfe 100644 --- a/ArchiSteamFarm/Localization/Strings.resx +++ b/ArchiSteamFarm/Localization/Strings.resx @@ -130,6 +130,10 @@ {0} {0} will be replaced by content string. Please note that this string should include newline for formatting. + + Configured {0} property is invalid: {1} + {0} will be replaced by name of the configuration property, {1} will be replaced by invalid value + ASF V{0} has run into fatal exception before core logging module was even able to initialize! {0} will be replaced by version number @@ -147,10 +151,21 @@ StackTrace: Request failing: {0} {0} will be replaced by URL of the request + + Global config could not be loaded, please make sure that {0} exists and is valid! Follow setting up guide on the wiki if you're confused. + {0} will be replaced by file's path + + + Global database could not be loaded, if issue persists, please remove {0} in order to recreate database! + {0} will be replaced by file's path + {0} is invalid! {0} will be replaced by object's name + + Refusing to execute this function due to invalid DeviceID in ASF 2FA! + No bots are defined, did you forget to configure your ASF? @@ -164,7 +179,7 @@ StackTrace: Could not remove old ASF binary, please remove {0} manually in order for update function to work! - {0} will be replaced by binary's name + {0} will be replaced by file's path Request failed despite of {0} tries! @@ -179,19 +194,22 @@ StackTrace: Could not proceed with an update because that version doesn't include any assets! + + Received a request for user input, but process is running in headless mode! + Refusing to handle the request because SteamOwnerID is not set! Exiting... - + Failed! Global config file has been changed! - + Global config file has been removed! @@ -202,6 +220,9 @@ StackTrace: Logging in to {0}... {0} will be replaced by service's name + + No bots are running, exiting... + Refreshing our session! @@ -212,6 +233,9 @@ StackTrace: Restarting... + + ASF detected unsupported runtime version, program might NOT run correctly in current environment. You're running it at your own risk without support! + Required version: {0} | Found version: {1} {0} will be replaced by required version, {1} will be replaced by current version @@ -220,7 +244,7 @@ StackTrace: Your {0} runtime version is OK. {0} will be replaced by runtime name (e.g. "Mono") - + Your {0} runtime version is too old! {0} will be replaced by runtime name (e.g. "Mono") @@ -281,7 +305,51 @@ StackTrace: Local version: {0} | Remote version: {1} {0} will be replaced by current version, {1} will be replaced by remote version - + + <{0}> Please enter your Device ID (including "android:"): + {0} will be replaced by bot's name. Please note that this translation should end with space + + + <{0}> Please enter your 2FA code from your Steam authenticator app: + {0} will be replaced by bot's name. Please note that this translation should end with space + + + <{0}> Please enter SteamGuard auth code that was sent on your e-mail: + {0} will be replaced by bot's name. Please note that this translation should end with space + + + <{0}> Please enter your Steam login: + {0} will be replaced by bot's name. Please note that this translation should end with space + + + <{0}> Please enter Steam parental PIN: + {0} will be replaced by bot's name. Please note that this translation should end with space + + + <{0}> Please enter your Steam password: + {0} will be replaced by bot's name. Please note that this translation should end with space + + + <{0}> Please enter undocumented value of {1}: + {0} will be replaced by bot's name, {1} will be replaced by property name. Please note that this translation should end with space + + + <{0}> Please enter your WCF host: + {0} will be replaced by bot's name. Please note that this translation should end with space + + + Received unknown confirmation type, please report this: {0} + {0} will be replaced by unknown confirmation type + + + Playing more than {0} games concurrently is not possible, only first {0} entries from {1} will be used! + {0} will be replaced by max number of games, {1} will be replaced by name of the configuration property + + + Ignoring WCF command because --client wasn't specified: {0} + {0} will be replaced by WCF command + + WCF service could not be started because of AddressAccessDeniedException! If you want to use WCF service provided by ASF, consider starting ASF as administrator, or giving proper permissions! @@ -291,6 +359,10 @@ StackTrace: WCF server ready! + + WCF response received: {0} + {0} will be replaced by WCF response + Sending command: {0} to WCF server on {1}... {0} will be replaced by WCF command, {1} will be replaced by WCF hostname diff --git a/ArchiSteamFarm/MobileAuthenticator.cs b/ArchiSteamFarm/MobileAuthenticator.cs index 2bb35d019..bfa9ef3fb 100644 --- a/ArchiSteamFarm/MobileAuthenticator.cs +++ b/ArchiSteamFarm/MobileAuthenticator.cs @@ -30,6 +30,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using ArchiSteamFarm.JSON; +using ArchiSteamFarm.Localization; using HtmlAgilityPack; using Newtonsoft.Json; @@ -84,7 +85,7 @@ namespace ArchiSteamFarm { } if (!HasCorrectDeviceID) { - Bot.ArchiLogger.LogGenericWarning("Can't execute properly due to invalid DeviceID!"); + Bot.ArchiLogger.LogGenericError(Strings.ErrorMobileAuthenticatorInvalidDeviceID); return null; } @@ -110,7 +111,7 @@ namespace ArchiSteamFarm { internal async Task> GetConfirmations() { if (!HasCorrectDeviceID) { - Bot.ArchiLogger.LogGenericWarning("Can't execute properly due to invalid DeviceID!"); + Bot.ArchiLogger.LogGenericError(Strings.ErrorMobileAuthenticatorInvalidDeviceID); return null; } @@ -174,7 +175,7 @@ namespace ArchiSteamFarm { } else if (description.StartsWith("Trade with ", StringComparison.Ordinal)) { type = Steam.ConfirmationDetails.EType.Trade; } else { - Bot.ArchiLogger.LogGenericWarning("Received unknown confirmation type, please report this: " + description); + Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningMobileAuthenticatorUnknownConfirmationType, description)); type = Steam.ConfirmationDetails.EType.Other; } @@ -191,7 +192,7 @@ namespace ArchiSteamFarm { } if (!HasCorrectDeviceID) { - Bot.ArchiLogger.LogGenericWarning("Can't execute properly due to invalid DeviceID!"); + Bot.ArchiLogger.LogGenericError(Strings.ErrorMobileAuthenticatorInvalidDeviceID); return false; } diff --git a/ArchiSteamFarm/Program.cs b/ArchiSteamFarm/Program.cs index dd0fdfef6..1aeae839c 100644 --- a/ArchiSteamFarm/Program.cs +++ b/ArchiSteamFarm/Program.cs @@ -60,13 +60,13 @@ namespace ArchiSteamFarm { Environment.Exit(exitCode); } - internal static string GetUserInput(ASF.EUserInputType userInputType, string botName = SharedInfo.ASF, string extraInformation = null) { + internal static string GetUserInput(ASF.EUserInputType userInputType, string botName = SharedInfo.ASF) { if (userInputType == ASF.EUserInputType.Unknown) { return null; } if (GlobalConfig.Headless || !Runtime.IsUserInteractive) { - ArchiLogger.LogGenericWarning("Received a request for user input, but process is running in headless mode!"); + ArchiLogger.LogGenericWarning(Strings.ErrorUserInputRunningInHeadlessMode); return null; } @@ -75,38 +75,28 @@ namespace ArchiSteamFarm { Logging.OnUserInputStart(); switch (userInputType) { case ASF.EUserInputType.DeviceID: - Console.Write("<" + botName + "> Please enter your Device ID (including \"android:\"): "); + Console.Write(string.Join(Strings.UserInputDeviceID, botName)); break; case ASF.EUserInputType.Login: - Console.Write("<" + botName + "> Please enter your login: "); + Console.Write(string.Join(Strings.UserInputSteamLogin, botName)); break; case ASF.EUserInputType.Password: - Console.Write("<" + botName + "> Please enter your password: "); - break; - case ASF.EUserInputType.PhoneNumber: - Console.Write("<" + botName + "> Please enter your full phone number (e.g. +1234567890): "); - break; - case ASF.EUserInputType.SMS: - Console.Write("<" + botName + "> Please enter SMS code sent on your mobile: "); + Console.Write(string.Join(Strings.UserInputSteamPassword, botName)); break; case ASF.EUserInputType.SteamGuard: - Console.Write("<" + botName + "> Please enter the auth code sent to your email: "); + Console.Write(string.Join(Strings.UserInputSteamGuard, botName)); break; case ASF.EUserInputType.SteamParentalPIN: - Console.Write("<" + botName + "> Please enter steam parental PIN: "); - break; - case ASF.EUserInputType.RevocationCode: - Console.WriteLine("<" + botName + "> PLEASE WRITE DOWN YOUR REVOCATION CODE: " + extraInformation); - Console.Write("<" + botName + "> Hit enter once ready..."); + Console.Write(string.Join(Strings.UserInputSteamParentalPIN, botName)); break; case ASF.EUserInputType.TwoFactorAuthentication: - Console.Write("<" + botName + "> Please enter your 2 factor auth code from your authenticator app: "); + Console.Write(string.Join(Strings.UserInputSteam2FA, botName)); break; case ASF.EUserInputType.WCFHostname: - Console.Write("<" + botName + "> Please enter your WCF host: "); + Console.Write(string.Join(Strings.UserInputWCFHost, botName)); break; default: - Console.Write("<" + botName + "> Please enter not documented yet value of \"" + userInputType + "\": "); + Console.Write(string.Join(Strings.UserInputUnknown, botName, userInputType)); break; } @@ -137,14 +127,6 @@ namespace ArchiSteamFarm { Environment.Exit(0); } - internal static void Shutdown() { - if (!InitShutdownSequence()) { - return; - } - - ShutdownResetEvent.Set(); - } - private static async Task Init(string[] args) { AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; TaskScheduler.UnobservedTaskException += UnobservedTaskExceptionHandler; @@ -179,7 +161,7 @@ namespace ArchiSteamFarm { ArchiLogger.LogGenericInfo("ASF V" + SharedInfo.Version); if (!Runtime.IsRuntimeSupported) { - ArchiLogger.LogGenericError("ASF detected unsupported runtime version, program might NOT run correctly in current environment. You're running it at your own risk!"); + ArchiLogger.LogGenericError(Strings.WarningRuntimeUnsupported); Thread.Sleep(10000); } @@ -218,7 +200,7 @@ namespace ArchiSteamFarm { GlobalConfig = GlobalConfig.Load(globalConfigFile); if (GlobalConfig == null) { - ArchiLogger.LogGenericError("Global config could not be loaded, please make sure that " + globalConfigFile + " exists and is valid! Did you forget to read wiki?"); + ArchiLogger.LogGenericError(string.Format(Strings.ErrorGlobalConfigNotLoaded, globalConfigFile)); Thread.Sleep(5000); Exit(1); } @@ -227,7 +209,7 @@ namespace ArchiSteamFarm { GlobalDatabase = GlobalDatabase.Load(globalDatabaseFile); if (GlobalDatabase == null) { - ArchiLogger.LogGenericError("Global database could not be loaded, if issue persists, please remove " + globalDatabaseFile + " in order to recreate database!"); + ArchiLogger.LogGenericError(string.Format(Strings.ErrorGlobalDatabaseNotLoaded, globalDatabaseFile)); Thread.Sleep(5000); Exit(1); } @@ -301,11 +283,13 @@ namespace ArchiSteamFarm { } if (!Mode.HasFlag(EMode.Client)) { - ArchiLogger.LogGenericWarning("Ignoring command because --client wasn't specified: " + arg); + ArchiLogger.LogGenericWarning(string.Format(Strings.WarningWCFIgnoringCommand, arg)); break; } - ArchiLogger.LogGenericInfo("Response received: " + WCF.SendCommand(arg)); + string response = WCF.SendCommand(arg); + + ArchiLogger.LogGenericInfo(string.Join(Strings.WCFResponseReceived, response)); break; } } @@ -339,6 +323,14 @@ namespace ArchiSteamFarm { } } + private static void Shutdown() { + if (!InitShutdownSequence()) { + return; + } + + ShutdownResetEvent.Set(); + } + private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs args) { if (args?.ExceptionObject == null) { ArchiLogger.LogNullError(nameof(args) + " || " + nameof(args.ExceptionObject)); diff --git a/ArchiSteamFarm/Runtime.cs b/ArchiSteamFarm/Runtime.cs index db4fcdac1..03fd04b76 100644 --- a/ArchiSteamFarm/Runtime.cs +++ b/ArchiSteamFarm/Runtime.cs @@ -53,7 +53,7 @@ namespace ArchiSteamFarm { return true; } - Program.ArchiLogger.LogGenericWarning(string.Format(Strings.RuntimeVersionTooOld, "Mono")); + Program.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningRuntimeVersionTooOld, "Mono")); Program.ArchiLogger.LogGenericWarning(string.Format(Strings.RuntimeVersionComparison, minMonoVersion, monoVersion)); _IsRuntimeSupported = false; return false; @@ -74,7 +74,7 @@ namespace ArchiSteamFarm { return true; } - Program.ArchiLogger.LogGenericWarning(string.Format(Strings.RuntimeVersionTooOld, ".NET")); + Program.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningRuntimeVersionTooOld, ".NET")); Program.ArchiLogger.LogGenericWarning(string.Format(Strings.RuntimeVersionComparison, minNetVersion, netVersion)); _IsRuntimeSupported = false; return false; diff --git a/ArchiSteamFarm/WCF.cs b/ArchiSteamFarm/WCF.cs index e80cb968e..c2363f7ca 100644 --- a/ArchiSteamFarm/WCF.cs +++ b/ArchiSteamFarm/WCF.cs @@ -135,7 +135,7 @@ namespace ArchiSteamFarm { Program.ArchiLogger.LogGenericInfo(Strings.WCFReady); } catch (AddressAccessDeniedException) { - Program.ArchiLogger.LogGenericError(Strings.WCFAddressAccessDeniedException); + Program.ArchiLogger.LogGenericError(Strings.ErrorWCFAddressAccessDeniedException); } catch (Exception e) { Program.ArchiLogger.LogGenericException(e); }