mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
fix: plugin config deletion context menu (#955)
This commit is contained in:
parent
5ffe5690a4
commit
1e40a930a9
2 changed files with 11 additions and 7 deletions
|
|
@ -2631,9 +2631,9 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
|||
|
||||
public static string PluginContext_HidePlugin => Loc.Localize("InstallerHidePlugin", "Hide from installer");
|
||||
|
||||
public static string PluginContext_DeletePluginConfig => Loc.Localize("InstallerDeletePluginConfig", "Reset plugin");
|
||||
public static string PluginContext_DeletePluginConfig => Loc.Localize("InstallerDeletePluginConfig", "Reset plugin configuration");
|
||||
|
||||
public static string PluginContext_DeletePluginConfigReload => Loc.Localize("InstallerDeletePluginConfigReload", "Reset plugin settings & reload");
|
||||
public static string PluginContext_DeletePluginConfigReload => Loc.Localize("InstallerDeletePluginConfigReload", "Reset plugin configuration and reload");
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -1128,17 +1128,18 @@ internal partial class PluginManager : IDisposable, IServiceType
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unload the plugin, delete its configuration, and reload it.
|
||||
/// Delete the plugin configuration, unload/reload it if loaded.
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin.</param>
|
||||
/// <exception cref="Exception">Throws if the plugin is still loading/unloading.</exception>
|
||||
/// <returns>The task.</returns>
|
||||
public async Task DeleteConfigurationAsync(LocalPlugin plugin)
|
||||
{
|
||||
if (plugin.State == PluginState.Loading || plugin.State == PluginState.Unloaded)
|
||||
if (plugin.State is PluginState.Loading or PluginState.Unloading)
|
||||
throw new Exception("Cannot delete configuration for a loading/unloading plugin");
|
||||
|
||||
if (plugin.IsLoaded)
|
||||
var isReloading = plugin.IsLoaded;
|
||||
if (isReloading)
|
||||
await plugin.UnloadAsync();
|
||||
|
||||
for (var waitUntil = Environment.TickCount64 + 1000; Environment.TickCount64 < waitUntil;)
|
||||
|
|
@ -1154,9 +1155,12 @@ internal partial class PluginManager : IDisposable, IServiceType
|
|||
}
|
||||
}
|
||||
|
||||
if (isReloading)
|
||||
{
|
||||
// Let's indicate "installer" here since this is supposed to be a fresh install
|
||||
await plugin.LoadAsync(PluginLoadReason.Installer);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the given manifest is eligible for ANYTHING. These are hard
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue