mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Localizing...
This commit is contained in:
parent
c51061f0fb
commit
b2b11fe807
9 changed files with 386 additions and 49 deletions
|
@ -338,6 +338,7 @@
|
|||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=WCF/@EntryIndexedValue">WCF</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=WTF/@EntryIndexedValue">WTF</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XML/@EntryIndexedValue">XML</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="I" Suffix="" Style="AaBb" /></Policy></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="_" Suffix="" Style="AaBb" /><ExtraRule Prefix="_" Suffix="" Style="aaBb" /></Policy></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="_" Suffix="" Style="AaBb" /><ExtraRule Prefix="_" Suffix="" Style="aaBb" /></Policy></s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
|
|
|
@ -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<Bot, DateTime> LastWriteTimes = new ConcurrentDictionary<Bot, DateTime>();
|
||||
|
||||
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<GitHub.ReleaseResponse>(releaseURL).ConfigureAwait(false);
|
||||
if (releaseResponse == null) {
|
||||
Program.ArchiLogger.LogGenericWarning("Could not check latest version!");
|
||||
Program.ArchiLogger.LogGenericWarning(Strings.ErrorUpdateCheckFailed);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
List<GitHub.ReleaseResponse> releases = await Program.WebBrowser.UrlGetToJsonResultRetry<List<GitHub.ReleaseResponse>>(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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<KeyValue> 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<KeyValue> 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<string, string> data = new Dictionary<string, string>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
238
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
238
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
|
@ -61,12 +61,248 @@ namespace ArchiSteamFarm.Localization {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
internal static string AutoUpdateCheckInfo {
|
||||
get {
|
||||
return ResourceManager.GetString("AutoUpdateCheckInfo", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ASF V{0} has run into fatal exception before core logging module was even able to initialize!.
|
||||
/// </summary>
|
||||
internal static string ErrorEarlyFatalExceptionInfo {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorEarlyFatalExceptionInfo", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Exception: {0}() {1}
|
||||
///StackTrace:
|
||||
///{2}.
|
||||
/// </summary>
|
||||
internal static string ErrorEarlyFatalExceptionPrint {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorEarlyFatalExceptionPrint", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Exiting with non-zero error code!.
|
||||
/// </summary>
|
||||
internal static string ErrorExitingWithNonZeroErrorCode {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorExitingWithNonZeroErrorCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No bots are defined, did you forget to configure your ASF?.
|
||||
/// </summary>
|
||||
internal static string ErrorNoBotsDefined {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorNoBotsDefined", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} is null!.
|
||||
/// </summary>
|
||||
internal static string ErrorObjectIsNull {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorObjectIsNull", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Parsing {0} failed!.
|
||||
/// </summary>
|
||||
internal static string ErrorParsingObject {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorParsingObject", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Could not remove old ASF binary, please remove {0} manually in order for update function to work!.
|
||||
/// </summary>
|
||||
internal static string ErrorRemovingOldBinary {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorRemovingOldBinary", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Request failed despite of {0} tries!.
|
||||
/// </summary>
|
||||
internal static string ErrorRequestFailedTooManyTimes {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorRequestFailedTooManyTimes", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Could not check latest version!.
|
||||
/// </summary>
|
||||
internal static string ErrorUpdateCheckFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorUpdateCheckFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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!.
|
||||
/// </summary>
|
||||
internal static string ErrorUpdateNoAssetForThisBinary {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorUpdateNoAssetForThisBinary", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Could not proceed with an update because that version doesn't include any assets!.
|
||||
/// </summary>
|
||||
internal static string ErrorUpdateNoAssets {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorUpdateNoAssets", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Exiting....
|
||||
/// </summary>
|
||||
internal static string Exiting {
|
||||
get {
|
||||
return ResourceManager.GetString("Exiting", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed!.
|
||||
/// </summary>
|
||||
internal static string Failed {
|
||||
get {
|
||||
return ResourceManager.GetString("Failed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Global config file has been changed!.
|
||||
/// </summary>
|
||||
internal static string GlobalConfigChanged {
|
||||
get {
|
||||
return ResourceManager.GetString("GlobalConfigChanged", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Global config file has been removed!.
|
||||
/// </summary>
|
||||
internal static string GlobalConfigRemoved {
|
||||
get {
|
||||
return ResourceManager.GetString("GlobalConfigRemoved", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Logging in to {0}....
|
||||
/// </summary>
|
||||
internal static string LoggingIn {
|
||||
get {
|
||||
return ResourceManager.GetString("LoggingIn", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Refreshing our session!.
|
||||
/// </summary>
|
||||
internal static string RefreshingOurSession {
|
||||
get {
|
||||
return ResourceManager.GetString("RefreshingOurSession", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Restarting....
|
||||
/// </summary>
|
||||
internal static string Restarting {
|
||||
get {
|
||||
return ResourceManager.GetString("Restarting", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Starting....
|
||||
/// </summary>
|
||||
internal static string Starting {
|
||||
get {
|
||||
return ResourceManager.GetString("Starting", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Success!.
|
||||
/// </summary>
|
||||
internal static string Success {
|
||||
get {
|
||||
return ResourceManager.GetString("Success", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unlocking parental account....
|
||||
/// </summary>
|
||||
internal static string UnlockingParentalAccount {
|
||||
get {
|
||||
return ResourceManager.GetString("UnlockingParentalAccount", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Checking for new version....
|
||||
/// </summary>
|
||||
internal static string UpdateCheckingNewVersion {
|
||||
get {
|
||||
return ResourceManager.GetString("UpdateCheckingNewVersion", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Downloading new version... While waiting, consider donating if you appreciate the work being done! :).
|
||||
/// </summary>
|
||||
internal static string UpdateDownloadingNewVersion {
|
||||
get {
|
||||
return ResourceManager.GetString("UpdateDownloadingNewVersion", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Update process finished!.
|
||||
/// </summary>
|
||||
internal static string UpdateFinished {
|
||||
get {
|
||||
return ResourceManager.GetString("UpdateFinished", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New ASF version is available! Consider updating yourself!.
|
||||
/// </summary>
|
||||
internal static string UpdateNewVersionAvailable {
|
||||
get {
|
||||
return ResourceManager.GetString("UpdateNewVersionAvailable", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Local version: {0} | Remote version: {1}.
|
||||
/// </summary>
|
||||
internal static string UpdateVersionInfo {
|
||||
get {
|
||||
return ResourceManager.GetString("UpdateVersionInfo", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,6 +118,6 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Starting" xml:space="preserve">
|
||||
<value>Startowanie</value>
|
||||
<value>Startowanie...</value>
|
||||
</data>
|
||||
</root>
|
|
@ -117,7 +117,96 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="AutoUpdateCheckInfo" xml:space="preserve">
|
||||
<value>ASF will automatically check for new versions every {0} hours.</value>
|
||||
<comment>{0} will be replaced by number of hours</comment>
|
||||
</data>
|
||||
<data name="ErrorEarlyFatalExceptionInfo" xml:space="preserve">
|
||||
<value>ASF V{0} has run into fatal exception before core logging module was even able to initialize!</value>
|
||||
<comment>{0} will be replaced by version number</comment>
|
||||
</data>
|
||||
<data name="ErrorEarlyFatalExceptionPrint" xml:space="preserve">
|
||||
<value>Exception: {0}() {1}
|
||||
StackTrace:
|
||||
{2}</value>
|
||||
<comment>{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.</comment>
|
||||
</data>
|
||||
<data name="ErrorExitingWithNonZeroErrorCode" xml:space="preserve">
|
||||
<value>Exiting with non-zero error code!</value>
|
||||
</data>
|
||||
<data name="ErrorNoBotsDefined" xml:space="preserve">
|
||||
<value>No bots are defined, did you forget to configure your ASF?</value>
|
||||
</data>
|
||||
<data name="ErrorObjectIsNull" xml:space="preserve">
|
||||
<value>{0} is null!</value>
|
||||
<comment>{0} will be replaced by object's name</comment>
|
||||
</data>
|
||||
<data name="ErrorParsingObject" xml:space="preserve">
|
||||
<value>Parsing {0} failed!</value>
|
||||
<comment>{0} will be replaced by object's name</comment>
|
||||
</data>
|
||||
<data name="ErrorRemovingOldBinary" xml:space="preserve">
|
||||
<value>Could not remove old ASF binary, please remove {0} manually in order for update function to work!</value>
|
||||
<comment>{0} will be replaced by binary's name</comment>
|
||||
</data>
|
||||
<data name="ErrorRequestFailedTooManyTimes" xml:space="preserve">
|
||||
<value>Request failed despite of {0} tries!</value>
|
||||
<comment>{0} will be replaced by maximum number of tries</comment>
|
||||
</data>
|
||||
<data name="ErrorUpdateCheckFailed" xml:space="preserve">
|
||||
<value>Could not check latest version!</value>
|
||||
</data>
|
||||
<data name="ErrorUpdateNoAssetForThisBinary" xml:space="preserve">
|
||||
<value>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!</value>
|
||||
</data>
|
||||
<data name="ErrorUpdateNoAssets" xml:space="preserve">
|
||||
<value>Could not proceed with an update because that version doesn't include any assets!</value>
|
||||
</data>
|
||||
<data name="Exiting" xml:space="preserve">
|
||||
<value>Exiting...</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Failed!</value>
|
||||
</data>
|
||||
<data name="GlobalConfigChanged" xml:space="preserve">
|
||||
<value>Global config file has been changed!</value>
|
||||
</data>
|
||||
<data name="GlobalConfigRemoved" xml:space="preserve">
|
||||
<value>Global config file has been removed!</value>
|
||||
</data>
|
||||
<data name="LoggingIn" xml:space="preserve">
|
||||
<value>Logging in to {0}...</value>
|
||||
<comment>{0} will be replaced by service's name</comment>
|
||||
</data>
|
||||
<data name="RefreshingOurSession" xml:space="preserve">
|
||||
<value>Refreshing our session!</value>
|
||||
</data>
|
||||
<data name="Restarting" xml:space="preserve">
|
||||
<value>Restarting...</value>
|
||||
</data>
|
||||
<data name="Starting" xml:space="preserve">
|
||||
<value>Starting</value>
|
||||
<value>Starting...</value>
|
||||
</data>
|
||||
<data name="Success" xml:space="preserve">
|
||||
<value>Success!</value>
|
||||
</data>
|
||||
<data name="UnlockingParentalAccount" xml:space="preserve">
|
||||
<value>Unlocking parental account...</value>
|
||||
</data>
|
||||
<data name="UpdateCheckingNewVersion" xml:space="preserve">
|
||||
<value>Checking for new version...</value>
|
||||
</data>
|
||||
<data name="UpdateDownloadingNewVersion" xml:space="preserve">
|
||||
<value>Downloading new version... While waiting, consider donating if you appreciate the work being done! :)</value>
|
||||
</data>
|
||||
<data name="UpdateFinished" xml:space="preserve">
|
||||
<value>Update process finished!</value>
|
||||
</data>
|
||||
<data name="UpdateNewVersionAvailable" xml:space="preserve">
|
||||
<value>New ASF version is available! Consider updating yourself!</value>
|
||||
</data>
|
||||
<data name="UpdateVersionInfo" xml:space="preserve">
|
||||
<value>Local version: {0} | Remote version: {1}</value>
|
||||
<comment>{0} will be replaced by current version, {1} will be replaced by remote version</comment>
|
||||
</data>
|
||||
</root>
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue