Exemplo n.º 1
0
        public List <INode> GetDescendantNodes(INode inode, string _filter, bool getDirectories = true,
                                               bool getFiles = true)
        {
            // TODO: Potential bug with a fileq showing allowing further indexing.
            // TODO: Implement .lnk and symbolic link handling.
            // TODO: Fix file handling.
            // Define the return value.
            var returnNodesList = new List <INode>();
            var pathsList       = new List <string>();

            if (inode.HasDecendants)
            {
                if (getDirectories)
                {
                    pathsList.AddRange(Directory.GetDirectories(inode.FileSystemUri, _filter,
                                                                SearchOption.TopDirectoryOnly));
                    foreach (var path in pathsList)
                    {
                        var node = new Node(GetDistinctName(path), "", "", path, DefaultNodeTheme, DefaultNodeFont,
                                            GetFolderIconBitmap(path), true, true);
                        returnNodesList.Add(node);
                    }
                    pathsList.Clear();
                }

                if (getFiles)
                {
                    pathsList.AddRange(Directory.GetFiles(inode.FileSystemUri, _filter, SearchOption.TopDirectoryOnly));
                    foreach (var path in pathsList)
                    {
                        var node = new Node(GetDistinctName(path), "", "", path, DefaultNodeTheme, DefaultNodeFont,
                                            GetFileIconBitmap(path), true, false);
                        node.HasDecendants = false;
                        returnNodesList.Add(node);
                    }
                    pathsList.Clear();
                }

                if (returnNodesList.Count == 0)
                {
                    // here
                    var nt = new NodeTheme(Color.LightGray, Color.DarkSlateGray, Color.Beige, Color.Black, Color.Black,
                                           Color.Black);
                    var node = new Node("Empty", "", "", "", DefaultNodeTheme, DefaultNodeFont,
                                        SystemIcons.Exclamation.ToBitmap(), true, true);

                    node.State         = NodeState.None;
                    node.HasDecendants = false;
                    returnNodesList.Add(node);
                }
            }


            return(returnNodesList);
        }
Exemplo n.º 2
0
 public Node(string _text, string _description, string _hoverDescription, string _fileSystemUri, NodeTheme _theme,
             Font _fontFace, Bitmap _iconBitmap, bool _shouldBeRendered, bool _hasDecendants,
             List <string> _potentialChildren = null)
 {
     Text              = _text;
     Description       = _description;
     HoverDescription  = _hoverDescription;
     FileSystemUri     = _fileSystemUri;
     Theme             = _theme;
     FontFace          = _fontFace;
     IconBitmap        = _iconBitmap;
     Bounds            = new RectangleF(0, 0, 0, 0);
     ShouldBeRendered  = _shouldBeRendered;
     HasDecendants     = _hasDecendants;
     PotentialChildren = _potentialChildren;
 }
Exemplo n.º 3
0
 public INode[] GenererateChildren(FileSystemQuery fsQuery, string filter, NodeTheme _defaultNodeTheme,
                                   Font _defaultFont)
 {
     return(fsQuery.GetDescendantNodes(this, filter).ToArray());
 }
Exemplo n.º 4
0
 public FileSystemQuery(NodeTheme _defaultNodeTheme, Font _defualtNodeFont)
 {
     DefaultNodeTheme = _defaultNodeTheme;
     DefaultNodeFont  = _defualtNodeFont;
 }