Beispiel #1
0
        public Node Create(PackEntry packEntry, IPackEntryEventHandler eventHandler, Node node = null)
        {
            var newParent = CreateNode(packEntry, null);

            if (node != null)
            {
                node.Nodes.Add(newParent);
            }
            else
            {
                node = newParent;
            }

            var dir = packEntry as VirtualDirectory;

            if (dir != null)
            {
                foreach (var subdirs in dir.Subdirectories.Values)
                {
                    Create(subdirs, eventHandler, newParent);
                }

                foreach (var file in dir.Files.Values)
                {
                    var newFile = CreateNode(file, eventHandler);
                    newParent.Nodes.Add(newFile);
                }
            }

            return(newParent);
        }
Beispiel #2
0
        public Node CreateNode(PackEntry packEntry, IPackEntryEventHandler eventHandler)
        {
            var newNode = new TreeNode(packEntry.Name);

            newNode.Tag = packEntry;

            var dir = packEntry as VirtualDirectory;

            if (dir != null)
            {
                if (eventHandler != null)
                {
                    dir.DirectoryAdded += eventHandler.Dir_FileAdded;
                    dir.FileAdded      += eventHandler.Dir_FileAdded;
                    dir.FileRemoved    += eventHandler.Dir_FileRemoved;
                }
                newNode.Image = _treeViewIconCreator.Folder;
            }
            else
            {
                newNode.Image = _treeViewIconCreator.DefaultFile;
            }

            return(newNode);
        }