static void Main(string[] args)
        {
            string rootDirectory = @"C:\Windows";
            Folder rootFolder = new Folder(rootDirectory, false);

            Console.WriteLine("Getting items in {0}, this can take a while", rootDirectory);
            Console.WriteLine();

            PopulateFolders(rootDirectory, rootFolder);

            // Create the Windows Folder tree
            FoldersTree windowsFolderTree = new FoldersTree(rootFolder);

            try
            {
                // Get the subtree, by folder path string
                Folder subFolderFilesSize = windowsFolderTree.GetFolderByName("C:\\Windows\\addins\\Test");
                FoldersTree subFoldersTree = windowsFolderTree.GetSubTree(subFolderFilesSize);

                long sumFilesSize = subFoldersTree.GetTreeFilesLength();

                Console.WriteLine("Files size sum in Tree({0}) = {1}", subFolderFilesSize.Name, sumFilesSize);
            }
            catch (FileNotFoundException ex)
            {
                Console.WriteLine("Error finding files size: {0}", ex.Message);
            }
        }
Beispiel #2
0
        /* ----------------------
        *      METHODS
        * -------------------- */
        // By given node, return the subtree
        public FoldersTree GetSubTree(Folder subTreeRoot)
        {
            FoldersTree subTree = new FoldersTree(subTreeRoot);

            return(subTree);
        }
Beispiel #3
0
        /* ----------------------
         *      METHODS
         * -------------------- */
        // By given node, return the subtree
        public FoldersTree GetSubTree(Folder subTreeRoot)
        {
            FoldersTree subTree = new FoldersTree(subTreeRoot);

            return subTree;
        }