_RangeDistanceToleranceAverage
VerifyPersonContainersDisplayDirectoryAllFiles usePersonCharactersCopyCount
This commit is contained in:
@ -20,9 +20,6 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
|
||||
protected readonly List<LocationContainer<MetadataExtractor.Directory>> _LocationContainers;
|
||||
protected readonly ReadOnlyDictionary<int, Dictionary<int, PersonContainer[]>> _IdThenNormalizedRectangleToPersonContainers;
|
||||
|
||||
public Dictionary<int, int[]> KeyValuePairs => throw new NotImplementedException();
|
||||
public Dictionary<int, int[]> IndicesFromNew => throw new NotImplementedException();
|
||||
|
||||
private readonly long _Ticks;
|
||||
private readonly Serilog.ILogger? _Log;
|
||||
private readonly Configuration? _Configuration;
|
||||
@ -746,7 +743,7 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
|
||||
string successful = $"_ {nameof(Shared.Models.Stateless.IMapLogic.ManualCopy).Humanize(LetterCasing.Title)} Successful";
|
||||
foreach (KeyValuePair<long, PersonContainer> personKeyToPersonContainer in _PersonKeyToPersonContainer)
|
||||
{
|
||||
if (personKeyToPersonContainer.Value.Key is null || personKeyToPersonContainer.Value.Birthdays is null || !personKeyToPersonContainer.Value.Birthdays.Any())
|
||||
if (personKeyToPersonContainer.Value.Key is null || personKeyToPersonContainer.Value.Birthdays is null || !personKeyToPersonContainer.Value.Birthdays.Any() || personKeyToPersonContainer.Value.PersonDirectory is null)
|
||||
continue;
|
||||
personBirthday = personKeyToPersonContainer.Value.Birthdays[zero];
|
||||
foreach (string personDisplayDirectoryAllFile in personKeyToPersonContainer.Value.DisplayDirectoryAllFiles)
|
||||
@ -805,7 +802,10 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
|
||||
continue;
|
||||
if (File.Exists(shortcutFile))
|
||||
continue;
|
||||
windowsShortcut = new() { Path = faceFile };
|
||||
if (personKeyToPersonContainer.Value.PersonDirectory.Char == ']')
|
||||
windowsShortcut = new() { Path = faceFile };
|
||||
else
|
||||
windowsShortcut = new() { Path = checkFile };
|
||||
windowsShortcut.Save(shortcutFile);
|
||||
windowsShortcut.Dispose();
|
||||
if (!File.Exists(shortcutFile))
|
||||
@ -892,6 +892,7 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
|
||||
{
|
||||
if (_Configuration is null)
|
||||
throw new NullReferenceException(nameof(_Configuration));
|
||||
string year;
|
||||
long personKey;
|
||||
string fileName;
|
||||
string faceFile;
|
||||
@ -901,6 +902,8 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
|
||||
string? facesDirectory;
|
||||
PersonContainer? personContainer;
|
||||
Dictionary<long, int> personKeyToCount = new();
|
||||
bool usePersonCharactersCopyCount = personCharactersCopyCount != int.MaxValue;
|
||||
string delete = $"_ {nameof(Shared.Models.Stateless.IMapLogic.ManualCopy).Humanize(LetterCasing.Title)} Delete";
|
||||
foreach (Mapping mapping in mappingCollection)
|
||||
{
|
||||
directoryName = Path.GetDirectoryName(mapping.MappingFromItem.RelativePath);
|
||||
@ -922,10 +925,13 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
|
||||
faceFileName = $"{mapping.MappingFromLocation.DeterministicHashCodeKey}{mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}{_Configuration.FacesFileNameExtension}";
|
||||
faceFile = Path.Combine(facesDirectory, faceFileName);
|
||||
personKey = mapping.MappingFromPerson.PersonBirthday.Value.Ticks;
|
||||
if (!personKeyToCount.ContainsKey(personKey))
|
||||
personKeyToCount.Add(personKey, 0);
|
||||
if (personKeyToCount[personKey] > personCharactersCopyCount)
|
||||
continue;
|
||||
if (usePersonCharactersCopyCount)
|
||||
{
|
||||
if (!personKeyToCount.ContainsKey(personKey))
|
||||
personKeyToCount.Add(personKey, 0);
|
||||
if (personKeyToCount[personKey] > personCharactersCopyCount)
|
||||
continue;
|
||||
}
|
||||
if (!_PersonKeyToPersonContainer.TryGetValue(personKey, out personContainer))
|
||||
continue;
|
||||
if (personContainer.PersonDirectory is null || !_Configuration.PersonCharacters.Contains(personContainer.PersonDirectory.Char))
|
||||
@ -935,12 +941,23 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
|
||||
if (!File.Exists(faceFile))
|
||||
continue;
|
||||
directory = Path.Combine(a2PeopleSingletonDirectory, personContainer.PersonDirectory.Char.ToString(), personContainer.PersonDirectory.Group, personContainer.DisplayDirectoryName);
|
||||
if (!Directory.Exists(directory))
|
||||
continue;
|
||||
if (usePersonCharactersCopyCount)
|
||||
{
|
||||
if (!Directory.Exists(directory))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
year = mapping.MappingFromItem.IsWrongYear is null || mapping.MappingFromItem.IsWrongYear.Value ? "0000" : mapping.MappingFromItem.MinimumDateTime.ToString("yyyy");
|
||||
directory = Path.Combine(directory, delete, year);
|
||||
if (!Directory.Exists(directory))
|
||||
_ = Directory.CreateDirectory(directory);
|
||||
}
|
||||
fileName = Path.Combine(directory, faceFileName);
|
||||
if (File.Exists(fileName))
|
||||
continue;
|
||||
personKeyToCount[personKey] += 1;
|
||||
if (usePersonCharactersCopyCount)
|
||||
personKeyToCount[personKey] += 1;
|
||||
File.Copy(faceFile, fileName);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user