Exemple #1
0
 private void ExtractFileList <T>(HACmdLineFSEntityList <T> aList, SXILElementCategory aCategory, bool aExpandDirectoriesToUnderlyingFiles) where T : HACmdLineFSEntity, new()
 {
     foreach (SXILElement element in aCategory)
     {
         if (element is SXILElementFile)
         {
             SXILElementFile file = (SXILElementFile)element;
             Trace("[CmdInput] ExtractFileList() - file: " + file);
             if (!file.Exists)
             {
                 throw new FileNotFoundException("File not found", file.Name);
             }
             //
             aList.Add(file);
         }
         else if (element is SXILElementDirectory)
         {
             SXILElementDirectory dir = (SXILElementDirectory)element;
             Trace("[CmdInput] ExtractFileList() - dir:  " + dir);
             if (!dir.Exists)
             {
                 throw new DirectoryNotFoundException("Directory not found: " + dir.Name);
             }
             //
             if (aExpandDirectoriesToUnderlyingFiles)
             {
                 aList.AddRange(dir.Files);
             }
             else
             {
                 aList.Add(dir.Directory);
             }
         }
     }
 }