public Command GetCommand(OperationParameters operationParameters) { if (!RequirementsSatisfied(operationParameters)) { return(null); } return(BuildCommand(operationParameters)); }
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); }
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); }
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; }
public EngineInstall GetRelevantEngineInstall(OperationParameters operationParameters) { return(operationParameters.Target?.GetEngineInstall()); }
protected string GetTargetName(OperationParameters operationParameters) { return(operationParameters.Target.GetName()); }
protected abstract Command BuildCommand(OperationParameters operationParameters);
public virtual string GetLogsPath(OperationParameters operationParameters) { return(null); }
public Plugin GetPlugin(OperationParameters operationParameters) { return(operationParameters.Target as Plugin); }
public override string GetLogsPath(OperationParameters operationParameters) { return(GetProject(operationParameters).GetLogsPath()); }
public Project GetProject(OperationParameters operationParameters) { return(operationParameters.Target as Project); }