mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +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_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
|
#endregion
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1128,17 +1128,18 @@ internal partial class PluginManager : IDisposable, IServiceType
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unload the plugin, delete its configuration, and reload it.
|
/// Delete the plugin configuration, unload/reload it if loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plugin">The plugin.</param>
|
/// <param name="plugin">The plugin.</param>
|
||||||
/// <exception cref="Exception">Throws if the plugin is still loading/unloading.</exception>
|
/// <exception cref="Exception">Throws if the plugin is still loading/unloading.</exception>
|
||||||
/// <returns>The task.</returns>
|
/// <returns>The task.</returns>
|
||||||
public async Task DeleteConfigurationAsync(LocalPlugin plugin)
|
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");
|
throw new Exception("Cannot delete configuration for a loading/unloading plugin");
|
||||||
|
|
||||||
if (plugin.IsLoaded)
|
var isReloading = plugin.IsLoaded;
|
||||||
|
if (isReloading)
|
||||||
await plugin.UnloadAsync();
|
await plugin.UnloadAsync();
|
||||||
|
|
||||||
for (var waitUntil = Environment.TickCount64 + 1000; Environment.TickCount64 < waitUntil;)
|
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
|
// Let's indicate "installer" here since this is supposed to be a fresh install
|
||||||
await plugin.LoadAsync(PluginLoadReason.Installer);
|
await plugin.LoadAsync(PluginLoadReason.Installer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the given manifest is eligible for ANYTHING. These are hard
|
/// 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