Beispiel #1
0
        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...");
        }
Beispiel #2
0
        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;
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public NPlantAssemblyLoader(IRunnerRecorder recorder)
 {
     _recorder = recorder;
 }
Beispiel #5
0
        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...");
        }
Beispiel #6
0
 public NPlantDiagramLoader(IRunnerRecorder recorder)
 {
     _recorder = recorder;
 }
Beispiel #7
0
 public NPlantDiagramLoader(IRunnerRecorder recorder)
 {
     _recorder = recorder;
 }
Beispiel #8
0
 public NPlantAssemblyLoader(IRunnerRecorder recorder)
 {
     _recorder = recorder;
 }