removed-person
This commit is contained in:
@ -5,11 +5,6 @@ public interface IPerson
|
||||
|
||||
// ...
|
||||
|
||||
Models.PersonName TestStatic_GetPersonName(string name) =>
|
||||
GetPersonName(name);
|
||||
static Models.PersonName GetPersonName(string name) =>
|
||||
PersonName.GetPersonName(name);
|
||||
|
||||
static (char, char, char) GetPersonHour(string personDisplayDirectoryName, int hour) =>
|
||||
hour == 0 ? new('U', 'U', 'U') :
|
||||
hour == 1 ? new('U', 'U', 'U') :
|
||||
@ -47,24 +42,4 @@ public interface IPerson
|
||||
static bool IsDefaultName(string mappingDefaultName, string value) =>
|
||||
value == mappingDefaultName || (value.Length > 1 && value[0] == 'X' && value[1] == ']');
|
||||
|
||||
bool TestStatic_IsDefaultName(string mappingDefaultName, Models.Person person) =>
|
||||
IsDefaultName(mappingDefaultName, person);
|
||||
static bool IsDefaultName(string mappingDefaultName, Models.Person person) =>
|
||||
IsDefaultName(mappingDefaultName, person.Name.Alias is null ? string.Empty : person.Name.Alias.Value);
|
||||
|
||||
string TestStatic_GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.Person person) =>
|
||||
GetFileFullName(storage, personBirthdayFormat, person);
|
||||
static string GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.Person person) =>
|
||||
IPersonBirthday.GetFileFullName(storage, personBirthdayFormat, person.Birthday);
|
||||
|
||||
Models.Person TestStatic_GetPerson(char[] personCharacters, string personDisplayDirectoryName, long personKey, Models.PersonBirthday personBirthday) =>
|
||||
GetPerson(personCharacters, personDisplayDirectoryName, personKey, personBirthday);
|
||||
static Models.Person GetPerson(char[] personCharacters, string personDisplayDirectoryName, long personKey, Models.PersonBirthday personBirthday) =>
|
||||
Person.GetPerson(personCharacters, personDisplayDirectoryName, Array.Empty<string>(), personKey, personBirthday);
|
||||
|
||||
Models.Person TestStatic_GetPerson(char[] personCharacters, string personDisplayDirectoryName, string[] personDisplayDirectoryAllFiles, long personKey) =>
|
||||
GetPerson(personCharacters, personDisplayDirectoryName, personDisplayDirectoryAllFiles, personKey);
|
||||
static Models.Person GetPerson(char[] personCharacters, string personDisplayDirectoryName, string[] personDisplayDirectoryAllFiles, long personKey) =>
|
||||
Person.GetPerson(personCharacters, personDisplayDirectoryName, personDisplayDirectoryAllFiles, personKey, IPersonBirthday.GetPersonBirthday(personKey));
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonAddress
|
||||
{
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonAddressCity
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonAddressCity.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
static string GetDefaultValue() => PersonAddressCity.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonAddressState
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonAddressState.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
static string GetDefaultValue() => PersonAddressState.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonAddressStreet
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonAddressStreet.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
static string GetDefaultValue() => PersonAddressStreet.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonAddressZipCode
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonAddressZipCode.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
static string GetDefaultValue() => PersonAddressZipCode.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -125,9 +125,9 @@ public interface IPersonBirthday
|
||||
static DateTime? GetDateTime(string personBirthdayFormat, string personKeyFormatted) =>
|
||||
DateTime.TryParseExact(GetDateTime(personKeyFormatted), personBirthdayFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime) ? dateTime : null;
|
||||
|
||||
List<(string, Models.PersonBirthday)> TestStatic_GetPersonBirthdays(string personBirthdayFormat, string[] personKeyDirectories, string personDisplayDirectory, string personDisplayDirectoryName) =>
|
||||
GetPersonBirthdays(personBirthdayFormat, personKeyDirectories, personDisplayDirectory, personDisplayDirectoryName);
|
||||
static List<(string, Models.PersonBirthday)> GetPersonBirthdays(string personBirthdayFormat, string[] personKeyDirectories, string personDisplayDirectory, string personDisplayDirectoryName) =>
|
||||
PersonBirthday.GetPersonBirthdays(personBirthdayFormat, personKeyDirectories, personDisplayDirectory, personDisplayDirectoryName);
|
||||
List<(string, Models.PersonBirthday)> TestStatic_GetPersonBirthdays(string personBirthdayFormat, string[] personKeyDirectories, string personDisplayDirectoryName) =>
|
||||
GetPersonBirthdays(personBirthdayFormat, personKeyDirectories, personDisplayDirectoryName);
|
||||
static List<(string, Models.PersonBirthday)> GetPersonBirthdays(string personBirthdayFormat, string[] personKeyDirectories, string personDisplayDirectoryName) =>
|
||||
PersonBirthday.GetPersonBirthdays(personBirthdayFormat, personKeyDirectories, personDisplayDirectoryName);
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonComment
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonComment.GetDefaultValue(); // <{1}>PluralValue
|
||||
|
||||
static string GetDefaultValue() => PersonComment.GetDefaultValue(); // <{1}>PluralValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonContainer
|
||||
@ -17,19 +15,9 @@ public interface IPersonContainer
|
||||
static List<Models.PersonContainer> GetPersonContainers(Properties.IStorage storage, string personBirthdayFormat, char[] personCharacters, string facesFileNameExtension) =>
|
||||
PersonContainer.GetPersonContainers(storage, personBirthdayFormat, personCharacters, facesFileNameExtension);
|
||||
|
||||
List<(long?, string)> TestStatic_GetDisplay(string personBirthdayFormat, Models.PersonContainer personContainer) =>
|
||||
GetDisplay(personBirthdayFormat, personContainer);
|
||||
static List<(long?, string)> GetDisplay(string personBirthdayFormat, Models.PersonContainer personContainer) =>
|
||||
PersonContainer.GetDisplay(personBirthdayFormat, personContainer);
|
||||
|
||||
string? TestStatic_VerifyAge(char numberSign, string personDisplayDirectory, string? minusOne, string personDisplayDirectoryName, int? approximateYears, List<(string PersonKeyFormatted, Models.PersonBirthday PersonBirthday)> collection) =>
|
||||
VerifyAge(numberSign, personDisplayDirectory, minusOne, personDisplayDirectoryName, approximateYears, collection);
|
||||
static string? VerifyAge(char numberSign, string personDisplayDirectory, string? minusOne, string personDisplayDirectoryName, int? approximateYears, List<(string PersonKeyFormatted, Models.PersonBirthday PersonBirthday)> collection) =>
|
||||
PersonContainer.VerifyAge(numberSign, personDisplayDirectory, minusOne, personDisplayDirectoryName, approximateYears, collection);
|
||||
|
||||
ReadOnlyDictionary<string, string> TestStatic_GetPersonKeyFormattedToPersonFullName(string personBirthdayFormat, ReadOnlyCollection<Models.PersonContainer> personContainers) =>
|
||||
GetPersonKeyFormattedToPersonFullName(personBirthdayFormat, personContainers);
|
||||
static ReadOnlyDictionary<string, string> GetPersonKeyFormattedToPersonFullName(string personBirthdayFormat, ReadOnlyCollection<Models.PersonContainer> personContainers) =>
|
||||
PersonContainer.GetPersonKeyFormattedToPersonFullName(personBirthdayFormat, personContainers);
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonEmail
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonEmail.GetDefaultValue(); // <{1}>PluralValue
|
||||
|
||||
static string GetDefaultValue() => PersonEmail.GetDefaultValue(); // <{1}>PluralValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonId
|
||||
{
|
||||
|
||||
long TestStatic_GetDefaultValue() => PersonId.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
static long GetDefaultValue() => PersonId.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonName
|
||||
{
|
||||
|
||||
// ...
|
||||
|
||||
string TestStatic_GetFullName(Models.PersonName personName) =>
|
||||
GetFullName(personName);
|
||||
static string GetFullName(Models.PersonName personName) =>
|
||||
PersonName.GetFullName(personName);
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonNameAlias
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonNameAlias.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
static string GetDefaultValue() => PersonNameAlias.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonNameFirst
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonNameFirst.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
static string GetDefaultValue() => PersonNameFirst.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonNameLast
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonNameLast.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
static string GetDefaultValue() => PersonNameLast.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonNameMiddle
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonNameMiddle.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
static string GetDefaultValue() => PersonNameMiddle.GetDefaultValue(); // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonNumber
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() => PersonNumber.GetDefaultValue(); // <{1}>PluralValue
|
||||
|
||||
static string GetDefaultValue() => PersonNumber.GetDefaultValue(); // <{1}>PluralValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
public interface IPersonURL
|
||||
{
|
||||
|
||||
string TestStatic_GetDefaultValue() =>
|
||||
GetDefaultValue(); // <{1}>PluralValue
|
||||
static string GetDefaultValue() =>
|
||||
PersonURL.GetDefaultValue(); // <{1}>PluralValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class Person
|
||||
{
|
||||
|
||||
// ...
|
||||
|
||||
internal static (Models.PersonBirthday?, string) Get(string personBirthdayFormat, string personDisplayDirectory, string personKeyDirectory, DateTime birthday)
|
||||
{
|
||||
Models.PersonBirthday? personBirthday = new(birthday);
|
||||
string personKeyFormatted = IPersonBirthday.GetFormatted(personBirthdayFormat, personBirthday);
|
||||
string convertedPersonKeyDirectory = Path.Combine(personDisplayDirectory, personKeyFormatted);
|
||||
if (!Directory.Exists(convertedPersonKeyDirectory))
|
||||
Directory.Move(personKeyDirectory, convertedPersonKeyDirectory);
|
||||
return new(personBirthday, personKeyFormatted);
|
||||
}
|
||||
|
||||
internal static Models.Person GetPerson(char[] personCharacters, string personDisplayDirectoryName, string[] personDisplayDirectoryAllFiles, long personKey, Models.PersonBirthday personBirthday)
|
||||
{
|
||||
Models.Person result;
|
||||
string[] matches;
|
||||
List<Models.PersonURL> urls = new();
|
||||
Models.PersonId id = new(personKey);
|
||||
List<Models.PersonEmail> emails = new();
|
||||
List<Models.PersonNumber> numbers = new();
|
||||
List<Models.PersonComment> comments = new();
|
||||
List<Models.PersonAddress> addresses = new();
|
||||
string checkFileName = $"{personDisplayDirectoryName.First()}.json";
|
||||
string nameWithoutApproximateYears = personDisplayDirectoryName.Split(personCharacters).First();
|
||||
matches = (from l in personDisplayDirectoryAllFiles where Path.GetFileName(l) == checkFileName select l).ToArray();
|
||||
Models.PersonName? name;
|
||||
if (!matches.Any())
|
||||
name = PersonName.GetPersonName(nameWithoutApproximateYears);
|
||||
else
|
||||
{
|
||||
string json = File.ReadAllText(matches.First());
|
||||
name = JsonSerializer.Deserialize<Models.PersonName>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
name ??= PersonName.GetPersonName(nameWithoutApproximateYears);
|
||||
if (name.Last is null || string.IsNullOrEmpty(name.Last.Value))
|
||||
name = PersonName.GetPersonName(nameWithoutApproximateYears);
|
||||
}
|
||||
result = new(id, personBirthday, name, comments, urls, numbers, emails, addresses);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonAddress
|
||||
{
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonAddressCity
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonAddressState
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonAddressStreet
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonAddressZipCode
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -87,7 +87,7 @@ internal abstract class PersonBirthday
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static List<(string, Models.PersonBirthday)> GetPersonBirthdays(string personBirthdayFormat, string[] personKeyDirectories, string personDisplayDirectory, string personDisplayDirectoryName)
|
||||
internal static List<(string, Models.PersonBirthday)> GetPersonBirthdays(string personBirthdayFormat, string[] personKeyDirectories, string personDisplayDirectoryName)
|
||||
{
|
||||
List<(string, Models.PersonBirthday)> results = new();
|
||||
string personKeyFormatted;
|
||||
@ -98,7 +98,8 @@ internal abstract class PersonBirthday
|
||||
if (!DateTime.TryParseExact(personKeyFormatted, "MM.dd.yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime birthday))
|
||||
personBirthday = IPersonBirthday.GetPersonBirthday(personBirthdayFormat, personKeyFormatted);
|
||||
else
|
||||
(personBirthday, personKeyFormatted) = Person.Get(personBirthdayFormat, personDisplayDirectory, personKeyDirectory, birthday);
|
||||
// (personBirthday, personKeyFormatted) = Person.Get(personBirthdayFormat, personDisplayDirectory, personKeyDirectory, birthday);
|
||||
continue;
|
||||
if (personBirthday is null)
|
||||
continue;
|
||||
if (!IPersonBirthday.IsCounterPersonBirthday(personBirthday) && ((!personKeyDirectory.Contains('#') && (personDisplayDirectoryName.Contains('~') || personDisplayDirectoryName.Contains('#'))) || (personKeyDirectory.Contains('#') && !personDisplayDirectoryName.Contains('#'))))
|
||||
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonComment
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // <{1}>PluralValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonContainer
|
||||
@ -92,13 +90,12 @@ internal abstract class PersonContainer
|
||||
return results;
|
||||
}
|
||||
|
||||
private static List<Models.PersonContainer> GetPersonContainersCollections(string facesFileNameExtension, char[] personCharacters, PersonDirectory personDirectory, char numberSign, string personDisplayDirectory, string personDisplayDirectoryName, int? approximateYears, List<(string PersonKeyFormatted, Models.PersonBirthday PersonBirthday)> collection)
|
||||
private static List<Models.PersonContainer> GetPersonContainersCollections(string facesFileNameExtension, PersonDirectory personDirectory, char numberSign, string personDisplayDirectory, string personDisplayDirectoryName, int? approximateYears, List<(string PersonKeyFormatted, Models.PersonBirthday PersonBirthday)> collection)
|
||||
{
|
||||
List<Models.PersonContainer> results = new();
|
||||
long personKey;
|
||||
string[] files;
|
||||
const int zero = 0;
|
||||
Models.Person person;
|
||||
string personKeyDirectory;
|
||||
Models.PersonContainer personContainer;
|
||||
Models.PersonBirthday[] orderedPersonBirthdays;
|
||||
@ -119,8 +116,7 @@ internal abstract class PersonContainer
|
||||
if (!files.Any())
|
||||
continue;
|
||||
personDisplayDirectoryAllFiles.AddRange(files.Where(l => l.EndsWith(".rel")));
|
||||
person = IPerson.GetPerson(personCharacters, personDisplayDirectoryName, personDisplayDirectoryAllFiles.ToArray(), personKey);
|
||||
personContainer = new(approximateYears, orderedPersonBirthdays, personDisplayDirectoryAllFiles.ToArray(), personDisplayDirectoryName, personKey, person, personDirectory);
|
||||
personContainer = new(approximateYears, orderedPersonBirthdays, personDisplayDirectoryAllFiles.ToArray(), personDisplayDirectoryName, personKey, personDirectory);
|
||||
results.Add(personContainer);
|
||||
}
|
||||
return results;
|
||||
@ -177,7 +173,7 @@ internal abstract class PersonContainer
|
||||
continue;
|
||||
approximateYears = Age.GetApproximateYears(personCharacters, personDisplayDirectoryName);
|
||||
personKeyDirectories = Directory.GetDirectories(personDisplayDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
collection = PersonBirthday.GetPersonBirthdays(personBirthdayFormat, personKeyDirectories, personDisplayDirectory, personDisplayDirectoryName);
|
||||
collection = PersonBirthday.GetPersonBirthdays(personBirthdayFormat, personKeyDirectories, personDisplayDirectoryName);
|
||||
if (personDisplayDirectoryName.Contains('^'))
|
||||
{
|
||||
minusOne = Path.GetDirectoryName(personDisplayDirectory);
|
||||
@ -189,7 +185,7 @@ internal abstract class PersonContainer
|
||||
continue;
|
||||
if (collection.Count > 0)
|
||||
{
|
||||
personContainers = GetPersonContainersCollections(facesFileNameExtension, personCharacters, personDirectory, numberSign, personDisplayDirectory, personDisplayDirectoryName, approximateYears, collection);
|
||||
personContainers = GetPersonContainersCollections(facesFileNameExtension, personDirectory, numberSign, personDisplayDirectory, personDisplayDirectoryName, approximateYears, collection);
|
||||
results.AddRange(personContainers);
|
||||
}
|
||||
else
|
||||
@ -264,7 +260,7 @@ internal abstract class PersonContainer
|
||||
groupDirectoryName = Path.GetFileName(groupDirectory);
|
||||
if (personCharacters[i] != groupDirectoryName.First())
|
||||
continue;
|
||||
(changes, collection) = GetPersonContainersInnerGroups( personBirthdayFormat, facesFileNameExtension, personCharacters, groupDirectory, groupDirectoryName);
|
||||
(changes, collection) = GetPersonContainersInnerGroups(personBirthdayFormat, facesFileNameExtension, personCharacters, groupDirectory, groupDirectoryName);
|
||||
allChanges.AddRange(changes);
|
||||
personContainers.AddRange(collection);
|
||||
}
|
||||
@ -296,31 +292,13 @@ internal abstract class PersonContainer
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<(long?, string)> GetDisplay(string personBirthdayFormat, Models.PersonContainer personContainer)
|
||||
{
|
||||
List<(long?, string)> results = new();
|
||||
string personKeyFormatted;
|
||||
Models.PersonContainer pc = personContainer;
|
||||
if (pc.Person is null || pc.Key is null || pc.Birthdays is null || !pc.Birthdays.Any())
|
||||
results.Add(new(pc.Key, string.Concat('\t', pc.Key, '\t', pc.ApproximateYears, '\t', pc.DisplayDirectoryName)));
|
||||
else
|
||||
{
|
||||
foreach (Models.PersonBirthday personBirthday in pc.Birthdays)
|
||||
{
|
||||
personKeyFormatted = IPersonBirthday.GetFormatted(personBirthdayFormat, personBirthday);
|
||||
results.Add(new(pc.Key, string.Concat(personKeyFormatted, '\t', pc.Key, '\t', pc.ApproximateYears, '\t', pc.DisplayDirectoryName)));
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static List<long> GetPersonKeys(IEnumerable<Models.PersonContainer> personContainers)
|
||||
{
|
||||
List<long> results = new();
|
||||
long personKey;
|
||||
foreach (Models.PersonContainer personContainer in personContainers)
|
||||
{
|
||||
if (personContainer.Person is null || personContainer.Key is null || personContainer.Birthdays is null || personContainer.Birthdays.Length == 0)
|
||||
if (personContainer.Key is null || personContainer.Birthdays is null || personContainer.Birthdays.Length == 0)
|
||||
continue;
|
||||
foreach (Models.PersonBirthday personBirthday in personContainer.Birthdays)
|
||||
{
|
||||
@ -331,24 +309,4 @@ internal abstract class PersonContainer
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static ReadOnlyDictionary<string, string> GetPersonKeyFormattedToPersonFullName(string personBirthdayFormat, ReadOnlyCollection<Models.PersonContainer> personContainers)
|
||||
{
|
||||
Dictionary<string, string> results = new();
|
||||
string? value;
|
||||
string personFullName;
|
||||
string personKeyFormatted;
|
||||
foreach (Models.PersonContainer personContainer in personContainers)
|
||||
{
|
||||
if (personContainer.Key is null || personContainer.Birthdays is null || personContainer.Person is null || personContainer.PersonDirectory is null || personContainer.Birthdays.Length == 0)
|
||||
continue;
|
||||
personKeyFormatted = IPersonBirthday.GetFormatted(personBirthdayFormat, personContainer.Key.Value);
|
||||
personFullName = PersonName.GetFullName(personContainer.Person.Name);
|
||||
if (!results.TryGetValue(personKeyFormatted, out value))
|
||||
results.Add(personKeyFormatted, personFullName);
|
||||
else if (value != personFullName)
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
return new(results);
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonEmail
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // <{1}>PluralValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonId
|
||||
{
|
||||
|
||||
internal static long GetDefaultValue() => long.MinValue; // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
using System.Text;
|
||||
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonName
|
||||
{
|
||||
|
||||
// ...
|
||||
|
||||
internal static Models.PersonName GetPersonName(string name)
|
||||
{
|
||||
Models.PersonName result;
|
||||
Models.PersonNameLast personNameLast;
|
||||
Models.PersonNameAlias personNameAlias;
|
||||
Models.PersonNameFirst personNameFirst;
|
||||
Models.PersonNameMiddle personNameMiddle;
|
||||
string[] segments = name.Split(' ');
|
||||
if (segments.Length == 1)
|
||||
{
|
||||
personNameFirst = new(string.Empty);
|
||||
personNameLast = new(string.Empty);
|
||||
personNameMiddle = new(string.Empty);
|
||||
personNameAlias = new(segments[0]);
|
||||
}
|
||||
else if (segments.Length == 2)
|
||||
{
|
||||
personNameFirst = new(segments[0]);
|
||||
personNameLast = new(segments[1]);
|
||||
personNameMiddle = new(string.Empty);
|
||||
personNameAlias = new(string.Empty);
|
||||
}
|
||||
else if (segments.Length == 3 && segments[2] is "Jr." or "Jr" or "Sr")
|
||||
{
|
||||
personNameFirst = new(segments[0]);
|
||||
personNameLast = new(segments[1]);
|
||||
personNameMiddle = new(string.Empty);
|
||||
personNameAlias = new(string.Join(' ', segments));
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] comment = name.Split(new string[] { " (" }, StringSplitOptions.None);
|
||||
if (comment.Length == 1)
|
||||
{
|
||||
personNameFirst = new(segments[0]);
|
||||
personNameLast = new(segments[^1]);
|
||||
personNameMiddle = new(string.Empty);
|
||||
personNameAlias = new(string.Join(' ', segments));
|
||||
}
|
||||
else
|
||||
{
|
||||
segments = comment[0].Split(' ');
|
||||
personNameFirst = new(segments[0]);
|
||||
personNameLast = new(segments[^1]);
|
||||
personNameMiddle = new(string.Empty);
|
||||
personNameAlias = new(string.Concat(string.Join(' ', segments), " (", comment[1]));
|
||||
}
|
||||
}
|
||||
result = new(personNameFirst, personNameMiddle, personNameLast, personNameAlias);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static string GetFullName(Models.PersonName personName)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
if (personName.First is not null && !string.IsNullOrEmpty(personName.First.Value))
|
||||
_ = result.Append(personName.First.Value);
|
||||
if (personName.Middle is not null && !string.IsNullOrEmpty(personName.Middle.Value))
|
||||
_ = result.Append(' ').Append(personName.Middle.Value);
|
||||
if (personName.Last is not null && !string.IsNullOrEmpty(personName.Last.Value))
|
||||
_ = result.Append(' ').Append(personName.Last.Value);
|
||||
if (personName.Alias is not null && !string.IsNullOrEmpty(personName.Alias.Value))
|
||||
{
|
||||
if (personName.Alias.Value.Contains(" Jr"))
|
||||
_ = result.Append(" Jr");
|
||||
else if (personName.Alias.Value.Contains(" Sr"))
|
||||
_ = result.Append(" Sr");
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonNameAlias
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonNameFirst
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonNameLast
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonNameMiddle
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonNumber
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // <{1}>PluralValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
internal abstract class PersonURL
|
||||
{
|
||||
|
||||
internal static string GetDefaultValue() => string.Empty; // <{1}>PluralValue
|
||||
|
||||
// ...
|
||||
|
||||
}
|
Reference in New Issue
Block a user