From 28e2cfbc7cf2ef42e12989cc8c241148a62dfacd Mon Sep 17 00:00:00 2001 From: JustArchi Date: Fri, 6 Jan 2017 15:32:12 +0100 Subject: [PATCH] Localizing... --- .../Localization/Strings.Designer.cs | 217 ++++++++++++++++++ ArchiSteamFarm/Localization/Strings.resx | 90 ++++++++ ArchiSteamFarm/Runtime.cs | 17 +- ArchiSteamFarm/Trading.cs | 9 +- ArchiSteamFarm/Utilities.cs | 39 +--- ArchiSteamFarm/WCF.cs | 16 +- ArchiSteamFarm/WebBrowser.cs | 45 ++-- 7 files changed, 363 insertions(+), 70 deletions(-) diff --git a/ArchiSteamFarm/Localization/Strings.Designer.cs b/ArchiSteamFarm/Localization/Strings.Designer.cs index cd9e45ccc..1f3f1c95e 100644 --- a/ArchiSteamFarm/Localization/Strings.Designer.cs +++ b/ArchiSteamFarm/Localization/Strings.Designer.cs @@ -60,6 +60,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Accepting trade: {0}. + /// + internal static string AcceptingTrade { + get { + return ResourceManager.GetString("AcceptingTrade", resourceCulture); + } + } + /// /// Looks up a localized string similar to ASF will automatically check for new versions every {0} hours.. /// @@ -69,6 +78,16 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Content: + ///{0}. + /// + internal static string Content { + get { + return ResourceManager.GetString("Content", 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!. /// @@ -98,6 +117,24 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Request failing: {0}. + /// + internal static string ErrorFailingRequest { + get { + return ResourceManager.GetString("ErrorFailingRequest", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is invalid!. + /// + internal static string ErrorIsInvalid { + get { + return ResourceManager.GetString("ErrorIsInvalid", resourceCulture); + } + } + /// /// Looks up a localized string similar to No bots are defined, did you forget to configure your ASF?. /// @@ -170,6 +207,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Refusing to handle the request because SteamOwnerID is not set!. + /// + internal static string ErrorWCFAccessDenied { + get { + return ResourceManager.GetString("ErrorWCFAccessDenied", resourceCulture); + } + } + /// /// Looks up a localized string similar to Exiting.... /// @@ -206,6 +252,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Ignoring trade: {0}. + /// + internal static string IgnoringTrade { + get { + return ResourceManager.GetString("IgnoringTrade", resourceCulture); + } + } + /// /// Looks up a localized string similar to Logging in to {0}.... /// @@ -224,6 +279,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Rejecting trade: {0}. + /// + internal static string RejectingTrade { + get { + return ResourceManager.GetString("RejectingTrade", resourceCulture); + } + } + /// /// Looks up a localized string similar to Restarting.... /// @@ -233,6 +297,33 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Required version: {0} | Found version: {1}. + /// + internal static string RuntimeVersionComparison { + get { + return ResourceManager.GetString("RuntimeVersionComparison", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your {0} runtime version is OK.. + /// + internal static string RuntimeVersionOK { + get { + return ResourceManager.GetString("RuntimeVersionOK", resourceCulture); + } + } + + /// + /// 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.... /// @@ -242,6 +333,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Status code: {0}. + /// + internal static string StatusCode { + get { + return ResourceManager.GetString("StatusCode", resourceCulture); + } + } + /// /// Looks up a localized string similar to Success!. /// @@ -251,6 +351,78 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to 1 day. + /// + internal static string TimeSpanDay { + get { + return ResourceManager.GetString("TimeSpanDay", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} days. + /// + internal static string TimeSpanDays { + get { + return ResourceManager.GetString("TimeSpanDays", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1 hour. + /// + internal static string TimeSpanHour { + get { + return ResourceManager.GetString("TimeSpanHour", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} hours. + /// + internal static string TimeSpanHours { + get { + return ResourceManager.GetString("TimeSpanHours", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1 minute. + /// + internal static string TimeSpanMinute { + get { + return ResourceManager.GetString("TimeSpanMinute", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} minutes. + /// + internal static string TimeSpanMinutes { + get { + return ResourceManager.GetString("TimeSpanMinutes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1 second. + /// + internal static string TimeSpanSecond { + get { + return ResourceManager.GetString("TimeSpanSecond", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} seconds. + /// + internal static string TimeSpanSeconds { + get { + return ResourceManager.GetString("TimeSpanSeconds", resourceCulture); + } + } + /// /// Looks up a localized string similar to Unlocking parental account.... /// @@ -304,5 +476,50 @@ namespace ArchiSteamFarm.Localization { return ResourceManager.GetString("UpdateVersionInfo", resourceCulture); } } + + /// + /// 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 WCFAddressAccessDeniedException { + get { + return ResourceManager.GetString("WCFAddressAccessDeniedException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Answered to WCF command: {0} with: {1}. + /// + internal static string WCFAnswered { + get { + return ResourceManager.GetString("WCFAnswered", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WCF server ready!. + /// + internal static string WCFReady { + get { + return ResourceManager.GetString("WCFReady", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sending command: {0} to WCF server on {1}.... + /// + internal static string WCFSendingCommand { + get { + return ResourceManager.GetString("WCFSendingCommand", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting WCF server on {0}.... + /// + internal static string WCFStarting { + get { + return ResourceManager.GetString("WCFStarting", resourceCulture); + } + } } } diff --git a/ArchiSteamFarm/Localization/Strings.resx b/ArchiSteamFarm/Localization/Strings.resx index ebbf66eb7..70224387e 100644 --- a/ArchiSteamFarm/Localization/Strings.resx +++ b/ArchiSteamFarm/Localization/Strings.resx @@ -117,10 +117,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Accepting trade: {0} + {0} will be replaced by trade number + ASF will automatically check for new versions every {0} hours. {0} will be replaced by number of hours + + Content: +{0} + {0} will be replaced by content string. Please note that this string should include newline for formatting. + ASF V{0} has run into fatal exception before core logging module was even able to initialize! {0} will be replaced by version number @@ -134,6 +143,14 @@ StackTrace: Exiting with non-zero error code! + + Request failing: {0} + {0} will be replaced by URL of the request + + + {0} is invalid! + {0} will be replaced by object's name + No bots are defined, did you forget to configure your ASF? @@ -162,6 +179,9 @@ StackTrace: Could not proceed with an update because that version doesn't include any assets! + + Refusing to handle the request because SteamOwnerID is not set! + Exiting... @@ -174,6 +194,10 @@ StackTrace: Global config file has been removed! + + Ignoring trade: {0} + {0} will be replaced by trade number + Logging in to {0}... {0} will be replaced by service's name @@ -181,15 +205,63 @@ StackTrace: Refreshing our session! + + Rejecting trade: {0} + {0} will be replaced by trade number + Restarting... + + Required version: {0} | Found version: {1} + {0} will be replaced by required version, {1} will be replaced by current version + + + 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") + Starting... + + Status code: {0} + {0} will be replaced by status code number/name + Success! + + 1 day + + + {0} days + {0} will be replaced by number of days + + + 1 hour + + + {0} hours + {0} will be replaced by number of hours + + + 1 minute + + + {0} minutes + {0} will be replaced by number of minutes + + + 1 second + + + {0} seconds + {0} will be replaced by number of seconds + Unlocking parental account... @@ -209,4 +281,22 @@ StackTrace: Local version: {0} | Remote version: {1} {0} will be replaced by current version, {1} will be replaced by remote version + + 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! + + + Answered to WCF command: {0} with: {1} + {0} will be replaced by WCF command, {1} will be replaced by WCF answer + + + WCF server ready! + + + Sending command: {0} to WCF server on {1}... + {0} will be replaced by WCF command, {1} will be replaced by WCF hostname + + + Starting WCF server on {0}... + {0} will be replaced by WCF hostname + \ No newline at end of file diff --git a/ArchiSteamFarm/Runtime.cs b/ArchiSteamFarm/Runtime.cs index 0b32b7922..db4fcdac1 100644 --- a/ArchiSteamFarm/Runtime.cs +++ b/ArchiSteamFarm/Runtime.cs @@ -24,6 +24,7 @@ using System; using System.Reflection; +using ArchiSteamFarm.Localization; using Microsoft.Win32; namespace ArchiSteamFarm { @@ -46,12 +47,14 @@ namespace ArchiSteamFarm { Version minMonoVersion = new Version(4, 6); if (monoVersion >= minMonoVersion) { - Program.ArchiLogger.LogGenericInfo("Your Mono version is OK. Required: " + minMonoVersion + " | Found: " + monoVersion); + Program.ArchiLogger.LogGenericInfo(string.Format(Strings.RuntimeVersionOK, "Mono")); + Program.ArchiLogger.LogGenericInfo(string.Format(Strings.RuntimeVersionComparison, minMonoVersion, monoVersion)); _IsRuntimeSupported = true; return true; } - Program.ArchiLogger.LogGenericWarning("Your Mono version is too old. Required: " + minMonoVersion + " | Found: " + monoVersion); + Program.ArchiLogger.LogGenericWarning(string.Format(Strings.RuntimeVersionTooOld, "Mono")); + Program.ArchiLogger.LogGenericWarning(string.Format(Strings.RuntimeVersionComparison, minMonoVersion, monoVersion)); _IsRuntimeSupported = false; return false; } @@ -65,12 +68,14 @@ namespace ArchiSteamFarm { Version minNetVersion = new Version(4, 6, 1); if (netVersion >= minNetVersion) { - Program.ArchiLogger.LogGenericInfo("Your .NET version is OK. Required: " + minNetVersion + " | Found: " + netVersion); + Program.ArchiLogger.LogGenericInfo(string.Format(Strings.RuntimeVersionOK, ".NET")); + Program.ArchiLogger.LogGenericInfo(string.Format(Strings.RuntimeVersionComparison, minNetVersion, netVersion)); _IsRuntimeSupported = true; return true; } - Program.ArchiLogger.LogGenericWarning("Your .NET version is too old. Required: " + minNetVersion + " | Found: " + netVersion); + Program.ArchiLogger.LogGenericWarning(string.Format(Strings.RuntimeVersionTooOld, ".NET")); + Program.ArchiLogger.LogGenericWarning(string.Format(Strings.RuntimeVersionComparison, minNetVersion, netVersion)); _IsRuntimeSupported = false; return false; } @@ -160,7 +165,9 @@ namespace ArchiSteamFarm { } } - if (release >= 394747) { + // https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx + + if (release >= 394802) { return new Version(4, 6, 2); } diff --git a/ArchiSteamFarm/Trading.cs b/ArchiSteamFarm/Trading.cs index 85479b064..d74f626da 100644 --- a/ArchiSteamFarm/Trading.cs +++ b/ArchiSteamFarm/Trading.cs @@ -28,6 +28,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using ArchiSteamFarm.JSON; +using ArchiSteamFarm.Localization; namespace ArchiSteamFarm { internal sealed class Trading : IDisposable { @@ -128,7 +129,7 @@ namespace ArchiSteamFarm { } if (tradeOffer.State != Steam.TradeOffer.ETradeOfferState.Active) { - Bot.ArchiLogger.LogGenericError("Ignoring trade in non-active state!"); + Bot.ArchiLogger.LogGenericError(string.Format(Strings.ErrorIsInvalid, tradeOffer.State)); return null; } @@ -141,14 +142,14 @@ namespace ArchiSteamFarm { switch (result.Result) { case ParseTradeResult.EResult.AcceptedWithItemLose: case ParseTradeResult.EResult.AcceptedWithoutItemLose: - Bot.ArchiLogger.LogGenericInfo("Accepting trade: " + tradeOffer.TradeOfferID); + Bot.ArchiLogger.LogGenericInfo(string.Format(Strings.AcceptingTrade, tradeOffer.TradeOfferID)); await Bot.ArchiWebHandler.AcceptTradeOffer(tradeOffer.TradeOfferID).ConfigureAwait(false); break; case ParseTradeResult.EResult.RejectedPermanently: case ParseTradeResult.EResult.RejectedTemporarily: if (result.Result == ParseTradeResult.EResult.RejectedPermanently) { if (Bot.BotConfig.IsBotAccount) { - Bot.ArchiLogger.LogGenericInfo("Rejecting trade: " + tradeOffer.TradeOfferID); + Bot.ArchiLogger.LogGenericInfo(string.Format(Strings.RejectingTrade, tradeOffer.TradeOfferID)); Bot.ArchiWebHandler.DeclineTradeOffer(tradeOffer.TradeOfferID); break; } @@ -156,7 +157,7 @@ namespace ArchiSteamFarm { IgnoredTrades.Add(tradeOffer.TradeOfferID); } - Bot.ArchiLogger.LogGenericInfo("Ignoring trade: " + tradeOffer.TradeOfferID); + Bot.ArchiLogger.LogGenericInfo(string.Format(Strings.IgnoringTrade, tradeOffer.TradeOfferID)); break; } diff --git a/ArchiSteamFarm/Utilities.cs b/ArchiSteamFarm/Utilities.cs index c3fcdfc1d..28b0fb0db 100644 --- a/ArchiSteamFarm/Utilities.cs +++ b/ArchiSteamFarm/Utilities.cs @@ -28,6 +28,7 @@ using System.Linq; using System.Net; using System.Runtime.CompilerServices; using System.Text; +using ArchiSteamFarm.Localization; namespace ArchiSteamFarm { internal static class Utilities { @@ -83,51 +84,27 @@ namespace ArchiSteamFarm { StringBuilder result = new StringBuilder(); if (timeSpan.Days > 0) { - result.Append(" " + timeSpan.Days + " day"); - - if (timeSpan.Days > 1) { - result.Append('s'); - } - - result.Append(','); + result.Append((timeSpan.Days > 1 ? string.Format(Strings.TimeSpanDays, timeSpan.Days) : Strings.TimeSpanDay) + ", "); } if (timeSpan.Hours > 0) { - result.Append(" " + timeSpan.Hours + " hour"); - if (timeSpan.Hours > 1) { - result.Append('s'); - } - - result.Append(','); + result.Append((timeSpan.Hours > 1 ? string.Format(Strings.TimeSpanHours, timeSpan.Hours) : Strings.TimeSpanHour) + ", "); } if (timeSpan.Minutes > 0) { - result.Append(" " + timeSpan.Minutes + " minute"); - if (timeSpan.Minutes > 1) { - result.Append('s'); - } - - result.Append(','); + result.Append((timeSpan.Minutes > 1 ? string.Format(Strings.TimeSpanMinutes, timeSpan.Minutes) : Strings.TimeSpanMinute) + ", "); } if (timeSpan.Seconds > 0) { - result.Append(" " + timeSpan.Hours + " second"); - if (timeSpan.Seconds > 1) { - result.Append('s'); - } - - result.Append(','); + result.Append((timeSpan.Seconds > 1 ? string.Format(Strings.TimeSpanSeconds, timeSpan.Seconds) : Strings.TimeSpanSecond) + ", "); } - if (result.Length <= 1) { + if (result.Length == 0) { return ""; } - // Get rid of initial space - result.Remove(0, 1); - - // Get rid of last comma - result.Length--; + // Get rid of last comma + space + result.Length -= 2; return result.ToString(); } diff --git a/ArchiSteamFarm/WCF.cs b/ArchiSteamFarm/WCF.cs index eacd2e789..e80cb968e 100644 --- a/ArchiSteamFarm/WCF.cs +++ b/ArchiSteamFarm/WCF.cs @@ -26,6 +26,7 @@ using System; using System.Linq; using System.ServiceModel; using System.ServiceModel.Channels; +using ArchiSteamFarm.Localization; namespace ArchiSteamFarm { [ServiceContract] @@ -59,12 +60,12 @@ namespace ArchiSteamFarm { } if (Program.GlobalConfig.SteamOwnerID == 0) { - return "Refusing to handle request because SteamOwnerID is not set!"; + return Strings.ErrorWCFAccessDenied; } Bot bot = Bot.Bots.Values.FirstOrDefault(); if (bot == null) { - return "ERROR: No bots are enabled!"; + return Strings.ErrorNoBotsDefined; } string command = "!" + input; @@ -73,7 +74,7 @@ namespace ArchiSteamFarm { // We must keep it synchronous until either Mono gets fixed, or culprit for freeze located (and corrected) string output = bot.Response(Program.GlobalConfig.SteamOwnerID, command).Result; - Program.ArchiLogger.LogGenericInfo("Answered to WCF command: " + input + " with: " + output); + Program.ArchiLogger.LogGenericInfo(string.Format(Strings.WCFAnswered, input, output)); return output; } @@ -94,7 +95,7 @@ namespace ArchiSteamFarm { return null; } - Program.ArchiLogger.LogGenericInfo("Sending command: " + input + " to WCF server on " + URL + "..."); + Program.ArchiLogger.LogGenericInfo(string.Format(Strings.WCFSendingCommand, input, URL)); if (Client == null) { Client = new Client( @@ -116,7 +117,7 @@ namespace ArchiSteamFarm { return; } - Program.ArchiLogger.LogGenericInfo("Starting WCF server on " + URL + "..."); + Program.ArchiLogger.LogGenericInfo(string.Format(Strings.WCFStarting, URL)); try { ServiceHost = new ServiceHost(typeof(WCF), new Uri(URL)); @@ -132,10 +133,9 @@ namespace ArchiSteamFarm { ); ServiceHost.Open(); - Program.ArchiLogger.LogGenericInfo("WCF server ready!"); + Program.ArchiLogger.LogGenericInfo(Strings.WCFReady); } catch (AddressAccessDeniedException) { - Program.ArchiLogger.LogGenericError("WCF service could not be started because of AddressAccessDeniedException!"); - Program.ArchiLogger.LogGenericWarning("If you want to use WCF service provided by ASF, consider starting ASF as administrator, or giving proper permissions!"); + Program.ArchiLogger.LogGenericError(Strings.WCFAddressAccessDeniedException); } catch (Exception e) { Program.ArchiLogger.LogGenericException(e); } diff --git a/ArchiSteamFarm/WebBrowser.cs b/ArchiSteamFarm/WebBrowser.cs index 07a5c2f28..5660b0b86 100644 --- a/ArchiSteamFarm/WebBrowser.cs +++ b/ArchiSteamFarm/WebBrowser.cs @@ -28,6 +28,7 @@ using System.Net; using System.Net.Http; using System.Threading.Tasks; using System.Xml; +using ArchiSteamFarm.Localization; using HtmlAgilityPack; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -61,7 +62,7 @@ namespace ArchiSteamFarm { }; // Most web services expect that UserAgent is set, so we declare it globally - HttpClient.DefaultRequestHeaders.UserAgent.ParseAdd("ArchiSteamFarm/" + SharedInfo.Version); + HttpClient.DefaultRequestHeaders.UserAgent.ParseAdd(nameof(ArchiSteamFarm) + "/" + SharedInfo.Version); } internal static void Init() { @@ -101,8 +102,8 @@ namespace ArchiSteamFarm { return result; } - ArchiLogger.LogGenericWarning("Request failed even after " + MaxRetries + " tries"); - ArchiLogger.LogGenericDebug("Failing request: " + request); + ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries)); + ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); return null; } @@ -121,8 +122,8 @@ namespace ArchiSteamFarm { return result; } - ArchiLogger.LogGenericWarning("Request failed even after " + MaxRetries + " tries"); - ArchiLogger.LogGenericDebug("Failing request: " + request); + ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries)); + ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); return null; } @@ -141,8 +142,8 @@ namespace ArchiSteamFarm { return result; } - ArchiLogger.LogGenericWarning("Request failed even after " + MaxRetries + " tries"); - ArchiLogger.LogGenericDebug("Failing request: " + request); + ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries)); + ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); return null; } @@ -180,8 +181,8 @@ namespace ArchiSteamFarm { return result; } - ArchiLogger.LogGenericWarning("Request failed even after " + MaxRetries + " tries"); - ArchiLogger.LogGenericDebug("Failing request: " + request); + ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries)); + ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); return null; } @@ -200,8 +201,8 @@ namespace ArchiSteamFarm { return true; } - ArchiLogger.LogGenericWarning("Request failed even after " + MaxRetries + " tries"); - ArchiLogger.LogGenericDebug("Failing request: " + request); + ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries)); + ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); return false; } @@ -220,8 +221,8 @@ namespace ArchiSteamFarm { return result; } - ArchiLogger.LogGenericWarning("Request failed even after " + MaxRetries + " tries"); - ArchiLogger.LogGenericDebug("Failing request: " + request); + ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries)); + ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); return null; } @@ -251,8 +252,8 @@ namespace ArchiSteamFarm { return true; } - ArchiLogger.LogGenericWarning("Request failed even after " + MaxRetries + " tries"); - ArchiLogger.LogGenericDebug("Failing request: " + request); + ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries)); + ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); return false; } @@ -340,8 +341,8 @@ namespace ArchiSteamFarm { return result; } - ArchiLogger.LogGenericWarning("Request failed even after " + MaxRetries + " tries"); - ArchiLogger.LogGenericDebug("Failing request: " + request); + ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries)); + ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); return null; } @@ -477,8 +478,8 @@ namespace ArchiSteamFarm { return result; } - ArchiLogger.LogGenericWarning("Request failed even after " + MaxRetries + " tries"); - ArchiLogger.LogGenericDebug("Failing request: " + request); + ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, MaxRetries)); + ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); return null; } @@ -533,9 +534,9 @@ namespace ArchiSteamFarm { } if (Debugging.IsDebugBuild || Program.GlobalConfig.Debug) { - ArchiLogger.LogGenericDebug("Request: " + request + " failed!"); - ArchiLogger.LogGenericDebug("Status code: " + responseMessage.StatusCode); - ArchiLogger.LogGenericDebug("Content: " + Environment.NewLine + await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false)); + ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); + ArchiLogger.LogGenericDebug(string.Format(Strings.StatusCode, responseMessage.StatusCode)); + ArchiLogger.LogGenericDebug(string.Format(Strings.Content, await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false))); } responseMessage.Dispose();