/// <summary>
 /// Run command.
 /// </summary>
 /// <param name="command"></param>
 /// <param name="arguments"></param>
 public Tuple<bool, object> Run(CommandInfo command, object[] arguments)
 {
     var method = GetCommands().FirstOrDefault(x => x.Item1 == command);
     if (method != null)
     {
         try
         {
             var obj = Activator.CreateInstance(method.Item3, null);
             var result = method.Item2.Invoke(obj, arguments);
             return new Tuple<bool, object>(true, result);
         }
         catch (Exception) { } // todo: log
     }
     return new Tuple<bool, object>(false, null);
 }
Exemple #2
0
 /// <summary>
 /// Gets the methode.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <returns></returns>
 public Tuple<CommandInfo, MethodInfo, Type> GetMethode(CommandInfo command)
 {
     return GetCommands().FirstOrDefault(x => x.Item1 == command);
 }