public static List <FileInfo> FindEpOnDisk([CanBeNull] DirFilesCache dfc, [NotNull] ShowItem si, [NotNull] Episode epi, bool checkDirectoryExist = true) { DirFilesCache cache = dfc ?? new DirFilesCache(); List <FileInfo> ret = new List <FileInfo>(); int seasWanted = si.DvdOrder ? epi.TheDvdSeason.SeasonNumber : epi.TheAiredSeason.SeasonNumber; int epWanted = si.DvdOrder ? epi.DvdEpNum : epi.AiredEpNum; int snum = seasWanted; Dictionary <int, List <string> > dirs = si.AllFolderLocationsEpCheck(checkDirectoryExist); if (!dirs.ContainsKey(snum)) { return(ret); } foreach (string folder in dirs[snum]) { FileInfo[] files = cache.GetFiles(folder); if (files is null) { continue; } 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); }