Esempio n. 1
0
        public List <FolderTreeWeb> GetFoldersForWeb()
        {
            List <FolderTreeWeb> list = new List <FolderTreeWeb> ();
            FolderTreeWeb        node = new FolderTreeWeb();

            GetFoldersForWeb(ConfigManageClass.UAVPath, node);
            list.Add(node);
            return(list);
        }
Esempio n. 2
0
        public void GetFoldersForWeb(string filePath, FolderTreeWeb node)
        {
            DirectoryInfo folder = new DirectoryInfo(filePath);

            node.text = folder.Name.Contains("UAVS") ? "无人机视频" : folder.Name;
            // node.id = folder.FullName;
            node.nodes = new List <FolderTreeWeb>();
            FileInfo[] chldFiles = folder.GetFiles("*.*");
            foreach (FileInfo chlFile in chldFiles)
            {
                FolderTreeWeb chldNode = new FolderTreeWeb();
                chldNode.leaf = true;
                chldNode.text = chlFile.Name;
                chldNode.path = chlFile.FullName;
                // chldNode.id = chlFile.FullName;
                chldNode.parentid = node.id;
                node.nodes.Add(chldNode);
            }
            DirectoryInfo[] chldFolders = folder.GetDirectories();
            foreach (DirectoryInfo chldFolder in chldFolders)
            {
                DirectoryInfo   folderChild = new DirectoryInfo(chldFolder.FullName);
                DirectoryInfo[] chlds       = folderChild.GetDirectories();
                FolderTreeWeb   chldNode    = new FolderTreeWeb();
                chldNode.text = folder.Name.Contains("UAVS") ? "无人机视频" : folder.Name;
                // chldNode.id = folder.FullName;
                chldNode.parentid = node.id;
                node.nodes.Add(chldNode);
                GetFoldersForWeb(chldFolder.FullName, chldNode);
                if (chlds.Length > 0)
                {
                    chldNode.leaf = false;
                }
                else
                {
                    chldNode.leaf = true;
                }
            }
        }