Пример #1
0
        public static List <Res> Folder2Reses(string folderPath, string urlRoot, List <Res> list)
        {
            FolderGenerate.Folder2Res(folderPath, urlRoot, list);
            var allFolders = Directory.GetDirectories(folderPath, "*.*", SearchOption.TopDirectoryOnly);

            for (int i = 0; i < allFolders.Length; i++)
            {
                var           path       = allFolders[i];
                DirectoryInfo folder     = new DirectoryInfo(path);
                string        folderName = folder.Name;
                if (Program.CheckWebFolder(folderName))
                {
                    continue;
                }
                var url = Helper.GetUrl(urlRoot, folderName);
                FolderGenerate.Folder2Reses(path, url, list);
            }
            return(list);
        }
        //singles那种文件夹使用
        // folderPath .../assets/temp/avatar
        // urlRoot       assets/temp/(avatar)
        public static Group Folder2Group(string folderPath, string urlRoot)
        {
            DirectoryInfo folder     = new DirectoryInfo(folderPath);
            string        folderName = folder.Name;

            if (Program.CheckWebFolder(folderName))
            {
                return(null);
            }
            Group group = new Group();

            group.Name = folderName;//temp下子文件夹
            List <Res> list = new List <Res>();
            var        url  = Helper.GetUrl(urlRoot, folder.Name);

            FolderGenerate.Folder2Reses(folderPath, url, list);
            group.listRes = list;
            group.Keys    = group.GenerateKey();
            return(group);
        }