private void CheckCommandTypeMatch(CommandTypeInfo[] commandTypes) { ParameterInfo[] parameters = this.method.GetParameters(); Type[] parameterType = new Type[(int)parameters.Length]; for (int i = 0; i < (int)parameters.Length; i++) { parameterType[i] = parameters[i].ParameterType; } for (int j = 0; j < (int)commandTypes.Length; j++) { if ((int)parameters.Length == commandTypes[j].parametersLength) { if (CommandAttributeVerifier.BothAreAction(this.method, commandTypes[j])) { if (!commandTypes[j].isGeneric) { this.commandType = commandTypes[j]; } else { this.commandType = commandTypes[j].MakeGeneric(parameterType); } break; } else if (CommandAttributeVerifier.BothAreFunc(this.method, commandTypes[j])) { if (!commandTypes[j].isGeneric) { this.commandType = commandTypes[j]; } else { this.commandType = commandTypes[j].MakeGeneric(parameterType.Concat <Type>((IEnumerable <Type>)(new Type[] { this.method.ReturnType })).ToArray <Type>()); } break; } } } }
private static bool BothAreFunc(MethodInfo method, CommandTypeInfo commandType) { return(method.ReturnType == typeof(void) ? false : commandType.isFunc); }