public IEnumerable <AbstractSectorDataFile> GetFilesToInclude(SectorDataFileFactory dataFileFactory)
        {
            if (!Directory.Exists(Folder))
            {
                throw new InputDirectoryNotFoundException(Folder);
            }

            string[] allFiles = Directory.GetFiles(
                Folder,
                "*.*",
                Recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly
                );

            // Match on include patterns
            if (IncludePattern != null)
            {
                allFiles = allFiles.Where(file => IncludePattern.IsMatch(file)).ToArray();
            }

            Array.Sort(allFiles, StringComparer.InvariantCulture);

            List <AbstractSectorDataFile> files = new List <AbstractSectorDataFile>();

            foreach (string path in allFiles)
            {
                if (ShouldInclude(path))
                {
                    files.Add(dataFileFactory.Create(path, InputDataType));
                }
            }

            return(files);
        }
Ejemplo n.º 2
0
        public IEnumerable <AbstractSectorDataFile> GetFilesToInclude(SectorDataFileFactory dataFileFactory)
        {
            List <AbstractSectorDataFile> files = new List <AbstractSectorDataFile>();

            foreach (string path in FileList)
            {
                if (File.Exists(path))
                {
                    if (this.ExceptWhereExists == "" || !File.Exists(ExceptWhereExists))
                    {
                        files.Add(dataFileFactory.Create(path, this.InputDataType));
                    }
                }
                else if (!this.IgnoreMissing)
                {
                    throw new InputFileNotFoundException(path);
                }
            }

            return(files);
        }