public FileController(ITagRest tagRest, IFileRest fileRest, IProcessRest processRest, ISearchRest searchRest, IValidateFilePathControllerRest validateRest) : base() { _tagRest = tagRest; _fileRest = fileRest; _processRest = processRest; _searchRest = searchRest; _validateRest = validateRest; }
private static void DirectorySearch(string folderPath, JsTreeNodeModel root, IFileRest fileRest) { root.Children = new List <JsTreeNodeModel>(); root.State.Opened = true; foreach (string fileName in Directory.GetFiles(folderPath)) { if (AllowedExtensions != null && AllowedExtensions.Any(ext => fileName.EndsWith(ext))) { BaseFile file = fileRest.Get(fileName); FileInfo fileInfo = new FileInfo(fileName); root.Children.Add(new JsTreeNodeModel { Text = fileInfo.Name, Type = file == null ? "file_new" : "file_added", Attr = new JsTreeAttr { DataFilename = fileInfo.FullName }, State = new JsTreeNodeState() }); } } foreach (string directoryName in Directory.GetDirectories(folderPath)) { DirectoryInfo directoryInfo = new DirectoryInfo(directoryName); JsTreeNodeModel node = new JsTreeNodeModel { Text = directoryInfo.Name, State = new JsTreeNodeState() }; DirectorySearch(directoryName, node, fileRest); root.Children.Add(node); } }
private static void DirectorySearch(string folderPath, JsTreeNodeModel root, IFileRest fileRest) { root.Children = new List<JsTreeNodeModel>(); root.State.Opened = true; foreach (string fileName in Directory.GetFiles(folderPath)) { if (AllowedExtensions != null && AllowedExtensions.Any(ext => fileName.EndsWith(ext))) { BaseFile file = fileRest.Get(fileName); FileInfo fileInfo = new FileInfo(fileName); root.Children.Add(new JsTreeNodeModel { Text = fileInfo.Name, Type = file == null ? "file_new" : "file_added", Attr = new JsTreeAttr { DataFilename = fileInfo.FullName }, State = new JsTreeNodeState() }); } } foreach (string directoryName in Directory.GetDirectories(folderPath)) { DirectoryInfo directoryInfo = new DirectoryInfo(directoryName); JsTreeNodeModel node = new JsTreeNodeModel { Text = directoryInfo.Name, State = new JsTreeNodeState() }; DirectorySearch(directoryName, node, fileRest); root.Children.Add(node); } }