public static void generarImagen(ParseTreeNode raiz)
        {
            String grafoDot = ControlDot.getDot(raiz);

            Console.WriteLine(grafoDot);
            //WINGRAPHVIZLib.DOT dot = new WINGRAPHVIZLib.DOT();
            // WINGRAPHVIZLib.BinaryImage img = dot.ToPNG(grafoDot);
            //img.Save("AST.png");
        }
示例#2
0
        private static void generarImagen(ParseTreeNode raiz)
        {
            String grafoDot = ControlDot.getDot(raiz);

            TextWriter file = new StreamWriter("ast.dot");

            file.WriteLine(grafoDot);
            file.Close();

            TextWriter bat = new StreamWriter("file.bat");

            bat.WriteLine("@echo off");
            bat.WriteLine("cd C:\\Program Files\\Java\\jre1.8.0_161\\bin\\javaw.exe");
            bat.WriteLine("dot -Tpng ast.dot -o ast.png");
            bat.Close();

            System.Diagnostics.Process.Start("file.bat");
        }
        public static void GenerarImagen(ParseTreeNode raiz)
        {
            String grafoDOT = ControlDot.getDot(raiz);

            File.Create("ArbolGramatica.dot").Dispose();
            TextWriter tw = new StreamWriter("ArbolGramatica.dot");

            tw.WriteLine(grafoDOT);
            tw.Close();

            //ejecutar graphviz
            ProcessStartInfo startinfo = new ProcessStartInfo("C:\\Program Files (x86)\\Graphviz2.38\\bin\\dot.exe");
            Process          process;

            startinfo.RedirectStandardOutput = true;
            startinfo.UseShellExecute        = false;
            startinfo.Arguments = "-Tpng ArbolGramatica.dot -o ArbolGramatica.png";
            process             = Process.Start(startinfo);
            process.Close();
        }
示例#4
0
        private static void generarImagen(ParseTreeNode raiz)
        {
            String grafoDOT = ControlDot.getDOT(raiz);

            generarArchivoDot(grafoDOT);

            try
            {
                var comand   = String.Format("dot -Tjpg {0} -o {1}", "C:\\compiladores2\\CompiAST.dot", "C:\\compiladores2\\CompiAST.jpg");
                var prostart = new System.Diagnostics.ProcessStartInfo("cmd", "/C" + comand);
                var proc     = new System.Diagnostics.Process();
                proc.StartInfo = prostart;
                proc.StartInfo.CreateNoWindow = true;
                proc.Start();
                proc.WaitForExit();
            }
            catch (Exception)
            {
                MessageBox.Show("No se pudo generar la imagen CompiAST.jpg");
            }
        }