public void GenerateLayout(Graph graph, LayoutSettings layoutSettings) { graph.ThrowIfNull(nameof(graph)); layoutSettings.ThrowIfNull(nameof(layoutSettings)); CreateDotFile(graph, layoutSettings); CommandExecutionSettings commandExecutionSettings = new CommandExecutionSettings { EnvironmentVariables = new Dictionary <string, string> { { "Path", _graphvizDirectory } }, WorkingDirectory = _graphvizDirectory, StopAfterExecution = false }; using WindowsCommandExecutioner commandExecutioner = new WindowsCommandExecutioner(commandExecutionSettings); commandExecutioner.ExecuteCommand(CreateLayoutCommand); PathInfo outputImagePath = new PathInfo(layoutSettings.OutputImagePath); if (outputImagePath.IsValid()) { commandExecutioner.ExecuteCommand(CreateImageCommand); commandExecutioner.Stop(); outputImagePath.Parent.Create(); File.Copy(GetFilePath(ImageOutputName).FullPath, outputImagePath.FullPath, true); } if (commandExecutioner.Errors.Any()) { throw new GraphLayoutException(graph, commandExecutioner.Errors); } if (commandExecutioner.IsRunning) { commandExecutioner.Stop(); } CleanUp(); }