From f98193a06dc740a31d6901deeeed7bd9628d3460 Mon Sep 17 00:00:00 2001 From: Raymond Date: Tue, 21 Sep 2021 10:15:51 -0400 Subject: [PATCH] Display banned plugins for updating --- .../Internal/Windows/PluginInstallerWindow.cs | 23 +++++++++++++++++-- Dalamud/Plugin/Internal/LocalPlugin.cs | 10 ++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs index c5c56a137..b244c33f3 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs @@ -868,6 +868,7 @@ namespace Dalamud.Interface.Internal.Windows ImGui.SameLine(); var cursor = ImGui.GetCursorPos(); + // Name ImGui.Text(label); @@ -1130,6 +1131,13 @@ namespace Dalamud.Interface.Internal.Windows trouble = true; } + // Banned + if (plugin.IsBanned) + { + label += Locs.PluginTitleMod_BannedError; + trouble = true; + } + ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}"); if (this.DrawPluginCollapsingHeader(label, plugin.Manifest, trouble, availablePluginUpdate != default, false, () => this.DrawInstalledPluginContextMenu(plugin), index)) @@ -1181,6 +1189,13 @@ namespace Dalamud.Interface.Internal.Windows ImGui.PopStyleColor(); } + if (plugin.IsBanned) + { + ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); + ImGui.TextWrapped(Locs.PluginBody_Banned); + ImGui.PopStyleColor(); + } + // Available commands (if loaded) if (plugin.IsLoaded) { @@ -1264,7 +1279,7 @@ namespace Dalamud.Interface.Internal.Windows var disabled = this.updateStatus == OperationStatus.InProgress || this.installStatus == OperationStatus.InProgress; // Disable everything if the plugin is outdated - disabled = disabled || (plugin.IsOutdated && !configuration.LoadAllApiLevels); + disabled = disabled || (plugin.IsOutdated && !configuration.LoadAllApiLevels) || plugin.IsBanned; if (plugin.State == PluginState.InProgress) { @@ -1460,7 +1475,7 @@ namespace Dalamud.Interface.Internal.Windows private void DrawDeletePluginButton(LocalPlugin plugin) { var unloaded = plugin.State == PluginState.Unloaded; - var showButton = unloaded && (plugin.IsDev || plugin.IsOutdated); + var showButton = unloaded && (plugin.IsDev || plugin.IsOutdated || plugin.IsBanned); if (!showButton) return; @@ -1926,6 +1941,8 @@ namespace Dalamud.Interface.Internal.Windows public static string PluginTitleMod_OutdatedError => Loc.Localize("InstallerOutdatedError", " (outdated)"); + public static string PluginTitleMod_BannedError => Loc.Localize("InstallerOutdatedError", " (banned)"); + public static string PluginTitleMod_New => Loc.Localize("InstallerNewPlugin ", " New!"); #endregion @@ -1960,6 +1977,8 @@ namespace Dalamud.Interface.Internal.Windows public static string PluginBody_Outdated => Loc.Localize("InstallerOutdatedPluginBody ", "This plugin is outdated and incompatible at the moment. Please wait for it to be updated by its author."); + public static string PluginBody_Banned => Loc.Localize("InstallerBannedPluginBody ", "This plugin version is banned and not available at the moment. Please wait for it to be updated by its author."); + #endregion #region Plugin buttons diff --git a/Dalamud/Plugin/Internal/LocalPlugin.cs b/Dalamud/Plugin/Internal/LocalPlugin.cs index 0b2b1d91f..c06c12c08 100644 --- a/Dalamud/Plugin/Internal/LocalPlugin.cs +++ b/Dalamud/Plugin/Internal/LocalPlugin.cs @@ -129,6 +129,9 @@ namespace Dalamud.Plugin.Internal this.testingFile.Delete(); } + var pluginManager = Service.Get(); + this.IsBanned = pluginManager.IsManifestBanned(this.Manifest); + this.SaveManifest(); } @@ -183,6 +186,11 @@ namespace Dalamud.Plugin.Internal /// public bool IsTesting => this.Manifest.IsTestingExclusive || this.Manifest.Testing; + /// + /// Gets a value indicating whether this plugin has been banned. + /// + public bool IsBanned { get; } + /// /// Gets a value indicating whether this plugin is dev plugin. /// @@ -262,7 +270,9 @@ namespace Dalamud.Plugin.Internal { var manifestFile = LocalPluginManifest.GetManifestFile(this.DllFile); if (manifestFile.Exists) + { this.Manifest = LocalPluginManifest.Load(manifestFile); + } } }