Example #1
0
        // 创建节点
        private DJNode buildNode(string path)
        {
            path = path.Trim();
            if (!File.Exists(path) && !Directory.Exists(path)) return null;
            if (isHiddenFile(path)) return null;

            if (File.Exists(path))
            {
                FileInfo file = new FileInfo(path);
                DJNode Fnode = new DJNode(file.Name, file.FullName, true);
                return Fnode;
            }
            else
            {
                DirectoryInfo dir = new DirectoryInfo(path);
                DJNode DNode = new DJNode(dir.Name, dir.FullName, false);

                DirectoryInfo[] dirs = dir.GetDirectories();
                for (int i = 0, len = dirs.Length; i < len; i++)
                {
                    NodeHelper.add(DNode, buildNode(dirs[i].FullName));
                }
                FileInfo[] files = dir.GetFiles();
                for (int i = 0, len = files.Length; i < len; i++)
                {
                    NodeHelper.add(DNode, buildNode(files[i].FullName));
                }

                return DNode;
            }
        }
Example #2
0
 public static int add(TreeView tree, DJNode node)
 {
     if (tree == null || node == null) return -1;
     return tree.Nodes.Add(node);
 }
Example #3
0
 public static int add(DJNode parent, DJNode child)
 {
     if (parent == null || child == null) return -1;
     return parent.Nodes.Add(child);
 }
Example #4
0
        private void ffAdd(string initText, bool isFile)
        {
            DJNode selectNode = fileTree.SelectedNode as DJNode;
            DJNode node = new DJNode(initText, selectNode.filePath, isFile);
            NodeHelper.add(selectNode, node);

            fileTree.SelectedNode = node;
            node.BeginEdit();
        }