From efad273aea9480c1d2adf9aee4a6c8ad0d9bf32d Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 15 May 2023 16:32:48 +0800 Subject: [PATCH] tweaks --- TVRename/ScanActivity/Finders/FinderHelper.cs | 37 ++++++------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/TVRename/ScanActivity/Finders/FinderHelper.cs b/TVRename/ScanActivity/Finders/FinderHelper.cs index 60c86591..5f26c4dc 100644 --- a/TVRename/ScanActivity/Finders/FinderHelper.cs +++ b/TVRename/ScanActivity/Finders/FinderHelper.cs @@ -23,14 +23,10 @@ internal static class FinderHelper private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); public static bool FindSeasEp(FileInfo fi, out int seas, out int ep, out int maxEp, ShowConfiguration? si, out TVSettings.FilenameProcessorRE? re) - { - return FindSeasEp(fi, out seas, out ep, out maxEp, si, TVSettings.Instance.FNPRegexs, out re); - } + => FindSeasEp(fi, out seas, out ep, out maxEp, si, TVSettings.Instance.FNPRegexs, out re); public static bool FindSeasEp(string itemName, out int seas, out int ep, out int maxEp, ShowConfiguration? si, IEnumerable rexps, out TVSettings.FilenameProcessorRE? re) - { - return FindSeasEp(string.Empty, itemName, out seas, out ep, out maxEp, si, rexps, out re); - } + => FindSeasEp(string.Empty, itemName, out seas, out ep, out maxEp, si, rexps, out re); public static bool FindSeasEp(FileInfo? fi, out int seas, out int ep, out int maxEp, ShowConfiguration? si, IEnumerable rexps, out TVSettings.FilenameProcessorRE? re) @@ -425,7 +421,7 @@ private static string SimplifyFilename(string filename, string? showNameHint) return returnFilename; } - public static bool FindSeasEp(string directory, string filename, out int seas, out int ep, out int maxEp, + private static bool FindSeasEp(string directory, string filename, out int seas, out int ep, out int maxEp, ShowConfiguration? si, IEnumerable rexps, out TVSettings.FilenameProcessorRE? rex) { string showNameHint = si != null ? si.ShowName : string.Empty; @@ -589,7 +585,7 @@ private static bool HaveSameNonZeroId(MediaConfiguration item, MediaConfiguratio && currentlyMatchedTvShow.IdFor(p) > 0; } - public static string RemoveSe(string hint) + private static string RemoveSe(string hint) { foreach (TVSettings.FilenameProcessorRE re in TVSettings.Instance.FNPRegexs.Where(re => re.Enabled)) { @@ -631,13 +627,10 @@ public static string RemoveSe(string hint) } private static bool LookForSeries(string test, IEnumerable shows) - { - return GetMatchingSeries(test,shows).Any(); - } + => GetMatchingSeries(test,shows).Any(); + private static IEnumerable GetMatchingSeries(string test, IEnumerable shows) - { - return shows.Where(si => si.NameMatch(test)); - } + => shows.Where(si => si.NameMatch(test)); private static bool LookForMovies(string test, IEnumerable shows) => GetMatchingMovies(test,shows).Any(); @@ -972,7 +965,7 @@ private static MediaConfiguration.MediaType GuessType(string refinedHint, string return otherMatchingShows.MaxBy(s => s.ShowName.Length); } - public static MovieConfiguration? FindBestMatchingShow(string filename, IEnumerable shows) + private static MovieConfiguration? FindBestMatchingShow(string filename, IEnumerable shows) { IEnumerable showItems = shows as MovieConfiguration[] ?? shows.ToArray(); @@ -991,19 +984,13 @@ private static MediaConfiguration.MediaType GuessType(string refinedHint, string } public static IEnumerable FindMatchingShows(FileInfo fi, IEnumerable sil) - { - return FindMatchingShows(fi.Name, sil); - } + => FindMatchingShows(fi.Name, sil); public static IEnumerable FindMatchingShows(string filename, IEnumerable sil) - { - return sil.Where(item => item.NameMatch(filename)); - } + => sil.Where(item => item.NameMatch(filename)); - public static IEnumerable FindMatchingMovies(string filename, IEnumerable sil) - { - return sil.Where(item => item.NameMatch(filename)); - } + private static IEnumerable FindMatchingMovies(string filename, IEnumerable sil) + => sil.Where(item => item.NameMatch(filename)); public static FileInfo GenerateTargetName(ItemMissing mi, FileInfo from) {