Exemple #1
0
        static void Main(string[] args)
        {
            var sol = new SolutionParser();
              var projects = sol.Parse(@"..\..\..\Solstat.sln");

              Console.WriteLine("Projects in solution:");

              foreach (var project in projects)
              {
            Console.WriteLine(string.Format("{0} ({1})", project.Name, project.Path));
              }

              Console.WriteLine("Total: " + projects.Count);

              Console.ReadLine();
        }
        private void ExecuteOpenSolutionFileCommand(object parameter)
        {
            var dialog = new OpenFileDialog();
              dialog.DefaultExt = ".sln";
              if (dialog.ShowDialog().GetValueOrDefault())
              {
            var path = dialog.FileName;
            var parser = new SolutionParser();
            var projects = parser.Parse(path);

            var warnAsError = projects.Count(p => p.WarnAsError);

            NumberOfProjects = projects.Count;
            TreatWarningsAsErrors = (double)warnAsError / projects.Count;
              }
        }
Exemple #3
0
        public SolutionStatistics Generate(string solutionFilePath)
        {
            if (string.IsNullOrEmpty(solutionFilePath))
            throw new ArgumentNullException("solutionFilePath", "Parameter 'solutionFilePath' cannot be null or empty.");

              if (!File.Exists(solutionFilePath))
            throw new ArgumentException(string.Format("File does not exist ({0})", solutionFilePath));

              var parser = new SolutionParser();
              var projects = parser.Parse(solutionFilePath);

              var statistics = new SolutionStatistics();

              CategoryFiller(projects, p => p.TargetFrameworkVersion.ToString(), statistics.TargetFramework.Values);

              foreach (var p in projects)
            statistics.Projects.Add(p);

              return statistics;
        }