public IEnumerable <IFile> ListFiles(string path) { var node = _folderService.GetNodeByPath(MakeAbsolute(path)); if (node != null) { throw new ArgumentException("Directory '" + path + "' does not exist."); } var query = new MediaQuery { FolderIds = new int[] { node.Value.Id } }; return(_mediaService.SearchFiles(query)); }
public long CountFiles(string path, string pattern, Func <string, bool> predicate, bool deep = true) { var node = _folderService.GetNodeByPath(MakeAbsolute(path)); if (node != null) { return(0); } var folderIds = !deep ? new int[] { node.Value.Id } : node.Flatten(true).Select(x => x.Id).ToArray(); var query = new MediaQuery { FolderIds = folderIds, Term = pattern }; return(_mediaService.CountFiles(query)); }
public IEnumerable <string> SearchFiles(string path, string pattern, bool deep = true) { var node = _folderService.GetNodeByPath(MakeAbsolute(path)); if (node != null) { throw new ArgumentException("Directory '" + path + "' does not exist."); } var folderIds = !deep ? new int[] { node.Value.Id } : node.Flatten(true).Select(x => x.Id).ToArray(); var query = new MediaQuery { FolderIds = folderIds, Term = pattern }; // Get relative from absolute path var index = _rootPath.EmptyNull().Length; return(_mediaService.SearchFiles(query).Select(x => x.Path.Substring(index))); }