public GetFolders ( string folder, string filter ) : IEnumerable |
||
folder | string | |
filter | string | |
Résultat | IEnumerable |
private TreeNodeCollection AddFolders(string parent, FormDataCollection queryStrings) { var pickerApiController = new FileSystemPickerApiController(); var filter = queryStrings.Get("filter").Split(',').Select(a => a.Trim().EnsureStartsWith(".")).ToArray(); var treeNodeCollection = new TreeNodeCollection(); var startFolderName = queryStrings.Get("startfolder"); var startFolderPath = startFolderName.TrimStart(new char[] { '~', '/' }).EnsureStartsWith("~/"); IEnumerable <TreeNode> treeNodeList = pickerApiController.GetFolders(parent, filter) .Select(dir => CreateTreeNode(String.Format("{0}{1}", startFolderName, dir.FullName.Replace(IOHelper.MapPath(startFolderPath), "").Replace("\\", "/")), parent, queryStrings, dir.Name, "icon-folder", true)); //filter[0] == "." ? // dir.EnumerateDirectories().Any() || pickerApiController.GetFiles(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), filter).Any() : // pickerApiController.GetFiles(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), filter).Any()) treeNodeCollection.AddRange(treeNodeList); return(treeNodeCollection); }
private TreeNodeCollection AddFolders(string parent, FormDataCollection queryStrings) { var pickerApiController = new FileSystemPickerApiController(); var filter = queryStrings.Get("filter").Split(',').Select(a => a.Trim().EnsureStartsWith(".")).ToArray(); var treeNodeCollection = new TreeNodeCollection(); treeNodeCollection.AddRange(pickerApiController.GetFolders(parent, filter) .Select(dir => CreateTreeNode(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), parent, queryStrings, dir.Name, "icon-folder", filter[0] == "." ? dir.EnumerateDirectories().Any() || pickerApiController.GetFiles(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), filter).Any() : pickerApiController.GetFiles(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), filter).Any()))); return treeNodeCollection; }
private TreeNodeCollection AddFolders(string parent, FormDataCollection queryStrings) { var pickerApiController = new FileSystemPickerApiController(); var filter = queryStrings.Get("filter").Split(',').Select(a => a.Trim().EnsureStartsWith(".")).ToArray(); var treeNodeCollection = new TreeNodeCollection(); treeNodeCollection.AddRange(pickerApiController.GetFolders(parent, filter) .Select(dir => CreateTreeNode(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), parent, queryStrings, dir.Name, "icon-folder", filter[0] == "." ? dir.EnumerateDirectories().Any() || pickerApiController.GetFiles(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), filter).Any() : pickerApiController.GetFiles(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), filter).Any()))); return(treeNodeCollection); }