Change to support 7680 x 4320 and
Configuration additions
This commit is contained in:
@ -5,10 +5,10 @@ using View_by_Distance.Shared.Models;
|
||||
|
||||
namespace View_by_Distance.Map.Models.Stateless;
|
||||
|
||||
public class ByDeterministicHashCode
|
||||
public class ByRef
|
||||
{
|
||||
|
||||
private static void SetOther(string resizeFilenameExtension, Person[] people, string deterministicHashCodePeopleDirectory, List<double> skipCollection, Dictionary<long, long> personKeyAliases, List<(string, int?, PersonBirthday[], long)> peopleCollection)
|
||||
private static void SetOther(Property.Models.Configuration propertyConfiguration, Configuration configuration, string resizeFilenameExtension, Person[] people, string deterministicHashCodePeopleDirectory, List<double> skipCollection, Dictionary<long, long> personKeyAliases, List<(string, int?, PersonBirthday[], long)> peopleCollection)
|
||||
{
|
||||
long pK;
|
||||
string json;
|
||||
@ -32,7 +32,7 @@ public class ByDeterministicHashCode
|
||||
Dictionary<string, Person> personKeyValuePairs = new();
|
||||
foreach (Person person in people)
|
||||
{
|
||||
personKeyFormatted = Shared.Models.Stateless.Methods.IPersonBirthday.GetFormatted(Shared.Models.Stateless.IPersonBirthday.Format, person.Birthday);
|
||||
personKeyFormatted = Shared.Models.Stateless.Methods.IPersonBirthday.GetFormatted(configuration.PersonBirthdayFormat, person.Birthday);
|
||||
if (personKeyValuePairs.ContainsKey(personKeyFormatted))
|
||||
break;
|
||||
personKeyValuePairs.Add(personKeyFormatted, person);
|
||||
@ -71,11 +71,11 @@ public class ByDeterministicHashCode
|
||||
{
|
||||
personKeyFormatted = Path.GetFileName(personKeyDirectory);
|
||||
if (!DateTime.TryParseExact(personKeyFormatted, "MM.dd.yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime birthday))
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(Shared.Models.Stateless.IPersonBirthday.Format, personKeyFormatted);
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(configuration.PersonBirthdayFormat, personKeyFormatted);
|
||||
else
|
||||
{
|
||||
personBirthday = new PersonBirthday(birthday);
|
||||
personKeyFormatted = Shared.Models.Stateless.Methods.IPersonBirthday.GetFormatted(Shared.Models.Stateless.IPersonBirthday.Format, personBirthday);
|
||||
personKeyFormatted = Shared.Models.Stateless.Methods.IPersonBirthday.GetFormatted(configuration.PersonBirthdayFormat, personBirthday);
|
||||
convertedPersonKeyDirectory = Path.Combine(personDisplayDirectory, personKeyFormatted);
|
||||
if (!Directory.Exists(convertedPersonKeyDirectory))
|
||||
Directory.Move(personKeyDirectory, convertedPersonKeyDirectory);
|
||||
@ -89,7 +89,7 @@ public class ByDeterministicHashCode
|
||||
foreach (string personKeyDirectory in personKeyDirectories)
|
||||
{
|
||||
personKeyFormatted = Path.GetFileName(personKeyDirectory);
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(Shared.Models.Stateless.IPersonBirthday.Format, personKeyFormatted);
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(configuration.PersonBirthdayFormat, personKeyFormatted);
|
||||
if (personBirthday is null)
|
||||
continue;
|
||||
if (personKeyValuePairs.ContainsKey(personKeyFormatted))
|
||||
@ -123,25 +123,27 @@ public class ByDeterministicHashCode
|
||||
}
|
||||
}
|
||||
approximateYears = null;
|
||||
const string displayDirectoryName = Property.Models.Stateless.IResult.AllInOne;
|
||||
DateTime incrementDate = new(Shared.Models.Stateless.IPersonBirthday.FirstYear, 1, 1);
|
||||
string displayDirectoryName = propertyConfiguration.ResultAllInOne;
|
||||
DateTime incrementDate = new(configuration.PersonBirthdayFirstYear, 1, 1);
|
||||
for (int i = 0; i < 500; i++)
|
||||
{
|
||||
personKey = incrementDate.Ticks;
|
||||
personBirthday = new(incrementDate);
|
||||
incrementDate = incrementDate.AddDays(1);
|
||||
personKeyFormatted = Shared.Models.Stateless.Methods.IPersonBirthday.GetFormatted(Shared.Models.Stateless.IPersonBirthday.Format, personBirthday);
|
||||
personKeyFormatted = Shared.Models.Stateless.Methods.IPersonBirthday.GetFormatted(configuration.PersonBirthdayFormat, personBirthday);
|
||||
if (personKeys.Contains(personKey))
|
||||
continue;
|
||||
personKeys.Add(personKey);
|
||||
peopleCollection.Add(new(displayDirectoryName, approximateYears, new PersonBirthday[] { personBirthday }, personKey));
|
||||
}
|
||||
}
|
||||
internal static void SetCollections(int maxDegreeOfParallelism, long ticks, string zPropertyHolderContentDirectory, Dictionary<long, long> personKeyAliases, List<(PersonBirthday, int, int)> idThenNormalizedPixelPercentageCollection, List<(PersonBirthday, int, int)> incorrectIdThenNormalizedPixelPercentageCollection, Dictionary<int, List<Face>> keyValuePairs)
|
||||
|
||||
internal static List<(string, char, string, int?, int?, List<Face>?)> DeleteEmptyDirectoriesAndGetCollection(Configuration configuration, long ticks, string zPropertyHolderContentDirectory, Dictionary<int, List<Face>> keyValuePairs)
|
||||
{
|
||||
List<(string, char, string, int?, int?, List<Face>?)> results = new();
|
||||
int? id;
|
||||
string[] files;
|
||||
long personKey;
|
||||
List<Face>? faces;
|
||||
const int zero = 0;
|
||||
string[] yearDirectories;
|
||||
string personKeyFormatted;
|
||||
@ -150,14 +152,12 @@ public class ByDeterministicHashCode
|
||||
string[] personKeyDirectories;
|
||||
int? normalizedPixelPercentage;
|
||||
string[] personNameDirectories;
|
||||
PersonBirthday? personBirthday;
|
||||
string[] personNameLinkDirectories;
|
||||
string? personFirstInitialDirectory;
|
||||
bool keyValuePairsAny = keyValuePairs.Any();
|
||||
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
|
||||
int totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
||||
string[] ticksDirectories = Directory.GetDirectories(zPropertyHolderContentDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
string message = $") {ticksDirectories.Length:000} ticks Director(ies) - {totalSeconds} total second(s)";
|
||||
string message = $") {ticksDirectories.Length:000} ticks Director(ies) - A - {totalSeconds} total second(s)";
|
||||
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||
using ProgressBar progressBar = new(ticksDirectories.Length, message, options);
|
||||
foreach (string ticksDirectory in ticksDirectories)
|
||||
@ -170,20 +170,8 @@ public class ByDeterministicHashCode
|
||||
foreach (string personKeyDirectory in personKeyDirectories)
|
||||
{
|
||||
personKeyFormatted = Path.GetFileName(personKeyDirectory);
|
||||
if (personKeyFormatted.Length != Shared.Models.Stateless.IPersonBirthday.Format.Length)
|
||||
personBirthday = null;
|
||||
else
|
||||
{
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(Shared.Models.Stateless.IPersonBirthday.Format, personKeyFormatted);
|
||||
if (personBirthday is null)
|
||||
continue;
|
||||
personKey = personBirthday.Value.Ticks;
|
||||
if (personKeyAliases.ContainsKey(personKey))
|
||||
{
|
||||
personKey = personKeyAliases[personKey];
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(personKey);
|
||||
}
|
||||
}
|
||||
if (personKeyFormatted.Length != configuration.PersonBirthdayFormat.Length)
|
||||
continue;
|
||||
yearDirectories = Directory.GetDirectories(personKeyDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string yearDirectory in yearDirectories)
|
||||
{
|
||||
@ -196,27 +184,24 @@ public class ByDeterministicHashCode
|
||||
personFirstInitial = Path.GetFileName(personNameDirectory)[..1];
|
||||
if (personFirstInitial is null)
|
||||
continue;
|
||||
personFirstInitialDirectory = Path.Combine(yearDirectory, personFirstInitial);
|
||||
files = Directory.GetFiles(personNameDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
personFirstInitialDirectory = Path.Combine(yearDirectory, personFirstInitial.ToString());
|
||||
if (personNameDirectory != personFirstInitialDirectory)
|
||||
Directory.Move(personNameDirectory, personFirstInitialDirectory);
|
||||
files = Directory.GetFiles(personFirstInitialDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
if (personKeyFormatted == nameof(Models.MapLogic.ForceSingleImage) && files.Any())
|
||||
throw new Exception($"Move personKey directories up one from {nameof(Models.MapLogic.ForceSingleImage)} and delete {nameof(Models.MapLogic.ForceSingleImage)} directory!");
|
||||
if (personKeyFormatted == nameof(Sorting) && files.Any())
|
||||
throw new Exception($"Move personKey directories up one from {nameof(Sorting)} and delete {nameof(Sorting)} directory!");
|
||||
if (personBirthday is null)
|
||||
continue;
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (file.EndsWith(".lnk") || file.EndsWith(".json"))
|
||||
continue;
|
||||
(id, normalizedPixelPercentage) = Shared.Models.Stateless.Methods.IMapping.GetReversedDeterministicHashCodeKey(Shared.Models.Stateless.ILocation.Digits, keyValuePairsAny, keyValuePairs, file);
|
||||
(id, normalizedPixelPercentage, faces) = Shared.Models.Stateless.Methods.IMapping.GetReversedDeterministicHashCodeKey(configuration.LocationDigits, keyValuePairsAny, keyValuePairs, file);
|
||||
if (id is null || normalizedPixelPercentage is null)
|
||||
continue;
|
||||
if (personFirstInitial != "!")
|
||||
idThenNormalizedPixelPercentageCollection.Add(new(personBirthday, id.Value, normalizedPixelPercentage.Value));
|
||||
else
|
||||
incorrectIdThenNormalizedPixelPercentageCollection.Add(new(personBirthday, id.Value, normalizedPixelPercentage.Value));
|
||||
results.Add(new(personKeyFormatted, personFirstInitial[0], file, id, normalizedPixelPercentage, faces));
|
||||
}
|
||||
personNameLinkDirectories = Directory.GetDirectories(personNameDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
personNameLinkDirectories = Directory.GetDirectories(personFirstInitialDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string personNameLinkDirectory in personNameLinkDirectories)
|
||||
{
|
||||
files = Directory.GetFiles(personNameLinkDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
@ -228,10 +213,7 @@ public class ByDeterministicHashCode
|
||||
}
|
||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(personNameLinkDirectory);
|
||||
}
|
||||
if (personNameDirectory == personFirstInitialDirectory)
|
||||
continue;
|
||||
Directory.Move(personNameDirectory, personFirstInitialDirectory);
|
||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(personNameDirectory);
|
||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(personFirstInitialDirectory);
|
||||
}
|
||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(yearDirectory);
|
||||
}
|
||||
@ -240,9 +222,10 @@ public class ByDeterministicHashCode
|
||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(ticksDirectory);
|
||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(ticksDirectory);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void SetKeyValuePairs(List<(PersonBirthday, int, int)> idThenNormalizedPixelPercentageCollection, List<(PersonBirthday, int, int)> incorrectIdThenNormalizedPixelPercentageCollection, Dictionary<int, Dictionary<int, PersonBirthday[]>> idThenNormalizedPixelPercentageKeyValuePairs, Dictionary<int, Dictionary<int, PersonBirthday[]>> incorrectIdThenNormalizedPixelPercentageKeyValuePairs)
|
||||
private static void SetKeyValuePairs(Configuration configuration, List<(PersonBirthday, int, int)> idThenNormalizedPixelPercentageCollection, List<(PersonBirthday, int, int)> incorrectIdThenNormalizedPixelPercentageCollection, Dictionary<int, Dictionary<int, PersonBirthday[]>> idThenNormalizedPixelPercentageKeyValuePairs, Dictionary<int, Dictionary<int, PersonBirthday[]>> incorrectIdThenNormalizedPixelPercentageKeyValuePairs)
|
||||
{
|
||||
string check;
|
||||
int normalizedPixelPercentageInDecimalForm;
|
||||
@ -252,7 +235,7 @@ public class ByDeterministicHashCode
|
||||
if (!idThenNormalizedPixelPercentageScope.ContainsKey(id))
|
||||
idThenNormalizedPixelPercentageScope.Add(id, new());
|
||||
check = normalizedPixelPercentage.ToString();
|
||||
if (check.Length == Shared.Models.Stateless.ILocation.Digits)
|
||||
if (check.Length == configuration.LocationDigits)
|
||||
{
|
||||
if (!idThenNormalizedPixelPercentageScope[id].ContainsKey(normalizedPixelPercentage))
|
||||
idThenNormalizedPixelPercentageScope[id].Add(normalizedPixelPercentage, new());
|
||||
@ -260,7 +243,7 @@ public class ByDeterministicHashCode
|
||||
}
|
||||
else
|
||||
{
|
||||
normalizedPixelPercentageInDecimalForm = int.Parse(check.PadRight(Shared.Models.Stateless.ILocation.Digits, '0'));
|
||||
normalizedPixelPercentageInDecimalForm = int.Parse(check.PadRight(configuration.LocationDigits, '0'));
|
||||
if (!idThenNormalizedPixelPercentageScope[id].ContainsKey(normalizedPixelPercentageInDecimalForm))
|
||||
idThenNormalizedPixelPercentageScope[id].Add(normalizedPixelPercentageInDecimalForm, new());
|
||||
idThenNormalizedPixelPercentageScope[id][normalizedPixelPercentageInDecimalForm].Add(personBirthday);
|
||||
@ -278,7 +261,7 @@ public class ByDeterministicHashCode
|
||||
if (!incorrectIdThenNormalizedPixelPercentageScope.ContainsKey(id))
|
||||
incorrectIdThenNormalizedPixelPercentageScope.Add(id, new());
|
||||
check = normalizedPixelPercentage.ToString();
|
||||
if (check.Length == Shared.Models.Stateless.ILocation.Digits)
|
||||
if (check.Length == configuration.LocationDigits)
|
||||
{
|
||||
if (!incorrectIdThenNormalizedPixelPercentageScope[id].ContainsKey(normalizedPixelPercentage))
|
||||
incorrectIdThenNormalizedPixelPercentageScope[id].Add(normalizedPixelPercentage, new());
|
||||
@ -286,7 +269,7 @@ public class ByDeterministicHashCode
|
||||
}
|
||||
else
|
||||
{
|
||||
normalizedPixelPercentageInDecimalForm = int.Parse(check.PadRight(Shared.Models.Stateless.ILocation.Digits, '0'));
|
||||
normalizedPixelPercentageInDecimalForm = int.Parse(check.PadRight(configuration.LocationDigits, '0'));
|
||||
if (!incorrectIdThenNormalizedPixelPercentageScope[id].ContainsKey(normalizedPixelPercentageInDecimalForm))
|
||||
incorrectIdThenNormalizedPixelPercentageScope[id].Add(normalizedPixelPercentageInDecimalForm, new());
|
||||
incorrectIdThenNormalizedPixelPercentageScope[id][normalizedPixelPercentageInDecimalForm].Add(personBirthday);
|
||||
@ -300,19 +283,151 @@ public class ByDeterministicHashCode
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetByRef(int maxDegreeOfParallelism, long ticks, string resizeFilenameExtension, Person[] people, List<double> skipCollection, Dictionary<long, (string DisplayDirectoryName, int? ApproximateYears, PersonBirthday[] PersonBirthdays, long PersonKey)> peopleKeyValuePairs, List<long> notMappedPersonKeys, Dictionary<int, Dictionary<int, PersonBirthday[]>> idThenNormalizedPixelPercentageKeyValuePairs, Dictionary<int, Dictionary<int, PersonBirthday[]>> incorrectIdThenNormalizedPixelPercentageKeyValuePairs, string zPropertyHolderContentDirectory, string zPropertyHolderPeopleContentDirectory)
|
||||
private static string? GetCheckFile(string file, int id, int normalizedPixelPercentage)
|
||||
{
|
||||
string? result;
|
||||
string? fileName = Path.GetFileName(file);
|
||||
if (fileName is null)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
string[] segments = fileName.Split('.');
|
||||
if (segments.Length != 3)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
string extensionLowered = $".{segments[2]}";
|
||||
string? directoryName = Path.GetDirectoryName(file);
|
||||
if (string.IsNullOrEmpty(directoryName))
|
||||
result = null;
|
||||
else
|
||||
result = Path.Combine(directoryName, $"{Shared.Models.Stateless.Methods.IMapping.GetDeterministicHashCodeKey(id, normalizedPixelPercentage)}{extensionLowered}.json");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static bool Valid(string checkFile, List<Face> faces)
|
||||
{
|
||||
bool result = false;
|
||||
string json;
|
||||
foreach (Face face in faces)
|
||||
{
|
||||
if (face.FaceEncoding is null)
|
||||
throw new NotSupportedException();
|
||||
if (faces.Count != 1)
|
||||
break;
|
||||
result = true;
|
||||
if (File.Exists(checkFile))
|
||||
continue;
|
||||
json = JsonSerializer.Serialize(face.FaceEncoding);
|
||||
_ = Shared.Models.Stateless.Methods.IPath.WriteAllText(checkFile, json, updateDateWhenMatches: false, compareBeforeWrite: true, updateToWhenMatches: null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int SetCollectionsAndGet(Configuration configuration, long ticks, Shared.Models.Methods.IFaceDistance? distance, Dictionary<long, long> personKeyAliases, List<(PersonBirthday, int, int)> idThenNormalizedPixelPercentageCollection, List<(PersonBirthday, int, int)> incorrectIdThenNormalizedPixelPercentageCollection, List<(string, char, string, int?, int?, List<Face>?)> collection)
|
||||
{
|
||||
int result = 0;
|
||||
long personKey;
|
||||
string? checkFile;
|
||||
List<Face> checkFaces = new();
|
||||
PersonBirthday? personBirthday;
|
||||
int totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
||||
string message = $") {collection.Count:000} ticks Director(ies) - B - {totalSeconds} total second(s)";
|
||||
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||
using ProgressBar progressBar = new(collection.Count, message, options);
|
||||
foreach ((string personKeyFormatted, char personFirstInitial, string file, int? id, int? normalizedPixelPercentage, List<Face>? faces) in collection)
|
||||
{
|
||||
progressBar.Tick();
|
||||
if (id is null || normalizedPixelPercentage is null)
|
||||
continue;
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(configuration.PersonBirthdayFormat, personKeyFormatted);
|
||||
if (personBirthday is null)
|
||||
continue;
|
||||
personKey = personBirthday.Value.Ticks;
|
||||
if (personKeyAliases.ContainsKey(personKey))
|
||||
{
|
||||
personKey = personKeyAliases[personKey];
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(personKey);
|
||||
}
|
||||
if (faces is not null)
|
||||
{
|
||||
checkFaces.Clear();
|
||||
foreach (Face face in faces)
|
||||
{
|
||||
if (face.Mapping is null)
|
||||
throw new NotSupportedException();
|
||||
if (normalizedPixelPercentage.Value != face.Mapping.MappingFromLocation.NormalizedPixelPercentage)
|
||||
continue;
|
||||
checkFaces.Add(face);
|
||||
}
|
||||
checkFile = GetCheckFile(file, id.Value, normalizedPixelPercentage.Value);
|
||||
if (string.IsNullOrEmpty(checkFile))
|
||||
{
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
if (checkFaces.Count != 1 && distance is not null && File.Exists(checkFile))
|
||||
{
|
||||
checkFaces.Clear();
|
||||
checkFaces.AddRange(distance.GetMatchingFaces(configuration.FaceDistanceTolerance, checkFile, faces));
|
||||
}
|
||||
if (!checkFaces.Any())
|
||||
{
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
if (checkFaces.Count != 1)
|
||||
{
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
if (!Valid(checkFile, checkFaces))
|
||||
{
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (personFirstInitial != '!')
|
||||
idThenNormalizedPixelPercentageCollection.Add(new(personBirthday, id.Value, normalizedPixelPercentage.Value));
|
||||
else
|
||||
incorrectIdThenNormalizedPixelPercentageCollection.Add(new(personBirthday, id.Value, normalizedPixelPercentage.Value));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static void Set(Property.Models.Configuration propertyConfiguration, Configuration? configuration, long ticks, string resizeFilenameExtension, Person[] people, string zPropertyHolderContentDirectory, string zPropertyHolderPeopleContentDirectory, List<Face> distinctFilteredFaces, Shared.Models.Methods.IFaceDistance? distance, List<double> skipCollection, Dictionary<long, (string DisplayDirectoryName, int? ApproximateYears, PersonBirthday[] PersonBirthdays, long PersonKey)> peopleKeyValuePairs, List<long> notMappedPersonKeys, Dictionary<int, Dictionary<int, PersonBirthday[]>> idThenNormalizedPixelPercentageKeyValuePairs, Dictionary<int, Dictionary<int, PersonBirthday[]>> incorrectIdThenNormalizedPixelPercentageKeyValuePairs)
|
||||
{
|
||||
if (configuration is null)
|
||||
throw new NullReferenceException(nameof(configuration));
|
||||
Dictionary<long, long> personKeyAliases = new();
|
||||
Dictionary<int, List<Face>> keyValuePairs = new();
|
||||
List<long> idThenNormalizedPixelPercentagePersonKeys = new();
|
||||
List<(string, int?, PersonBirthday[], long)> peopleCollection = new();
|
||||
List<(PersonBirthday, int, int)> idThenNormalizedPixelPercentageCollection = new();
|
||||
List<(PersonBirthday, int, int)> incorrectIdThenNormalizedPixelPercentageCollection = new();
|
||||
SetOther(resizeFilenameExtension, people, zPropertyHolderPeopleContentDirectory, skipCollection, personKeyAliases, peopleCollection);
|
||||
SetCollections(maxDegreeOfParallelism, ticks, zPropertyHolderContentDirectory, personKeyAliases, idThenNormalizedPixelPercentageCollection, incorrectIdThenNormalizedPixelPercentageCollection, keyValuePairs);
|
||||
SetKeyValuePairs(idThenNormalizedPixelPercentageCollection, incorrectIdThenNormalizedPixelPercentageCollection, idThenNormalizedPixelPercentageKeyValuePairs, incorrectIdThenNormalizedPixelPercentageKeyValuePairs);
|
||||
SetOther(propertyConfiguration, configuration, resizeFilenameExtension, people, zPropertyHolderPeopleContentDirectory, skipCollection, personKeyAliases, peopleCollection);
|
||||
foreach (Face face in distinctFilteredFaces)
|
||||
{
|
||||
if (face.FaceEncoding is null || face.Location?.NormalizedPixelPercentage is null)
|
||||
throw new NotSupportedException();
|
||||
if (face.Mapping is null)
|
||||
throw new NotSupportedException();
|
||||
if (!keyValuePairs.ContainsKey(face.Mapping.MappingFromItem.Id))
|
||||
keyValuePairs.Add(face.Mapping.MappingFromItem.Id, new());
|
||||
keyValuePairs[face.Mapping.MappingFromItem.Id].Add(face);
|
||||
}
|
||||
List<(string, char, string, int?, int?, List<Face>?)> collection = DeleteEmptyDirectoriesAndGetCollection(configuration, ticks, zPropertyHolderContentDirectory, keyValuePairs);
|
||||
int unableToMatchCount = SetCollectionsAndGet(configuration, ticks, distance, personKeyAliases, idThenNormalizedPixelPercentageCollection, incorrectIdThenNormalizedPixelPercentageCollection, collection);
|
||||
SetKeyValuePairs(configuration, idThenNormalizedPixelPercentageCollection, incorrectIdThenNormalizedPixelPercentageCollection, idThenNormalizedPixelPercentageKeyValuePairs, incorrectIdThenNormalizedPixelPercentageKeyValuePairs);
|
||||
int totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
||||
string message = $") {collection.Count:000} ticks Director(ies) - C - {unableToMatchCount} Unable To Match Count / {collection.Count} Collection - {totalSeconds} total second(s)";
|
||||
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||
using ProgressBar progressBar = new(collection.Count, message, options);
|
||||
foreach (KeyValuePair<int, Dictionary<int, PersonBirthday[]>> keyValuePair in idThenNormalizedPixelPercentageKeyValuePairs)
|
||||
{
|
||||
progressBar.Tick();
|
||||
foreach (KeyValuePair<int, PersonBirthday[]> keyValue in keyValuePair.Value)
|
||||
idThenNormalizedPixelPercentagePersonKeys.AddRange(from l in keyValue.Value select l.Value.Ticks);
|
||||
}
|
||||
@ -337,7 +452,7 @@ public class ByDeterministicHashCode
|
||||
{
|
||||
int? approximateYears = null;
|
||||
PersonBirthday? personBirthday;
|
||||
const string displayDirectoryName = Property.Models.Stateless.IResult.AllInOne;
|
||||
string displayDirectoryName = propertyConfiguration.ResultAllInOne;
|
||||
foreach (long personKey in idThenNormalizedPixelPercentagePersonKeys)
|
||||
{
|
||||
if (!peopleKeyValuePairs.ContainsKey(personKey))
|
Reference in New Issue
Block a user