public async Task Run(string inputFolder, string outFolder)
        {
            try
            {
                var dirs = Directory.EnumerateDirectories(inputFolder);
                foreach (var dir in dirs)
                {
                    string[] folderArr = dir.Split("\\");
                    if (folderArr.Length == 0)
                    {
                        folderArr = dir.Split("/");
                    }

                    string folderName = folderArr[folderArr.Length - 1];
                    string pumlFolder = $"{outFolder}\\{folderName}\\{PUML_FOLDER}";
                    await gen.Run(dir, pumlFolder);

                    var factory      = new RendererFactory();
                    var localSetting = new PlantUmlSettings()
                    {
                        LocalPlantUmlPath    = "C:\\Users\\emriti\\Desktop\\wow\\plantuml.jar",
                        LocalGraphvizDotPath = "C:\\Program Files\\Graphviz\\bin\\dot.exe",
                        RenderingMode        = RenderingMode.Local
                    };
                    var renderer = factory.CreateRenderer(localSetting);

                    var files        = Directory.EnumerateFiles(pumlFolder, "include.puml", SearchOption.AllDirectories);
                    var outputFormat = OutputFormat.Svg;
                    var outputExt    = "svg";

                    foreach (var file in files)
                    {
                        var data = "";
                        using (StreamReader sr = new StreamReader(file))
                        {
                            data = sr.ReadToEnd();
                        }

                        var bytes = await renderer.RenderAsync(data, outputFormat);

                        var filePath = $"{outFolder}\\{folderName}\\{folderName}.{outputExt}";
                        File.WriteAllBytes(filePath, bytes);

                        OnProgress($"Rendering svg {folderName} ...");
                    }
                }
            }
            catch (Exception ex)
            {
                OnError(ex);
            }
        }
예제 #2
0
 public Renderer(PlantUmlSettings plantUmlSettings = null)
 {
     PlantUmlRenderer = new RendererFactory().CreateRenderer(plantUmlSettings ?? new PlantUmlSettings {
         RemoteUrl = "https://www.plantuml.com/plantuml/"
     });
 }