Example #1
0
        private void RunCommandWithParameters(string[] input, ICommand command)
        {
            ISubCommandHandler subCommandHandler = ProcessArgs(input);

            if (subCommandHandler != null)
            {
                if (subCommandHandler.IsValid)
                {
                    if (subCommandHandler.IsValid)
                    {
                        command.Run(subCommandHandler);
                    }
                    else if (subCommandHandler.IsValid)
                    {
                        command.Run(ParseArguments(input));
                    }
                }
                else
                {
                    _logger.LogError($"Command error: {subCommandHandler.ErrorMessage}");
                }
            }
            else
            {
                command.Run();
            }
        }
Example #2
0
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
            [Inject] ICommand command)
        {
            try
            {
                string text    = req.Query["text"];
                string subtext = req.Query["subtext"];

                command.InitializeService(text, subtext);
                return(command.Run());
            }
            catch (Exception ex)
            {
                var error = new JObject
                {
                    ["error"] = ex.Message
                };

                return(new ObjectResult(error)
                {
                    StatusCode = 400
                });
            }
        }
Example #3
0
        private bool TryToProceedCommand(ICommand command, IEnumerable <string> args)
        {
            if (command != null)
            {
                if (command.Verbose)
                {
                    Console.WriteLine("Proceeding Command: " + command.Name);
                }

                try
                {
                    _commandPropertyWalker.FillCommandProperties(args, command);
                    command.Console = Console;
                    command.Run();
                    return(true);
                }
                catch (Exception exception)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Unexpected error happended while proceeding the command: " + command.Name);
                    var exceptionWalker = new ExceptionWalker(exception);
                    foreach (var message in exceptionWalker.GetExceptionMessages())
                    {
                        Console.WriteLine(message);
                    }
                    Console.ResetColor();
                    return(false);
                }
            }
            return(false);
        }
Example #4
0
        private static void ExecuteCommand(Type commandType, IVerb verb, object[] arguments)
        {
            // We have a commandType. Construct it and invoke it.
            ICommand command = null;

            try
            {
                command = (ICommand)Activator.CreateInstance(commandType);
            }
            catch (Exception ex)
            {
                This.Logger.Error(string.Format(
                                      "The command type {0} is not convertible to ICommand: {1}",
                                      commandType, ex.Message), ex);
                return;
            }

            if (command == null)
            {
                This.Logger.Error(string.Format(
                                      "Could not convert the command type {0} to ICommand", commandType));
                return;
            }

            // We have a command object. Invoke it
            else
            {
                command.Run(verb, arguments);
            }
        }
Example #5
0
        // TestExternalTokenHelperProcessCLI can be called to implement TestExternalTokenHelperProcess
        // for TestProcess that just executes a CLI command.
        //~ func TestExternalTokenHelperProcessCLI(t *testing.T, cmd cli.Command) {
        public static void TestExternalTokenHelperProcessCLI(ICommand cmd)
        {
            //~ args := os.Args
            //~ for len(args) > 0 {
            //~     if args[0] == "--" {
            //~         args = args[1:]
            //~         break
            //~     }
            //~
            //~     args = args[1:]
            //~ }
            //~ if len(args) == 0 || args[0] != "GO_WANT_HELPER_PROCESS" {
            //~     return
            //~ }
            //~ args = args[1:]
            var args = Environment.GetCommandLineArgs().ToList();

            while (args.Count > 0)
            {
                if (args[0] == "--")
                {
                    args.RemoveAt(0);
                    break;
                }
                args.RemoveAt(0);
            }
            if (args.Count == 0 || args[0] != "GO_WANT_HELPER_PROCESS")
            {
                return;
            }
            args.RemoveAt(0);

            //~ os.Exit(cmd.Run(args))
            Environment.Exit(cmd.Run(args.ToArray()));
        }
Example #6
0
        public IObservable <UniRx.Unit> Run()
        {
            IUnitData[] unitDatas = _unitSpawnSettings.GetUnits(_data.unitCommandData.UnitType);
            if (_data.unitCommandData.UnitIndex >= unitDatas.Length)
            {
                string errorMsg = string.Format("Unit Index not in unit datas range: {0}",
                                                _data.unitCommandData.UnitIndex);
                _logger.LogError(LoggedFeature.Units, errorMsg);
                return(Observable.Throw <UniRx.Unit>(new IndexOutOfRangeException(errorMsg)));
            }

            IUnitData unitData = unitDatas[(int)_data.unitCommandData.UnitIndex];

            // First, spawn the pets recursively.
            // We create commands that we execute directly, because
            // we don't want to treat these as standalone commands (they are only ever children of this command)
            IUnit[] pets = new IUnit[_data.unitCommandData.pets.Length];
            for (var i = 0; i < _data.unitCommandData.pets.Length; i++)
            {
                SpawnUnitData petSpawnUnitData =
                    new SpawnUnitData(_data.unitCommandData.pets[i], _data.tileCoords, _data.isInitialSpawn);
                ICommand petSpawnCommand =
                    _commandFactory.Create(typeof(SpawnUnitCommand), typeof(SpawnUnitData), petSpawnUnitData);
                petSpawnCommand.Run();
                pets[i] = _unitRegistry.GetUnit(_data.unitCommandData.pets[i].unitId);
            }

            // Now, spawn the unit itself.
            IUnit unit = _unitPool.Spawn(_data.unitCommandData.unitId, unitData, pets);

            _gridUnitManager.PlaceUnitAtTile(unit, _data.tileCoords);

            _logger.Log(LoggedFeature.Units, "Spawned: {0}. Id: {1}", unitData.Name, unit.UnitId);
            return(Observable.ReturnUnit());
        }
Example #7
0
 public void Run(string[] args)
 {
     if (HasArgs)
     {
         String[] newArgs = new String[args.Length + this.args.Length + 1];
         this.args.CopyTo(newArgs, 1);
         newArgs[0] = redirect.Name;
         args.Skip(1).ToArray().CopyTo(newArgs, this.args.Length + 1);
         redirect.Run(newArgs);
     }
     else
     {
         args[0] = redirect.Name;
         redirect.Run(args);
     }
 }
Example #8
0
        public void RunCommand(string name)
        {
            if (name == "KONIEC")
            {
                return;
            }

            ICommand selected = null;

            foreach (ICommand command in Commands)
            {
                if (command.GetName() == name)
                {
                    selected = command;
                    break;
                }
            }

            if (selected == null)
            {
                Console.WriteLine("== NIEZNANA KOMENDA ==");
            }
            else
            {
                Console.Clear();
                selected.Run();
                Console.Clear();
            }
        }
Example #9
0
        static Action <FileTemplateOptions> ReadAction(XmlElement el)
        {
            switch (el.Name)
            {
            case "RunCommand":
                if (el.HasAttribute("path"))
                {
                    try {
                        ICommand command = (ICommand)AddInTree.BuildItem(el.GetAttribute("path"), null);
                        return(fileCreateInformation => {
                            command.Owner = fileCreateInformation;
                            command.Run();
                        });
                    } catch (TreePathNotFoundException ex) {
                        MessageService.ShowWarning(ex.Message + " - in " + el.OwnerDocument.DocumentElement.GetAttribute("fileName"));
                        return(null);
                    }
                }
                else
                {
                    ProjectTemplate.WarnAttributeMissing(el, "path");
                    return(null);
                }

            default:
                ProjectTemplate.WarnObsoleteNode(el, "Unknown action element is ignored");
                return(null);
            }
        }
Example #10
0
		private static void HandleClientCommunication(User userObj, string userInput)
		{
			UserInput CurrentInput = new UserInput(userObj, userInput);

			if (userInput.StartsWith(".")) {
				if (userInput.Trim().Length == 1) {
					userObj.LastCommand.Run(userObj.LastInput);
					return;
				}

				//TODO: need to check partial input as well
				ICommand CurrentCommand = Server.CommandList.Find(x => x.Name.Equals(CurrentInput.Args [0].ToLower()));

				if (CurrentCommand != null) {
					userObj.LastCommand = CurrentCommand;
					userObj.LastInput = CurrentInput;

					CurrentCommand.Run(CurrentInput);
				} else {
					userObj.WriteLine("Unknown command.");
				}
			} else {
				//TODO: setup default command thing.. 
				Server.DefaultCommand.Run(CurrentInput);
			}
		}
Example #11
0
 public static void Main(string[] args)
 {
     if (args == null || args.Length == 0)
     {
         Entitas.CodeGeneration.CodeGenerator.CLI.MainClass.printUsage();
     }
     else
     {
         Entitas.CodeGeneration.CodeGenerator.CLI.MainClass.setupLogging(args);
         try
         {
             ICommand command = AppDomain.CurrentDomain.GetInstancesOf <ICommand>().SingleOrDefault((ICommand c) => c.trigger == args[0]);
             if (command != null)
             {
                 command.Run(args);
             }
             else
             {
                 Entitas.CodeGeneration.CodeGenerator.CLI.MainClass.printUsage();
             }
         }
         catch (Exception ex)
         {
             Entitas.CodeGeneration.CodeGenerator.CLI.MainClass.printException(ex, args);
         }
     }
 }
Example #12
0
 protected override void OnClick(BarItemLink link)
 {
     base.OnClick(link);
     if (this.codon != null)
     {
         ICommand command = this.Command;
         if (command != null)
         {
             if (command.CheckPermission())
             {
                 if (this.Checked)
                 {
                     command.Run(this, null);
                     string functionInfo = this.Command.CommandID;
                     if (this.Command.CommandName != null && this.Command.CommandName != "")
                     {
                         functionInfo = StringParser.Parse(this.Command.CommandName);
                     }
                     LoggingService.Info("Function " + functionInfo + " run.");
                     return;
                 }
                 command.RestoreEnv();
                 return;
             }
             else
             {
                 XtraMessageBox.Show(StringParser.Parse("${res:ModeNoAuth}"), StringParser.Parse("${res:View_Prompt}"));
             }
         }
     }
 }
Example #13
0
        static void Main(string[] args)
        {
            Configuration.GetInstance().Load();

            if (args.Length == 0)
            {
                Console.WriteLine(TRY_HELP);
                Environment.Exit(0);
            }

            ICommand command = CommandFactory.GetCommand(args[0]);

            if (command == null)
            {
                Console.Error.WriteLine(ERROR_BAD_CMDLINE_SYNTAX);
                Environment.Exit(1);
            }

            if (!command.Parse(args))
            {
                Console.Error.WriteLine(Program.ERROR_BAD_CMDLINE_SYNTAX);
                Environment.Exit(127);
            }

            command.Run();

            Environment.Exit(Program.errors == 0 ? 0 : 1);
        }
        public void OnCommandEndEdit(String str)
        {
            if (InputManager.Instance.IsKeyDown(KeyCode.Return) && isConsoleVisible)
            {
                string cmd = if_commandInput.text;
                if (!IsCommandVaild(cmd))
                {
                    AppendTextToConsole(cmd + " is not a vaild command");
                }
                else
                {
                    AppendTextToConsole(cmd);
                    ICommand command = ParseCommand(cmd);

                    if (command == null)
                    {
                        AppendTextToConsole("Cannot find command \"" + cmd + "\"");
                    }
                    else
                    {
                        command.Run();
                    }
                }

                if_commandInput.text = "";
                SetFocusOnInputfield();
            }
        }
Example #15
0
 void OnActivated(object o, EventArgs e)
 {
     if (cmd != null)
     {
         cmd.Run(o, e);
     }
 }
Example #16
0
        public string ExecuteCommand(string content)
        {
            var result = string.Empty;

            string[] e = content.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (e != null && e.Length > 0)
            {
                var commandname = e[0].ToLower();

                ICommand command = null;

                command = FindCommand(commandname);

                if (command == null)
                {
                    return("unknown command...");
                }
                else
                {
                    command.CommandManager = this;

                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine();
                    sb.AppendLine(command.Run(e));

                    return(sb.ToString());
                }
            }
            else
            {
                return("no input...");
            }
        }
Example #17
0
        public void Programm_Passes_InputIsReadFromFileAndCorrect()
        {
            // Arrange
            CommandFactory commandFactory = new CommandFactory(new CommandContext());
            List <string>  CommandList    = new List <string>();

            if (File.Exists("CommandsForTest.tdat"))
            {
                string readText = File.ReadAllText("CommandsForTest.tdat");

                string[] linesFromFile = readText.Split(new[] { Environment.NewLine, "\n" }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string commandLine in linesFromFile)
                {
                    if (commandLine != "")
                    {
                        CommandList.Add(commandLine);
                    }
                }
            }

            // Act&&Assert
            foreach (string command in CommandList)
            {
                ICommand executable = commandFactory.GetCommand(command);
                Assert.Null(Record.Exception(() => executable.Run()));
            }
        }
        private async Task ResolveCommand(string inputTrigger)
        {
            if (!this.Commands.ContainsKey(inputTrigger))
            {
                this.Context.Output.Clear();
                (this.Context.Output as IConsoleOutput).WriteLine("This command does not exist.", ConsoleColor.Red);
                return;
            }

            CommandPrescription prescription = this.Commands[inputTrigger];

            if (prescription != null)
            {
                if (prescription.IsProcessRefreshing)
                {
                    await Gatherer.Run(Context, prescription.IsRefreshingBlacklistedOnly);
                }

                if (!typeof(IGatherer).IsAssignableFrom(prescription.CommandType))
                {
                    ICommand command = (ICommand)Activator.CreateInstance(prescription.CommandType);
                    await command.Run(Context);
                }
            }
        }
Example #19
0
 public async override Task Run()
 {
     using (Logger.BeginScope("Processing action {Action} scope id: {RunTraceId}", _command.Action, Guid.NewGuid()))
     {
         await _command.Run();
     }
 }
Example #20
0
        private void repositoryItemCheckEdit_CheckedChanged(object sender, System.EventArgs e)
        {
            CheckEdit checkEdit = sender as CheckEdit;

            if (this.codon != null && checkEdit != null)
            {
                ICommand command = this.Command;
                if (command != null)
                {
                    if (command.CheckPermission())
                    {
                        if (checkEdit.Checked)
                        {
                            command.Run(sender, e);
                            string functionInfo = this.Command.CommandID;
                            if (this.Command.CommandName != null && this.Command.CommandName != "")
                            {
                                functionInfo = StringParser.Parse(this.Command.CommandName);
                            }
                            LoggingService.Info("Function " + functionInfo + " run.");
                            return;
                        }
                        command.RestoreEnv();
                        return;
                    }
                    else
                    {
                        XtraMessageBox.Show(StringParser.Parse("${res:ModeNoAuth}"), StringParser.Parse("${res:View_Prompt}"));
                    }
                }
            }
        }
        private void ProcessNextCommand()
        {
            _processingCommand = true;
            PendingCommand pendingCommand = _pendingCommands.Dequeue();
            ICommand       command        =
                _commandFactory.Create(pendingCommand.commandType, pendingCommand.dataType, pendingCommand.data);

            if (command == null)
            {
                _logger.LogError(LoggedFeature.CommandSystem,
                                 "Command is not bound. Have you installed a separate Installer via CommandsInstaller.Install?");
                return;
            }

            IObservable <Unit> observable = command.Run();
            IObserver <Unit>   observer   = Observer.Create <Unit>(HandleCommandSuccess, HandleCommandError);

            observable.Subscribe(observer);

            // Notify listeners
            CommandSnapshot commandSnapshot =
                new CommandSnapshot(command,
                                    pendingCommand.data,
                                    _clock.Now,
                                    pendingCommand.source);

            foreach (var commandQueueListener in _listeners)
            {
                commandQueueListener.HandleCommandQueued(commandSnapshot);
            }
        }
Example #22
0
        static void ProcessLine(string line, CMDFactory commands)
        {
            //Check if line is a command by checking for parsing symbols
            if (line.StartsWith("{") && line.EndsWith("}") && line.Contains(":"))
            {
                //Regex for extracting command name
                string commName = Regex.Matches(line, @"\{(.+?)\:")
                                  .Cast <Match>()
                                  .Select(m => m.Groups[1].Value).FirstOrDefault();

                //Regex for extracting parameters
                string commParams = Regex.Matches(line, @"\:(.+?)\}")
                                    .Cast <Match>()
                                    .Select(m => m.Groups[1].Value).FirstOrDefault();

                //Create array of parameters by splitting the string by ','
                string[] paramSplit = commParams.Split(',');

                //Get command from CMDFactory
                ICommand scamCMD = commands.GetCMD(commName);

                //Run command
                scamCMD.Run(paramSplit);
            }
            else
            {
                //If line is not a command simply print out the string as is.
                Console.WriteLine(line);
            }
        }
 private void OnChanged(object o, EventArgs e)
 {
     if (cmd != null)
     {
         cmd.Run(o, e);
     }
 }
Example #24
0
        private bool TryToProceedCommand(ICommand command, IEnumerable<string> args)
        {
            if (command != null)
            {
                if (command.Verbose)
                    Console.WriteLine("Proceeding Command: " + command.Name);

                try
                {
                    _commandPropertyWalker.FillCommandProperties(args, command);
                    command.Console = Console;
                    command.Run();
                    return true;
                }
                catch (Exception exception)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Unexpected error happended while proceeding the command: " + command.Name);
                    var exceptionWalker = new ExceptionWalker(exception);
                    foreach (var message in exceptionWalker.GetExceptionMessages())
                    {
                        Console.WriteLine(message);
                    }
                    Console.ResetColor();
                    return false;
                }
            }
            return false;
        }
Example #25
0
        protected void sst_Elapsed(object sender, ElapsedEventArgs e)
        {
            ScheduledServiceEntity entity = null;

            try
            {
                entity = ((ScheduledServiceTimer)sender).ScheduledServiceEntity;
                if (entity.WaitForRun == true)  // ÏÐÖÃ״̬²Å¿ÉÒÔRun
                {
                    Assembly assembly = Assembly.LoadFrom(entity.AssemblyPath);
                    Type     type     = assembly.GetType(entity.Type);
                    using (ICommand command = (ICommand)Activator.CreateInstance(type))
                    {
                        entity.WaitForRun = false;
                        command.NewTransactionCode();
                        ServiceResult sr = command.Run(RunMethod.Auto);
                        if (sr.Result == false)
                        {
                            EventLog.WriteEntry("Engine.sst_Elapsed", sr.Message + " Transaction Code:" + sr.TransactionCode, EventLogEntryType.Error);
                        }
                        entity.WaitForRun = true;
                    }
                }
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("Engine.sst_Elapsed", ex.Message, EventLogEntryType.Error);
                if (entity != null)
                {
                    entity.WaitForRun = true;
                }
            }
        }
Example #26
0
        /// <summary>
        /// Returns a menu item for this command
        /// </summary>
        public ToolStripItem CreateMenuItem()
        {
            ICommand cmd = (ICommand)CreateInstance(typeof(ICommand));

            return(new ToolStripMenuItem(Data.Label, Icon, delegate {
                cmd.Run();
            }));
        }
Example #27
0
 protected override void OnClick(EventArgs e)
 {
     base.OnClick(e);
     if (command != null)
     {
         command.Run();
     }
 }
Example #28
0
 /// <summary>
 ///     Calls a command checking CanExecute method
 /// </summary>
 /// <param name="command">
 ///     ICommand
 /// </param>
 /// <param name="parameter">
 ///     Data used by the command. If the command does not require data to be passed, this object can be
 ///     set to null.
 /// </param>
 public static Task RunAsync(this ICommand command, object parameter)
 {
     if (command is IAsyncDelegateCommand asyncCommand)
     {
         return(asyncCommand.ExecuteAsync(parameter));
     }
     return(Task.Run(() => { command.Run(parameter); }));
 }
Example #29
0
        /// <summary>
        /// Returns a toolbar item for this command
        /// </summary>
        public ToolStripItem CreateButton()
        {
            ICommand cmd = (ICommand)CreateInstance(typeof(ICommand));

            return(new ToolStripButton(null, Icon, delegate {
                cmd.Run();
            }));
        }
Example #30
0
 /// <summary>
 ///     Calls a command checking CanExecute method
 /// </summary>
 public static Task RunAsync(this ICommand command)
 {
     if (command is IAsyncDelegateCommand asyncCommand)
     {
         return(asyncCommand.ExecuteAsync(null));
     }
     return(Task.Run(() => { command.Run(); }));
 }
 protected override void OnButtonClick(EventArgs e)
 {
     if (!buttonEnabled)
     {
         return;
     }
     base.OnButtonClick(e);
     menuCommand.Run();
 }
        protected void Cycle(ICommand command)
        {
            try
            {
                command.Run();

                Thread.Sleep(this.interval);
            }
            catch (TimeoutException)
            {
            }
        }
 private static CommandResult RunCommand(HttpApplication application, ICommand command)
 {
     try
     {
         return command.Run(new HttpRequestWrapper(application.Request));
     }
     catch (AuthServicesException)
     {
         return new CommandResult()
         {
             HttpStatusCode = HttpStatusCode.InternalServerError
         };
     }
 }
 private static CommandResult RunCommand(HttpContext application, ICommand command, IOptions options)
 {
     try
     {
         return command.Run(new HttpRequestWrapper(application.Request).ToHttpRequestData(), options, application.Session);
     }
     catch (OIDCException)
     {
         return new CommandResult
         {
             HttpStatusCode = HttpStatusCode.InternalServerError
         };
     }
 }
Example #35
0
        private bool TryToProceedCommand(ICommand command, IEnumerable<string> args)
        {
            if (command != null)
            {
                AbstractTraceConsole traceConsole = null;
                try
                {
                    command.InjectProperties(args);
                    traceConsole = new TraceConsole(Console, command);

                    if (!command.AllowParallel && !_lockingService.AcquireLock(command.Name))
                        return false;

                    command.Console = traceConsole;
                    command.Run();
                    return true;
                }
                catch (Exception exception)
                {
                    LogException(traceConsole, exception, command);
                    return false;
                }
                finally
                {
                    if (!command.AllowParallel)
                        _lockingService.ReleaseLock(command.Name);

                    var disposable = traceConsole as IDisposable;
                    if (disposable != null)
                        disposable.Dispose();
                }

            }
            return false;
        }
		void RunCommand(ICommand command)
		{
			command.Owner = treeView;
			command.Run();
		}
 private static CommandResult RunCommand(HttpApplication application, ICommand command, IOptions options)
 {
     return command.Run(
     new HttpRequestWrapper(application.Request).ToHttpRequestData(),
     options);
 }
Example #38
0
    /// <summary>
    /// Executes a command
    /// </summary>
    /// <param name="cmd">The command to execute</param>
    /// <param name="args">Arguments to apply to the command</param>
    /// <param name="directive">Directives to execute with</param>
    /// <returns>The outcome of the execution</returns>
    private CommandResult ExecuteCommand(ICommand cmd, string[] args, ExecutionDirective directive)
    {
      cmd.Initialise(_context, _formatter);
      CommandResult result = null;

      var manualParseInterface = CommandInspector.GetManualParseCommand(cmd);
      if (manualParseInterface != null)
      {
        var subArgs = from arg in args
                      select Parser.PerformSubstitution(_context, arg);

        result = manualParseInterface.Run(subArgs.ToArray());
      }
      else
      {
        var properties = cmd.GetType().GetProperties();

        object propValue = null;
        var processingArgs = args;

        // Process multi-word named parameters first
        foreach (var prop in properties)
        {
          propValue = null;

          var namedParameterAttribute = CommandInspector.GetNamedParameter(prop);
          if (namedParameterAttribute != null && namedParameterAttribute.WordCount > 1)
          {
            var words = new List<string>();

            for (var i = 0; i < namedParameterAttribute.WordCount; i++)
            {
              var value = string.Empty;
              ParameterUtil.GetParameter(args, "-" + namedParameterAttribute.Name, i, ref value);
              if (!string.IsNullOrEmpty(value))
                words.Add(value);
            }

            if (words.Count > 0)
            {
              propValue = words.ToArray();
              processingArgs = ParameterUtil.RemoveParameter(processingArgs, "-" + namedParameterAttribute.Name, namedParameterAttribute.WordCount);
            }
          }

          ConvertAndAssignParameter(prop, cmd, propValue);
        }

        // Find flags
        var flags = from prop in properties
                    let attr = CommandInspector.GetFlagParameter(prop)
                    where attr != null
                    select attr.Name;

        // Parse remaining arguments
        StringDictionary named = null;
        string[] numbered = null;
        ParameterUtil.ExtractParameters(out named, out numbered, processingArgs, flags.ToArray());

        // Map the parameters to properties
        foreach (var prop in properties)
        {
          propValue = null;

          var namedParameterAttribute = CommandInspector.GetNamedParameter(prop);
          if (namedParameterAttribute != null)
          {
            if (named.ContainsKey(namedParameterAttribute.Name))
              propValue = named[namedParameterAttribute.Name];
          }

          var numberedParameterAttribute = CommandInspector.GetNumberedParameter(prop);
          if (numberedParameterAttribute != null)
          {
            if (numberedParameterAttribute.Number < numbered.Length)
              propValue = numbered[numberedParameterAttribute.Number];
          }

          var flagParameterAttribute = CommandInspector.GetFlagParameter(prop);
          if (flagParameterAttribute != null)
          {
            if (named.ContainsKey(flagParameterAttribute.Name))
            {
#if NET45
              var origVal = (bool)prop.GetValue(cmd);
#else
              var origVal = (bool)prop.GetValue(cmd, null);
#endif
              propValue = !origVal;
            }
          }

          ConvertAndAssignParameter(prop, cmd, propValue);
        }

        AssignListParameter(cmd, properties, numbered);

        result = cmd.Run();
      }

      if ((bool)(directive.StopOnError ?? false) && (result.Status == CommandStatus.Failure))
        _executionFaulted = true;

      return result;
    }