private static void WriteSlnDetails(IEnumerable <string> slnPaths)
        {
            var options = new WriteSlnProjectsOptions {
                WriteProjectType = true
            };

            foreach (var slnPath in slnPaths)
            {
                var slnFileInfo = new FileInfo(slnPath);

                Output.WriteSlnHeader(slnFileInfo);
                Output.WriteSlnProjects(slnFileInfo, options);
            }
        }
Exemplo n.º 2
0
        public static void WriteSlnProjectsInTable(this Output source, FileInfo slnFileInfo, WriteSlnProjectsOptions options)
        {
            var slnProjects = Io.GetDotNetSolutionProjects(slnFileInfo);

            var count = slnProjects.Count();

            if (count < 1)
            {
                return;
            }

            var table = new Table(2, count)
            {
                ValueColor = new OutputColor(ConsoleColor.White, ConsoleColor.Blue)
            };

            var rowNumber = 0;

            foreach (var slnProject in slnProjects)
            {
                var basePath     = Path.GetDirectoryName(slnFileInfo.FullName);
                var projFilePath = Path.Combine(basePath, slnProject.Path);

                try
                {
                    var dotNetProject = DotNetProject.Load(projFilePath);

                    table.UpdateRow(rowNumber, new[] { new Cell(slnProject.ToText(options)), new Cell(dotNetProject.ToText())
                                                       {
                                                           ValueAlignment = CellValueAlignment.Right
                                                       } });
                }
                catch (InvalidDotNetProjectException)
                {
                    table.UpdateRow(rowNumber, new[] { new Cell(slnProject.ToText(options)), new Cell("(Unknown)")
                                                       {
                                                           ValueAlignment = CellValueAlignment.Right
                                                       } });
                }
                catch (Exception ex)
                {
                    table.UpdateRow(rowNumber, new[] { new Cell(slnProject.ToText(options)), new Cell($"ERROR: {ex.Message}")
                                                       {
                                                           ValueAlignment = CellValueAlignment.Right
                                                       } });
                }

                rowNumber++;
            }

            source.Write(table);
            source.WriteLine();
        }
Exemplo n.º 3
0
        public static void WriteSlnProjects(this Output source, FileInfo slnFileInfo, WriteSlnProjectsOptions options)
        {
            foreach (var slnProject in Io.GetDotNetSolutionProjects(slnFileInfo))
            {
                var basePath     = Path.GetDirectoryName(slnFileInfo.FullName);
                var projFilePath = Path.Combine(basePath, slnProject.Path);

                try
                {
                    var dotNetProject = DotNetProject.Load(projFilePath);

                    source.WriteAlignToSides(slnProject.ToText(options), dotNetProject.ToText());
                }
                catch (InvalidDotNetProjectException)
                {
                    source.WriteAlignToSides(slnProject.Name, "(Unknown)", new OutputColor(ConsoleColor.Yellow));
                }
                catch (Exception ex)
                {
                    source.WriteAlignToSides(slnProject.Name, $"ERROR: {ex.Message}", new OutputColor(ConsoleColor.Red));
                }
            }

            source.WriteLine();
        }