Code/SboxSuperuser/Engine/CommandDiscovery/HandlerSignature6.cs

One of a set of IHandlerSignature implementations used by a command discovery system. For a six parameter handler it checks that the method binds, via MethodDescription.CreateDelegate, to either Func<..., CommandResult> or Func<..., Task<CommandResult>> without invoking it.

namespace SboxSuperuser.Engine.CommandDiscovery;

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