Ejemplo n.º 1
0
        }//end method

        public static IEnumerable <FileSystemInfo> RecurseFileSystem(string path,
                                                                     Predicate <FileSystemInfo> filter)
        {
            DirectoryStateMachine directories =
                new DirectoryStateMachine(new DirectoryInfo(path), filter);
            DirectoryInfo dirInfo = directories.GetNext();

            FileStateMachine files =
                new FileStateMachine(dirInfo, filter);
            FileInfo fileInfo = files.GetNext();

            //recurse the files
            while ((fileInfo = files.GetNext()) != null)
            {
                if (filter.Invoke(fileInfo))
                {
                    yield return(fileInfo);
                }
            }

            //recurse the directories
            while ((dirInfo = directories.GetNext()) != null)
            {
                if (filter.Invoke(dirInfo))
                {
                    yield return(dirInfo);
                }

                //the recursive part, is different for IEnumerables
                foreach (var subDir in RecurseFileSystem(path + "\\" + dirInfo.Name, filter))
                {
                    yield return(subDir);
                }
            }
        } //end method
Ejemplo n.º 2
0
        }//end method

        //*** need for merge solutions program ***
        public static IEnumerable <string> RecurseFiles(string path)
        {
            DirectoryStateMachine directories =
                new DirectoryStateMachine(new DirectoryInfo(path));
            DirectoryInfo dirInfo;

            FileStateMachine files =
                new FileStateMachine(new DirectoryInfo(path));
            FileInfo fileInfo;

            //recurse the files
            while ((fileInfo = files.GetNext()) != null)
            {
                yield return(fileInfo.FullName);
            }

            //recurse the directories
            while ((dirInfo = directories.GetNext()) != null)
            {
                //yield return dirInfo;

                //the recursive part, is different for IEnumerables
                foreach (var subFile in RecurseFiles(path + "\\" + dirInfo.Name))
                {
                    yield return(subFile.ToString());
                }
            }
        }//end method
Ejemplo n.º 3
0
        public static IEnumerable <FileSystemInfo> RecurseFiles(this DirectoryInfo dir)
        {
            DirectoryStateMachine directories =
                new DirectoryStateMachine(new DirectoryInfo(dir.FullName));
            DirectoryInfo dirInfo = directories.GetNext();

            FileStateMachine files =
                new FileStateMachine(dirInfo);
            FileInfo fileInfo = files.GetNext();

            //recurse the files
            while ((fileInfo = files.GetNext()) != null)
            {
                yield return(fileInfo);
            }

            //recurse the directories
            while ((dirInfo = directories.GetNext()) != null)
            {
                //yield return dirInfo;

                //the recursive part, is different for IEnumerables
                foreach (var subFile in new DirectoryInfo(dir.FullName + "\\" + dirInfo.Name).RecurseFiles())
                {
                    yield return(subFile);
                }
            }
        }//end method
Ejemplo n.º 4
0
        //*** need for merge solutions program ***
        public static IEnumerable<string> RecurseDirectories(string path)
        {
            DirectoryStateMachine directories =
                new DirectoryStateMachine(new DirectoryInfo(path));
            DirectoryInfo dirInfo;

            //recurse the directories
            while (( dirInfo = directories.GetNext() ) != null) {
                yield return dirInfo.FullName;

                //the recursive part, is different for IEnumerables
                foreach (var subDir in from folder in RecurseDirectories(path + "\\" + dirInfo.Name) select new DirectoryInfo(folder))
                    yield return subDir.FullName;
            }
        }
Ejemplo n.º 5
0
        }//end method

        //*** need for merge solutions program ***
        public static IEnumerable <string> RecurseDirectories(string path)
        {
            DirectoryStateMachine directories =
                new DirectoryStateMachine(new DirectoryInfo(path));
            DirectoryInfo dirInfo;

            //recurse the directories
            while ((dirInfo = directories.GetNext()) != null)
            {
                yield return(dirInfo.FullName);

                //the recursive part, is different for IEnumerables
                foreach (var subDir in from folder in RecurseDirectories(path + "\\" + dirInfo.Name) select new DirectoryInfo(folder))
                {
                    yield return(subDir.FullName);
                }
            }
        }//end method
Ejemplo n.º 6
0
        public static IEnumerable<FileSystemInfo> RecurseFiles(this DirectoryInfo dir)
        {
            DirectoryStateMachine directories =
                new DirectoryStateMachine(new DirectoryInfo(dir.FullName));
            DirectoryInfo dirInfo = directories.GetNext();

            FileStateMachine files =
                new FileStateMachine(dirInfo);
            FileInfo fileInfo = files.GetNext();

            //recurse the files
            while (( fileInfo = files.GetNext() ) != null) {
                yield return fileInfo;
            }

            //recurse the directories
            while (( dirInfo = directories.GetNext() ) != null) {
                //yield return dirInfo;

                //the recursive part, is different for IEnumerables
                foreach (var subFile in new DirectoryInfo(dir.FullName + "\\" + dirInfo.Name).RecurseFiles())
                    yield return subFile;
            }
        }
Ejemplo n.º 7
0
        public static IEnumerable<FileSystemInfo> RecurseFileSystem(string path, 
            Predicate<FileSystemInfo> filter)
        {
            DirectoryStateMachine directories =
                new DirectoryStateMachine(new DirectoryInfo(path), filter);
            DirectoryInfo dirInfo = directories.GetNext();

            FileStateMachine files =
                new FileStateMachine(dirInfo, filter);
            FileInfo fileInfo = files.GetNext();

            //recurse the files
            while (( fileInfo = files.GetNext() ) != null) {
                if (filter.Invoke(fileInfo))
                    yield return fileInfo;
            }

            //recurse the directories
            while (( dirInfo = directories.GetNext() ) != null) {
                if(filter.Invoke(dirInfo))
                    yield return dirInfo;

                //the recursive part, is different for IEnumerables
                foreach (var subDir in RecurseFileSystem(path + "\\" + dirInfo.Name, filter))
                    yield return subDir;
            }
        }
Ejemplo n.º 8
0
        //*** need for merge solutions program ***
        public static IEnumerable<string> RecurseFiles(string path)
        {
            DirectoryStateMachine directories =
                new DirectoryStateMachine(new DirectoryInfo(path));
            DirectoryInfo dirInfo;

            FileStateMachine files =
                new FileStateMachine(new DirectoryInfo(path));
            FileInfo fileInfo;

            //recurse the files
            while (( fileInfo = files.GetNext() ) != null) {
                yield return fileInfo.FullName;
            }

            //recurse the directories
            while (( dirInfo = directories.GetNext() ) != null) {
                //yield return dirInfo;

                //the recursive part, is different for IEnumerables
                foreach (var subFile in RecurseFiles(path + "\\" + dirInfo.Name))
                    yield return subFile.ToString();
            }
        }