Exemplo n.º 1
0
 private static ExpectedParameter[] GetExpectedParameters(JsonCompositeCommandConfiguration commandConfiguration)
 {
     return(commandConfiguration
            .InputParameters
            ?.Select(parameter => parameter.ToExpectedParameter())
            ?.ToArray());
 }
Exemplo n.º 2
0
        internal CompositeCommand Build(JsonCompositeCommandConfiguration commandConfiguration)
        {
            if (commandConfiguration == null)
            {
                throw new System.ArgumentNullException(nameof(commandConfiguration));
            }

            commandConfiguration.Validate();

            var command = new CompositeCommand(commandConfiguration.CommandName,
                                               GetExpectedParameters(commandConfiguration), commandConfiguration.ExpectedInputFilesInfo);

            foreach (var childCommand in commandConfiguration.ChildCommands)
            {
                var helper = new Helper(commandConfiguration, childCommand);
                command.AddCommand(childCommand.StepName,
                                   new ChildCommandConfiguration()
                {
                    StepName           = childCommand.StepName,
                    StepNumber         = childCommand.StepNumber,
                    Command            = _commandFactory.GetCommand(childCommand.CommandName),
                    FileInputProvider  = helper,
                    InputParamProvider = helper,
                    OutputPath         = childCommand.OutputPath,
                });
            }
            return(command);
        }
Exemplo n.º 3
0
 internal Helper(JsonCompositeCommandConfiguration commandConfiguration, JsonChildCommandConfiguration childCommandConfiguration)
 {
     _childCommandConfiguration = childCommandConfiguration;
     _parentInputFilesInfo      = commandConfiguration.ExpectedInputFilesInfo;
     _parentCommandName         = commandConfiguration.CommandName;
     if (commandConfiguration.CustomObjects != null)
     {
         commandConfiguration.CustomObjects.ToList().ForEach(o => _customObjects.Add(o.Name, o.Value));
     }
 }