Exemplo n.º 1
0
        private static void GetFolderData(string folderName, TreeNode parentNode)
        {
            DirectoryInfo di        = new DirectoryInfo(folderName);
            TreeNode      newParent = new TreeNode();

            newParent.Text = di.Name;
            Mappa m = new Mappa();

            m.di          = di;
            newParent.Tag = m;

            foreach (FileInfo fi in di.GetFiles())
            {
                if (fi.Extension == ".jpg")
                {
                    TreeNode fileNode = new TreeNode();
                    fileNode.Text = fi.Name;
                    Fajl f = new Fajl();
                    f.fi         = fi;
                    f.Sorszam    = fileCounter;
                    fileNode.Tag = f;
                    newParent.Nodes.Add(fileNode);
                    fajlok.Add(fileCounter, f);
                    fileCounter++;
                }
            }


            foreach (DirectoryInfo dir in di.GetDirectories())
            {
                GetFolderData(dir.FullName, newParent);
            }
            parentNode.Nodes.Add(newParent);
        }
Exemplo n.º 2
0
        public static TreeNode FillTreeNodes(string rootfolder)
        {
            DirectoryInfo di = new DirectoryInfo(rootfolder);

            TreeNode node = new TreeNode();

            node.Text = di.Name;
            Mappa m = new Mappa();

            m.di     = di;
            node.Tag = m;

            GetFolderData(rootfolder, node);

            return(node);
        }