A handler signature validator for command discovery. Implements IHandlerSignature for four-parameter handlers and binds the method to either Func<T1,T2,T3,T4,CommandResult> or the Task<CommandResult> variant via MethodDescription.CreateDelegate, without invoking it.
namespace SboxSuperuser.Engine.CommandDiscovery;
internal sealed class HandlerSignature4<T1, T2, T3, T4> : IHandlerSignature
{
/// <summary>Checks closed delegate binding without executing the handler.</summary>
public void Validate( Sandbox.MethodDescription method )
{
if ( method.ReturnType == typeof( CommandResult ) )
{
_ = method.CreateDelegate<Func<T1, T2, T3, T4, CommandResult>>();
}
else
{
_ = method.CreateDelegate<Func<T1, T2, T3, T4, Task<CommandResult>>>();
}
}
}