diff --git a/ArchiSteamFarm/Core/ASF.cs b/ArchiSteamFarm/Core/ASF.cs index b86314270..ed937dfe5 100644 --- a/ArchiSteamFarm/Core/ASF.cs +++ b/ArchiSteamFarm/Core/ASF.cs @@ -202,7 +202,7 @@ public static class ASF { if (!updated) { // ASF wasn't updated as part of the process, update the plugins alone - updated = await PluginsCore.UpdatePlugins(SharedInfo.Version, false, updateChannel, forced).ConfigureAwait(false); + updated = await PluginsCore.UpdatePlugins(SharedInfo.Version, false, updateChannel, updateOverride, forced).ConfigureAwait(false); } return (updated, newVersion); @@ -929,7 +929,7 @@ public static class ASF { await using (memoryStream.ConfigureAwait(false)) { using ZipArchive zipArchive = new(memoryStream); - if (!await UpdateFromArchive(newVersion, channel.Value, forced, zipArchive).ConfigureAwait(false)) { + if (!await UpdateFromArchive(newVersion, channel.Value, updateOverride, forced, zipArchive).ConfigureAwait(false)) { ArchiLogger.LogGenericError(Strings.WarningFailed); } } @@ -965,7 +965,7 @@ public static class ASF { } } - private static async Task UpdateFromArchive(Version newVersion, GlobalConfig.EUpdateChannel updateChannel, bool forced, ZipArchive zipArchive) { + private static async Task UpdateFromArchive(Version newVersion, GlobalConfig.EUpdateChannel updateChannel, bool updateOverride, bool forced, ZipArchive zipArchive) { ArgumentNullException.ThrowIfNull(newVersion); if (!Enum.IsDefined(updateChannel)) { @@ -986,7 +986,7 @@ public static class ASF { } // We're ready to start update process, handle any plugin updates ready for new version - await PluginsCore.UpdatePlugins(newVersion, true, updateChannel, forced).ConfigureAwait(false); + await PluginsCore.UpdatePlugins(newVersion, true, updateChannel, updateOverride, forced).ConfigureAwait(false); return Utilities.UpdateFromArchive(zipArchive, SharedInfo.HomeDirectory); } diff --git a/ArchiSteamFarm/Localization/Strings.Designer.cs b/ArchiSteamFarm/Localization/Strings.Designer.cs index 81460c56a..11bcbf5e8 100644 --- a/ArchiSteamFarm/Localization/Strings.Designer.cs +++ b/ArchiSteamFarm/Localization/Strings.Designer.cs @@ -1263,6 +1263,12 @@ namespace ArchiSteamFarm.Localization { } } + public static string PluginUpdateNewVersionAvailable { + get { + return ResourceManager.GetString("PluginUpdateNewVersionAvailable", resourceCulture); + } + } + public static string PluginUpdateFound { get { return ResourceManager.GetString("PluginUpdateFound", resourceCulture); diff --git a/ArchiSteamFarm/Localization/Strings.resx b/ArchiSteamFarm/Localization/Strings.resx index a65fa193f..7056a2682 100644 --- a/ArchiSteamFarm/Localization/Strings.resx +++ b/ArchiSteamFarm/Localization/Strings.resx @@ -779,6 +779,10 @@ Process uptime: {1} No update available for {0} plugin: {1} ≥ {2}. {0} will be replaced by plugin name (string), {1} will be replaced by current plugin's version, {2} will be replaced by remote plugin's version. + + New {0} plugin version is available! Consider updating yourself! + {0} will be replaced by plugin name (string). + Found {0} plugin update from version {1} to {2}... {0} will be replaced by plugin name (string), {1} will be replaced by current plugin's version, {2} will be replaced by remote plugin's version. diff --git a/ArchiSteamFarm/Plugins/PluginsCore.cs b/ArchiSteamFarm/Plugins/PluginsCore.cs index c39ed739c..0a9ae91a9 100644 --- a/ArchiSteamFarm/Plugins/PluginsCore.cs +++ b/ArchiSteamFarm/Plugins/PluginsCore.cs @@ -709,7 +709,7 @@ public static class PluginsCore { } } - internal static async Task UpdatePlugins(Version asfVersion, bool asfUpdate, GlobalConfig.EUpdateChannel? updateChannel = null, bool forced = false) { + internal static async Task UpdatePlugins(Version asfVersion, bool asfUpdate, GlobalConfig.EUpdateChannel? updateChannel = null, bool updateOverride = false, bool forced = false) { ArgumentNullException.ThrowIfNull(asfVersion); if (updateChannel.HasValue && !Enum.IsDefined(updateChannel.Value)) { @@ -720,10 +720,10 @@ public static class PluginsCore { return false; } - return await UpdatePlugins(asfVersion, asfUpdate, ActivePluginUpdates, updateChannel, forced).ConfigureAwait(false); + return await UpdatePlugins(asfVersion, asfUpdate, ActivePluginUpdates, updateChannel, updateOverride, forced).ConfigureAwait(false); } - internal static async Task UpdatePlugins(Version asfVersion, bool asfUpdate, IReadOnlyCollection plugins, GlobalConfig.EUpdateChannel? updateChannel = null, bool forced = false) { + internal static async Task UpdatePlugins(Version asfVersion, bool asfUpdate, IReadOnlyCollection plugins, GlobalConfig.EUpdateChannel? updateChannel = null, bool updateOverride = false, bool forced = false) { ArgumentNullException.ThrowIfNull(asfVersion); if ((plugins == null) || (plugins.Count == 0)) { @@ -746,7 +746,7 @@ public static class PluginsCore { ASF.ArchiLogger.LogGenericInfo(Strings.PluginUpdatesChecking); - IList pluginUpdates = await Utilities.InParallel(plugins.Select(plugin => UpdatePlugin(asfVersion, asfUpdate, plugin, updateChannel.Value, forced))).ConfigureAwait(false); + IList pluginUpdates = await Utilities.InParallel(plugins.Select(plugin => UpdatePlugin(asfVersion, asfUpdate, plugin, updateChannel.Value, updateOverride, forced))).ConfigureAwait(false); return pluginUpdates.Any(static updated => updated); } @@ -794,7 +794,7 @@ public static class PluginsCore { } [UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL3000", Justification = "We don't care about trimmed assemblies, as we need it to work only with the known (used) ones")] - private static async Task UpdatePlugin(Version asfVersion, bool asfUpdate, IPluginUpdates plugin, GlobalConfig.EUpdateChannel updateChannel, bool forced) { + private static async Task UpdatePlugin(Version asfVersion, bool asfUpdate, IPluginUpdates plugin, GlobalConfig.EUpdateChannel updateChannel, bool updateOverride, bool forced) { ArgumentNullException.ThrowIfNull(asfVersion); ArgumentNullException.ThrowIfNull(plugin); @@ -833,6 +833,12 @@ public static class PluginsCore { return false; } + if (!updateOverride && ((ASF.GlobalConfig?.UpdatePeriod ?? GlobalConfig.DefaultUpdatePeriod) == 0)) { + ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.PluginUpdateNewVersionAvailable, pluginName)); + + return false; + } + ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.PluginUpdateInProgress, pluginName)); Progress progressReporter = new(); diff --git a/ArchiSteamFarm/Steam/Interaction/Actions.cs b/ArchiSteamFarm/Steam/Interaction/Actions.cs index 5a60544b0..9577bbded 100644 --- a/ArchiSteamFarm/Steam/Interaction/Actions.cs +++ b/ArchiSteamFarm/Steam/Interaction/Actions.cs @@ -504,7 +504,7 @@ public sealed class Actions : IAsyncDisposable, IDisposable { return (false, Strings.NothingFound); } - bool updated = await PluginsCore.UpdatePlugins(SharedInfo.Version, false, pluginsForUpdate, channel, forced).ConfigureAwait(false); + bool updated = await PluginsCore.UpdatePlugins(SharedInfo.Version, false, pluginsForUpdate, channel, true, forced).ConfigureAwait(false); if (updated) { Utilities.InBackground(ASF.RestartOrExit);