From b2b11fe8072b16c17830d80829c2bc78746e68ed Mon Sep 17 00:00:00 2001 From: JustArchi Date: Fri, 6 Jan 2017 13:20:36 +0100 Subject: [PATCH] Localizing... --- ArchiSteamFarm.sln.DotSettings | 1 + ArchiSteamFarm/ASF.cs | 48 ++-- ArchiSteamFarm/ArchiLogger.cs | 8 +- ArchiSteamFarm/ArchiWebHandler.cs | 40 +-- ArchiSteamFarm/Bot.cs | 2 +- .../Localization/Strings.Designer.cs | 238 +++++++++++++++++- ArchiSteamFarm/Localization/Strings.pl.resx | 2 +- ArchiSteamFarm/Localization/Strings.resx | 91 ++++++- ArchiSteamFarm/Program.cs | 5 + 9 files changed, 386 insertions(+), 49 deletions(-) diff --git a/ArchiSteamFarm.sln.DotSettings b/ArchiSteamFarm.sln.DotSettings index 798f42643..963d01188 100644 --- a/ArchiSteamFarm.sln.DotSettings +++ b/ArchiSteamFarm.sln.DotSettings @@ -338,6 +338,7 @@ WCF WTF XML + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="I" Suffix="" Style="AaBb" /></Policy> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="_" Suffix="" Style="AaBb" /><ExtraRule Prefix="_" Suffix="" Style="aaBb" /></Policy> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="_" Suffix="" Style="AaBb" /><ExtraRule Prefix="_" Suffix="" Style="aaBb" /></Policy> True diff --git a/ArchiSteamFarm/ASF.cs b/ArchiSteamFarm/ASF.cs index c4fe25697..5c74b813a 100644 --- a/ArchiSteamFarm/ASF.cs +++ b/ArchiSteamFarm/ASF.cs @@ -31,9 +31,11 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; using ArchiSteamFarm.JSON; +using ArchiSteamFarm.Localization; namespace ArchiSteamFarm { internal static class ASF { + private const byte AutoUpdatePeriodInHours = 24; private static readonly ConcurrentDictionary LastWriteTimes = new ConcurrentDictionary(); private static Timer AutoUpdatesTimer; @@ -57,7 +59,7 @@ namespace ArchiSteamFarm { File.Delete(oldExeFile); } catch (Exception e) { Program.ArchiLogger.LogGenericException(e); - Program.ArchiLogger.LogGenericError("Could not remove old ASF binary, please remove " + oldExeFile + " manually in order for update function to work!"); + Program.ArchiLogger.LogGenericError(string.Format(Strings.ErrorRemovingOldBinary, oldExeFile)); } } @@ -69,11 +71,11 @@ namespace ArchiSteamFarm { AutoUpdatesTimer = new Timer( async e => await CheckForUpdate().ConfigureAwait(false), null, - TimeSpan.FromDays(1), // Delay - TimeSpan.FromDays(1) // Period + TimeSpan.FromHours(AutoUpdatePeriodInHours), // Delay + TimeSpan.FromHours(AutoUpdatePeriodInHours) // Period ); - Program.ArchiLogger.LogGenericInfo("ASF will automatically check for new versions every 24 hours"); + Program.ArchiLogger.LogGenericInfo(string.Format(Strings.AutoUpdateCheckInfo, AutoUpdatePeriodInHours)); } string releaseURL = SharedInfo.GithubReleaseURL; @@ -81,20 +83,20 @@ namespace ArchiSteamFarm { releaseURL += "/latest"; } - Program.ArchiLogger.LogGenericInfo("Checking new version..."); + Program.ArchiLogger.LogGenericInfo(Strings.UpdateCheckingNewVersion); GitHub.ReleaseResponse releaseResponse; if (Program.GlobalConfig.UpdateChannel == GlobalConfig.EUpdateChannel.Stable) { releaseResponse = await Program.WebBrowser.UrlGetToJsonResultRetry(releaseURL).ConfigureAwait(false); if (releaseResponse == null) { - Program.ArchiLogger.LogGenericWarning("Could not check latest version!"); + Program.ArchiLogger.LogGenericWarning(Strings.ErrorUpdateCheckFailed); return; } } else { List releases = await Program.WebBrowser.UrlGetToJsonResultRetry>(releaseURL).ConfigureAwait(false); if ((releases == null) || (releases.Count == 0)) { - Program.ArchiLogger.LogGenericWarning("Could not check latest version!"); + Program.ArchiLogger.LogGenericWarning(Strings.ErrorUpdateCheckFailed); return; } @@ -102,33 +104,32 @@ namespace ArchiSteamFarm { } if (string.IsNullOrEmpty(releaseResponse.Tag)) { - Program.ArchiLogger.LogGenericWarning("Could not check latest version!"); + Program.ArchiLogger.LogGenericWarning(Strings.ErrorUpdateCheckFailed); return; } Version newVersion = new Version(releaseResponse.Tag); - Program.ArchiLogger.LogGenericInfo("Local version: " + SharedInfo.Version + " | Remote version: " + newVersion); + Program.ArchiLogger.LogGenericInfo(string.Format(Strings.UpdateVersionInfo, SharedInfo.Version, newVersion)); if (SharedInfo.Version.CompareTo(newVersion) >= 0) { // If local version is the same or newer than remote version return; } if (!updateOverride && !Program.GlobalConfig.AutoUpdates) { - Program.ArchiLogger.LogGenericInfo("New version is available!"); - Program.ArchiLogger.LogGenericInfo("Consider updating yourself!"); + Program.ArchiLogger.LogGenericInfo(Strings.UpdateNewVersionAvailable); await Task.Delay(5000).ConfigureAwait(false); return; } if (File.Exists(oldExeFile)) { - Program.ArchiLogger.LogGenericWarning("Refusing to proceed with auto update as old " + oldExeFile + " binary could not be removed, please remove it manually"); + Program.ArchiLogger.LogGenericError(string.Format(Strings.ErrorRemovingOldBinary, oldExeFile)); return; } // Auto update logic starts here if (releaseResponse.Assets == null) { - Program.ArchiLogger.LogGenericWarning("Could not proceed with update because that version doesn't include assets!"); + Program.ArchiLogger.LogGenericWarning(Strings.ErrorUpdateNoAssets); return; } @@ -136,17 +137,16 @@ namespace ArchiSteamFarm { GitHub.ReleaseResponse.Asset binaryAsset = releaseResponse.Assets.FirstOrDefault(asset => !string.IsNullOrEmpty(asset.Name) && asset.Name.Equals(exeFileName, StringComparison.OrdinalIgnoreCase)); if (binaryAsset == null) { - Program.ArchiLogger.LogGenericWarning("Could not proceed with update because there is no asset that relates to currently running binary!"); + Program.ArchiLogger.LogGenericWarning(Strings.ErrorUpdateNoAssetForThisBinary); return; } if (string.IsNullOrEmpty(binaryAsset.DownloadURL)) { - Program.ArchiLogger.LogGenericWarning("Could not proceed with update because download URL is empty!"); + Program.ArchiLogger.LogNullError(nameof(binaryAsset.DownloadURL)); return; } - Program.ArchiLogger.LogGenericInfo("Downloading new version..."); - Program.ArchiLogger.LogGenericInfo("While waiting, consider donating if you appreciate the work being done :)"); + Program.ArchiLogger.LogGenericInfo(Strings.UpdateDownloadingNewVersion); byte[] result = await Program.WebBrowser.UrlGetToBytesRetry(binaryAsset.DownloadURL).ConfigureAwait(false); if (result == null) { @@ -192,7 +192,7 @@ namespace ArchiSteamFarm { return; } - Program.ArchiLogger.LogGenericInfo("Update process finished!"); + Program.ArchiLogger.LogGenericInfo(Strings.UpdateFinished); await RestartOrExit().ConfigureAwait(false); } @@ -216,7 +216,7 @@ namespace ArchiSteamFarm { } if (Bot.Bots.Count == 0) { - Program.ArchiLogger.LogGenericWarning("No bots are defined, did you forget to configure your ASF?"); + Program.ArchiLogger.LogGenericWarning(Strings.ErrorNoBotsDefined); } } @@ -269,7 +269,7 @@ namespace ArchiSteamFarm { } if (botName.Equals(SharedInfo.ASF)) { - Program.ArchiLogger.LogGenericWarning("Global config file has been changed!"); + Program.ArchiLogger.LogGenericWarning(Strings.GlobalConfigChanged); await RestartOrExit().ConfigureAwait(false); return; } @@ -335,7 +335,7 @@ namespace ArchiSteamFarm { } if (botName.Equals(SharedInfo.ASF)) { - Program.ArchiLogger.LogGenericError("Global config file has been removed, exiting..."); + Program.ArchiLogger.LogGenericError(Strings.GlobalConfigRemoved); Program.Exit(1); return; } @@ -358,7 +358,7 @@ namespace ArchiSteamFarm { } if (oldBotName.Equals(SharedInfo.ASF)) { - Program.ArchiLogger.LogGenericError("Global config file has been renamed, exiting..."); + Program.ArchiLogger.LogGenericError(Strings.GlobalConfigRemoved); Program.Exit(1); return; } @@ -378,11 +378,11 @@ namespace ArchiSteamFarm { private static async Task RestartOrExit() { if (Program.GlobalConfig.AutoRestart) { - Program.ArchiLogger.LogGenericInfo("Restarting..."); + Program.ArchiLogger.LogGenericInfo(Strings.Restarting); await Task.Delay(5000).ConfigureAwait(false); Program.Restart(); } else { - Program.ArchiLogger.LogGenericInfo("Exiting..."); + Program.ArchiLogger.LogGenericInfo(Strings.Exiting); await Task.Delay(5000).ConfigureAwait(false); Program.Exit(); } diff --git a/ArchiSteamFarm/ArchiLogger.cs b/ArchiSteamFarm/ArchiLogger.cs index 75005942b..00efba287 100644 --- a/ArchiSteamFarm/ArchiLogger.cs +++ b/ArchiSteamFarm/ArchiLogger.cs @@ -26,6 +26,7 @@ using System; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Runtime.CompilerServices; +using ArchiSteamFarm.Localization; using NLog; namespace ArchiSteamFarm { @@ -40,7 +41,6 @@ namespace ArchiSteamFarm { Logger = LogManager.GetLogger(name); } - [SuppressMessage("ReSharper", "LocalizableElement")] internal void LogFatalException(Exception exception, [CallerMemberName] string previousMethodName = null) { if (exception == null) { LogNullError(nameof(exception)); @@ -55,10 +55,10 @@ namespace ArchiSteamFarm { } // Otherwise, if we run into fatal exception before logging module is even initialized, write exception to classic log file - File.WriteAllText(SharedInfo.LogFile, DateTime.Now + " ASF V" + SharedInfo.Version + " has run into fatal exception before core logging module was even able to initialize!" + Environment.NewLine); + File.WriteAllText(SharedInfo.LogFile, string.Format(DateTime.Now + Strings.ErrorEarlyFatalExceptionInfo + Environment.NewLine, SharedInfo.Version)); while (true) { - File.AppendAllText(SharedInfo.LogFile, "[!] EXCEPTION: " + previousMethodName + "() " + exception.Message + Environment.NewLine + "StackTrace:" + Environment.NewLine + exception.StackTrace); + File.AppendAllText(SharedInfo.LogFile, string.Format(Strings.ErrorEarlyFatalExceptionPrint, previousMethodName, exception.Message, exception.StackTrace)); if (exception.InnerException != null) { exception = exception.InnerException; continue; @@ -137,7 +137,7 @@ namespace ArchiSteamFarm { return; } - LogGenericError(nullObjectName + " is null!", previousMethodName); + LogGenericError(string.Format(Strings.ErrorObjectIsNull, nullObjectName), previousMethodName); } } } \ No newline at end of file diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index e0e912a79..54a71fa0a 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -31,6 +31,7 @@ using System.Threading; using System.Threading.Tasks; using System.Xml; using ArchiSteamFarm.JSON; +using ArchiSteamFarm.Localization; using HtmlAgilityPack; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -39,6 +40,11 @@ using Formatting = Newtonsoft.Json.Formatting; namespace ArchiSteamFarm { internal sealed class ArchiWebHandler : IDisposable { + private const string IEconService = "IEconService"; + private const string IPlayerService = "IPlayerService"; + private const string ISteamUserAuth = "ISteamUserAuth"; + private const string ITwoFactorService = "ITwoFactorService"; + private const byte MinSessionTTL = GlobalConfig.DefaultHttpTimeout / 4; // Assume session is valid for at least that amount of seconds // We must use HTTPS for SteamCommunity, as http would make certain POST requests failing (trades) @@ -162,7 +168,7 @@ namespace ArchiSteamFarm { KeyValue response = null; for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) { - using (dynamic iEconService = WebAPI.GetInterface("IEconService", Bot.BotConfig.SteamApiKey)) { + using (dynamic iEconService = WebAPI.GetInterface(IEconService, Bot.BotConfig.SteamApiKey)) { iEconService.Timeout = Timeout; try { @@ -178,7 +184,7 @@ namespace ArchiSteamFarm { } if (response == null) { - Bot.ArchiLogger.LogGenericWarning("Request failed even after " + WebBrowser.MaxRetries + " tries"); + Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxRetries)); } } @@ -213,7 +219,7 @@ namespace ArchiSteamFarm { KeyValue response = null; for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) { - using (dynamic iEconService = WebAPI.GetInterface("IEconService", Bot.BotConfig.SteamApiKey)) { + using (dynamic iEconService = WebAPI.GetInterface(IEconService, Bot.BotConfig.SteamApiKey)) { iEconService.Timeout = Timeout; try { @@ -230,7 +236,7 @@ namespace ArchiSteamFarm { } if (response == null) { - Bot.ArchiLogger.LogGenericWarning("Request failed even after " + WebBrowser.MaxRetries + " tries"); + Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxRetries)); return null; } @@ -296,7 +302,7 @@ namespace ArchiSteamFarm { List itemsToGive = trade["items_to_give"].Children; if (itemsToGive.Count > 0) { if (!ParseItems(descriptions, itemsToGive, tradeOffer.ItemsToGive)) { - Bot.ArchiLogger.LogGenericError("Parsing " + nameof(itemsToGive) + " failed!"); + Bot.ArchiLogger.LogGenericError(string.Format(Strings.ErrorParsingObject, nameof(itemsToGive))); return null; } } @@ -304,7 +310,7 @@ namespace ArchiSteamFarm { List itemsToReceive = trade["items_to_receive"].Children; if (itemsToReceive.Count > 0) { if (!ParseItems(descriptions, itemsToReceive, tradeOffer.ItemsToReceive)) { - Bot.ArchiLogger.LogGenericError("Parsing " + nameof(itemsToReceive) + " failed!"); + Bot.ArchiLogger.LogGenericError(string.Format(Strings.ErrorParsingObject, nameof(itemsToReceive))); return null; } } @@ -596,7 +602,7 @@ namespace ArchiSteamFarm { KeyValue response = null; for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) { - using (dynamic iPlayerService = WebAPI.GetInterface("IPlayerService", Bot.BotConfig.SteamApiKey)) { + using (dynamic iPlayerService = WebAPI.GetInterface(IPlayerService, Bot.BotConfig.SteamApiKey)) { iPlayerService.Timeout = Timeout; try { @@ -612,7 +618,7 @@ namespace ArchiSteamFarm { } if (response == null) { - Bot.ArchiLogger.LogGenericWarning("Request failed even after " + WebBrowser.MaxRetries + " tries"); + Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxRetries)); return null; } @@ -633,7 +639,7 @@ namespace ArchiSteamFarm { internal uint GetServerTime() { KeyValue response = null; for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) { - using (dynamic iTwoFactorService = WebAPI.GetInterface("ITwoFactorService")) { + using (dynamic iTwoFactorService = WebAPI.GetInterface(ITwoFactorService)) { iTwoFactorService.Timeout = Timeout; try { @@ -651,7 +657,7 @@ namespace ArchiSteamFarm { return response["server_time"].AsUnsignedInteger(); } - Bot.ArchiLogger.LogGenericWarning("Request failed even after " + WebBrowser.MaxRetries + " tries"); + Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, WebBrowser.MaxRetries)); return 0; } @@ -792,10 +798,10 @@ namespace ArchiSteamFarm { byte[] cryptedLoginKey = SteamKit2.CryptoHelper.SymmetricEncrypt(loginKey, sessionKey); // Do the magic - Bot.ArchiLogger.LogGenericInfo("Logging in to ISteamUserAuth..."); + Bot.ArchiLogger.LogGenericInfo(string.Format(Strings.LoggingIn, ISteamUserAuth)); KeyValue authResult; - using (dynamic iSteamUserAuth = WebAPI.GetInterface("ISteamUserAuth")) { + using (dynamic iSteamUserAuth = WebAPI.GetInterface(ISteamUserAuth)) { iSteamUserAuth.Timeout = Timeout; try { @@ -838,7 +844,7 @@ namespace ArchiSteamFarm { WebBrowser.CookieContainer.Add(new Cookie("steamLoginSecure", steamLoginSecure, "/", "." + SteamCommunityHost)); WebBrowser.CookieContainer.Add(new Cookie("steamLoginSecure", steamLoginSecure, "/", "." + SteamStoreHost)); - Bot.ArchiLogger.LogGenericInfo("Success!"); + Bot.ArchiLogger.LogGenericInfo(Strings.Success); // Unlock Steam Parental if needed if (!parentalPin.Equals("0")) { @@ -1104,7 +1110,7 @@ namespace ArchiSteamFarm { LastSessionRefreshCheck = DateTime.Now; return true; } else { - Bot.ArchiLogger.LogGenericInfo("Refreshing our session!"); + Bot.ArchiLogger.LogGenericInfo(Strings.RefreshingOurSession); return await Bot.RefreshSession().ConfigureAwait(false); } } finally { @@ -1118,7 +1124,7 @@ namespace ArchiSteamFarm { return false; } - Bot.ArchiLogger.LogGenericInfo("Unlocking parental account..."); + Bot.ArchiLogger.LogGenericInfo(Strings.UnlockingParentalAccount); const string request = SteamCommunityURL + "/parental/ajaxunlock"; Dictionary data = new Dictionary(1) { @@ -1127,11 +1133,11 @@ namespace ArchiSteamFarm { bool result = await WebBrowser.UrlPostRetry(request, data, SteamCommunityURL).ConfigureAwait(false); if (!result) { - Bot.ArchiLogger.LogGenericInfo("Failed!"); + Bot.ArchiLogger.LogGenericInfo(Strings.Failed); return false; } - Bot.ArchiLogger.LogGenericInfo("Success!"); + Bot.ArchiLogger.LogGenericInfo(Strings.Success); return true; } } diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 85cd1a163..476c8afd4 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -2571,7 +2571,7 @@ namespace ArchiSteamFarm { if (!KeepRunning) { KeepRunning = true; Task.Run(() => HandleCallbacks()).Forget(); - ArchiLogger.LogGenericInfo(Strings.Starting + "..."); + ArchiLogger.LogGenericInfo(Strings.Starting); } await Connect().ConfigureAwait(false); diff --git a/ArchiSteamFarm/Localization/Strings.Designer.cs b/ArchiSteamFarm/Localization/Strings.Designer.cs index 8591a8e0d..cd9e45ccc 100644 --- a/ArchiSteamFarm/Localization/Strings.Designer.cs +++ b/ArchiSteamFarm/Localization/Strings.Designer.cs @@ -61,12 +61,248 @@ namespace ArchiSteamFarm.Localization { } /// - /// Looks up a localized string similar to Starting. + /// Looks up a localized string similar to ASF will automatically check for new versions every {0} hours.. + /// + internal static string AutoUpdateCheckInfo { + get { + return ResourceManager.GetString("AutoUpdateCheckInfo", 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!. + /// + internal static string ErrorEarlyFatalExceptionInfo { + get { + return ResourceManager.GetString("ErrorEarlyFatalExceptionInfo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Exception: {0}() {1} + ///StackTrace: + ///{2}. + /// + internal static string ErrorEarlyFatalExceptionPrint { + get { + return ResourceManager.GetString("ErrorEarlyFatalExceptionPrint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Exiting with non-zero error code!. + /// + internal static string ErrorExitingWithNonZeroErrorCode { + get { + return ResourceManager.GetString("ErrorExitingWithNonZeroErrorCode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No bots are defined, did you forget to configure your ASF?. + /// + internal static string ErrorNoBotsDefined { + get { + return ResourceManager.GetString("ErrorNoBotsDefined", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is null!. + /// + internal static string ErrorObjectIsNull { + get { + return ResourceManager.GetString("ErrorObjectIsNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parsing {0} failed!. + /// + internal static string ErrorParsingObject { + get { + return ResourceManager.GetString("ErrorParsingObject", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not remove old ASF binary, please remove {0} manually in order for update function to work!. + /// + internal static string ErrorRemovingOldBinary { + get { + return ResourceManager.GetString("ErrorRemovingOldBinary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Request failed despite of {0} tries!. + /// + internal static string ErrorRequestFailedTooManyTimes { + get { + return ResourceManager.GetString("ErrorRequestFailedTooManyTimes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not check latest version!. + /// + internal static string ErrorUpdateCheckFailed { + get { + return ResourceManager.GetString("ErrorUpdateCheckFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not proceed with update because there is no asset that relates to currently running binary! Please ensure that your ASF binary is named appropriately!. + /// + internal static string ErrorUpdateNoAssetForThisBinary { + get { + return ResourceManager.GetString("ErrorUpdateNoAssetForThisBinary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not proceed with an update because that version doesn't include any assets!. + /// + internal static string ErrorUpdateNoAssets { + get { + return ResourceManager.GetString("ErrorUpdateNoAssets", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Exiting.... + /// + internal static string Exiting { + get { + return ResourceManager.GetString("Exiting", resourceCulture); + } + } + + /// + /// 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!. + /// + internal static string GlobalConfigChanged { + get { + return ResourceManager.GetString("GlobalConfigChanged", resourceCulture); + } + } + + /// + /// 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 Logging in to {0}.... + /// + internal static string LoggingIn { + get { + return ResourceManager.GetString("LoggingIn", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Refreshing our session!. + /// + internal static string RefreshingOurSession { + get { + return ResourceManager.GetString("RefreshingOurSession", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Restarting.... + /// + internal static string Restarting { + get { + return ResourceManager.GetString("Restarting", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting.... /// internal static string Starting { get { return ResourceManager.GetString("Starting", resourceCulture); } } + + /// + /// Looks up a localized string similar to Success!. + /// + internal static string Success { + get { + return ResourceManager.GetString("Success", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unlocking parental account.... + /// + internal static string UnlockingParentalAccount { + get { + return ResourceManager.GetString("UnlockingParentalAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Checking for new version.... + /// + internal static string UpdateCheckingNewVersion { + get { + return ResourceManager.GetString("UpdateCheckingNewVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Downloading new version... While waiting, consider donating if you appreciate the work being done! :). + /// + internal static string UpdateDownloadingNewVersion { + get { + return ResourceManager.GetString("UpdateDownloadingNewVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Update process finished!. + /// + internal static string UpdateFinished { + get { + return ResourceManager.GetString("UpdateFinished", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to New ASF version is available! Consider updating yourself!. + /// + internal static string UpdateNewVersionAvailable { + get { + return ResourceManager.GetString("UpdateNewVersionAvailable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Local version: {0} | Remote version: {1}. + /// + internal static string UpdateVersionInfo { + get { + return ResourceManager.GetString("UpdateVersionInfo", resourceCulture); + } + } } } diff --git a/ArchiSteamFarm/Localization/Strings.pl.resx b/ArchiSteamFarm/Localization/Strings.pl.resx index 4050f235b..472fb76ac 100644 --- a/ArchiSteamFarm/Localization/Strings.pl.resx +++ b/ArchiSteamFarm/Localization/Strings.pl.resx @@ -118,6 +118,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Startowanie + Startowanie... \ No newline at end of file diff --git a/ArchiSteamFarm/Localization/Strings.resx b/ArchiSteamFarm/Localization/Strings.resx index 91ca6111e..ebbf66eb7 100644 --- a/ArchiSteamFarm/Localization/Strings.resx +++ b/ArchiSteamFarm/Localization/Strings.resx @@ -117,7 +117,96 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ASF will automatically check for new versions every {0} hours. + {0} will be replaced by number of hours + + + ASF V{0} has run into fatal exception before core logging module was even able to initialize! + {0} will be replaced by version number + + + Exception: {0}() {1} +StackTrace: +{2} + {0} will be replaced by function name, {1} will be replaced by exception message, {2} will be replaced by entire stack trace. Please note that this string should include newlines for formatting. + + + Exiting with non-zero error code! + + + No bots are defined, did you forget to configure your ASF? + + + {0} is null! + {0} will be replaced by object's name + + + Parsing {0} failed! + {0} will be replaced by object's name + + + 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 + + + Request failed despite of {0} tries! + {0} will be replaced by maximum number of tries + + + Could not check latest version! + + + Could not proceed with update because there is no asset that relates to currently running binary! Please ensure that your ASF binary is named appropriately! + + + Could not proceed with an update because that version doesn't include any assets! + + + Exiting... + + + Failed! + + + Global config file has been changed! + + + Global config file has been removed! + + + Logging in to {0}... + {0} will be replaced by service's name + + + Refreshing our session! + + + Restarting... + - Starting + Starting... + + + Success! + + + Unlocking parental account... + + + Checking for new version... + + + Downloading new version... While waiting, consider donating if you appreciate the work being done! :) + + + Update process finished! + + + New ASF version is available! Consider updating yourself! + + + Local version: {0} | Remote version: {1} + {0} will be replaced by current version, {1} will be replaced by remote version \ No newline at end of file diff --git a/ArchiSteamFarm/Program.cs b/ArchiSteamFarm/Program.cs index b60b01f7b..becae8673 100644 --- a/ArchiSteamFarm/Program.cs +++ b/ArchiSteamFarm/Program.cs @@ -31,6 +31,7 @@ using System.Reflection; using System.ServiceProcess; using System.Threading; using System.Threading.Tasks; +using ArchiSteamFarm.Localization; using SteamKit2; namespace ArchiSteamFarm { @@ -51,6 +52,10 @@ namespace ArchiSteamFarm { private static bool ShutdownSequenceInitialized; internal static void Exit(byte exitCode = 0) { + if (exitCode != 0) { + ArchiLogger.LogGenericError(Strings.ErrorNonZeroErrorCode); + } + Shutdown(); Environment.Exit(exitCode); }