private void ReviewFilesInDownloadDirectory(string dirPath, IDialogParent owner) { try { foreach (string filePath in Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories).Where(File.Exists)) { if (currentSettings.Token.IsCancellationRequested) { return; } FileInfo fi = new FileInfo(filePath); if (fi.IgnoreFile()) { continue; } List <ShowConfiguration> matchingShows = showList.Where(si => si.NameMatch(fi, TVSettings.Instance.UseFullPathNameToMatchSearchFolders)).ToList(); List <ShowConfiguration> matchingShowsNoDupes = FinderHelper.RemoveShortShows(matchingShows); if (matchingShowsNoDupes.Any()) { ReviewFileInDownloadDirectory(currentSettings.Unattended, fi, matchingShowsNoDupes, owner); } List <MovieConfiguration> matchingMovies = movieList.Where(mi => mi.NameMatch(fi, TVSettings.Instance.UseFullPathNameToMatchSearchFolders)).ToList(); List <MovieConfiguration> matchingNoDupesMovies = FinderHelper.RemoveShortShows(matchingMovies); if (matchingNoDupesMovies.Any()) { ReviewFileInDownloadDirectory(currentSettings.Unattended, fi, matchingNoDupesMovies, owner); } } } catch (UnauthorizedAccessException ex) { LOGGER.Warn(ex, $"Could not access files in {dirPath}"); } catch (DirectoryNotFoundException ex) { LOGGER.Warn(ex, $"Could not access files in {dirPath}"); } catch (IOException ex) { LOGGER.Warn(ex, $"Could not access files in {dirPath}"); } }