private static List <FileInfo> FindEpOnDisk(DirFilesCache?dfc, ShowConfiguration si, ProcessedEpisode epi, bool checkDirectoryExist = true) { DirFilesCache cache = dfc ?? new DirFilesCache(); List <FileInfo> ret = new List <FileInfo>(); int seasWanted = epi.AppropriateSeasonNumber; int epWanted = epi.AppropriateEpNum; int snum = seasWanted; Dictionary <int, SafeList <string> > dirs = si.AllFolderLocationsEpCheck(checkDirectoryExist); if (!dirs.ContainsKey(snum)) { return(ret); } foreach (string folder in dirs[snum]) { FileInfo[] files = cache.GetFiles(folder); foreach (FileInfo fiTemp in files.Where(fiTemp => fiTemp.IsMovieFile())) { if (!FindSeasEp(fiTemp, out int seasFound, out int epFound, out int _, si)) { continue; } if (seasFound == -1) { seasFound = seasWanted; } if (seasFound == seasWanted && epFound == epWanted) { ret.Add(fiTemp); } } } return(ret); }