I have a .dot file and I need to use c# to generate an image for the DOT Language file. Is there any tool can help me to开发者_运维问答 do so?
Thanks!
This DOT grammar for Gold Parser allows you to parse a .DOT file.
To actually produce images, you can use DOT, NEATO, etc from AT&T Graphiz
If you want to do it in Visio, my addin for Visio is a free option (and a shameless plug). BTW, it's open source
A word of friendly advice: parsing DOT is relatively easy; making the results into a picture is considerably harder.
There are several NuGet packages that does this. For example DotBuilder by Toby Rogers which will let you build a graph and render it using your graphviz installation like this:
var gv = new GraphViz(@"C:\Develop\Tools\graphviz\bin", OutputFormat.Svg);
using (var stream = new FileStream(@"c:\artifacts\dotbuilder\test.svg", FileMode.Create))
{
gv.RenderGraph(graph, stream);
}
What it does for the rendering is really just a command line call to the graphviz binary which you could also do directly from your own code if you prefer to not use third-party tool.
精彩评论