private IEnumerable <VideoFile> GetVideoFileList( IFolderSettings folderSettings) { operationStartTime = DateTime.Now; OnOperationUpdate(OperationType.Searching, ProgressStyle.Marquee); // Get all video files in source path. var foundFiles = GetAllAccessibleFilesIn( folderSettings.BasePath, folderSettings.ExcludedDirectories, folderSettings.Recursive) .Where(f => folderSettings.FileExtensions.Contains( Path.GetExtension(f), StringComparer.InvariantCultureIgnoreCase)) .Select(f => new VideoFile(f)) .ToList(); if (CurrentState.VideoFiles == null) { return(foundFiles); } foreach (var file in foundFiles.Except(CurrentState.VideoFiles)) { NewFiles.TryAdd(file, 0); } foreach (var file in CurrentState.VideoFiles.Except(foundFiles)) { DeletedFiles.TryAdd(file, 0); } return(CurrentState.VideoFiles); }
private void HandleNewFileEvent(string filePath) { if (!IsFilePathRelevant(filePath, CurrentState.Settings)) { return; } _ = NewFiles.TryAdd(new VideoFile(filePath), 0); OnLogged(string.Format(LogNewFile, filePath)); StartProcessingChanges(); }