Esempio n. 1
0
        private void Parse(string solutionFile, string[] skip)
        {
            VsSolution solution = VsSolution.Parse(File.ReadAllLines(solutionFile));

            string solutionPath = solutionFile;

            solutionPath = solutionPath.Remove(solutionPath.LastIndexOf('\\'));

            skip = TrimToLower(skip);

            List <ListBoxItemData> allFiles = new List <ListBoxItemData>();

            int  totalLines = 0;
            int  totalItems = 0;
            long totalSize  = 0;

            foreach (VsSolutionProjectPart each in solution.LinkedProjects)
            {
                if (!Contains(skip, each.Name.ToLower().Trim()))
                {
                    string projectPath = solutionPath + "\\" + each.Path;

                    if (File.Exists(projectPath))
                    {
                        VsProject proj = VsProject.Parse(projectPath.Remove(projectPath.LastIndexOf('\\')), File.ReadAllText(projectPath));
                        projectPath = projectPath.Remove(projectPath.LastIndexOf('\\'));

                        ProcessProject(allFiles, ref totalLines, ref totalItems, ref totalSize, each, projectPath, proj);
                    }
                }
            }

            Dispatcher.BeginInvoke(() =>
            {
                files.ItemsSource   = allFiles;
                skipBox.IsEnabled   = solutionPathBox.IsEnabled = browseButton.IsEnabled = parseButton.IsEnabled = true;
                parseButton.Content = "_Parse";
                lineCount.Text      = totalLines.ToString() + " line" + (totalLines != 1 ? "s" : "");
                itemCount.Text      = totalItems.ToString() + " item" + (totalItems != 1 ? "s" : "");
                itemSize.Text       = IOHelpers.FormatFileSize(totalSize);
            });
        }