Get Segments

This commit is contained in:
2022-09-20 20:24:03 -07:00
parent b24d3b9c8d
commit 90244811ed
7 changed files with 60 additions and 54 deletions

View File

@ -18,7 +18,7 @@ internal abstract class Mapping
int? id;
List<Models.Face>? faces;
int? normalizedPixelPercentage;
(string? Id, string? NormalizedPixelPercentage, string? ExtensionLowered, bool? Check) segments = GetSegments(facesFileNameExtension, fileName);
(string? Id, string? NormalizedPixelPercentage, string? ExtensionLowered, bool? Check) segments = GetSegments(locationDigits, facesFileNameExtension, fileName);
if (string.IsNullOrEmpty(segments.Id) || string.IsNullOrEmpty(segments.NormalizedPixelPercentage) || string.IsNullOrEmpty(segments.ExtensionLowered) || segments.Check is null)
{
id = null;
@ -45,7 +45,7 @@ internal abstract class Mapping
return new(id, normalizedPixelPercentage, faces);
}
internal static (string?, string?, string?, bool?) GetSegments(string facesFileNameExtension, string fileName)
internal static (string?, string?, string?, bool?) GetSegments(int locationDigits, string facesFileNameExtension, string fileName)
{
string[] segments = fileName.Split('.');
string? id;
@ -63,8 +63,8 @@ internal abstract class Mapping
{
id = segments[0];
extensionLowered = $".{segments[2]}";
normalizedPixelPercentage = segments[1];
needsFacesFileNameExtension = segments.Length == 3;
normalizedPixelPercentage = ILocation.GetRightPadded(locationDigits, segments[1]);
}
return new(id, normalizedPixelPercentage, extensionLowered, needsFacesFileNameExtension);
}