Exemplo n.º 1
0
        public Command GetCommand(OperationParameters operationParameters)
        {
            if (!RequirementsSatisfied(operationParameters))
            {
                return(null);
            }

            return(BuildCommand(operationParameters));
        }
Exemplo n.º 2
0
        public string GetOutputPath(OperationParameters operationParameters)
        {
            string path = operationParameters.OutputPathRoot;

            if (operationParameters.UseOutputPathProjectSubfolder)
            {
                string subfolderName = GetTargetName(operationParameters);
                path = Path.Combine(path, subfolderName.Replace(" ", ""));
            }
            if (operationParameters.UseOutputPathOperationSubfolder)
            {
                path = Path.Combine(path, OperationName.Replace(" ", ""));
            }
            return(path);
        }
Exemplo n.º 3
0
        public Process Execute(OperationParameters operationParameters, DataReceivedEventHandler outputHandler, DataReceivedEventHandler errorHandler, EventHandler exitHandler)
        {
            if (!RequirementsSatisfied(operationParameters))
            {
                throw new Exception("Requirements not satisfied");
            }

            Command command = BuildCommand(operationParameters);

            if (command == null)
            {
                throw new Exception("No command");
            }

            if (!File.Exists(command.File))
            {
                throw new Exception("File " + command.File + " not found");
            }

            ProcessStartInfo startInfo = new ProcessStartInfo
            {
                FileName               = command.File,
                Arguments              = command.Arguments,
                UseShellExecute        = false,
                RedirectStandardOutput = true,
                RedirectStandardError  = true,
                CreateNoWindow         = true
            };

            Process process = new Process {
                StartInfo = startInfo
            };

            process.EnableRaisingEvents = true;
            process.OutputDataReceived += outputHandler;
            process.ErrorDataReceived  += errorHandler;
            process.Exited += exitHandler;
            process.Start();
            process.BeginOutputReadLine();
            process.BeginErrorReadLine();

            return(process);
        }
Exemplo n.º 4
0
        public virtual bool RequirementsSatisfied(OperationParameters operationParameters)
        {
            if (!SupportsTarget(operationParameters.Target))
            {
                return(false);
            }

            if (!SupportsConfiguration(operationParameters.Configuration))
            {
                return(false);
            }

            if (!GetRelevantEngineInstall(operationParameters).SupportsConfiguration(operationParameters.Configuration))
            {
                return(false);
            }

            return(true);
        }
 public OperationRunner(Operation operation, OperationParameters operationParameters)
 {
     _operation           = operation;
     _operationParameters = operationParameters;
 }
Exemplo n.º 6
0
 public EngineInstall GetRelevantEngineInstall(OperationParameters operationParameters)
 {
     return(operationParameters.Target?.GetEngineInstall());
 }
Exemplo n.º 7
0
 protected string GetTargetName(OperationParameters operationParameters)
 {
     return(operationParameters.Target.GetName());
 }
Exemplo n.º 8
0
 protected abstract Command BuildCommand(OperationParameters operationParameters);
Exemplo n.º 9
0
 public virtual string GetLogsPath(OperationParameters operationParameters)
 {
     return(null);
 }
Exemplo n.º 10
0
 public Plugin GetPlugin(OperationParameters operationParameters)
 {
     return(operationParameters.Target as Plugin);
 }
Exemplo n.º 11
0
 public override string GetLogsPath(OperationParameters operationParameters)
 {
     return(GetProject(operationParameters).GetLogsPath());
 }
Exemplo n.º 12
0
 public Project GetProject(OperationParameters operationParameters)
 {
     return(operationParameters.Target as Project);
 }