Mass push
This commit is contained in:
@ -9,69 +9,69 @@ internal abstract class Mapping
|
||||
string? id;
|
||||
string? extensionLowered;
|
||||
bool? needsFacesFileNameExtension;
|
||||
string? normalizedPixelPercentage;
|
||||
string? normalizedRectangle;
|
||||
if (segments.Length < 4 || $".{segments[3]}" != facesFileNameExtension)
|
||||
{
|
||||
id = null;
|
||||
extensionLowered = null;
|
||||
normalizedPixelPercentage = null;
|
||||
normalizedRectangle = null;
|
||||
needsFacesFileNameExtension = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = segments[0];
|
||||
extensionLowered = $".{segments[2]}";
|
||||
normalizedPixelPercentage = segments[1];
|
||||
normalizedRectangle = segments[1];
|
||||
needsFacesFileNameExtension = segments.Length == 3;
|
||||
}
|
||||
return new(id, normalizedPixelPercentage, extensionLowered, needsFacesFileNameExtension);
|
||||
return new(id, normalizedRectangle, extensionLowered, needsFacesFileNameExtension);
|
||||
}
|
||||
|
||||
private static (int?, int?, List<Models.Mapping>?) GetReversedDeterministicHashCodeKeysFromSegments(string facesFileNameExtension, bool idToMappingCollectionAny, Dictionary<int, List<Models.Mapping>> idToMappingCollection, string fileName)
|
||||
private static (int?, int?, List<Models.Mapping>?) GetConvertedsFromSegments(string facesFileNameExtension, bool idToMappingCollectionAny, Dictionary<int, List<Models.Mapping>> idToMappingCollection, string fileName)
|
||||
{
|
||||
int? id;
|
||||
int? normalizedPixelPercentage;
|
||||
int? normalizedRectangle;
|
||||
List<Models.Mapping>? mappingCollection;
|
||||
(string? Id, string? NormalizedPixelPercentage, string? ExtensionLowered, bool? Check) segments = GetSegments(facesFileNameExtension, fileName);
|
||||
if (string.IsNullOrEmpty(segments.Id) || string.IsNullOrEmpty(segments.NormalizedPixelPercentage) || string.IsNullOrEmpty(segments.ExtensionLowered) || segments.Check is null)
|
||||
(string? Id, string? NormalizedRectangle, string? ExtensionLowered, bool? Check) segments = GetSegments(facesFileNameExtension, fileName);
|
||||
if (string.IsNullOrEmpty(segments.Id) || string.IsNullOrEmpty(segments.NormalizedRectangle) || string.IsNullOrEmpty(segments.ExtensionLowered) || segments.Check is null)
|
||||
{
|
||||
id = null;
|
||||
mappingCollection = null;
|
||||
normalizedPixelPercentage = null;
|
||||
normalizedRectangle = null;
|
||||
}
|
||||
else if (!int.TryParse(segments.Id, out int idValue) || !int.TryParse(segments.NormalizedPixelPercentage, out int normalizedPixelPercentageValue))
|
||||
else if (!int.TryParse(segments.Id, out int idValue) || !int.TryParse(segments.NormalizedRectangle, out int normalizedRectangleValue))
|
||||
{
|
||||
id = null;
|
||||
mappingCollection = null;
|
||||
normalizedPixelPercentage = null;
|
||||
normalizedRectangle = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = idValue;
|
||||
normalizedPixelPercentage = normalizedPixelPercentageValue;
|
||||
normalizedRectangle = normalizedRectangleValue;
|
||||
if (!idToMappingCollectionAny || !idToMappingCollection.ContainsKey(idValue))
|
||||
mappingCollection = null;
|
||||
else
|
||||
mappingCollection = idToMappingCollection[idValue];
|
||||
}
|
||||
return new(id, normalizedPixelPercentage, mappingCollection);
|
||||
return new(id, normalizedRectangle, mappingCollection);
|
||||
}
|
||||
|
||||
internal static (int?, int?, List<Models.Mapping>?) GetReversedDeterministicHashCodeKey(string facesFileNameExtension, bool idToMappingCollectionAny, Dictionary<int, List<Models.Mapping>> idToMappingCollection, string file)
|
||||
internal static (int?, int?, List<Models.Mapping>?) GetConverted(string facesFileNameExtension, bool idToMappingCollectionAny, Dictionary<int, List<Models.Mapping>> idToMappingCollection, string file)
|
||||
{
|
||||
int? id;
|
||||
int? normalizedPixelPercentage;
|
||||
int? normalizedRectangle;
|
||||
List<Models.Mapping>? mappingCollection;
|
||||
string fileName = Path.GetFileName(file);
|
||||
if (fileName.Length < 2 || fileName[1..].Contains('-'))
|
||||
if (fileName.Length >= 2 && !fileName[1..].Contains('-'))
|
||||
(id, normalizedRectangle, mappingCollection) = GetConvertedsFromSegments(facesFileNameExtension, idToMappingCollectionAny, idToMappingCollection, fileName);
|
||||
else
|
||||
{
|
||||
id = null;
|
||||
mappingCollection = null;
|
||||
normalizedPixelPercentage = null;
|
||||
normalizedRectangle = null;
|
||||
}
|
||||
else
|
||||
(id, normalizedPixelPercentage, mappingCollection) = GetReversedDeterministicHashCodeKeysFromSegments(facesFileNameExtension, idToMappingCollectionAny, idToMappingCollection, fileName);
|
||||
return new(id, normalizedPixelPercentage, mappingCollection);
|
||||
return new(id, normalizedRectangle, mappingCollection);
|
||||
}
|
||||
|
||||
internal static int GetAreaPermille(int faceAreaPermille, int bottom, int height, int left, int right, int top, int width)
|
||||
|
Reference in New Issue
Block a user