private void Initialize(MethodInfo method, Object obj, Prep prep, Object indirect) { var parameters = method.GetParameters(); var types = new List <Type>(); var args = new List <object>(); foreach (var parameter in parameters) { if (parameter.ParameterType == typeof(Object)) { if (args.Contains(obj)) { args.Add(indirect); } else { args.Add(obj); } types.Add(parameter.ParameterType); } else if (parameter.ParameterType.IsSubclassOf(typeof(Prep))) { args.Add(prep); types.Add(parameter.ParameterType); } } Types = types.ToArray(); Args = args.ToArray(); }
public CommandHandler(CommandLineParserResult parsed) { this.parsed = parsed; verb = parsed.Verb; objects = parsed.Objects; preposition = parsed.Preposition; indirectObject = parsed.IndirectObject; verbType = verb?.GetType(); result = new CommandResult { Success = false, }; }
public DynamicCall(MethodInfo method, Object obj, Prep prep, Object indirect) { Initialize(method, obj, prep, indirect); }