public FolderNode(string namePassed, FolderNode parentPassed) : this() { if (namePassed != null) { name = namePassed; } parent = parentPassed; }
public FileTree() { root = null; rootPath = string.Empty; errorHandler = null; reportHandler = null; errorHandlerOn = false; reportHandlerOn = false; }
private FileNode() { parent = null; name = string.Empty; extension = string.Empty; errorHandler = null; reportHandler = null; errorHandlerOn = false; reportHandlerOn = false; }
protected FolderNode() { parent = null; name = string.Empty; folders = new List<FolderNode>(); files = new List<FileNode>(); errorHandler = null; reportHandler = null; errorHandlerOn = false; reportHandlerOn = false; }
public FileNode(string namePassed, string extensionPassed, FolderNode parentPassed) : this() { if (namePassed != null) { name = namePassed; } if (extensionPassed != null) { extension = extensionPassed; } parent = parentPassed; }
private void PreOrderTraverse(HandleFile filehandler, FolderNode currentNode) { foreach (FileNode file in currentNode.Files) { filehandler(file); } foreach (FolderNode folder in currentNode.Folders) { PreOrderTraverse(filehandler, folder); } }
private void PreOrderTraverse(HandleFolder folderHandler, FolderNode currentNode) { folderHandler(currentNode); foreach (FolderNode folder in currentNode.Folders) { PreOrderTraverse(folderHandler, folder); } }
private void GrowTree(FolderNode currentNode) { currentNode.UpdateFoldersAndFiles(); foreach (FolderNode folder in currentNode.Folders) { GrowTree(folder); } }
public bool SetRoot(string rootPathPassed) { bool setResult = false; if ((rootPathPassed != null) && (Directory.Exists(rootPathPassed))) { DirectoryInfo rootFolder = new DirectoryInfo(rootPathPassed); if (rootFolder.Exists) { rootPath = rootFolder.FullName.Substring(0, rootFolder.FullName.Length - rootFolder.Name.Length); root = new RootFolderNode(this, rootFolder.Name); GrowTree(root); setResult = true; } } return setResult; }