Interface over passing ticks

This commit is contained in:
2025-07-04 09:11:05 -07:00
parent 93598255c0
commit 8f7fd02ba8
17 changed files with 124 additions and 105 deletions

View File

@ -28,10 +28,17 @@ internal abstract class Id
(byte)(filePath.Id > -1 ? 8 : 2);
internal static byte GetHasDateTimeOriginal(ResultSettings resultSettings, FilePath filePath) =>
(byte)(!resultSettings.ValidVideoFormatExtensions.Contains(filePath.ExtensionLowered) ? filePath.Id > -1 ? 9 : 1 : filePath.Id > -1 ? 6 : 4);
(byte)(IsIgnoreOrValidVideoFormatExtension(resultSettings, filePath) ? filePath.Id > -1 ? 6 : 4 : filePath.Id > -1 ? 9 : 1);
private static bool IsIgnoreOrValidVideoFormatExtension(ResultSettings resultSettings, FilePath filePath) =>
IsIgnoreOrValidVideoFormatExtension(resultSettings, filePath.ExtensionLowered);
private static bool IsIgnoreOrValidVideoFormatExtension(ResultSettings resultSettings, string extensionLowered) =>
resultSettings.IgnoreExtensions.Contains(extensionLowered)
|| resultSettings.ValidVideoFormatExtensions.Contains(extensionLowered);
internal static byte GetMissingDateTimeOriginal(ResultSettings resultSettings, FilePath filePath) =>
(byte)(!resultSettings.ValidVideoFormatExtensions.Contains(filePath.ExtensionLowered) ? filePath.Id > -1 ? 7 : 3 : filePath.Id > -1 ? 5 : 0);
(byte)(IsIgnoreOrValidVideoFormatExtension(resultSettings, filePath) ? filePath.Id > -1 ? 5 : 0 : filePath.Id > -1 ? 7 : 3);
internal static int GetId(ResultSettings resultSettings, MetadataSettings metadataSettings, string intelligentId)
{
@ -81,18 +88,18 @@ internal abstract class Id
}
else if (id > -1)
{
if (!resultSettings.ValidVideoFormatExtensions.Contains(extensionLowered))
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 8 : hasDateTimeOriginal.Value ? 9 : 7;
else
if (IsIgnoreOrValidVideoFormatExtension(resultSettings, extensionLowered))
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 6 : 5;
else
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 8 : hasDateTimeOriginal.Value ? 9 : 7;
value = id.ToString().PadLeft(metadataSettings.IntMinValueLength, '0');
}
else
{
if (!resultSettings.ValidVideoFormatExtensions.Contains(extensionLowered))
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 2 : hasDateTimeOriginal.Value ? 1 : 3;
else
if (IsIgnoreOrValidVideoFormatExtension(resultSettings, extensionLowered))
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? throw new NotImplementedException() : hasDateTimeOriginal.Value ? 4 : 0;
else
key = hasIgnoreKeyword is not null && hasIgnoreKeyword.Value ? 2 : hasDateTimeOriginal.Value ? 1 : 3;
value = id.ToString()[1..].PadLeft(metadataSettings.IntMinValueLength, '0');
}
for (int i = value.Length - resultSettings.ResultAllInOneSubdirectoryLength - 1; i > -1; i--)