mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 20:33:40 +01:00
Use EnumerateInvocationList instead of GetInvocationList (#2303)
This commit is contained in:
parent
13306e24ba
commit
03e728e129
24 changed files with 402 additions and 294 deletions
|
|
@ -527,18 +527,15 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
/// <param name="affectedThisPlugin">If this plugin was affected by the change.</param>
|
||||
internal void NotifyActivePluginsChanged(PluginListInvalidationKind kind, bool affectedThisPlugin)
|
||||
{
|
||||
if (this.ActivePluginsChanged is { } callback)
|
||||
foreach (var action in Delegate.EnumerateInvocationList(this.ActivePluginsChanged))
|
||||
{
|
||||
foreach (var action in callback.GetInvocationList().Cast<IDalamudPluginInterface.ActivePluginsChangedDelegate>())
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
action(kind, affectedThisPlugin);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Exception during raise of {handler}", action.Method);
|
||||
}
|
||||
action(kind, affectedThisPlugin);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Exception during raise of {handler}", action.Method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -547,18 +544,15 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
{
|
||||
this.UiLanguage = langCode;
|
||||
|
||||
if (this.LanguageChanged is { } callback)
|
||||
foreach (var action in Delegate.EnumerateInvocationList(this.LanguageChanged))
|
||||
{
|
||||
foreach (var action in callback.GetInvocationList().Cast<IDalamudPluginInterface.LanguageChangedDelegate>())
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
action(langCode);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Exception during raise of {handler}", action.Method);
|
||||
}
|
||||
action(langCode);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Exception during raise of {handler}", action.Method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue