MapFaceFileLogic

Author:
This commit is contained in:
2024-05-26 23:37:26 -07:00
parent 7f8b09e66c
commit dca487deb3
20 changed files with 906 additions and 103 deletions

View File

@ -17,14 +17,16 @@ internal abstract class RelationLogic
Dictionary<long, Dictionary<int, List<LocationContainer>>> personKeyTo = [];
foreach (LocationContainer locationContainer in locationContainers)
{
if (locationContainer.PersonKey is null)
continue;
if (!locationContainer.FromDistanceContent)
continue;
if (!locationContainer.FilePath.FullName.Contains(configuration.LocationContainerDirectoryPattern))
continue;
if (!personKeyTo.TryGetValue(locationContainer.PersonKey, out yearTo))
if (!personKeyTo.TryGetValue(locationContainer.PersonKey.Value, out yearTo))
{
personKeyTo.Add(locationContainer.PersonKey, []);
if (!personKeyTo.TryGetValue(locationContainer.PersonKey, out yearTo))
personKeyTo.Add(locationContainer.PersonKey.Value, []);
if (!personKeyTo.TryGetValue(locationContainer.PersonKey.Value, out yearTo))
throw new Exception();
}
if (!yearTo.TryGetValue(locationContainer.CreationDateOnly.Year, out collection))
@ -45,6 +47,7 @@ internal abstract class RelationLogic
int lastIndex;
List<int> years = [];
List<int> indices = [];
LocationContainer locationContainer;
List<(int Index, int Year)> sort = [];
List<LocationContainer> collection = [];
KeyValuePair<int, List<LocationContainer>> keyValue;
@ -76,7 +79,10 @@ internal abstract class RelationLogic
key = $"{years.Min()}-{keyValue.Key}";
if (collection.Count == 0)
continue;
results.Add(new(key, collection[0].PersonKey, new(collection)));
locationContainer = collection[0];
if (locationContainer.PersonKey is null)
continue;
results.Add(new(key, locationContainer.PersonKey.Value, new(collection)));
collection = [];
years.Clear();
}