rename private methods of DownloadableFileFilter

This commit is contained in:
Cucumberrbob 2025-03-03 12:44:15 +00:00
parent d40e686845
commit 706be01a40
No known key found for this signature in database
GPG key ID: 2B935C47401C3614

View file

@ -14,8 +14,8 @@ public class DownloadableFileFilter(ILogger<DownloadableFileFilter> logger) : ID
{ {
public Boolean IsDownloadable(Torrent torrent, String filePath, Int64 fileSize) public Boolean IsDownloadable(Torrent torrent, String filePath, Int64 fileSize)
{ {
var isDownloadable = SatisfiesMinSize(torrent, filePath, fileSize) && var isDownloadable = PassesSizeFilter(torrent, filePath, fileSize) &&
SatisfiesFileNameRegex(torrent, filePath); PassesFilePathFilter(torrent, filePath);
if (isDownloadable) if (isDownloadable)
{ {
@ -25,7 +25,7 @@ public class DownloadableFileFilter(ILogger<DownloadableFileFilter> logger) : ID
return isDownloadable; return isDownloadable;
} }
private Boolean SatisfiesMinSize(Torrent torrent, String filePath, Int64 fileSize) private Boolean PassesSizeFilter(Torrent torrent, String filePath, Int64 fileSize)
{ {
if (torrent is { ClientKind: Provider.RealDebrid, DownloadAction: TorrentDownloadAction.DownloadManual }) if (torrent is { ClientKind: Provider.RealDebrid, DownloadAction: TorrentDownloadAction.DownloadManual })
{ {
@ -42,12 +42,12 @@ public class DownloadableFileFilter(ILogger<DownloadableFileFilter> logger) : ID
return false; return false;
} }
private Boolean SatisfiesFileNameRegex(Torrent torrent, String filePath) private Boolean PassesFilePathFilter(Torrent torrent, String filePath)
{ {
return IncludeFileName(torrent, filePath) && ExcludeFileName(torrent, filePath); return PassesIncludeRegexFilter(torrent, filePath) && PassesExcludeRegexFilter(torrent, filePath);
} }
private Boolean IncludeFileName(Torrent torrent, String filePath) private Boolean PassesIncludeRegexFilter(Torrent torrent, String filePath)
{ {
if (String.IsNullOrWhiteSpace(torrent.IncludeRegex) || Regex.IsMatch(filePath, torrent.IncludeRegex)) if (String.IsNullOrWhiteSpace(torrent.IncludeRegex) || Regex.IsMatch(filePath, torrent.IncludeRegex))
{ {
@ -59,7 +59,7 @@ public class DownloadableFileFilter(ILogger<DownloadableFileFilter> logger) : ID
return false; return false;
} }
private Boolean ExcludeFileName(Torrent torrent, String filePath) private Boolean PassesExcludeRegexFilter(Torrent torrent, String filePath)
{ {
// If the IncludeRegex is set, ignore the ExcludeRegex // If the IncludeRegex is set, ignore the ExcludeRegex
if (!String.IsNullOrWhiteSpace(torrent.IncludeRegex)) if (!String.IsNullOrWhiteSpace(torrent.IncludeRegex))