Example #1
0
 public static void GenerateConfig(List <Group> listGroup, JToken groupConfigs, string resourcePath)
 {
     if (groupConfigs == null)
     {
         Program.ConsoleLog("缺少配置");
         return;
     }
     foreach (var child in groupConfigs)
     {
         var confFolderPath = child["folderPath"].Value <string>();
         var confUrlRoot    = child["urlRoot"].Value <string>();
         var isSingle       = child["single"].Value <bool>();
         var isSheet        = false;
         if (child["sheet"] != null)
         {
             isSheet = child["sheet"].Value <bool>();
         }
         if (isSheet)
         {
             if (isSingle)
             {
                 var singleGroup = SpecialFolderGenerate.SheetFolder2Group(resourcePath + confFolderPath, confUrlRoot);
                 if (singleGroup != null)
                 {
                     SpecialFolderGenerate.CheckDelGroup(singleGroup, listGroup);
                     listGroup.Add(singleGroup);
                 }
             }
             else
             {
                 SpecialFolderGenerate.SheetFolder2Groups(resourcePath + confFolderPath, confUrlRoot, listGroup);
             }
         }
         else
         {
             if (isSingle)
             {
                 var singleGroup = FolderGenerate.Folder2Group(resourcePath + confFolderPath, confUrlRoot);
                 if (singleGroup != null)
                 {
                     listGroup.Add(singleGroup);
                 }
             }
             else
             {
                 FolderGenerate.Folder2Groups(resourcePath + confFolderPath, confUrlRoot, listGroup);
             }
         }
     }
 }
Example #2
0
 //temp sound那种文件夹,根据文件夹下子文件夹生成组,一个文件夹一组
 public static void SheetFolder2Groups(string folderPath, string urlRoot, List <Group> listGroup)
 {
     if (Directory.Exists(folderPath))
     {
         var allFolders = Directory.GetDirectories(folderPath, "*.*", SearchOption.TopDirectoryOnly);
         for (int i = 0; i < allFolders.Length; i++)
         {
             var   path  = allFolders[i];
             Group group = SpecialFolderGenerate.SheetFolder2Group(path, urlRoot);
             if (group != null)
             {
                 SpecialFolderGenerate.CheckDelGroup(group, listGroup);
                 listGroup.Add(group);
             }
         }
     }
 }