public bool SameSource([NotNull] ActionDeleteDirectory o) => FileHelper.Same(toRemove, o.toRemove);
private static bool ReviewFile(bool unattended, [NotNull] FileInfo fi, [NotNull] List <ShowItem> matchingShows, [NotNull] FileInfo existingFile, bool fileCanBeDeleted, [NotNull] List <Item> returnActions, [NotNull] ProcessedEpisode pep) { FileHelper.VideoComparison result = FileHelper.BetterQualityFile(existingFile, fi); switch (result) { case FileHelper.VideoComparison.secondFileBetter: fileCanBeDeleted = false; if (TVSettings.Instance.ReplaceWithBetterQuality) { if (matchingShows.Count > 1) { LOGGER.Warn( $"Keeping {fi.FullName}. Although it is better quality than {existingFile.FullName}, there are other shows ({string.Join(", ", matchingShows.Select(item => item.ShowName))}) that match."); } else { returnActions.AddNullableRange(UpgradeFile(fi, pep, existingFile)); } } else { LOGGER.Warn( $"Keeping {fi.FullName} as it is better quality than some of the current files for that show (Auto Replace with better quality files is turned off)"); } break; case FileHelper.VideoComparison.cantTell: case FileHelper.VideoComparison.similar: if (unattended) { fileCanBeDeleted = false; LOGGER.Info( $"Keeping {fi.FullName} as it might be better quality than {existingFile.FullName}"); } else { if (matchingShows.Count > 1) { LOGGER.Warn( $"Keeping {fi.FullName}. Although it is better quality than {existingFile.FullName}, there are other shows ({string.Join(", ", matchingShows.Select(item => item.ShowName))}) that match."); fileCanBeDeleted = false; } else { fileCanBeDeleted = AskUserAboutFileReplacement(fi, existingFile, returnActions, pep, fileCanBeDeleted); } } break; //the other cases of the files being the same or the existing file being better are not enough to save the file case FileHelper.VideoComparison.firstFileBetter: break; case FileHelper.VideoComparison.same: break; default: throw new ArgumentOutOfRangeException(); } return(fileCanBeDeleted); }
public override bool SameAs(Item o) { return(o is ActionDeleteDirectory cmr && FileHelper.Same(toRemove, cmr.toRemove)); }
public override bool SameAs(Item o) { return((o is ActionDeleteFile cmr) && FileHelper.Same(toRemove, cmr.toRemove)); }