Strip old way
This commit is contained in:
@ -137,7 +137,7 @@ public class ByDeterministicHashCode
|
||||
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, double)> incorrectDeterministicHashCodeCollection, Dictionary<int, List<Face>> keyValuePairs)
|
||||
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)
|
||||
{
|
||||
int? id;
|
||||
string[] files;
|
||||
@ -211,7 +211,10 @@ public class ByDeterministicHashCode
|
||||
(id, normalizedPixelPercentage) = Shared.Models.Stateless.Methods.IMapping.GetReversedDeterministicHashCodeKey(Shared.Models.Stateless.ILocation.Digits, keyValuePairsAny, keyValuePairs, file);
|
||||
if (id is null || normalizedPixelPercentage is null)
|
||||
continue;
|
||||
idThenNormalizedPixelPercentageCollection.Add(new(personBirthday, id.Value, normalizedPixelPercentage.Value));
|
||||
if (personFirstInitial != "!")
|
||||
idThenNormalizedPixelPercentageCollection.Add(new(personBirthday, id.Value, normalizedPixelPercentage.Value));
|
||||
else
|
||||
incorrectIdThenNormalizedPixelPercentageCollection.Add(new(personBirthday, id.Value, normalizedPixelPercentage.Value));
|
||||
}
|
||||
personNameLinkDirectories = Directory.GetDirectories(personNameDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string personNameLinkDirectory in personNameLinkDirectories)
|
||||
@ -239,36 +242,11 @@ public class ByDeterministicHashCode
|
||||
}
|
||||
}
|
||||
|
||||
private static List<long> GetPersonKeys(Dictionary<int, PersonBirthday[]> deterministicHashCodeUnknownFaceKeyValuePairs)
|
||||
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)
|
||||
{
|
||||
List<long> results = new();
|
||||
long personKey;
|
||||
foreach (KeyValuePair<int, PersonBirthday[]> keyValuePair in deterministicHashCodeUnknownFaceKeyValuePairs)
|
||||
{
|
||||
foreach (PersonBirthday personBirthday in keyValuePair.Value)
|
||||
{
|
||||
personKey = personBirthday.Value.Ticks;
|
||||
results.Add(personKey);
|
||||
}
|
||||
}
|
||||
results = results.Distinct().ToList();
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void SetKeyValuePairs(List<(PersonBirthday, int, int)> idThenNormalizedPixelPercentageCollection, List<(PersonBirthday PersonBirthday, double IdAndNormalizedPixelPercentage)> incorrectDeterministicHashCodeCollection, Dictionary<double, PersonBirthday[]> incorrectDeterministicHashCodeKeyValuePairs, Dictionary<int, Dictionary<int, PersonBirthday[]>> idThenNormalizedPixelPercentageKeyValuePairs)
|
||||
{
|
||||
Dictionary<double, List<PersonBirthday>> incorrectDeterministicHashCodeScope = new();
|
||||
Dictionary<int, Dictionary<int, List<PersonBirthday>>> idThenNormalizedPixelPercentageScope = new();
|
||||
foreach ((PersonBirthday personBirthday, double idAndNormalizedPixelPercentage) in incorrectDeterministicHashCodeCollection)
|
||||
{
|
||||
if (!incorrectDeterministicHashCodeScope.ContainsKey(idAndNormalizedPixelPercentage))
|
||||
incorrectDeterministicHashCodeScope.Add(idAndNormalizedPixelPercentage, new());
|
||||
incorrectDeterministicHashCodeScope[idAndNormalizedPixelPercentage].Add(personBirthday);
|
||||
}
|
||||
foreach (KeyValuePair<double, List<PersonBirthday>> keyValuePair in incorrectDeterministicHashCodeScope)
|
||||
incorrectDeterministicHashCodeKeyValuePairs.Add(keyValuePair.Key, keyValuePair.Value.Distinct().ToArray());
|
||||
string check;
|
||||
int normalizedPixelPercentageInDecimalForm;
|
||||
Dictionary<int, Dictionary<int, List<PersonBirthday>>> idThenNormalizedPixelPercentageScope = new();
|
||||
foreach ((PersonBirthday personBirthday, int id, int normalizedPixelPercentage) in idThenNormalizedPixelPercentageCollection)
|
||||
{
|
||||
if (!idThenNormalizedPixelPercentageScope.ContainsKey(id))
|
||||
@ -294,30 +272,51 @@ public class ByDeterministicHashCode
|
||||
foreach (KeyValuePair<int, List<PersonBirthday>> innerKeyValuePair in keyValuePair.Value)
|
||||
idThenNormalizedPixelPercentageKeyValuePairs[keyValuePair.Key].Add(innerKeyValuePair.Key, innerKeyValuePair.Value.Distinct().ToArray());
|
||||
}
|
||||
Dictionary<int, Dictionary<int, List<PersonBirthday>>> incorrectIdThenNormalizedPixelPercentageScope = new();
|
||||
foreach ((PersonBirthday personBirthday, int id, int normalizedPixelPercentage) in incorrectIdThenNormalizedPixelPercentageCollection)
|
||||
{
|
||||
if (!incorrectIdThenNormalizedPixelPercentageScope.ContainsKey(id))
|
||||
incorrectIdThenNormalizedPixelPercentageScope.Add(id, new());
|
||||
check = normalizedPixelPercentage.ToString();
|
||||
if (check.Length == Shared.Models.Stateless.ILocation.Digits)
|
||||
{
|
||||
if (!incorrectIdThenNormalizedPixelPercentageScope[id].ContainsKey(normalizedPixelPercentage))
|
||||
incorrectIdThenNormalizedPixelPercentageScope[id].Add(normalizedPixelPercentage, new());
|
||||
incorrectIdThenNormalizedPixelPercentageScope[id][normalizedPixelPercentage].Add(personBirthday);
|
||||
}
|
||||
else
|
||||
{
|
||||
normalizedPixelPercentageInDecimalForm = int.Parse(check.PadRight(Shared.Models.Stateless.ILocation.Digits, '0'));
|
||||
if (!incorrectIdThenNormalizedPixelPercentageScope[id].ContainsKey(normalizedPixelPercentageInDecimalForm))
|
||||
incorrectIdThenNormalizedPixelPercentageScope[id].Add(normalizedPixelPercentageInDecimalForm, new());
|
||||
incorrectIdThenNormalizedPixelPercentageScope[id][normalizedPixelPercentageInDecimalForm].Add(personBirthday);
|
||||
}
|
||||
}
|
||||
foreach (KeyValuePair<int, Dictionary<int, List<PersonBirthday>>> keyValuePair in incorrectIdThenNormalizedPixelPercentageScope)
|
||||
{
|
||||
incorrectIdThenNormalizedPixelPercentageKeyValuePairs.Add(keyValuePair.Key, new());
|
||||
foreach (KeyValuePair<int, List<PersonBirthday>> innerKeyValuePair in keyValuePair.Value)
|
||||
incorrectIdThenNormalizedPixelPercentageKeyValuePairs[keyValuePair.Key].Add(innerKeyValuePair.Key, innerKeyValuePair.Value.Distinct().ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
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, PersonBirthday[]> deterministicHashCodeUnknownFaceKeyValuePairs, Dictionary<int, Dictionary<int, PersonBirthday[]>> idThenNormalizedPixelPercentageKeyValuePairs, Dictionary<double, PersonBirthday[]> incorrectDeterministicHashCodeKeyValuePairs, string zPropertyHolderContentDirectory, string zPropertyHolderPeopleContentDirectory)
|
||||
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)
|
||||
{
|
||||
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<long> deterministicHashCodeUnknownFacePersonKeys = GetPersonKeys(deterministicHashCodeUnknownFaceKeyValuePairs);
|
||||
List<(PersonBirthday PersonBirthday, double IdAndNormalizedPixelPercentage)> incorrectDeterministicHashCodeCollection = new();
|
||||
List<(PersonBirthday, int, int)> incorrectIdThenNormalizedPixelPercentageCollection = new();
|
||||
SetOther(resizeFilenameExtension, people, zPropertyHolderPeopleContentDirectory, skipCollection, personKeyAliases, peopleCollection);
|
||||
SetCollections(maxDegreeOfParallelism, ticks, zPropertyHolderContentDirectory, personKeyAliases, idThenNormalizedPixelPercentageCollection, incorrectDeterministicHashCodeCollection, keyValuePairs);
|
||||
SetKeyValuePairs(idThenNormalizedPixelPercentageCollection, incorrectDeterministicHashCodeCollection, incorrectDeterministicHashCodeKeyValuePairs, idThenNormalizedPixelPercentageKeyValuePairs);
|
||||
incorrectDeterministicHashCodeCollection = (from l in incorrectDeterministicHashCodeCollection orderby l.IdAndNormalizedPixelPercentage select l).ToList();
|
||||
SetCollections(maxDegreeOfParallelism, ticks, zPropertyHolderContentDirectory, personKeyAliases, idThenNormalizedPixelPercentageCollection, incorrectIdThenNormalizedPixelPercentageCollection, keyValuePairs);
|
||||
SetKeyValuePairs(idThenNormalizedPixelPercentageCollection, incorrectIdThenNormalizedPixelPercentageCollection, idThenNormalizedPixelPercentageKeyValuePairs, incorrectIdThenNormalizedPixelPercentageKeyValuePairs);
|
||||
foreach (KeyValuePair<int, Dictionary<int, PersonBirthday[]>> keyValuePair in idThenNormalizedPixelPercentageKeyValuePairs)
|
||||
{
|
||||
foreach (KeyValuePair<int, PersonBirthday[]> keyValue in keyValuePair.Value)
|
||||
idThenNormalizedPixelPercentagePersonKeys.AddRange(from l in keyValue.Value select l.Value.Ticks);
|
||||
}
|
||||
idThenNormalizedPixelPercentagePersonKeys = idThenNormalizedPixelPercentagePersonKeys.Distinct().ToList();
|
||||
foreach (KeyValuePair<int, PersonBirthday[]> keyValuePair in deterministicHashCodeUnknownFaceKeyValuePairs)
|
||||
deterministicHashCodeUnknownFacePersonKeys.AddRange(from l in keyValuePair.Value select l.Value.Ticks);
|
||||
deterministicHashCodeUnknownFacePersonKeys = deterministicHashCodeUnknownFacePersonKeys.Distinct().ToList();
|
||||
if (peopleCollection.Any())
|
||||
{
|
||||
foreach ((string displayDirectoryName, int? approximateYears, PersonBirthday[] personBirthdays, long personKey) in peopleCollection)
|
||||
@ -328,25 +327,17 @@ public class ByDeterministicHashCode
|
||||
continue;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
if (!deterministicHashCodeUnknownFacePersonKeys.Contains(personKey) && !idThenNormalizedPixelPercentagePersonKeys.Contains(personKey))
|
||||
if (!idThenNormalizedPixelPercentagePersonKeys.Contains(personKey))
|
||||
notMappedPersonKeys.Add(personKey);
|
||||
else
|
||||
peopleKeyValuePairs.Add(personKey, new(displayDirectoryName, approximateYears, personBirthdays, personKey));
|
||||
}
|
||||
}
|
||||
if (deterministicHashCodeUnknownFacePersonKeys.Any() || idThenNormalizedPixelPercentagePersonKeys.Any())
|
||||
if (idThenNormalizedPixelPercentagePersonKeys.Any())
|
||||
{
|
||||
int? approximateYears = null;
|
||||
PersonBirthday? personBirthday;
|
||||
const string displayDirectoryName = Property.Models.Stateless.IResult.AllInOne;
|
||||
foreach (long personKey in deterministicHashCodeUnknownFacePersonKeys)
|
||||
{
|
||||
if (!peopleKeyValuePairs.ContainsKey(personKey))
|
||||
{
|
||||
personBirthday = Shared.Models.Stateless.Methods.IPersonBirthday.GetPersonBirthday(personKey);
|
||||
peopleKeyValuePairs.Add(personKey, new(displayDirectoryName, approximateYears, new PersonBirthday[] { personBirthday }, personKey));
|
||||
}
|
||||
}
|
||||
foreach (long personKey in idThenNormalizedPixelPercentagePersonKeys)
|
||||
{
|
||||
if (!peopleKeyValuePairs.ContainsKey(personKey))
|
||||
|
Reference in New Issue
Block a user