Save Resized Images by Person Key Formatted

for Output Resolutions
This commit is contained in:
2022-10-02 10:40:32 -07:00
parent 9b8e3bdf55
commit 331d42685a
15 changed files with 125 additions and 141 deletions

View File

@ -30,10 +30,14 @@ public class SaveContainer
this(string.Empty, directory, null, null, null, null, string.Empty)
{ }
public SaveContainer(string checkFile, string directory, FileHolder? faceFileHolder) :
public SaveContainer(string checkFile, string directory, FileHolder faceFileHolder) :
this(checkFile, directory, faceFileHolder, null, null, null, string.Empty)
{ }
public SaveContainer(FileHolder resizedFileHolder, string checkFile, string directory) :
this(checkFile, directory, null, null, null, resizedFileHolder, string.Empty)
{ }
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });

View File

@ -5,10 +5,10 @@ public interface IPersonContainer
// ...
Models.PersonContainer[] TestStatic_GetPersonContainers(Properties.IStorage storage, string personBirthdayFormat, string facesFileNameExtension) =>
GetPersonContainers(storage, personBirthdayFormat, facesFileNameExtension);
static Models.PersonContainer[] GetPersonContainers(Properties.IStorage storage, string personBirthdayFormat, string facesFileNameExtension) =>
PersonContainer.GetPersonContainers(storage, personBirthdayFormat, facesFileNameExtension);
Models.PersonContainer[] TestStatic_GetPersonContainers(Properties.IStorage storage, string personBirthdayFormat, string[] verifyPersonKeyFormattedCollection, string facesFileNameExtension) =>
GetPersonContainers(storage, personBirthdayFormat, verifyPersonKeyFormattedCollection, facesFileNameExtension);
static Models.PersonContainer[] GetPersonContainers(Properties.IStorage storage, string personBirthdayFormat, string[] verifyPersonKeyFormattedCollection, string facesFileNameExtension) =>
PersonContainer.GetPersonContainers(storage, personBirthdayFormat, verifyPersonKeyFormattedCollection, facesFileNameExtension);
List<(long?, string)> TestStatic_GetDisplay(string personBirthdayFormat, Models.PersonContainer personContainer) =>
GetDisplay(personBirthdayFormat, personContainer);

View File

@ -155,7 +155,28 @@ internal abstract class PersonContainer
return results;
}
internal static Models.PersonContainer[] GetPersonContainers(Properties.IStorage storage, string personBirthdayFormat, string facesFileNameExtension)
private static void Verify(string personBirthdayFormat, string[] verifyPersonKeyFormattedCollection, Models.PersonContainer[] results)
{
const int zero = 0;
string personKeyFormatted;
List<string> collection = new();
Models.PersonBirthday personBirthday;
foreach (Models.PersonContainer personContainer in results)
{
if (personContainer.Key is null || personContainer.Birthdays is null || !personContainer.Birthdays.Any())
continue;
personBirthday = personContainer.Birthdays[zero];
personKeyFormatted = IPersonBirthday.GetFormatted(personBirthdayFormat, personBirthday);
if (!verifyPersonKeyFormattedCollection.Contains(personKeyFormatted))
continue;
if (personContainer.DisplayDirectoryAllFiles.Any(l => !l.Contains('^')))
collection.Add(personContainer.DisplayDirectoryName);
}
if (collection.Any())
throw new NotSupportedException($"A person in the verify collection has a approximate birthday!{Environment.NewLine}{string.Join(Environment.NewLine, collection.ToArray())}");
}
internal static Models.PersonContainer[] GetPersonContainers(Properties.IStorage storage, string personBirthdayFormat, string[] verifyPersonKeyFormattedCollection, string facesFileNameExtension)
{
Models.PersonContainer[] results;
char[] chars = IAge.GetChars();
@ -174,6 +195,7 @@ internal abstract class PersonContainer
results = Array.Empty<Models.PersonContainer>();
else
results = GetPersonContainersGroups(personBirthdayFormat, facesFileNameExtension, chars, groupDirectories);
Verify(personBirthdayFormat, verifyPersonKeyFormattedCollection, results);
return results;
}