After testing E_Distance.SaveGroupedFaceEncodings
This commit is contained in:
@ -10,10 +10,33 @@ internal abstract class PersonBirthday
|
||||
// ...
|
||||
|
||||
internal static string GetFormat() => "yyyy-MM-dd_HH";
|
||||
internal static Models.PersonBirthday GetNextBirthDate(Properties.IStorage storage) => throw new Exception(storage.ToString()); // Person.GetNextBirthDate(storage);
|
||||
internal static string[] GetSegments(string personKey) => personKey.Split('\t');
|
||||
internal static string GetFormatted(Models.PersonBirthday personBirthday) => personBirthday.Value.ToString(GetFormat());
|
||||
internal static string GetFileName(Models.PersonBirthday personBirthday) => $"{personBirthday.Value.ToString(GetFormat())}.json";
|
||||
internal static bool DoesBirthDateExits(Properties.IStorage storage, Models.PersonBirthday personBirthday) => File.Exists(GetFileFullName(storage, personBirthday));
|
||||
internal static Models.PersonBirthday GetNextBirthDate(Properties.IStorage storage) => throw new Exception(storage.ToString()); // Person.GetNextBirthDate(storage);
|
||||
internal static string GetFileFullName(Properties.IStorage storage, Models.PersonBirthday personBirthday) => Path.Combine(storage.PeopleRootDirectory, "{}", GetFileName(personBirthday));
|
||||
internal static DateTime? Get(string personKey) => DateTime.TryParseExact(personKey, GetFormat(), CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime) ? dateTime : null;
|
||||
internal static DateTime? GetDateTime(string personKey) => DateTime.TryParseExact(personKey, GetFormat(), CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime) ? dateTime : null;
|
||||
|
||||
internal static Models.PersonBirthday? GetPersonBirthday(string personKey)
|
||||
{
|
||||
Models.PersonBirthday? result;
|
||||
string[] segments = GetSegments(personKey);
|
||||
DateTime? dateTime = GetDateTime(segments[0]);
|
||||
if (dateTime is null)
|
||||
result = null;
|
||||
else
|
||||
result = new(dateTime.Value);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static TimeSpan? GetTimeSpan(DateTime minimumDateTime, bool? isWrongYear, Models.PersonBirthday personBirthday)
|
||||
{
|
||||
TimeSpan? timeSpan;
|
||||
if (isWrongYear is null || isWrongYear.Value || personBirthday.Value.Year < 1900)
|
||||
timeSpan = null;
|
||||
else
|
||||
timeSpan = new(minimumDateTime.Ticks - personBirthday.Value.Ticks);
|
||||
return timeSpan;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user