private void RunGenerateDiagramImagesStage(FileSystemInfo outputDirectory, IEnumerable <DiscoveredDiagram> diagrams, IRunnerRecorder recorder) { recorder.Log("Starting Stage: Diagram Rendering (output={0})...".FormatWith(outputDirectory.FullName)); foreach (var diagram in diagrams) { var text = BufferedClassDiagramGenerator.GetDiagramText(diagram.Diagram); var javaPath = _options.JavaPath ?? "java.exe"; var plantUml = _options.PlantUml ?? Assembly.GetExecutingAssembly().Location; var npImage = new NPlantImage(javaPath, new PlantUmlInvocation(plantUml)) { Logger = recorder.Log }; var image = npImage.Create(text, diagram.Diagram.Name); if (image != null) { string dir = outputDirectory.FullName; dir = Categorize(diagram, dir); var fileName = diagram.Diagram.Name.ReplaceIllegalPathCharacters('_'); image.SaveNPlantImage(dir, fileName); } } recorder.Log("Finished Stage: Diagram Rendering..."); }
public IEnumerable <DiscoveredDiagram> Load(Assembly assembly, Func <Type, bool> matcher) { _recorder.Log("Starting Stage: Diagram Instantiation..."); DiscoveredDiagram[] diagrams = LoadFromAssembly(assembly, _recorder.Log); _recorder.Log("Finished Stage: Diagram Instantiation (diagrams instantiated={0})...".FormatWith(diagrams.Length)); return(diagrams); }
public Assembly Load(string path) { _recorder.Log("Starting Stage: Assembly Load (assembly={0})...".FormatWith(path)); Assembly assembly = LoadAssembly(path, out var loadMessage); assembly.CheckForNull( () => new NPlantException( "Failed to load assembly '{0}'. Exception message detected: {1}".FormatWith(path, loadMessage))); _recorder.Log("Finished Stage: Assembly Load..."); return(assembly); }
private void RunGenerateDiagramImagesStage(FileSystemInfo outputDirectory, IEnumerable<DiscoveredDiagram> diagrams, IRunnerRecorder recorder) { recorder.Log("Starting Stage: Diagram Rendering (output={0})...".FormatWith(outputDirectory.FullName)); foreach (var diagram in diagrams) { var text = BufferedClassDiagramGenerator.GetDiagramText(diagram.Diagram); var javaPath = _options.JavaPath ?? "java.exe"; var plantUml = _options.PlantUml ?? Assembly.GetExecutingAssembly().Location; var npImage = new NPlantImage(javaPath, new PlantUmlInvocation(plantUml)) { Logger = recorder.Log }; var image = npImage.Create(text, diagram.Diagram.Name); if (image != null) { string dir = outputDirectory.FullName; dir = Categorize(diagram, dir); var fileName = diagram.Diagram.Name.ReplaceIllegalPathCharacters('_'); image.SaveNPlantImage(dir, fileName); } } recorder.Log("Finished Stage: Diagram Rendering..."); }
public static string Save(string outputDirectory, IDiagram diagram, IRunnerRecorder recorder) { var generator = diagram.CreateGenerator(); var filePath = Path.Combine(outputDirectory, "{0}.nplant".FormatWith(diagram.Name.ReplaceIllegalPathCharacters('_'))); if (File.Exists(filePath)) File.Delete(filePath); using (var file = File.CreateText(filePath)) { file.Write(generator.Generate()); recorder.Log("Diagram '{0}' written...".FormatWith(diagram.GetType().FullName)); recorder.Record(filePath); } return filePath; }
public static string Save(string outputDirectory, ClassDiagram diagram, IRunnerRecorder recorder) { var filePath = Path.Combine(outputDirectory, "{0}.nplant".FormatWith(diagram.Name.ReplaceIllegalPathCharacters('_'))); if (File.Exists(filePath)) { File.Delete(filePath); } using (var file = File.CreateText(filePath)) { var generator = new FileClassDiagramGenerator(diagram, file); generator.Generate(); recorder.Log("Diagram '{0}' written...".FormatWith(diagram.GetType().FullName)); recorder.Record(filePath); } return(filePath); }