Use EnumerateInvocationList instead of GetInvocationList (#2303)

This commit is contained in:
srkizer 2025-06-24 05:09:48 +09:00 committed by GitHub
parent 13306e24ba
commit 03e728e129
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 402 additions and 294 deletions

View file

@ -184,8 +184,18 @@ internal partial class ConsoleManager : IServiceType
/// <returns>Whether the command was successfully processed.</returns>
public bool ProcessCommand(string command)
{
if (this.Invoke?.Invoke(command) == true)
return true;
foreach (var action in Delegate.EnumerateInvocationList(this.Invoke))
{
try
{
if (action(command))
return true;
}
catch (Exception ex)
{
Log.Error(ex, "Exception during raise of {handler}", action.Method);
}
}
var matches = GetCommandParsingRegex().Matches(command);
if (matches.Count == 0)