Exemplo n.º 1
0
        protected override void OnDoWork(DoWorkEventArgs e)
        {
            TreeBuilderStruct treeBuilderStruct = (TreeBuilderStruct)e.Argument;

            maxFiles = treeBuilderStruct.totalFiles;
            this.buildTree(treeBuilderStruct, e);
        }
Exemplo n.º 2
0
        private void buildTree(TreeBuilderStruct pTreeBuilderStruct, DoWorkEventArgs e)
        {
            TreeNode t;

            StreamWriter sw = null;

            sw = File.CreateText(EXAMINE_OUTPUT_PATH);

            foreach (string path in pTreeBuilderStruct.pPaths)
            {
                t = null;

                if (File.Exists(path))
                {
                    if (!CancellationPending)
                    {
                        t = this.getFileNode(path, sw, pTreeBuilderStruct.checkForLibs, e);
                    }
                    else
                    {
                        e.Cancel = true;

                        if (sw != null)
                        {
                            sw.Close();
                            sw.Dispose();
                        }
                        return;
                    }
                }
                else if (Directory.Exists(path))
                {
                    t = new TreeNode(Path.GetFileName(path));
                    this.getDirectoryNode(path, t, sw, pTreeBuilderStruct.checkForLibs, e);

                    if (CancellationPending)
                    {
                        e.Cancel = true;

                        if (sw != null)
                        {
                            sw.Close();
                            sw.Dispose();
                        }

                        return;
                    }
                }

                // Add node, but ignore progress
                this.progressStruct.Clear();
                this.progressStruct.NewNode = (TreeNode)t.Clone();
                ReportProgress(Constants.IgnoreProgress, this.progressStruct);
            }

            sw.Close();
            sw.Dispose();
        }