Ejemplo n.º 1
0
        public static void ShowTopology(Unit.Renderer renderer)
        {
            var scriptName = "topo.dot";
            var fileName   = "topo.png";

            CreateTopologyScript(renderer, scriptName);
            RunGraphviz(scriptName, fileName);
            Process.Start(fileName);
        }
Ejemplo n.º 2
0
        static void CreateTopologyScript(Unit.Renderer renderer, string fileName)
        {
            var builder = new StringBuilder();

            builder.AppendFormat("digraph {0} {{\n", Path.GetFileNameWithoutExtension(fileName));
            builder.AppendLine("\tnode[shape=box];");
            var dict = new Dictionary <Unit.UnitBase, int>();


            dict[renderer] = 0;
            PrintLabel(renderer, builder, dict);
            PrintTopologyUnit(renderer, builder, dict);

            builder.AppendLine("}");
            File.WriteAllText(fileName, builder.ToString());
        }