Mass push
This commit is contained in:
@ -39,7 +39,7 @@ internal abstract class MapLogic
|
||||
int? id;
|
||||
long personKey;
|
||||
string personKeyFormatted;
|
||||
int? normalizedPixelPercentage;
|
||||
int? normalizedRectangle;
|
||||
string newestPersonKeyFormatted;
|
||||
foreach (PersonContainer personContainer in personContainers)
|
||||
{
|
||||
@ -47,12 +47,12 @@ internal abstract class MapLogic
|
||||
{
|
||||
if (!personDisplayDirectoryAllFile.EndsWith(configuration.FacesFileNameExtension))
|
||||
continue;
|
||||
(id, normalizedPixelPercentage, _) = IMapping.GetReversedDeterministicHashCodeKey(configuration.FacesFileNameExtension, personDisplayDirectoryAllFile);
|
||||
if (id is null || normalizedPixelPercentage is null)
|
||||
(id, normalizedRectangle, _) = IMapping.GetConverted(configuration.FacesFileNameExtension, personDisplayDirectoryAllFile);
|
||||
if (id is null || normalizedRectangle is null)
|
||||
continue;
|
||||
if (!skipCollection.ContainsKey(id.Value))
|
||||
skipCollection.Add(id.Value, new());
|
||||
skipCollection[id.Value].Add(normalizedPixelPercentage.Value);
|
||||
skipCollection[id.Value].Add(normalizedRectangle.Value);
|
||||
}
|
||||
if (personContainer.Person is null || personContainer.Key is null || personContainer.Birthdays is null || !personContainer.Birthdays.Any())
|
||||
continue;
|
||||
@ -86,7 +86,7 @@ internal abstract class MapLogic
|
||||
string? personFirstInitial;
|
||||
DirectoryInfo directoryInfo;
|
||||
string[] personKeyDirectories;
|
||||
int? normalizedPixelPercentage;
|
||||
int? normalizedRectangle;
|
||||
string[] personNameDirectories;
|
||||
string[] personNameLinkDirectories;
|
||||
string? personFirstInitialDirectory;
|
||||
@ -141,6 +141,16 @@ internal abstract class MapLogic
|
||||
else
|
||||
{
|
||||
personFirstInitial = personDisplayDirectoryNames[^1][..1];
|
||||
if (personFirstInitial.All(l => char.IsDigit(l)))
|
||||
{
|
||||
foreach (string file in files)
|
||||
File.Delete(file);
|
||||
files = Directory.GetFiles(personNameDirectory, "*", SearchOption.AllDirectories);
|
||||
foreach (string file in files)
|
||||
File.Delete(file);
|
||||
_ = IPath.DeleteEmptyDirectories(personNameDirectory);
|
||||
continue;
|
||||
}
|
||||
personFirstInitialDirectory = Path.Combine(yearDirectory, personFirstInitial.ToString());
|
||||
Directory.Move(personNameDirectory, personFirstInitialDirectory);
|
||||
files = Directory.GetFiles(personFirstInitialDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
@ -149,8 +159,8 @@ internal abstract class MapLogic
|
||||
{
|
||||
if (file.EndsWith(".lnk") || file.EndsWith(".json"))
|
||||
continue;
|
||||
(id, normalizedPixelPercentage, _) = IMapping.GetReversedDeterministicHashCodeKey(configuration.FacesFileNameExtension, file);
|
||||
if (id is null || normalizedPixelPercentage is null)
|
||||
(id, normalizedRectangle, _) = IMapping.GetConverted(configuration.FacesFileNameExtension, file);
|
||||
if (id is null || normalizedRectangle is null)
|
||||
continue;
|
||||
results.Add(new(personKeyFormatted, personDisplayDirectoryNames, file));
|
||||
}
|
||||
@ -182,15 +192,15 @@ internal abstract class MapLogic
|
||||
{
|
||||
Dictionary<int, List<(string, int)>> results = new();
|
||||
int? id;
|
||||
int? normalizedPixelPercentage;
|
||||
int? normalizedRectangle;
|
||||
foreach ((string personKeyFormatted, string[] personDisplayDirectoryNames, string mappedFaceFile) in collection)
|
||||
{
|
||||
(id, normalizedPixelPercentage, _) = IMapping.GetReversedDeterministicHashCodeKey(configuration.FacesFileNameExtension, mappedFaceFile);
|
||||
if (id is null || normalizedPixelPercentage is null)
|
||||
(id, normalizedRectangle, _) = IMapping.GetConverted(configuration.FacesFileNameExtension, mappedFaceFile);
|
||||
if (id is null || normalizedRectangle is null)
|
||||
continue;
|
||||
if (!results.ContainsKey(id.Value))
|
||||
results.Add(id.Value, new());
|
||||
results[id.Value].Add(new(mappedFaceFile, normalizedPixelPercentage.Value));
|
||||
results[id.Value].Add(new(mappedFaceFile, normalizedRectangle.Value));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
@ -211,7 +221,11 @@ internal abstract class MapLogic
|
||||
if (!Directory.Exists(eDistanceContentDirectory))
|
||||
_ = Directory.CreateDirectory(eDistanceContentDirectory);
|
||||
else
|
||||
{
|
||||
_ = IPath.DeleteEmptyDirectories(eDistanceContentDirectory);
|
||||
if (!Directory.Exists(eDistanceContentDirectory))
|
||||
_ = Directory.CreateDirectory(eDistanceContentDirectory);
|
||||
}
|
||||
ticksDirectories = Directory.GetDirectories(eDistanceContentDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
string message = $") {ticksDirectories.Length:000} collect from and clean ticks Director(ies) - A - {totalSeconds} total second(s)";
|
||||
@ -246,23 +260,23 @@ internal abstract class MapLogic
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
private static void SetKeyValuePairs(Configuration configuration, long ticks, List<PersonContainer> personContainers, Mapping[] mappingCollection, List<(string, string[], int, int)> personKeyFormattedIdThenNormalizedPixelPercentageCollection, List<(string, int, int)> incorrectPersonKeyFormattedIdThenNormalizedPixelPercentageCollection, Dictionary<long, PersonContainer> personKeyToPersonContainer, Dictionary<int, Dictionary<int, PersonContainer[]>> idThenNormalizedPixelPercentageToPersonContainers, List<(string[], PersonContainer)> possiblyNewPersonDisplayDirectoryNamesAndPersonContainer, Dictionary<int, Dictionary<int, PersonContainer[]>> incorrectIdThenNormalizedPixelPercentageToPersonContainers, Dictionary<long, (long LCL, long Minimum, long Maximum, long UCL)> personKeyToRanges)
|
||||
private static void SetKeyValuePairs(Configuration configuration, long ticks, List<PersonContainer> personContainers, Mapping[] mappingCollection, List<(string, string[], int, int)> personKeyFormattedIdThenNormalizedRectangleCollection, List<(string, int, int)> incorrectPersonKeyFormattedIdThenNormalizedRectangleCollection, Dictionary<long, PersonContainer> personKeyToPersonContainer, Dictionary<int, Dictionary<int, PersonContainer[]>> idThenNormalizedRectangleToPersonContainers, List<(string[], PersonContainer)> possiblyNewPersonDisplayDirectoryNamesAndPersonContainer, Dictionary<int, Dictionary<int, PersonContainer[]>> incorrectIdThenNormalizedRectangleToPersonContainers, Dictionary<long, (long LCL, long Minimum, long Maximum, long UCL)> personKeyToRanges)
|
||||
{
|
||||
PersonBirthday? personBirthday;
|
||||
PersonContainer[] distinctPersonContainers;
|
||||
Dictionary<string, PersonContainer> personKeyFormattedToPersonContainer = new();
|
||||
Dictionary<int, Dictionary<int, List<PersonContainer>>> idThenNormalizedPixelPercentageToPersonContainerCollection = new();
|
||||
Dictionary<int, Dictionary<int, List<PersonContainer>>> incorrectIdThenNormalizedPixelPercentageToPersonContainerCollection = new();
|
||||
Dictionary<int, Dictionary<int, List<PersonContainer>>> idThenNormalizedRectangleToPersonContainerCollection = new();
|
||||
Dictionary<int, Dictionary<int, List<PersonContainer>>> incorrectIdThenNormalizedRectangleToPersonContainerCollection = new();
|
||||
List<(long, PersonContainer)> collection = GetDistinctCollection(configuration, personContainers, personKeyFormattedToPersonContainer);
|
||||
foreach ((long personKey, PersonContainer personContainer) in collection)
|
||||
personKeyToPersonContainer.Add(personKey, personContainer);
|
||||
if (personKeyFormattedIdThenNormalizedPixelPercentageCollection.Any())
|
||||
if (personKeyFormattedIdThenNormalizedRectangleCollection.Any())
|
||||
{
|
||||
string personDisplayDirectory;
|
||||
PersonContainer personContainer;
|
||||
string personDisplayDirectoryName;
|
||||
Dictionary<string, (string[], PersonContainer)> personDisplayDirectoryTo = new();
|
||||
foreach ((string personKeyFormatted, string[] personDisplayDirectoryNames, int id, int normalizedPixelPercentage) in personKeyFormattedIdThenNormalizedPixelPercentageCollection)
|
||||
foreach ((string personKeyFormatted, string[] personDisplayDirectoryNames, int id, int normalizedRectangle) in personKeyFormattedIdThenNormalizedRectangleCollection)
|
||||
{
|
||||
personBirthday = IPersonBirthday.GetPersonBirthday(configuration.PersonBirthdayFormat, personKeyFormatted);
|
||||
if (personBirthday is null)
|
||||
@ -276,52 +290,52 @@ internal abstract class MapLogic
|
||||
}
|
||||
if (personDisplayDirectoryName.Length != 1 && personDisplayDirectoryName != configuration.MappingDefaultName && !personDisplayDirectoryTo.ContainsKey(personDisplayDirectory))
|
||||
personDisplayDirectoryTo.Add(personDisplayDirectory, new(personDisplayDirectoryNames, personKeyFormattedToPersonContainer[personKeyFormatted]));
|
||||
if (!idThenNormalizedPixelPercentageToPersonContainerCollection.ContainsKey(id))
|
||||
idThenNormalizedPixelPercentageToPersonContainerCollection.Add(id, new());
|
||||
if (!idThenNormalizedPixelPercentageToPersonContainerCollection[id].ContainsKey(normalizedPixelPercentage))
|
||||
idThenNormalizedPixelPercentageToPersonContainerCollection[id].Add(normalizedPixelPercentage, new());
|
||||
idThenNormalizedPixelPercentageToPersonContainerCollection[id][normalizedPixelPercentage].Add(personKeyFormattedToPersonContainer[personKeyFormatted]);
|
||||
if (!idThenNormalizedRectangleToPersonContainerCollection.ContainsKey(id))
|
||||
idThenNormalizedRectangleToPersonContainerCollection.Add(id, new());
|
||||
if (!idThenNormalizedRectangleToPersonContainerCollection[id].ContainsKey(normalizedRectangle))
|
||||
idThenNormalizedRectangleToPersonContainerCollection[id].Add(normalizedRectangle, new());
|
||||
idThenNormalizedRectangleToPersonContainerCollection[id][normalizedRectangle].Add(personKeyFormattedToPersonContainer[personKeyFormatted]);
|
||||
}
|
||||
foreach (KeyValuePair<string, (string[], PersonContainer)> keyValuePair in personDisplayDirectoryTo)
|
||||
possiblyNewPersonDisplayDirectoryNamesAndPersonContainer.Add(keyValuePair.Value);
|
||||
}
|
||||
foreach (KeyValuePair<int, Dictionary<int, List<PersonContainer>>> keyValuePair in idThenNormalizedPixelPercentageToPersonContainerCollection)
|
||||
foreach (KeyValuePair<int, Dictionary<int, List<PersonContainer>>> keyValuePair in idThenNormalizedRectangleToPersonContainerCollection)
|
||||
{
|
||||
idThenNormalizedPixelPercentageToPersonContainers.Add(keyValuePair.Key, new());
|
||||
idThenNormalizedRectangleToPersonContainers.Add(keyValuePair.Key, new());
|
||||
foreach (KeyValuePair<int, List<PersonContainer>> innerKeyValuePair in keyValuePair.Value)
|
||||
{
|
||||
distinctPersonContainers = GetDistinctPersonContainers(innerKeyValuePair.Value);
|
||||
idThenNormalizedPixelPercentageToPersonContainers[keyValuePair.Key].Add(innerKeyValuePair.Key, distinctPersonContainers);
|
||||
idThenNormalizedRectangleToPersonContainers[keyValuePair.Key].Add(innerKeyValuePair.Key, distinctPersonContainers);
|
||||
}
|
||||
};
|
||||
SetPersonTicks(configuration, ticks, mappingCollection, personKeyToRanges, idThenNormalizedPixelPercentageToPersonContainers);
|
||||
if (incorrectPersonKeyFormattedIdThenNormalizedPixelPercentageCollection.Any())
|
||||
SetPersonTicks(configuration, ticks, mappingCollection, personKeyToRanges, idThenNormalizedRectangleToPersonContainers);
|
||||
if (incorrectPersonKeyFormattedIdThenNormalizedRectangleCollection.Any())
|
||||
{
|
||||
PersonContainer personContainer;
|
||||
foreach ((string personKeyFormatted, int id, int normalizedPixelPercentage) in incorrectPersonKeyFormattedIdThenNormalizedPixelPercentageCollection)
|
||||
foreach ((string personKeyFormatted, int id, int normalizedRectangle) in incorrectPersonKeyFormattedIdThenNormalizedRectangleCollection)
|
||||
{
|
||||
personBirthday = IPersonBirthday.GetPersonBirthday(configuration.PersonBirthdayFormat, personKeyFormatted);
|
||||
if (personBirthday is null)
|
||||
continue;
|
||||
if (!incorrectIdThenNormalizedPixelPercentageToPersonContainerCollection.ContainsKey(id))
|
||||
incorrectIdThenNormalizedPixelPercentageToPersonContainerCollection.Add(id, new());
|
||||
if (!incorrectIdThenNormalizedRectangleToPersonContainerCollection.ContainsKey(id))
|
||||
incorrectIdThenNormalizedRectangleToPersonContainerCollection.Add(id, new());
|
||||
if (!personKeyFormattedToPersonContainer.ContainsKey(personKeyFormatted))
|
||||
{
|
||||
personContainer = new(personBirthday, configuration.MappingDefaultName);
|
||||
personKeyFormattedToPersonContainer.Add(personKeyFormatted, personContainer);
|
||||
}
|
||||
if (!incorrectIdThenNormalizedPixelPercentageToPersonContainerCollection[id].ContainsKey(normalizedPixelPercentage))
|
||||
incorrectIdThenNormalizedPixelPercentageToPersonContainerCollection[id].Add(normalizedPixelPercentage, new());
|
||||
incorrectIdThenNormalizedPixelPercentageToPersonContainerCollection[id][normalizedPixelPercentage].Add(personKeyFormattedToPersonContainer[personKeyFormatted]);
|
||||
if (!incorrectIdThenNormalizedRectangleToPersonContainerCollection[id].ContainsKey(normalizedRectangle))
|
||||
incorrectIdThenNormalizedRectangleToPersonContainerCollection[id].Add(normalizedRectangle, new());
|
||||
incorrectIdThenNormalizedRectangleToPersonContainerCollection[id][normalizedRectangle].Add(personKeyFormattedToPersonContainer[personKeyFormatted]);
|
||||
}
|
||||
}
|
||||
foreach (KeyValuePair<int, Dictionary<int, List<PersonContainer>>> keyValuePair in incorrectIdThenNormalizedPixelPercentageToPersonContainerCollection)
|
||||
foreach (KeyValuePair<int, Dictionary<int, List<PersonContainer>>> keyValuePair in incorrectIdThenNormalizedRectangleToPersonContainerCollection)
|
||||
{
|
||||
incorrectIdThenNormalizedPixelPercentageToPersonContainers.Add(keyValuePair.Key, new());
|
||||
incorrectIdThenNormalizedRectangleToPersonContainers.Add(keyValuePair.Key, new());
|
||||
foreach (KeyValuePair<int, List<PersonContainer>> innerKeyValuePair in keyValuePair.Value)
|
||||
{
|
||||
distinctPersonContainers = GetDistinctPersonContainers(innerKeyValuePair.Value);
|
||||
incorrectIdThenNormalizedPixelPercentageToPersonContainers[keyValuePair.Key].Add(innerKeyValuePair.Key, distinctPersonContainers);
|
||||
incorrectIdThenNormalizedRectangleToPersonContainers[keyValuePair.Key].Add(innerKeyValuePair.Key, distinctPersonContainers);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -352,19 +366,19 @@ internal abstract class MapLogic
|
||||
return results;
|
||||
}
|
||||
|
||||
private static (int, int) SetCollectionsAndGetUnableToMatchCount(Configuration configuration, long ticks, Dictionary<int, List<Mapping>> idToMappingCollection, Dictionary<string, string> personKeyFormattedToNewestPersonKeyFormatted, List<(string, string[], int, int)> personKeyFormattedIdThenNormalizedPixelPercentageCollection, List<(string, int, int)> incorrectPersonKeyFormattedIdThenNormalizedPixelPercentageCollection, List<(string, string[], string)> collection)
|
||||
private static (int, int) SetCollectionsAndGetUnableToMatchCount(Configuration configuration, long ticks, Dictionary<int, List<Mapping>> idToMappingCollection, Dictionary<string, string> personKeyFormattedToNewestPersonKeyFormatted, List<(string, string[], int, int)> personKeyFormattedIdThenNormalizedRectangleCollection, List<(string, int, int)> incorrectPersonKeyFormattedIdThenNormalizedRectangleCollection, List<(string, string[], string)> collection)
|
||||
{
|
||||
int result = 0;
|
||||
int? id;
|
||||
int? normalizedPixelPercentage;
|
||||
int? normalizedRectangle;
|
||||
string newestPersonKeyFormatted;
|
||||
List<Mapping>? mappingCollection;
|
||||
string personDisplayDirectoryName;
|
||||
List<int> normalizedPixelPercentages;
|
||||
List<int> normalizedRectangles;
|
||||
List<Mapping> checkMappingCollection = new();
|
||||
List<string> duplicateMappedFaceFiles = new();
|
||||
bool idToMappingCollectionAny = idToMappingCollection.Any();
|
||||
Dictionary<int, List<int>> idToNormalizedPixelPercentages = new();
|
||||
Dictionary<int, List<int>> idToNormalizedRectangles = new();
|
||||
int totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
||||
string message = $") {collection.Count:000} join from ticks Director(ies) - C - {totalSeconds} total second(s)";
|
||||
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||
@ -372,53 +386,51 @@ internal abstract class MapLogic
|
||||
foreach ((string personKeyFormatted, string[] personDisplayDirectoryNames, string mappedFaceFile) in collection)
|
||||
{
|
||||
progressBar.Tick();
|
||||
(id, normalizedPixelPercentage, mappingCollection) = IMapping.GetReversedDeterministicHashCodeKey(configuration.FacesFileNameExtension, idToMappingCollectionAny, idToMappingCollection, mappedFaceFile);
|
||||
if (id is null || normalizedPixelPercentage is null)
|
||||
{
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
if (!idToNormalizedPixelPercentages.ContainsKey(id.Value))
|
||||
idToNormalizedPixelPercentages.Add(id.Value, new());
|
||||
normalizedPixelPercentages = idToNormalizedPixelPercentages[id.Value];
|
||||
if (mappingCollection is null)
|
||||
(id, normalizedRectangle, mappingCollection) = IMapping.GetConverted(configuration.FacesFileNameExtension, idToMappingCollectionAny, idToMappingCollection, mappedFaceFile);
|
||||
if (id is null || normalizedRectangle is null)
|
||||
{
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
if (!idToNormalizedRectangles.ContainsKey(id.Value))
|
||||
idToNormalizedRectangles.Add(id.Value, new());
|
||||
normalizedRectangles = idToNormalizedRectangles[id.Value];
|
||||
checkMappingCollection.Clear();
|
||||
foreach (Mapping mapping in mappingCollection)
|
||||
if (mappingCollection is not null)
|
||||
{
|
||||
if (normalizedPixelPercentage.Value != mapping.MappingFromLocation.NormalizedPixelPercentage)
|
||||
continue;
|
||||
if (normalizedPixelPercentages.Contains(mapping.MappingFromLocation.NormalizedPixelPercentage))
|
||||
foreach (Mapping mapping in mappingCollection)
|
||||
{
|
||||
duplicateMappedFaceFiles.Add(mappedFaceFile);
|
||||
if (normalizedRectangle.Value != mapping.MappingFromLocation.NormalizedRectangle)
|
||||
continue;
|
||||
if (normalizedRectangles.Contains(mapping.MappingFromLocation.NormalizedRectangle))
|
||||
{
|
||||
duplicateMappedFaceFiles.Add(mappedFaceFile);
|
||||
continue;
|
||||
}
|
||||
checkMappingCollection.Add(mapping);
|
||||
}
|
||||
if (!checkMappingCollection.Any())
|
||||
{
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
if (checkMappingCollection.Count != 1)
|
||||
{
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
checkMappingCollection.Add(mapping);
|
||||
}
|
||||
if (!checkMappingCollection.Any())
|
||||
{
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
if (checkMappingCollection.Count != 1)
|
||||
{
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
normalizedPixelPercentages.Add(normalizedPixelPercentage.Value);
|
||||
idToNormalizedPixelPercentages[id.Value].Add(normalizedPixelPercentage.Value);
|
||||
normalizedRectangles.Add(normalizedRectangle.Value);
|
||||
idToNormalizedRectangles[id.Value].Add(normalizedRectangle.Value);
|
||||
if (!personKeyFormattedToNewestPersonKeyFormatted.ContainsKey(personKeyFormatted))
|
||||
newestPersonKeyFormatted = personKeyFormatted;
|
||||
else
|
||||
newestPersonKeyFormatted = personKeyFormattedToNewestPersonKeyFormatted[personKeyFormatted];
|
||||
personDisplayDirectoryName = personDisplayDirectoryNames[^1];
|
||||
if (string.IsNullOrEmpty(personDisplayDirectoryName) || personDisplayDirectoryName[0] == '!')
|
||||
incorrectPersonKeyFormattedIdThenNormalizedPixelPercentageCollection.Add(new(newestPersonKeyFormatted, id.Value, normalizedPixelPercentage.Value));
|
||||
incorrectPersonKeyFormattedIdThenNormalizedRectangleCollection.Add(new(newestPersonKeyFormatted, id.Value, normalizedRectangle.Value));
|
||||
else
|
||||
personKeyFormattedIdThenNormalizedPixelPercentageCollection.Add(new(newestPersonKeyFormatted, personDisplayDirectoryNames, id.Value, normalizedPixelPercentage.Value));
|
||||
personKeyFormattedIdThenNormalizedRectangleCollection.Add(new(newestPersonKeyFormatted, personDisplayDirectoryNames, id.Value, normalizedRectangle.Value));
|
||||
}
|
||||
if (duplicateMappedFaceFiles.Any())
|
||||
{
|
||||
@ -494,7 +506,7 @@ internal abstract class MapLogic
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetPersonTicks(Configuration configuration, long ticks, Mapping[] mappingCollection, Dictionary<long, (long LCL, long Minimum, long Maximum, long UCL)> personKeyToRanges, Dictionary<int, Dictionary<int, PersonContainer[]>> idThenNormalizedPixelPercentageToPersonContainers)
|
||||
private static void SetPersonTicks(Configuration configuration, long ticks, Mapping[] mappingCollection, Dictionary<long, (long LCL, long Minimum, long Maximum, long UCL)> personKeyToRanges, Dictionary<int, Dictionary<int, PersonContainer[]>> idThenNormalizedRectangleToPersonContainers)
|
||||
{
|
||||
PersonContainer[]? personContainers;
|
||||
Dictionary<int, PersonContainer[]>? keyValuePairs;
|
||||
@ -506,9 +518,9 @@ internal abstract class MapLogic
|
||||
foreach (Mapping mapping in mappingCollection)
|
||||
{
|
||||
progressBar.Tick();
|
||||
if (!idThenNormalizedPixelPercentageToPersonContainers.TryGetValue(mapping.MappingFromItem.Id, out keyValuePairs))
|
||||
if (!idThenNormalizedRectangleToPersonContainers.TryGetValue(mapping.MappingFromItem.Id, out keyValuePairs))
|
||||
continue;
|
||||
if (!keyValuePairs.TryGetValue(mapping.MappingFromLocation.NormalizedPixelPercentage, out personContainers))
|
||||
if (!keyValuePairs.TryGetValue(mapping.MappingFromLocation.NormalizedRectangle, out personContainers))
|
||||
continue;
|
||||
foreach (PersonContainer personContainer in personContainers)
|
||||
{
|
||||
@ -543,14 +555,14 @@ internal abstract class MapLogic
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void AppendToSkipCollection(Dictionary<int, List<int>> skipCollection, Dictionary<int, Dictionary<int, PersonContainer[]>> idThenNormalizedPixelPercentageToPersonContainers, Dictionary<int, Dictionary<int, PersonContainer[]>> incorrectIdThenNormalizedPixelPercentageToPersonContainers)
|
||||
private static void AppendToSkipCollection(Dictionary<int, List<int>> skipCollection, Dictionary<int, Dictionary<int, PersonContainer[]>> idThenNormalizedRectangleToPersonContainers, Dictionary<int, Dictionary<int, PersonContainer[]>> incorrectIdThenNormalizedRectangleToPersonContainers)
|
||||
{
|
||||
Dictionary<int, PersonContainer[]>? keyValuePairs;
|
||||
foreach (KeyValuePair<int, Dictionary<int, PersonContainer[]>> keyValuePair in incorrectIdThenNormalizedPixelPercentageToPersonContainers)
|
||||
foreach (KeyValuePair<int, Dictionary<int, PersonContainer[]>> keyValuePair in incorrectIdThenNormalizedRectangleToPersonContainers)
|
||||
{
|
||||
if (!skipCollection.ContainsKey(keyValuePair.Key))
|
||||
skipCollection.Add(keyValuePair.Key, new());
|
||||
if (idThenNormalizedPixelPercentageToPersonContainers.TryGetValue(keyValuePair.Key, out keyValuePairs))
|
||||
if (idThenNormalizedRectangleToPersonContainers.TryGetValue(keyValuePair.Key, out keyValuePairs))
|
||||
{
|
||||
if (keyValuePairs.ContainsKey(keyValuePair.Value.ElementAt(0).Key))
|
||||
continue;
|
||||
@ -600,7 +612,7 @@ internal abstract class MapLogic
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Set(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Configuration? configuration, long ticks, List<PersonContainer> personContainers, string? a2PeopleContentDirectory, string eDistanceContentDirectory, Mapping[] mappingCollection, Shared.Models.Methods.IMapLogicSupport mapLogicSupport, Dictionary<long, PersonContainer> personKeyToPersonContainer, Dictionary<long, (long LCL, long Minimum, long Maximum, long UCL)> personKeyToRanges, List<PersonContainer> notMappedPersonContainers, Dictionary<int, List<int>> skipCollection, Dictionary<int, Dictionary<int, PersonContainer[]>> idThenNormalizedPixelPercentageToPersonContainers)
|
||||
internal static void Set(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, Configuration? configuration, long ticks, List<PersonContainer> personContainers, string? a2PeopleContentDirectory, string eDistanceContentDirectory, Mapping[] mappingCollection, Shared.Models.Methods.IMapLogicSupport mapLogicSupport, Dictionary<long, PersonContainer> personKeyToPersonContainer, Dictionary<long, (long LCL, long Minimum, long Maximum, long UCL)> personKeyToRanges, List<PersonContainer> notMappedPersonContainers, Dictionary<int, List<int>> skipCollection, Dictionary<int, Dictionary<int, PersonContainer[]>> idThenNormalizedRectangleToPersonContainers)
|
||||
{
|
||||
if (configuration is null)
|
||||
throw new NullReferenceException(nameof(configuration));
|
||||
@ -612,9 +624,9 @@ internal abstract class MapLogic
|
||||
Dictionary<int, List<Mapping>> idToMappingCollection = new();
|
||||
Dictionary<string, string> personKeyFormattedToNewestPersonKeyFormatted = new();
|
||||
List<(string[], PersonContainer)> possiblyNewPersonDisplayDirectoryNamesAndPersonContainer = new();
|
||||
List<(string, string[], int, int)> personKeyFormattedIdThenNormalizedPixelPercentageCollection = new();
|
||||
List<(string, int, int)> incorrectPersonKeyFormattedIdThenNormalizedPixelPercentageCollection = new();
|
||||
Dictionary<int, Dictionary<int, PersonContainer[]>> incorrectIdThenNormalizedPixelPercentageToPersonContainers = new();
|
||||
List<(string, string[], int, int)> personKeyFormattedIdThenNormalizedRectangleCollection = new();
|
||||
List<(string, int, int)> incorrectPersonKeyFormattedIdThenNormalizedRectangleCollection = new();
|
||||
Dictionary<int, Dictionary<int, PersonContainer[]>> incorrectIdThenNormalizedRectangleToPersonContainers = new();
|
||||
SetPersonCollections(configuration, personContainers, personKeys, personKeyFormattedToNewestPersonKeyFormatted, personKeyFormattedCollection, skipCollection);
|
||||
personContainers.AddRange(AddToPersonKeysThenGetNonSpecificPeopleCollection(configuration, personKeys));
|
||||
foreach (Mapping mapping in mappingCollection)
|
||||
@ -627,14 +639,14 @@ internal abstract class MapLogic
|
||||
string[] ticksDirectories = Directory.GetDirectories(eDistanceContentDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
message = $") {ticksDirectories.Length:000} compile from and clean ticks Director(ies) - B - {totalSeconds} total second(s)";
|
||||
List<(string, string[], string)> collection = DeleteEmptyDirectoriesAndGetCollection(configuration, personKeyFormattedCollection, ticksDirectories, message);
|
||||
(int unableToMatchCount, int duplicateCount) = SetCollectionsAndGetUnableToMatchCount(configuration, ticks, idToMappingCollection, personKeyFormattedToNewestPersonKeyFormatted, personKeyFormattedIdThenNormalizedPixelPercentageCollection, incorrectPersonKeyFormattedIdThenNormalizedPixelPercentageCollection, collection);
|
||||
SetKeyValuePairs(configuration, ticks, personContainers, mappingCollection, personKeyFormattedIdThenNormalizedPixelPercentageCollection, incorrectPersonKeyFormattedIdThenNormalizedPixelPercentageCollection, personKeyToPersonContainer, idThenNormalizedPixelPercentageToPersonContainers, possiblyNewPersonDisplayDirectoryNamesAndPersonContainer, incorrectIdThenNormalizedPixelPercentageToPersonContainers, personKeyToRanges);
|
||||
(int unableToMatchCount, int duplicateCount) = SetCollectionsAndGetUnableToMatchCount(configuration, ticks, idToMappingCollection, personKeyFormattedToNewestPersonKeyFormatted, personKeyFormattedIdThenNormalizedRectangleCollection, incorrectPersonKeyFormattedIdThenNormalizedRectangleCollection, collection);
|
||||
SetKeyValuePairs(configuration, ticks, personContainers, mappingCollection, personKeyFormattedIdThenNormalizedRectangleCollection, incorrectPersonKeyFormattedIdThenNormalizedRectangleCollection, personKeyToPersonContainer, idThenNormalizedRectangleToPersonContainers, possiblyNewPersonDisplayDirectoryNamesAndPersonContainer, incorrectIdThenNormalizedRectangleToPersonContainers, personKeyToRanges);
|
||||
totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
|
||||
message = $") {collection.Count:000} message from ticks Director(ies) - D - {duplicateCount} Duplicate Count {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, PersonContainer[]>> keyValuePair in idThenNormalizedPixelPercentageToPersonContainers)
|
||||
foreach (KeyValuePair<int, Dictionary<int, PersonContainer[]>> keyValuePair in idThenNormalizedRectangleToPersonContainers)
|
||||
{
|
||||
progressBar.Tick();
|
||||
foreach (KeyValuePair<int, PersonContainer[]> keyValue in keyValuePair.Value)
|
||||
@ -644,7 +656,7 @@ internal abstract class MapLogic
|
||||
long[] personKeyCollection = (from l in nullablePersonKeyCollection where l is not null select l.Value).Distinct().ToArray();
|
||||
SetPersonKeyToPersonContainer(configuration, personContainers, personKeyCollection, personKeyToPersonContainer);
|
||||
notMappedPersonContainers.AddRange(GetNotMappedPersonContainers(configuration, personContainers, personKeyCollection));
|
||||
AppendToSkipCollection(skipCollection, idThenNormalizedPixelPercentageToPersonContainers, incorrectIdThenNormalizedPixelPercentageToPersonContainers);
|
||||
AppendToSkipCollection(skipCollection, idThenNormalizedRectangleToPersonContainers, incorrectIdThenNormalizedRectangleToPersonContainers);
|
||||
if (possiblyNewPersonDisplayDirectoryNamesAndPersonContainer.Any())
|
||||
mapLogicSupport.SavePossiblyNewPersonContainers(propertyConfiguration, configuration.PersonBirthdayFormat, configuration.FacesFileNameExtension, a2PeopleContentDirectory, personKeyToPersonContainer, possiblyNewPersonDisplayDirectoryNamesAndPersonContainer);
|
||||
}
|
||||
@ -690,7 +702,7 @@ internal abstract class MapLogic
|
||||
internal static SaveContainer GetDebugSaveContainer(string directory, SortingContainer sortingContainer, Mapping mapping)
|
||||
{
|
||||
SaveContainer result;
|
||||
FileHolder faceFileHolder = new($"C:/{sortingContainer.Sorting.Id}.{sortingContainer.Sorting.NormalizedPixelPercentage}");
|
||||
FileHolder faceFileHolder = new($"C:/{sortingContainer.Sorting.Id}.{sortingContainer.Sorting.NormalizedRectangle}");
|
||||
string shortcutFile = Path.Combine(directory, $"{sortingContainer.Mapping.MappingFromLocation.DeterministicHashCodeKey}{sortingContainer.Mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}.debug.lnk");
|
||||
result = new(directory, faceFileHolder, mapping.MappingFromItem.ResizedFileHolder, shortcutFile);
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user