SboxSuperuser/Engine/CommandDiscovery/HandlerSignature3.cs

One of the command discovery signature validators. For a three-argument handler method, it checks the method can bind as either Func<T1, T2, T3, CommandResult> or Func<T1, T2, T3, Task<CommandResult>>, chosen by the return type, without invoking it.

namespace SboxSuperuser.Engine.CommandDiscovery;

internal sealed class HandlerSignature3<T1, T2, T3> : 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, CommandResult>>();
		}
		else
		{
			_ = method.CreateDelegate<Func<T1, T2, T3, Task<CommandResult>>>();
		}
	}
}