public GetFileSystemEntries ( string dirPath ) : string[] | ||
dirPath | string | |
return | string[] |
/// <summary> /// Load all Python source files recursively if the given fullname is a /// directory; otherwise just load a file. Looks at file extension to /// determine whether to load a given file. /// </summary> public void LoadFileRecursive(string fullname) { int count = countFileRecursive(fullname); if (loadingProgress == null) { loadingProgress = new Progress(this, count, 50, this.HasOption("quiet")); } string file_or_dir = fullname; if (FileSystem.DirectoryExists(file_or_dir)) { foreach (string file in FileSystem.GetFileSystemEntries(file_or_dir)) { LoadFileRecursive(file); } } else { if (file_or_dir.EndsWith(suffix)) { LoadFile(file_or_dir); } } }
/// <summary> /// Count number of .py files /// </summary> /// <param name="fullname"></param> /// <returns></returns> public int countFileRecursive(string fullname) { string file_or_dir = fullname; int sum = 0; if (FileSystem.DirectoryExists(file_or_dir)) { foreach (string file in FileSystem.GetFileSystemEntries(file_or_dir)) { sum += countFileRecursive(file); } } else { if (file_or_dir.EndsWith(suffix)) { ++sum; } } return(sum); }