public void Export(List <ExtensionalGraph> extensionalGraphs, OutputLanguage output, bool writeToConsole,
                           bool writeToFiles, bool useProjectFolder)
        {
            string fileExtension = GetExtension(output);

            for (int i = 0; i < extensionalGraphs.Count; i++)
            {
                ExtensionalGraph extensionalGraph = extensionalGraphs[i];
                if (writeToFiles)
                {
                    string path = useProjectFolder ?
                                  _helper.GetPathWith(_conf.OutputFolderName, extensionalGraph.FileName + fileExtension) :
                                  extensionalGraph.FileName + fileExtension;
                    if (useProjectFolder)
                    {
                        _helper.EnsureOutputDirectoryCreated(_conf.OutputFolderName);
                    }
                    File.WriteAllText(path, extensionalGraph.GraphString);
                }
                if (writeToConsole)
                {
                    if (i == 0)
                    {
                        Console.WriteLine("\nRESULTS:\n");
                    }
                    Console.WriteLine($"Output graph {i}: \n");
                    Console.WriteLine(extensionalGraph.GraphString);
                }
            }
        }
Ejemplo n.º 2
0
        public List <ExtensionalGraph> Generate(List <LabelGraph> graphs)
        {
            List <ExtensionalGraph> gmlGraphs = new List <ExtensionalGraph>();

            foreach (var graph in graphs)
            {
                string           gmlString        = Generate(graph);
                ExtensionalGraph extensionalGraph = new ExtensionalGraph(graph.FileName, gmlString);
                gmlGraphs.Add(extensionalGraph);
            }
            return(gmlGraphs);
        }