Browse Source

Added an event for any time that plugins are disabled

pull/44/head
Anairkoen Schno 4 years ago
parent
commit
f333f772a6
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      IPA.Loader/Loader/PluginManager.cs

+ 11
- 1
IPA.Loader/Loader/PluginManager.cs View File

@ -158,7 +158,8 @@ namespace IPA.Loader
} }
} }
Task result;
var result = TaskEx.WhenAll();
if (toDisable.Any())
{ {
// then disable the mods that need to be // then disable the mods that need to be
static DisableExecutor MakeDisableExec(PluginExecutor e) static DisableExecutor MakeDisableExec(PluginExecutor e)
@ -208,6 +209,7 @@ namespace IPA.Loader
var disabled = new Dictionary<PluginExecutor, Task>(); var disabled = new Dictionary<PluginExecutor, Task>();
result = TaskEx.WhenAll(disableStructure.Select(d => Disable(d, disabled))); result = TaskEx.WhenAll(disableStructure.Select(d => Disable(d, disabled)));
OnPluginsDisabled?.Invoke(result);
} }
//DisabledConfig.Instance.Changed(); //DisabledConfig.Instance.Changed();
@ -258,6 +260,14 @@ namespace IPA.Loader
/// Called whenever a plugin is disabled. /// Called whenever a plugin is disabled.
/// </summary> /// </summary>
public static event PluginDisableDelegate PluginDisabled; public static event PluginDisableDelegate PluginDisabled;
/// <summary>
/// Called whenever any plugins are disabled with the <see cref="Task"/> representing them being disabled.
/// </summary>
/// <remarks>
/// Note that this is called on the Unity main thread, and cannot therefore block, as the <see cref="Task"/>
/// provided represents operations that also run on the Unity main thread.
/// </remarks>
public static event Action<Task> OnPluginsDisabled;
/// <summary> /// <summary>
/// Gets a list of all enabled BSIPA plugins. Use <see cref="EnabledPlugins"/> instead of this. /// Gets a list of all enabled BSIPA plugins. Use <see cref="EnabledPlugins"/> instead of this.


Loading…
Cancel
Save