A handler signature validator for command discovery. Checks that a method returning either CommandResult or Task<CommandResult> can be bound to a four-argument delegate, 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>>>();
}
}
}