Ejemplo n.º 1
0
        //void _Hierarchy_BeginProcessFolderChildrenEvent(object sender, FileSystemHierarchy.BeginProcessFolderChildrenEventArgs e)
        //{
        //    this.SetStatus("Reading... " + e.ParentFolder.ItemPath);
        //}

        private void buttonReadHierarchy_Click(object sender, EventArgs e)
        {
            //if (_ReadingHierarchy)
            //{
            //    _Hierarchy.RequestStopReadHierarchyFromDisk();
            //    return;
            //}

            _readingHierarchy = true;
            UpdateInterface();

            _hierarchy = FolderItem.CreateMultiRoot(textBoxRootFolderPath.Lines);
            //TODO: Find a way to search multiple distinct root folders
            //foreach (string root_path in textBoxRootFolderPath.Lines)
            //    if (root_path.Trim() != "" && Directory.Exists(root_path))
            //        _Hierarchy = FolderItem.CreateRoot(root_path);
            //        //_Hierarchy.AddActiveRootFolder(root_path);

            if (checkBoxReadFiles.Checked && checkBoxReadFolders.Checked)
            {
                _hierarchy.AddDescendantItemsFromDisk(textBoxFilesPattern.Text, textBoxFoldersPattern.Text);
            }

            else if (checkBoxReadFolders.Checked)
            {
                _hierarchy.AddDescendantFoldersFromDisk(textBoxFoldersPattern.Text);
            }

            else if (checkBoxReadFiles.Checked)
            {
                _hierarchy.AddChildFilesFromDisk(textBoxFoldersPattern.Text);
            }

            SetStatus("Ready");

            _readingHierarchy   = false;
            _rootFoldersChanged = false;
            UpdateInterface();
        }