/// <summary> /// Iterates over the contents of a directory and returns a complete list of all /// of the files contained within. The file names are returned as relative paths. /// Note that this method provides only a thin-layer over file system calls -- /// low-level file system exceptions may be thrown and they should be /// caught and handled appropriately. /// </summary> /// <param name="path">Path to enumerate</param> /// <param name="useUriSeparator">Use URI standard (forward slash) to separate directories</param> /// <returns>An ArrayList of file names (represented as string objects) /// </returns> public static ArrayList ListRecursive(string path, bool useUriSeparator) { // recursively iterate through the directory to find the list of files DirectoryLister lister = new DirectoryLister(path, useUriSeparator, true); return(lister.GetFiles()); }
public static bool CanCreateFrom(DataObjectMeister data) { // see if there are files at the top-level of the file data FileData fileData = data.FileData; if (fileData != null && fileData.Files.Length == 1 && fileData.Files[0].IsDirectory) { DirectoryLister lister = new DirectoryLister(fileData.Files[0].ContentsPath, false, true); foreach (string file in lister.GetFiles()) { if (PathHelper.IsPathImage(file)) { return true; } } } return false; }
protected override bool DoInsertData(DataAction action, MarkupPointer begin, MarkupPointer end) { //hack: drive the selection textRange to the caret (before calling InsertImages) EditorContext.MarkupServices.CreateMarkupRange(begin, end).ToTextRange().select(); List<string> files = new List<string>(); DirectoryLister lister = new DirectoryLister(DataMeister.FileData.Files[0].ContentsPath, false, true); foreach (string file in lister.GetFiles()) { if (PathHelper.IsPathImage(file)) { files.Add(Path.Combine(lister.RootPath, file)); } } return DoInsertDataCore(files, action, begin, end); }
/// <summary> /// Iterates over the contents of a directory and returns a complete list of all /// of the files contained within. The file names are returned as relative paths. /// Note that this method provides only a thin-layer over file system calls -- /// low-level file system exceptions may be thrown and they should be /// caught and handled appropriately. /// </summary> /// <param name="path">Path to enumerate</param> /// <param name="useUriSeparator">Use URI standard (forward slash) to separate directories</param> /// <returns>An ArrayList of file names (represented as string objects) /// </returns> public static ArrayList ListRecursive(string path, bool useUriSeparator) { // recursively iterate through the directory to find the list of files DirectoryLister lister = new DirectoryLister(path, useUriSeparator, true); return lister.GetFiles(); }