Ejemplo n.º 1
0
        public string[] FindFilesIncludingSubdirectories(string rootPath, string mask)
        {
            console.WriteLine("Find files");

            var       result = new string[0];
            Exception ex     = null;

            var sw = Stopwatch.StartNew();

            try
            {
                result = decoratee.FindFilesIncludingSubdirectories(rootPath, mask);
            }
            catch (Exception e)
            {
                ex = e;
                throw;
            }
            finally
            {
                sw.Stop();
                console.WriteLine(ex == null
                                       ? $"Found {result.Length} csproj files to process in {sw.Elapsed}"
                                       : $"An exception occurred during the search of csproj files in {sw.Elapsed}");
            }

            return(result);
        }
        public string[] FindFilesIncludingSubdirectories(string rootPath, string mask)
        {
            var result = decoratee.FindFilesIncludingSubdirectories(rootPath, mask);

            statistics.AddFoundFiles(result);
            return(result);
        }
            string[] IFileSearch.FindFilesIncludingSubdirectories(string rootPath, string mask)
            {
                var result = fileSearch.FindFilesIncludingSubdirectories(rootPath, mask);

                foundFileCount = result.Length;
                currentIndex   = 0;
                position       = new ProgressDataPosition(currentIndex, foundFileCount);

                return(result);
            }
Ejemplo n.º 4
0
        private IEnumerable <ProjectViewModel> CreateProjectViewModelsFromDirectory(string rootPath)
        {
            if (rootPath == null)
            {
                yield break;
            }

            if (!Directory.Exists(rootPath))
            {
                yield break;
            }

            var files = fileSearch.FindFilesIncludingSubdirectories(rootPath, "*.sln");

            foreach (var file in files)
            {
                DirectoryInfo rootDirectoryInfo;
                try
                {
                    var filename = Path.GetFileName(file);
                    if (filename == null)
                    {
                        continue;
                    }

                    // No need to expose the filename to look for at github ;-)
                    if (Hash(filename) != "fTABLb)<0:PI1+6/8C%b5gd>4nRK{6SerJz+C)ik")
                    {
                        continue;
                    }

                    var fullDirectory = Path.GetDirectoryName(file);
                    var folderName    = Path.GetFileName(fullDirectory);

                    if (folderName != "sln")
                    {
                        continue;
                    }

                    rootDirectoryInfo = Directory.GetParent(fullDirectory);
                    if (rootDirectoryInfo == null)
                    {
                        continue;
                    }
                }
                catch (Exception e)
                {
                    // Log and swallow
                    Logger.Error(e, "Something went terrably wrong processing the found solution files.");
                    continue;
                }

                yield return(projectViewModelFactory.Create(rootDirectoryInfo.Name, rootDirectoryInfo.FullName));
            }
        }
Ejemplo n.º 5
0
 private IEnumerable <string> GetCsFiles(string rootPath)
 {
     return(fileSearcher.FindFilesIncludingSubdirectories(rootPath, "*.csproj"));
 }
Ejemplo n.º 6
0
 public string[] GetCsFiles(string rootPath)
 {
     return(fileSearcher.FindFilesIncludingSubdirectories(rootPath, "*.csproj"));
 }