예제 #1
0
        private IEnumerable <IFileSystemGallery> UpdateCurrentState()
        {
            IEnumerable <FileInfo>      archives;
            IEnumerable <DirectoryInfo> archiveFolders;

            if (_observationType.HasFlag(ObservationType.FilesRecursive))
            {
                archives = SupportedExtensions.GetFilesWithExtensions(_observedFolder, SupportedExtensions.GetArchives(), SearchOption.AllDirectories);
            }
            else if (_observationType.HasFlag(ObservationType.FilesNonRecursive))
            {
                archives = SupportedExtensions.GetFilesWithExtensions(_observedFolder, SupportedExtensions.GetArchives());
            }
            else
            {
                archives = new List <FileInfo>();
            }

            if (_observationType.HasFlag(ObservationType.FoldersRecursive))
            {
                archiveFolders = GetArchiveDirectory(_observedFolder, SupportedExtensions.GetImages(), SearchOption.AllDirectories);
            }
            else if (_observationType.HasFlag(ObservationType.FoldersNonRecursive))
            {
                archiveFolders = GetArchiveDirectory(_observedFolder, SupportedExtensions.GetImages());
            }
            else
            {
                archiveFolders = new List <DirectoryInfo>();
            }

            foreach (var archiveFolder in archiveFolders)
            {
                yield return(new FolderFileSystemGallery(archiveFolder));
            }
            foreach (var fileInfo in archives)
            {
                yield return(new ArchiveFileSystemGallery(fileInfo));
            }
        }