mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat: check plugin load state after installing
This commit is contained in:
parent
a03db8b35d
commit
bc54bc83f3
2 changed files with 14 additions and 4 deletions
|
|
@ -689,7 +689,15 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
this.installStatus = OperationStatus.Idle;
|
||||
if (this.DisplayErrorContinuation(task, Locs.ErrorModal_InstallFail(manifest.Name)))
|
||||
{
|
||||
this.dalamud.InterfaceManager.Notifications.AddNotification($"The plugin {manifest.Name} was successfully installed.", "Plugin installed!", Notifications.Notification.Type.Success);
|
||||
if (task.Result.State == PluginState.Loaded)
|
||||
{
|
||||
this.dalamud.InterfaceManager.Notifications.AddNotification($"The plugin {manifest.Name} was successfully installed.", "Plugin installed!", Notifications.Notification.Type.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dalamud.InterfaceManager.Notifications.AddNotification($"The plugin {manifest.Name} failed to load.", "Plugin not installed!", Notifications.Notification.Type.Error);
|
||||
this.ShowErrorModal(Locs.ErrorModal_InstallFail(manifest.Name));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ namespace Dalamud.Plugin.Internal
|
|||
/// <param name="useTesting">If the testing version should be used.</param>
|
||||
/// <param name="reason">The reason this plugin was loaded.</param>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
||||
public async Task InstallPluginAsync(RemotePluginManifest repoManifest, bool useTesting, PluginLoadReason reason)
|
||||
public async Task<LocalPlugin> InstallPluginAsync(RemotePluginManifest repoManifest, bool useTesting, PluginLoadReason reason)
|
||||
{
|
||||
Log.Debug($"Installing plugin {repoManifest.Name} (testing={useTesting})");
|
||||
|
||||
|
|
@ -447,9 +447,10 @@ namespace Dalamud.Plugin.Internal
|
|||
|
||||
Log.Information($"Installed plugin {manifest.Name} (testing={useTesting})");
|
||||
|
||||
this.LoadPlugin(dllFile, manifest, reason);
|
||||
var plugin = this.LoadPlugin(dllFile, manifest, reason);
|
||||
|
||||
this.NotifyInstalledPluginsChanged();
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -461,7 +462,7 @@ namespace Dalamud.Plugin.Internal
|
|||
/// <param name="isDev">If this plugin should support development features.</param>
|
||||
/// <param name="isBoot">If this plugin is being loaded at boot.</param>
|
||||
/// <param name="doNotLoad">Don't load the plugin, just don't do it.</param>
|
||||
public void LoadPlugin(FileInfo dllFile, LocalPluginManifest manifest, PluginLoadReason reason, bool isDev = false, bool isBoot = false, bool doNotLoad = false)
|
||||
public LocalPlugin LoadPlugin(FileInfo dllFile, LocalPluginManifest manifest, PluginLoadReason reason, bool isDev = false, bool isBoot = false, bool doNotLoad = false)
|
||||
{
|
||||
var name = manifest?.Name ?? dllFile.Name;
|
||||
var loadPlugin = !doNotLoad;
|
||||
|
|
@ -523,6 +524,7 @@ namespace Dalamud.Plugin.Internal
|
|||
}
|
||||
|
||||
this.installedPlugins.Add(plugin);
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue