Beispiel #1
0
        /// <summary>
        /// 返回内置的文件和目录遍历器
        /// </summary>
        /// <returns>遍历器对象</returns>
        public System.Collections.IEnumerator GetEnumerator()
        {
            FileDirectoryEnumerator e = new FileDirectoryEnumerator();

            e.ReturnStringType   = this.bolReturnStringType;
            e.SearchForDirectory = this.bolSearchForDirectory;
            e.SearchForFile      = this.bolSearchForFile;
            e.SearchPath         = this.strSearchPath;
            e.SearchPattern      = this.strSearchPattern;
            e.ThrowIOException   = this.bolThrowIOException;
            myList.Add(e);
            return(e);
        }
Beispiel #2
0
        public static DirectoryInfo[] GetAllDirPath(string path)
        {
            FileDirectoryEnumerator ef = new FileDirectoryEnumerator();

            ef.SearchPath = path;
            ef.Reset();
            ef.SearchForDirectory = true;
            ef.SearchForFile      = false;
            ef.ReturnStringType   = false;
            ef.ThrowIOException   = false;
            System.Collections.ArrayList al = new System.Collections.ArrayList();
            while (ef.MoveNext())
            {
                al.Add((DirectoryInfo)ef.Current);
            }
            ef.Close();
            return((DirectoryInfo[])al.ToArray(typeof(DirectoryInfo)));
        }