private static GetResultResponse BuildResponse(InvestigationResult result)
 {
     return(new GetResultResponse()
     {
         Result = result.GetAllDistinctRecursive().Select(r => new PackageResult
         {
             PackageName = r.PackageName,
             SupportType = r.SupportType,
             Error = r.Error,
             Dependencies = r.Dependencies?.Select(d => d.PackageName).ToArray(),
             ProjectUrl = r.ProjectUrl,
             MoreInformation = r.MoreInformation.ValueOrNull()
         }).ToArray(),
         GraphViz = GraphVizOutputFormatter.Format(result),
         Cypher = CypherOutputFormatter.Format(result)
     });
 }
Exemplo n.º 2
0
        private static void WriteToOutputFiles(string outputDirectory, InvestigationResult result)
        {
            Directory.CreateDirectory(outputDirectory);
            File.WriteAllLines(Path.Combine(outputDirectory, "Flat.txt"), new[] { FlatListingOutputFormatter.Format(result) });
            File.WriteAllLines(Path.Combine(outputDirectory, "Tree.txt"), new[] { TreeOutputFormatter.Format(result) });
            File.WriteAllLines(Path.Combine(outputDirectory, "1Level.gv"), new[] { GraphVizOutputFormatter.Format(result, 1) });
            File.WriteAllLines(Path.Combine(outputDirectory, "All.gv"), new[] { GraphVizOutputFormatter.Format(result) });
            File.WriteAllLines(Path.Combine(outputDirectory, "All.cql"), new[] { CypherOutputFormatter.Format(result) });

            foreach (var package in result.PackageConfigResults)
            {
                File.WriteAllLines(Path.Combine(outputDirectory, package.PackageName + ".gv"), new[] { GraphVizOutputFormatter.Format(package) });
            }

            System.Console.ForegroundColor = ConsoleColor.Magenta;
            System.Console.WriteLine($"Output written to {outputDirectory}");
            System.Console.ResetColor();
        }