예제 #1
0
        public static void SaveDotFile(IFunction root, string fileName)
        {
            FileStream   fs = null;
            StreamWriter sw = null;

            string text = "graph CPP {\n" + root.BinaryTree() + "}";

            try
            {
                fs = new FileStream(fileName + ".dot", FileMode.OpenOrCreate, FileAccess.Write);
                sw = new StreamWriter(fs);
                sw.WriteLine(text);
            }
            catch (Exception)
            {
                return;
            }
            finally
            {
                if (sw != null)
                {
                    sw.Close();
                }
                if (fs != null)
                {
                    fs.Close();
                }
            }
        }