add LocalPlugin.IsOutdated shortcut

This commit is contained in:
Raymond 2021-09-20 16:32:01 -04:00
parent c34d4dfd87
commit cb1761f998
3 changed files with 9 additions and 4 deletions

View file

@ -1124,7 +1124,7 @@ namespace Dalamud.Interface.Internal.Windows
} }
// Outdated API level // Outdated API level
if (plugin.Manifest.DalamudApiLevel < PluginManager.DalamudApiLevel) if (plugin.IsOutdated)
{ {
label += Locs.PluginTitleMod_OutdatedError; label += Locs.PluginTitleMod_OutdatedError;
trouble = true; trouble = true;
@ -1174,7 +1174,7 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.TextWrapped(manifest.Description); ImGui.TextWrapped(manifest.Description);
} }
if (plugin.Manifest.DalamudApiLevel < PluginManager.DalamudApiLevel) if (plugin.IsOutdated)
{ {
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
ImGui.TextWrapped(Locs.PluginBody_Outdated); ImGui.TextWrapped(Locs.PluginBody_Outdated);
@ -1263,7 +1263,7 @@ namespace Dalamud.Interface.Internal.Windows
var disabled = this.updateStatus == OperationStatus.InProgress || this.installStatus == OperationStatus.InProgress; var disabled = this.updateStatus == OperationStatus.InProgress || this.installStatus == OperationStatus.InProgress;
// Disable everything if the plugin is outdated // Disable everything if the plugin is outdated
disabled = disabled || (plugin.Manifest.DalamudApiLevel < PluginManager.DalamudApiLevel && !configuration.LoadAllApiLevels); disabled = disabled || (plugin.IsOutdated && !configuration.LoadAllApiLevels);
if (plugin.State == PluginState.InProgress) if (plugin.State == PluginState.InProgress)
{ {

View file

@ -173,6 +173,11 @@ namespace Dalamud.Plugin.Internal
/// </summary> /// </summary>
public bool IsDisabled => this.Manifest.Disabled; public bool IsDisabled => this.Manifest.Disabled;
/// <summary>
/// Gets a value indicating whether this plugin's API level is out of date.
/// </summary>
public bool IsOutdated => this.Manifest.DalamudApiLevel < PluginManager.DalamudApiLevel;
/// <summary> /// <summary>
/// Gets a value indicating whether the plugin is for testing use only. /// Gets a value indicating whether the plugin is for testing use only.
/// </summary> /// </summary>

View file

@ -561,7 +561,7 @@ namespace Dalamud.Plugin.Internal
Log.Information(ex, $"Dev plugin failed to load, adding anyways: {dllFile.Name}"); Log.Information(ex, $"Dev plugin failed to load, adding anyways: {dllFile.Name}");
plugin.Disable(); // Disable here, otherwise you can't enable+load later plugin.Disable(); // Disable here, otherwise you can't enable+load later
} }
else if (plugin.Manifest.DalamudApiLevel < DalamudApiLevel) else if (plugin.IsOutdated)
{ {
// Out of date plugins get added so they can be updated. // Out of date plugins get added so they can be updated.
Log.Information(ex, $"Plugin was outdated, adding anyways: {dllFile.Name}"); Log.Information(ex, $"Plugin was outdated, adding anyways: {dllFile.Name}");