Exemplo n.º 1
0
        public IEnumerable <FileInfo> Locate(FileLocateConfig config)
        {
            if (!config.Directories.Any())
            {
                throw new ArgumentException("No directory specified");
            }

            if (!config.FileMasks.Any())
            {
                throw new ArgumentException("No file masks specifed");
            }

            config.Directories = config.Directories.Select(d => d.Replace("{tmp}", Path.GetTempPath()));

            foreach (var configDirectory in config.Directories.Where(Directory.Exists))
            {
                foreach (var file in Directory.EnumerateFiles(configDirectory))
                {
                    if (DoesFileMatch(file, config.FileMasks))
                    {
                        yield return(new FileInfo(file));
                    }
                }
            }
        }
Exemplo n.º 2
0
 public void Init(FileLocateConfig fileLocateConfig)
 {
     _fileLocateConfig = fileLocateConfig;
 }