internal static void AsParametersTo(this string[] args, ParameterDispatcher e) { if (args.Length > 0) { var OperationName = args[0]; if (args.Length > 1) { var x = new string[args.Length - 1]; Array.Copy(args, 1, x, 0, args.Length - 1); args = x; } var Operation = e[OperationName]; if (Operation == null) Operation = e[null]; object Arguments = null; if (Operation != null) if (Operation.GetArguments != null) Arguments = Operation.GetArguments(); if (Arguments != null) args.AsParametersTo(Arguments); if (Operation != null) if (Operation.Handler != null) Operation.Handler(Operation); } }
public static void AsParametersTo(this string[] args, params Action[] Handlers) { var a = new ParameterDispatcher(); foreach (var h in Handlers) { a.Add(h); } args.AsParametersTo(a); }