RenameUrl

This commit is contained in:
2023-12-25 20:41:10 -07:00
parent d830c1d5a4
commit 7ec50dd56e
2 changed files with 41 additions and 0 deletions

View File

@ -18,6 +18,24 @@ public interface IId
static string GetPaddedId(MetadataConfiguration metadataConfiguration, int index, int id) =>
Id.GetPaddedId(metadataConfiguration, index, id);
bool TestStatic_IsIgnore(FilePath filePath) =>
IsIgnore(filePath);
static bool IsIgnore(FilePath filePath) =>
filePath.FileNameFirstSegment[^1] is '2' or '8';
string TestStatic_GetIgnoreFullPath(FilePath filePath, FileHolder fileHolder) =>
GetIgnoreFullPath(filePath, fileHolder);
static string GetIgnoreFullPath(FilePath filePath, FileHolder fileHolder) =>
fileHolder.DirectoryName is null ?
throw new NotSupportedException() :
filePath.Id > -1 ?
fileHolder.NameWithoutExtension[^1] == '9' ?
Path.Combine(fileHolder.DirectoryName, $"{fileHolder.NameWithoutExtension[..^1]}8{fileHolder.ExtensionLowered}") :
throw new NotSupportedException("High") :
fileHolder.NameWithoutExtension[^1] == '1' ?
Path.Combine(fileHolder.DirectoryName, $"{fileHolder.NameWithoutExtension[..^1]}2{fileHolder.ExtensionLowered}") :
throw new NotSupportedException("Low");
bool TestStatic_NameWithoutExtensionIsIntelligentIdFormat(MetadataConfiguration metadataConfiguration, string fileNameFirstSegment) =>
NameWithoutExtensionIsIntelligentIdFormat(metadataConfiguration, fileNameFirstSegment);
static bool NameWithoutExtensionIsIntelligentIdFormat(MetadataConfiguration metadataConfiguration, string fileNameFirstSegment) =>