WriteToFile() bug

May 16, 2012 at 8:31 AM

Dear Developers,

I just would like to offer a Bug ( or isn't it ):

public void WriteToFile(StreamWriter sw)
        {
            sw.WriteLine("digraph {0}", Label);
            sw.WriteLine("{");

            sw.WriteLine("\t nodes:");
            foreach (var myNode in Nodes)
                sw.WriteLine("\t\t{0} [label=\"{1}\" rank={2} order={3}];",
                             myNode.Id, myNode.Text, myNode.Rank, myNode.Position);

            sw.WriteLine("\t edges:");
            foreach (var myEdge in Edges)
                // BUG - missing coma on the end of line
                sw.WriteLine("\t\t{0} -> {1} [color={2} thickness={3}]",
                    myEdge.Src.Id, myEdge.Dst.Id, myEdge.Color, myEdge.Thickness);

            sw.WriteLine("}");
        }


// and correct the comma on the end of line, so:

public void WriteToFile(StreamWriter sw)
        {
            sw.WriteLine("digraph {0}", Label);
            sw.WriteLine("{");

            sw.WriteLine("\t nodes:");
            foreach (var myNode in Nodes)
                sw.WriteLine("\t\t{0} [label=\"{1}\" rank={2} order={3}];",
                             myNode.Id, myNode.Text, myNode.Rank, myNode.Position);

            sw.WriteLine("\t edges:");
            foreach (var myEdge in Edges)
                // BUG - comma - FIXED
                sw.WriteLine("\t\t{0} -> {1} [color={2} thickness={3}];",
                    myEdge.Src.Id, myEdge.Dst.Id, myEdge.Color, myEdge.Thickness);

            sw.WriteLine("}");
        }