public FolderNode(string namePassed, FolderNode parentPassed)
     : this()
 {
     if (namePassed != null)
     {
         name = namePassed;
     }
     parent = parentPassed;
 }
Beispiel #2
0
        public FileTree()
        {
            root = null;
            rootPath = string.Empty;

            errorHandler = null;
            reportHandler = null;
            errorHandlerOn = false;
            reportHandlerOn = false;
        }
Beispiel #3
0
        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;
        }
Beispiel #5
0
 public FileNode(string namePassed, string extensionPassed, FolderNode parentPassed)
     : this()
 {
     if (namePassed != null)
     {
         name = namePassed;
     }
     if (extensionPassed != null)
     {
         extension = extensionPassed;
     }
     parent = parentPassed;
 }
Beispiel #6
0
 private void PreOrderTraverse(HandleFile filehandler, FolderNode currentNode)
 {
     foreach (FileNode file in currentNode.Files)
     {
         filehandler(file);
     }
     foreach (FolderNode folder in currentNode.Folders)
     {
         PreOrderTraverse(filehandler, folder);
     }
 }
Beispiel #7
0
 private void PreOrderTraverse(HandleFolder folderHandler, FolderNode currentNode)
 {
     folderHandler(currentNode);
     foreach (FolderNode folder in currentNode.Folders)
     {
         PreOrderTraverse(folderHandler, folder);
     }
 }
Beispiel #8
0
 private void GrowTree(FolderNode currentNode)
 {
     currentNode.UpdateFoldersAndFiles();
     foreach (FolderNode folder in currentNode.Folders)
     {
         GrowTree(folder);
     }
 }
Beispiel #9
0
 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;
 }