예제 #1
0
        private DirectoryContainer getDirectory(string root, DirectoryContainer dc, DirectoryInfo di)
        {
            FolderContentsGrabber fcg = new FolderContentsGrabber();

            dc.DirectoryList = fcg.GetSubdirectories(di);
            dc.FileList      = fcg.GetFilesFromDirectory(di);
            dc.Path          = di.FullName;

            return(dc);
        }
예제 #2
0
        private void walkDirectoryTree(DirectoryInfo root, FileCounterContainer fileCounter)
        {
            FileInfo[]            files   = null;
            DirectoryInfo[]       subDirs = null;
            FolderContentsGrabber fcg     = new FolderContentsGrabber();

            files = fcg.GetFilesFromDirectory(root);
            determineFilesLength(files, fileCounter);
            subDirs = fcg.GetSubdirectories(root);

            // Recursive call.
            if (subDirs != null)
            {
                Parallel.ForEach(subDirs, sd =>
                {
                    walkDirectoryTree(sd, fileCounter);
                });
            }
        }