diff --git a/Map/Models/Stateless/MapLogic.cs b/Map/Models/Stateless/MapLogic.cs index 309bfe4..dd6cdf5 100644 --- a/Map/Models/Stateless/MapLogic.cs +++ b/Map/Models/Stateless/MapLogic.cs @@ -60,7 +60,7 @@ internal abstract class MapLogic skipNotSkipCollection[id.Value].Add(wholePercentages.Value); } } - 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 (PersonBirthday personBirthday in personContainer.Birthdays) { @@ -513,7 +513,6 @@ internal abstract class MapLogic { List results = new(); bool check; - Person person; long personKey; int? approximateYears = null; PersonBirthday personBirthday; @@ -541,8 +540,7 @@ internal abstract class MapLogic if (check) continue; personBirthday = IPersonBirthday.GetPersonBirthday(personKey + (oneHour * 2)); - person = IPerson.GetPerson(configuration.PersonCharacters.ToArray(), configuration.MappingDefaultName, personKey, personBirthday); - personContainer = new(approximateYears, new PersonBirthday[] { personBirthday }, personDisplayDirectoryAllFiles, configuration.MappingDefaultName, personKey, person); + personContainer = new(approximateYears, new PersonBirthday[] { personBirthday }, personDisplayDirectoryAllFiles, configuration.MappingDefaultName, personKey); results.Add(personContainer); if (results.Count > 99) break; @@ -558,7 +556,7 @@ internal abstract class MapLogic List personKeys = IPersonContainer.GetPersonKeys(personContainers); foreach (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; if (personKeys.Contains(personContainer.Key.Value)) continue; diff --git a/Person/.vscode/launch.json b/Person/.vscode/launch.json deleted file mode 100644 index 7c5f5ff..0000000 --- a/Person/.vscode/launch.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - // Use IntelliSense to find out which attributes exist for C# debugging - // Use hover for the description of the existing attributes - // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md - "name": ".NET Core Launch (console)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/bin/Debug/net7.0/win-x64/Person.dll", - "args": [], - "cwd": "${workspaceFolder}", - // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console - "console": "internalConsole", - "stopAtEntry": false - }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach" - } - ] -} \ No newline at end of file diff --git a/Person/.vscode/tasks.json b/Person/.vscode/tasks.json deleted file mode 100644 index 8417c08..0000000 --- a/Person/.vscode/tasks.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "build", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/Person.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "publish", - "command": "dotnet", - "type": "process", - "args": [ - "publish", - "${workspaceFolder}/Person.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "watch", - "command": "dotnet", - "type": "process", - "args": [ - "watch", - "run", - "--project", - "${workspaceFolder}/Person.csproj" - ], - "problemMatcher": "$msCompile" - } - ] -} \ No newline at end of file diff --git a/Person/Models/AppSettings.cs b/Person/Models/AppSettings.cs deleted file mode 100644 index 5cbaa9a..0000000 --- a/Person/Models/AppSettings.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Person.Models; - -public class AppSettings -{ - - public string Company { init; get; } - public int MaxDegreeOfParallelism { init; get; } - public string WorkingDirectoryName { init; get; } - - [JsonConstructor] - public AppSettings(string company, - int maxDegreeOfParallelism, - string workingDirectoryName) - { - Company = company; - MaxDegreeOfParallelism = maxDegreeOfParallelism; - WorkingDirectoryName = workingDirectoryName; - } - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } - -} \ No newline at end of file diff --git a/Person/Models/Binder/AppSettings.cs b/Person/Models/Binder/AppSettings.cs deleted file mode 100644 index ef0e605..0000000 --- a/Person/Models/Binder/AppSettings.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.Extensions.Configuration; -using System.Text.Json; - -namespace View_by_Distance.Person.Models.Binder; - -public class AppSettings -{ - -#nullable disable - - public string Company { get; set; } - public int? MaxDegreeOfParallelism { get; set; } - public string WorkingDirectoryName { get; set; } - -#nullable restore - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } - - private static Models.AppSettings Get(AppSettings? appSettings) - { - Models.AppSettings result; - if (appSettings?.MaxDegreeOfParallelism is null) - throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism)); - result = new( - appSettings.Company, - appSettings.MaxDegreeOfParallelism.Value, - appSettings.WorkingDirectoryName - ); - return result; - } - - public static Models.AppSettings Get(IConfigurationRoot configurationRoot) - { - Models.AppSettings result; - AppSettings? appSettings = configurationRoot.Get(); - result = Get(appSettings); - return result; - } - -} \ No newline at end of file diff --git a/Person/Models/Binder/Configuration.cs b/Person/Models/Binder/Configuration.cs deleted file mode 100644 index b731100..0000000 --- a/Person/Models/Binder/Configuration.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Phares.Shared; -using System.ComponentModel.DataAnnotations; -using System.Text.Json; - -namespace View_by_Distance.Person.Models.Binder; - -public class Configuration -{ - -#nullable disable - - [Display(Name = "Ignore Extensions"), Required] public string[] IgnoreExtensions { get; set; } - [Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; } - [Display(Name = "Person Birthday Format"), Required] public string PersonBirthdayFormat { get; set; } - [Display(Name = "Save Directory"), Required] public string SaveDirectory { get; set; } - -#nullable restore - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } - - private static Models.Configuration Get(Configuration? configuration) - { - Models.Configuration result; - if (configuration is null) - throw new NullReferenceException(nameof(configuration)); - if (configuration.IgnoreExtensions is null) - throw new NullReferenceException(nameof(configuration.IgnoreExtensions)); - if (configuration.PersonBirthdayFormat is null) - throw new NullReferenceException(nameof(configuration.PersonBirthdayFormat)); - result = new( - configuration.IgnoreExtensions, - configuration.PersonBirthdayFormat, - configuration.PropertyConfiguration, - configuration.SaveDirectory); - return result; - } - - public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration) - { - Models.Configuration result; - Configuration? configuration; - if (isEnvironment is null) - configuration = configurationRoot.Get(); - else - { - string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment); - string section = string.Concat(environmentName, ":", nameof(Configuration)); - IConfigurationSection configurationSection = configurationRoot.GetSection(section); - configuration = configurationSection.Get(); - } - result = Get(configuration); - result.SetAndUpdate(propertyConfiguration); - return result; - } - -} \ No newline at end of file diff --git a/Person/Models/Configuration.cs b/Person/Models/Configuration.cs deleted file mode 100644 index d64f96c..0000000 --- a/Person/Models/Configuration.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Person.Models; - -public class Configuration -{ - - protected Property.Models.Configuration _PropertyConfiguration; - public string[] IgnoreExtensions { init; get; } - public string PersonBirthdayFormat { init; get; } - public string SaveDirectory { init; get; } - - public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration; - - [JsonConstructor] - public Configuration( - string[] ignoreExtensions, - string personBirthdayFormat, - Property.Models.Configuration propertyConfiguration, - string saveDirectory) - { - IgnoreExtensions = ignoreExtensions; - PersonBirthdayFormat = personBirthdayFormat; - _PropertyConfiguration = propertyConfiguration; - SaveDirectory = saveDirectory; - } - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } - - public void SetAndUpdate(Property.Models.Configuration configuration) - { - _PropertyConfiguration = configuration; - _PropertyConfiguration.Update(); - } - -} \ No newline at end of file diff --git a/Person/Models/Stateless/SerilogExtensionMethods.cs b/Person/Models/Stateless/SerilogExtensionMethods.cs deleted file mode 100644 index 60645e4..0000000 --- a/Person/Models/Stateless/SerilogExtensionMethods.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Person.Models.Stateless; - -public static class SerilogExtensionMethods -{ - - internal static void Warn(this Serilog.ILogger log, string messageTemplate) => log.Warning(messageTemplate); - - internal static void Info(this Serilog.ILogger log, string messageTemplate) => log.Information(messageTemplate); - -} \ No newline at end of file diff --git a/Person/Person.cs b/Person/Person.cs deleted file mode 100644 index 85e6e46..0000000 --- a/Person/Person.cs +++ /dev/null @@ -1,276 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Phares.Shared; -using Serilog; -using System.Text.Json; -using View_by_Distance.Person.Models; -using View_by_Distance.Shared.Models; -using View_by_Distance.Shared.Models.Stateless.Methods; - -namespace View_by_Distance.Person; - -public class Person -{ - - private readonly AppSettings _AppSettings; - private readonly string _WorkingDirectory; - private readonly IsEnvironment _IsEnvironment; - private readonly Configuration _Configuration; - private readonly IConfigurationRoot _ConfigurationRoot; - private readonly Property.Models.Configuration _PropertyConfiguration; - - public Person(List args, IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, AppSettings appSettings, string workingDirectory, bool isSilent, Shared.Models.Methods.IConsole console) - { - if (isSilent) - { } - if (console is null) - { } - _AppSettings = appSettings; - _IsEnvironment = isEnvironment; - long ticks = DateTime.Now.Ticks; - _WorkingDirectory = workingDirectory; - _ConfigurationRoot = configurationRoot; - ILogger? log = Log.ForContext(); - Property.Models.Configuration propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot); - Configuration configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration); - _PropertyConfiguration = propertyConfiguration; - _Configuration = configuration; - propertyConfiguration.Update(); - string? comparePathRoot = Path.GetDirectoryName(configuration.SaveDirectory); - if (comparePathRoot is null || comparePathRoot == propertyConfiguration.RootDirectory) - throw new Exception("Nested isn't allowed!"); - if (!Directory.Exists(configuration.SaveDirectory)) - _ = Directory.CreateDirectory(configuration.SaveDirectory); - log.Information(propertyConfiguration.RootDirectory); - Verify(); - Loop(ticks, log); - } - - private void Verify() - { - if (_AppSettings is null) - { } - if (_IsEnvironment is null) - { } - if (_Configuration is null) - { } - if (_ConfigurationRoot is null) - { } - if (_WorkingDirectory is null) - { } - if (_PropertyConfiguration is null) - { } - } - - private void Loop(long ticks, ILogger log) - { - Uri uri; - HttpClient httpClient = new(); - string fileName; - Task task; - int age; - int hours; - bool alive; - string json; - string? day; - string alias; - string? line; - string? year; - string? month; - ConsoleKey sex; - long personKey; - string? lastName; - string middleName; - string? firstName; - DateTime? dateTime; - string checkDirectory; - PersonName? personName; - DateTime parseDateTime; - ConsoleKey? consoleKey; - string? approximateYears; - string personKeyFormatted; - string personDisplayDirectory; - log.Information($"Ready to create / update a person? [{ticks}]"); - for (int y = 0; y < int.MaxValue; y++) - { - personName = null; - log.Information("Press \"Y\" key to continue, \"N\" key exit or close console"); - consoleKey = System.Console.ReadKey().Key; - log.Information(". . ."); - if (consoleKey is not ConsoleKey.Y and not ConsoleKey.N) - break; - else if (consoleKey is ConsoleKey.N) - break; - firstName = null; - for (int f = 0; f < 5; f++) - { - log.Information("Enter persons first name (minimum length of two characters)"); - line = System.Console.ReadLine(); - log.Information(". . ."); - if (string.IsNullOrEmpty(line) || line.Length < 2) - continue; - firstName = line.Trim(); - break; - } - if (firstName is null) - continue; - lastName = null; - for (int f = 0; f < 5; f++) - { - personName = IPerson.GetPersonName(firstName); - if (!string.IsNullOrEmpty(personName.First.Value) && !string.IsNullOrEmpty(personName.Last.Value)) - lastName = personName.Last.Value; - else - { - personName = null; - log.Information("Enter persons last name (minimum length of two characters)"); - line = System.Console.ReadLine(); - log.Information(". . ."); - if (string.IsNullOrEmpty(line) || line.Length < 2) - continue; - lastName = line.Trim(); - } - break; - } - if (lastName is null) - continue; - if (personName is not null) - middleName = personName.Middle.Value; - else - { - log.Information("Enter persons middle name (press enter if they don't have a middle name)"); - line = System.Console.ReadLine(); - log.Information(". . ."); - middleName = string.IsNullOrEmpty(line) ? string.Empty : line; - } - log.Information("Enter persons alias (press enter if they don't have a alias)"); - line = System.Console.ReadLine(); - log.Information(". . ."); - alias = string.IsNullOrEmpty(line) ? string.Empty : line; - personName ??= new(new(firstName), new(middleName), new(lastName), new(alias)); - json = JsonSerializer.Serialize(personName, new JsonSerializerOptions { WriteIndented = true }); - log.Information("Is the person \"M\" (Male), \"F\" (Female) or \"U\" (Unknown)"); - consoleKey = System.Console.ReadKey().Key; - log.Information(". . ."); - if (consoleKey is not ConsoleKey.M and not ConsoleKey.F and not ConsoleKey.U) - continue; - sex = consoleKey.Value; - log.Information("Is the person alive \"Y\" or \"N\""); - consoleKey = System.Console.ReadKey().Key; - log.Information(". . ."); - if (consoleKey is not ConsoleKey.Y and not ConsoleKey.N) - continue; - alive = consoleKey == ConsoleKey.Y; - dateTime = null; - approximateYears = null; - for (int f = 0; f < 5; f++) - { - day = null; - year = null; - month = null; - approximateYears = null; - log.Information("Enter persons birthday month (press enter if not known) [MMMM || MMM || MM || M]"); - line = System.Console.ReadLine(); - log.Information(". . ."); - if (string.IsNullOrEmpty(line)) - { - log.Information("Enter persons approximate age"); - line = System.Console.ReadLine(); - log.Information(". . ."); - if (string.IsNullOrEmpty(line) || !int.TryParse(line, out _)) - continue; - approximateYears = line.Trim(); - } - else - { - month = line.Trim(); - if (DateTime.TryParse(month, out parseDateTime) && parseDateTime != DateTime.MinValue) - { - month = parseDateTime.Month.ToString(); - day = parseDateTime.Day.ToString(); - year = parseDateTime.Year.ToString(); - } - else - { - log.Information("Enter persons birthday day (press enter if not known)"); - line = System.Console.ReadLine(); - log.Information(". . ."); - if (string.IsNullOrEmpty(line)) - { - log.Information("Enter persons approximate age"); - line = System.Console.ReadLine(); - log.Information(". . ."); - if (string.IsNullOrEmpty(line) || !int.TryParse(line, out _)) - continue; - approximateYears = line.Trim(); - } - else - { - day = line.Trim(); - log.Information("Enter persons birthday year (press enter if not known)"); - line = System.Console.ReadLine(); - log.Information(". . ."); - if (!string.IsNullOrEmpty(line)) - year = line.Trim(); - else - { - log.Information("Enter persons approximate age"); - line = System.Console.ReadLine(); - log.Information(". . ."); - if (string.IsNullOrEmpty(line) || !int.TryParse(line, out _)) - continue; - approximateYears = line.Trim(); - } - } - } - } - if (month is null || day is null || year is null) - dateTime = null; - else - { - dateTime = IPersonBirthday.GetDate(month, day, year); - if (dateTime is not null) - { - (age, _) = IAge.GetAge(new DateTime(ticks).Ticks, dateTime.Value); - approximateYears = age.ToString(); - } - } - if (approximateYears is null && (dateTime is null || dateTime == DateTime.MinValue)) - continue; - break; - } - if (approximateYears is null) - continue; - personDisplayDirectory = Path.Combine(_Configuration.SaveDirectory, ticks.ToString(), $"{personName.First.Value} {personName.Last.Value}~{approximateYears}"); - if (!Directory.Exists(personDisplayDirectory)) - _ = Directory.CreateDirectory(personDisplayDirectory); - log.Information("Enter url to download an image (press enter if none)"); - line = System.Console.ReadLine(); - log.Information(". . ."); - if (!string.IsNullOrEmpty(line)) - { - uri = new(line.Trim()); - if (uri.HostNameType != UriHostNameType.Dns) - continue; - task = httpClient.GetByteArrayAsync(uri); - fileName = Path.Combine(personDisplayDirectory, Path.GetFileName(uri.LocalPath)); - File.WriteAllBytes(fileName, task.Result); - } - if (dateTime is null) - personKeyFormatted = "2"; - else - { - hours = IPersonBirthday.GetHour(alive, sex); - personKey = dateTime.Value.AddHours(hours).Ticks; - personKeyFormatted = IPersonBirthday.GetFormatted(_Configuration.PersonBirthdayFormat, personKey); - } - checkDirectory = Path.Combine(personDisplayDirectory, personKeyFormatted); - log.Information($"Working directory <{checkDirectory}>"); - if (!Directory.Exists(checkDirectory)) - _ = Directory.CreateDirectory(checkDirectory); - _ = IPath.WriteAllText(Path.Combine(checkDirectory, $"{personKeyFormatted}.json"), json, updateDateWhenMatches: false, compareBeforeWrite: true); - log.Information($"Person saved ({personName.First.Value} {personName.Last.Value})"); - } - log.Information(". . ."); - } - -} \ No newline at end of file diff --git a/Person/Person.csproj b/Person/Person.csproj deleted file mode 100644 index 429d869..0000000 --- a/Person/Person.csproj +++ /dev/null @@ -1,59 +0,0 @@ - - - enable - 10.0 - enable - Exe - win-x64;linux-x64 - net7.0 - 7ca5318a-9332-4217-b9d8-cae696629934 - - - Phares.View.by.Distance.Person - false - 7.0.101.1 - Mike Phares - Phares - true - snupkg - - - true - true - true - - - Windows - - - OSX - - - Linux - - - - - - - - - - - - - - - - - - - - - Always - - - Always - - - \ No newline at end of file diff --git a/Person/Program.cs b/Person/Program.cs deleted file mode 100644 index a70d154..0000000 --- a/Person/Program.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Phares.Shared; -using Serilog; -using System.Diagnostics; -using System.Reflection; -using View_by_Distance.Person.Models; -using View_by_Distance.Shared.Models.Stateless.Methods; - -namespace View_by_Distance.Person; - -public class Program -{ - - public static void Secondary(List args) - { - LoggerConfiguration loggerConfiguration = new(); - Assembly assembly = Assembly.GetExecutingAssembly(); - bool debuggerWasAttachedAtLineZero = Debugger.IsAttached || assembly.Location.Contains(@"\bin\Debug"); - IsEnvironment isEnvironment = new(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: debuggerWasAttachedAtLineZero, nullASPNetCoreEnvironmentIsProduction: !debuggerWasAttachedAtLineZero); - IConfigurationBuilder configurationBuilder = new ConfigurationBuilder() - .AddEnvironmentVariables() - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddJsonFile(isEnvironment.AppSettingsFileName, optional: false, reloadOnChange: true) - .AddUserSecrets(); - IConfigurationRoot configurationRoot = configurationBuilder.Build(); - AppSettings appSettings = Models.Binder.AppSettings.Get(configurationRoot); - if (appSettings.MaxDegreeOfParallelism > Environment.ProcessorCount) - throw new Exception("MaxDegreeOfParallelism must be =< Environment.ProcessorCount!"); - if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName)) - throw new Exception("Working directory name must have a value!"); - string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName); - Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory); - _ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot); - Log.Logger = loggerConfiguration.CreateLogger(); - ILogger log = Log.ForContext(); - int silentIndex = args.IndexOf("s"); - if (silentIndex > -1) - args.RemoveAt(silentIndex); - try - { - if (args is null) - throw new Exception("args is null!"); - Shared.Models.Console console = new(); - _ = new Person(args, isEnvironment, configurationRoot, appSettings, workingDirectory, silentIndex > -1, console); - } - catch (Exception ex) - { - log.Fatal(string.Concat(ex.Message, Environment.NewLine, ex.StackTrace)); - } - finally - { - Log.CloseAndFlush(); - } - if (silentIndex > -1) - log.Debug("Done. Bye"); - else - { - log.Debug("Done. Press 'Enter' to end"); - _ = Console.ReadLine(); - } - } - - public static void Main(string[] args) - { - if (args is not null) - Secondary(args.ToList()); - else - Secondary(new List()); - } - -} \ No newline at end of file diff --git a/Person/appsettings.Development.json b/Person/appsettings.Development.json deleted file mode 100644 index ad9619a..0000000 --- a/Person/appsettings.Development.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Log4netProvider": "Debug" - } - }, - "Serilog": { - "MinimumLevel": "Debug" - } -} \ No newline at end of file diff --git a/Person/appsettings.json b/Person/appsettings.json deleted file mode 100644 index 3f52b70..0000000 --- a/Person/appsettings.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "Company": "Mike Phares", - "Linux": { - "Configuration": { - "DateGroup": "dd514b88", - "DiffPropertyDirectory": "", - "FileNameDirectorySeparator": ".Z.", - "ForcePropertyLastWriteTimeToCreationTime": false, - "MaxImagesInDirectoryForTopLevelFirstPass": 10, - "OutputExtension": ".jpg", - "Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]", - "PersonBirthdayFormat": "yyyy-MM-dd_HH", - "PopulatePropertyId": true, - "PropertiesChangedForProperty": false, - "ResultAllInOne": "_ _ _", - "ResultAllInOneSubdirectoryLength": 2, - "ResultCollection": "[]", - "ResultContent": "()", - "ResultSingleton": "{}", - "RootDirectory": "/srv/samba/share", - "SaveDirectory": "/home/vscode", - "IgnoreExtensions": [ - ".gif", - ".GIF", - ".nef", - ".NEF", - ".pdf", - ".PDF" - ], - "ValidImageFormatExtensions": [ - ".bmp", - ".BMP", - ".gif", - ".GIF", - ".jpeg", - ".JPEG", - ".jpg", - ".JPG", - ".png", - ".PNG", - ".tiff", - ".TIFF", - ".tif", - ".TIF" - ] - } - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Log4netProvider": "Debug", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "MaxDegreeOfParallelism": 1, - "Serilog": { - "Using": [ - "Serilog.Sinks.Console", - "Serilog.Sinks.File" - ], - "MinimumLevel": "Information", - "WriteTo": [ - { - "Name": "Debug", - "Args": { - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}" - } - }, - { - "Name": "Console", - "Args": { - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "%workingDirectory% - Log/log-.txt", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}", - "rollingInterval": "Hour" - } - } - ], - "Enrich": [ - "FromLogContext", - "WithMachineName", - "WithThreadId" - ], - "Properties": { - "Application": "Sample" - } - }, - "Windows": { - "Configuration": { - "DateGroup": "dd514b88", - "DiffPropertyDirectory": "", - "FileNameDirectorySeparator": ".Z.", - "ForcePropertyLastWriteTimeToCreationTime": false, - "MaxImagesInDirectoryForTopLevelFirstPass": 10, - "OutputExtension": ".jpg", - "Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]", - "PersonBirthdayFormat": "yyyy-MM-dd_HH", - "PopulatePropertyId": true, - "PropertiesChangedForProperty": false, - "ResultAllInOne": "_ _ _", - "ResultAllInOneSubdirectoryLength": 2, - "ResultCollection": "[]", - "ResultContent": "()", - "ResultSingleton": "{}", - "RootDirectory": "C:/Tmp/Phares/Compare/Images-dd514b88", - "SaveDirectory": "D:/Tmp", - "IgnoreExtensions": [ - ".gif", - ".GIF", - ".nef", - ".NEF", - ".pdf", - ".PDF" - ], - "ValidImageFormatExtensions": [ - ".bmp", - ".BMP", - ".gif", - ".GIF", - ".jpeg", - ".JPEG", - ".jpg", - ".JPG", - ".png", - ".PNG", - ".tiff", - ".TIFF", - ".tif", - ".TIF" - ] - } - }, - "WorkingDirectoryName": "PharesApps" -} \ No newline at end of file diff --git a/PhotoPrism/Models/_F_PhotoPrism.cs b/PhotoPrism/Models/_F_PhotoPrism.cs index 9dd448e..c04bce5 100644 --- a/PhotoPrism/Models/_F_PhotoPrism.cs +++ b/PhotoPrism/Models/_F_PhotoPrism.cs @@ -143,7 +143,6 @@ public class F_PhotoPrism private static void PopulateSubjects(string mappingDefaultName, string personBirthdayFormat, List subjects, StringBuilder stringBuilder, PersonContainer[] personContainers, (MappingFromPhotoPrism MappingFromPhotoPrism, Shared.Models.Marker Marker, float Percent)[] sortedCollection) { long? personKey; - string personName; const int zero = 0; string personKeyFormatted; PersonBirthday personBirthday; @@ -151,18 +150,17 @@ public class F_PhotoPrism { foreach (PersonContainer personContainer in personContainers) { - if (personContainer.Key is null || personContainer.Birthdays is null || personContainer.Person is null || !personContainer.Birthdays.Any()) + if (personContainer.Key is null || personContainer.Birthdays is null || !personContainer.Birthdays.Any()) continue; - if (IPerson.IsDefaultName(mappingDefaultName, personContainer.DisplayDirectoryName) || IPerson.IsDefaultName(mappingDefaultName, personContainer.Person)) + if (IPerson.IsDefaultName(mappingDefaultName, personContainer.DisplayDirectoryName)) continue; personBirthday = personContainer.Birthdays[zero]; personKey = personBirthday.Value.Ticks; - personName = personContainer.Person.GetFullName(); personKeyFormatted = IPersonBirthday.GetFormatted(personBirthdayFormat, personBirthday); - subjects.Add($"update `subjects` set subj_alias = '{personKeyFormatted}' where subj_name = '{personName}';"); + subjects.Add($"update `subjects` set subj_alias = '{personKeyFormatted}' where subj_name = '{personContainer.DisplayDirectoryName}';"); _ = stringBuilder. Append("update `markers` set subj_src = 'manual', marker_name = '"). - Append(personName). + Append(personContainer.DisplayDirectoryName). Append("' where marker_uid = '"). Append(marker.MarkerUid). AppendLine("';"); diff --git a/Shared/Models/Methods/IOutputResolution.cs b/Shared/Models/Methods/IOutputResolution.cs index 3083443..2b7d3b9 100644 --- a/Shared/Models/Methods/IOutputResolution.cs +++ b/Shared/Models/Methods/IOutputResolution.cs @@ -1,6 +1,6 @@ namespace View_by_Distance.Shared.Models.Methods; -public interface IOutputResolution : Stateless.Methods.IPerson +public interface IOutputResolution { } \ No newline at end of file diff --git a/Shared/Models/Methods/IPerson.cs b/Shared/Models/Methods/IPerson.cs deleted file mode 100644 index ba3d053..0000000 --- a/Shared/Models/Methods/IPerson.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPerson : Stateless.Methods.IPerson -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonAddress.cs b/Shared/Models/Methods/IPersonAddress.cs deleted file mode 100644 index 4f982c7..0000000 --- a/Shared/Models/Methods/IPersonAddress.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonAddress : Stateless.Methods.IPersonAddress -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonAddressCity.cs b/Shared/Models/Methods/IPersonAddressCity.cs deleted file mode 100644 index 074d800..0000000 --- a/Shared/Models/Methods/IPersonAddressCity.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonAddressCity : Stateless.Methods.IPersonAddressCity -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonAddressState.cs b/Shared/Models/Methods/IPersonAddressState.cs deleted file mode 100644 index 5fef12a..0000000 --- a/Shared/Models/Methods/IPersonAddressState.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonAddressState : Stateless.Methods.IPersonAddressState -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonAddressStreet.cs b/Shared/Models/Methods/IPersonAddressStreet.cs deleted file mode 100644 index c33151c..0000000 --- a/Shared/Models/Methods/IPersonAddressStreet.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonAddressStreet : Stateless.Methods.IPersonAddressStreet -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonAddressZipCode.cs b/Shared/Models/Methods/IPersonAddressZipCode.cs deleted file mode 100644 index 81db822..0000000 --- a/Shared/Models/Methods/IPersonAddressZipCode.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonAddressZipCode : Stateless.Methods.IPersonAddressZipCode -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonComment.cs b/Shared/Models/Methods/IPersonComment.cs deleted file mode 100644 index 22ee910..0000000 --- a/Shared/Models/Methods/IPersonComment.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonComment : Stateless.Methods.IPersonComment -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonEmail.cs b/Shared/Models/Methods/IPersonEmail.cs deleted file mode 100644 index 161461b..0000000 --- a/Shared/Models/Methods/IPersonEmail.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonEmail : Stateless.Methods.IPersonEmail -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonId.cs b/Shared/Models/Methods/IPersonId.cs deleted file mode 100644 index 3afac02..0000000 --- a/Shared/Models/Methods/IPersonId.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonId : Stateless.Methods.IPersonId -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonName.cs b/Shared/Models/Methods/IPersonName.cs deleted file mode 100644 index f31505a..0000000 --- a/Shared/Models/Methods/IPersonName.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonName : Stateless.Methods.IPersonName -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonNameAlias.cs b/Shared/Models/Methods/IPersonNameAlias.cs deleted file mode 100644 index e86637f..0000000 --- a/Shared/Models/Methods/IPersonNameAlias.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonNameAlias : Stateless.Methods.IPersonNameAlias -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonNameFirst.cs b/Shared/Models/Methods/IPersonNameFirst.cs deleted file mode 100644 index 0b8e170..0000000 --- a/Shared/Models/Methods/IPersonNameFirst.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonNameFirst : Stateless.Methods.IPersonNameFirst -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonNameLast.cs b/Shared/Models/Methods/IPersonNameLast.cs deleted file mode 100644 index f33ecf3..0000000 --- a/Shared/Models/Methods/IPersonNameLast.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonNameLast : Stateless.Methods.IPersonNameLast -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonNameMiddle.cs b/Shared/Models/Methods/IPersonNameMiddle.cs deleted file mode 100644 index 3bac1af..0000000 --- a/Shared/Models/Methods/IPersonNameMiddle.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonNameMiddle : Stateless.Methods.IPersonNameMiddle -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonNumber.cs b/Shared/Models/Methods/IPersonNumber.cs deleted file mode 100644 index 8194503..0000000 --- a/Shared/Models/Methods/IPersonNumber.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonNumber : Stateless.Methods.IPersonNumber -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Methods/IPersonURL.cs b/Shared/Models/Methods/IPersonURL.cs deleted file mode 100644 index 30d5fa5..0000000 --- a/Shared/Models/Methods/IPersonURL.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Methods; - -public interface IPersonURL : Stateless.Methods.IPersonURL -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Person.cs b/Shared/Models/Person.cs deleted file mode 100644 index 28c78f3..0000000 --- a/Shared/Models/Person.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class Person : Properties.IPerson -{ - - protected readonly PersonId _Id; // {-_-}SingletonClass - protected readonly PersonBirthday _Birthday; // {-_-}SingletonClass - protected readonly PersonName _Name; // {{_}}JsonValueKindObject - protected readonly List _Comments; // <{_}>PluralClass - protected readonly List _URLs; // <{_}>PluralClass - protected readonly List _Numbers; // <{_}>PluralClass - protected readonly List _Emails; // <{_}>PluralClass - protected readonly List _Addresses; // <<_>>JsonValueKindArray - - public PersonId Id => _Id; // {-_-}SingletonClass - public PersonBirthday Birthday => _Birthday; // {-_-}SingletonClass - public PersonName Name => _Name; // {{_}}JsonValueKindObject - public List Comments => _Comments; // <{_}>PluralClass - public List URLs => _URLs; // <{_}>PluralClass - public List Numbers => _Numbers; // <{_}>PluralClass - public List Emails => _Emails; // <{_}>PluralClass - public List Addresses => _Addresses; // <<_>>JsonValueKindArray - - [JsonConstructor] - public Person - ( - PersonId id, - PersonBirthday birthday, - PersonName name, - List comments, - List uRLs, - List numbers, - List emails, - List addresses - ) - { - _Id = id; // {-_-}SingletonClass - _Birthday = birthday; // {-_-}SingletonClass - _Name = name; // {{_}}JsonValueKindObject - _Comments = comments; // <{_}>PluralClass - _URLs = uRLs; // <{_}>PluralClass - _Numbers = numbers; // <{_}>PluralClass - _Emails = emails; // <{_}>PluralClass - _Addresses = addresses; // <<_>>JsonValueKindArray - } - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - - public string GetFullName() - { - StringBuilder result = new(); - if (_Name?.First is not null && !string.IsNullOrEmpty(_Name.First.Value)) - _ = result.Append(_Name.First.Value); - if (_Name?.Middle is not null && !string.IsNullOrEmpty(_Name.Middle.Value)) - _ = result.Append(' ').Append(_Name.Middle.Value); - if (_Name?.Last is not null && !string.IsNullOrEmpty(_Name.Last.Value)) - _ = result.Append(' ').Append(_Name.Last.Value); - if (_Name?.Alias is not null && !string.IsNullOrEmpty(_Name.Alias.Value)) - _ = result.Append(" (").Append(_Name.Alias.Value).Append(')'); - return result.ToString(); - } - -} \ No newline at end of file diff --git a/Shared/Models/PersonAddress.cs b/Shared/Models/PersonAddress.cs deleted file mode 100644 index 83e910a..0000000 --- a/Shared/Models/PersonAddress.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonAddress : Properties.IPersonAddress -{ - - protected readonly PersonAddressStreet _Street; // {-_-}SingletonClass - protected readonly PersonAddressCity _City; // {-_-}SingletonClass - protected readonly PersonAddressState _State; // {-_-}SingletonClass - protected readonly PersonAddressZipCode _ZipCode; // {-_-}SingletonClass - - public PersonAddressStreet Street => _Street; // {-_-}SingletonClass - public PersonAddressCity City => _City; // {-_-}SingletonClass - public PersonAddressState State => _State; // {-_-}SingletonClass - public PersonAddressZipCode ZipCode => _ZipCode; // {-_-}SingletonClass - - [JsonConstructor] - public PersonAddress - ( - PersonAddressStreet street, - PersonAddressCity city, - PersonAddressState state, - PersonAddressZipCode zipCode - ) - { - _Street = street; // {-_-}SingletonClass - _City = city; // {-_-}SingletonClass - _State = state; // {-_-}SingletonClass - _ZipCode = zipCode; // {-_-}SingletonClass - } - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonAddressCity.cs b/Shared/Models/PersonAddressCity.cs deleted file mode 100644 index a5488ac..0000000 --- a/Shared/Models/PersonAddressCity.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonAddressCity : Properties.IPersonAddressCity -{ - - protected readonly string _Value; // {{1}}SingletonValue - - public string Value => _Value; // {{1}}SingletonValue - - [JsonConstructor] - public PersonAddressCity - ( - string value - ) => _Value = value; // {{1}}SingletonValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonAddressState.cs b/Shared/Models/PersonAddressState.cs deleted file mode 100644 index 16d4cd6..0000000 --- a/Shared/Models/PersonAddressState.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonAddressState : Properties.IPersonAddressState -{ - - protected readonly string _Value; // {{1}}SingletonValue - - public string Value => _Value; // {{1}}SingletonValue - - [JsonConstructor] - public PersonAddressState - ( - string value - ) => _Value = value; // {{1}}SingletonValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonAddressStreet.cs b/Shared/Models/PersonAddressStreet.cs deleted file mode 100644 index 35a8162..0000000 --- a/Shared/Models/PersonAddressStreet.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonAddressStreet : Properties.IPersonAddressStreet -{ - - protected readonly string _Value; // {{1}}SingletonValue - - public string Value => _Value; // {{1}}SingletonValue - - [JsonConstructor] - public PersonAddressStreet - ( - string value - ) => _Value = value; // {{1}}SingletonValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonAddressZipCode.cs b/Shared/Models/PersonAddressZipCode.cs deleted file mode 100644 index 98f6423..0000000 --- a/Shared/Models/PersonAddressZipCode.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonAddressZipCode : Properties.IPersonAddressZipCode -{ - - protected readonly string _Value; // {{1}}SingletonValue - - public string Value => _Value; // {{1}}SingletonValue - - [JsonConstructor] - public PersonAddressZipCode - ( - string value - ) => _Value = value; // {{1}}SingletonValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonComment.cs b/Shared/Models/PersonComment.cs deleted file mode 100644 index 8468802..0000000 --- a/Shared/Models/PersonComment.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonComment : Properties.IPersonComment -{ - - protected readonly string _Value; // <{1}>PluralValue - - public string Value => _Value; // <{1}>PluralValue - - [JsonConstructor] - public PersonComment - ( - string value - ) => _Value = value; // <{1}>PluralValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonContainer.cs b/Shared/Models/PersonContainer.cs index 81df4d1..be012a3 100644 --- a/Shared/Models/PersonContainer.cs +++ b/Shared/Models/PersonContainer.cs @@ -12,40 +12,38 @@ public class PersonContainer : Properties.IPersonContainer public string DisplayDirectoryName { init; get; } public long? Key { init; get; } public bool? KeyIsMaxBirthday { init; get; } - public Person? Person { init; get; } public PersonDirectory? PersonDirectory { init; get; } [JsonConstructor] - public PersonContainer(int? approximateYears, PersonBirthday[]? birthdays, string[] displayDirectoryAllFiles, string displayDirectoryName, long? key, Person? person, PersonDirectory? personDirectory) + public PersonContainer(int? approximateYears, PersonBirthday[]? birthdays, string[] displayDirectoryAllFiles, string displayDirectoryName, long? key, PersonDirectory? personDirectory) { ApproximateYears = approximateYears; Birthdays = birthdays; DisplayDirectoryAllFiles = displayDirectoryAllFiles; DisplayDirectoryName = displayDirectoryName; Key = key; - Person = person; PersonDirectory = personDirectory; KeyIsMaxBirthday = birthdays is null || key is null ? null : key.Value == birthdays.First().Value.Ticks; } public PersonContainer(char[] personCharacters, PersonBirthday birthday, string displayDirectoryName, PersonDirectory personDirectory) : - this(Stateless.Methods.IAge.GetApproximateYears(personCharacters, displayDirectoryName), new PersonBirthday[] { birthday }, Array.Empty(), displayDirectoryName, birthday.Value.Ticks, Stateless.Methods.IPerson.GetPerson(personCharacters, displayDirectoryName, birthday.Value.Ticks, birthday), personDirectory) + this(Stateless.Methods.IAge.GetApproximateYears(personCharacters, displayDirectoryName), new PersonBirthday[] { birthday }, Array.Empty(), displayDirectoryName, birthday.Value.Ticks, personDirectory) { } public PersonContainer(int? approximateYears, PersonBirthday birthdays, string displayDirectoryName, long key) : - this(approximateYears, new PersonBirthday[] { birthdays }, Array.Empty(), displayDirectoryName, key, null, null) + this(approximateYears, new PersonBirthday[] { birthdays }, Array.Empty(), displayDirectoryName, key, null) { } public PersonContainer(int? approximateYears, PersonBirthday birthdays, PersonDirectory? personDirectory, string displayDirectoryName, long key) : - this(approximateYears, new PersonBirthday[] { birthdays }, Array.Empty(), displayDirectoryName, key, null, personDirectory) + this(approximateYears, new PersonBirthday[] { birthdays }, Array.Empty(), displayDirectoryName, key, personDirectory) { } public PersonContainer(int? approximateYears, string[] displayDirectoryAllFiles, string displayDirectoryName, PersonDirectory? personDirectory) : - this(approximateYears, null, displayDirectoryAllFiles, displayDirectoryName, null, null, personDirectory) + this(approximateYears, null, displayDirectoryAllFiles, displayDirectoryName, null, personDirectory) { } - public PersonContainer(int? approximateYears, PersonBirthday[]? birthdays, string[] displayDirectoryAllFiles, string displayDirectoryName, long? key, Person? person) : - this(approximateYears, birthdays, displayDirectoryAllFiles, displayDirectoryName, key, person, null) + public PersonContainer(int? approximateYears, PersonBirthday[]? birthdays, string[] displayDirectoryAllFiles, string displayDirectoryName, long? key) : + this(approximateYears, birthdays, displayDirectoryAllFiles, displayDirectoryName, key, null) { } public override string ToString() diff --git a/Shared/Models/PersonEmail.cs b/Shared/Models/PersonEmail.cs deleted file mode 100644 index 1973445..0000000 --- a/Shared/Models/PersonEmail.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonEmail : Properties.IPersonEmail -{ - - protected readonly string _Value; // <{1}>PluralValue - - public string Value => _Value; // <{1}>PluralValue - - [JsonConstructor] - public PersonEmail - ( - string value - ) => _Value = value; // <{1}>PluralValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonId.cs b/Shared/Models/PersonId.cs deleted file mode 100644 index e064d58..0000000 --- a/Shared/Models/PersonId.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonId : Properties.IPersonId -{ - - protected readonly long _Value; // {{1}}SingletonValue - - public long Value => _Value; // {{1}}SingletonValue - - [JsonConstructor] - public PersonId - ( - long value - ) => _Value = value; // {{1}}SingletonValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonImport.cs b/Shared/Models/PersonImport.cs deleted file mode 100644 index bc914a7..0000000 --- a/Shared/Models/PersonImport.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonImport -{ - - public DateTime _Key; - public string _Name; - public string _MergeName; - public string _OldName; - public string _Comment; - - public DateTime Key => _Key; - public string Name => _Name; - public string MergeName => _MergeName; - public string OldName => _OldName; - public string Comment => _Comment; - - [JsonConstructor] - public PersonImport(DateTime key, string name, string mergeName, string oldName, string comment) - { - _Key = key; - _Name = name; - _MergeName = mergeName; - _OldName = oldName; - _Comment = comment; - } - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } - -} \ No newline at end of file diff --git a/Shared/Models/PersonName.cs b/Shared/Models/PersonName.cs deleted file mode 100644 index c71bfe0..0000000 --- a/Shared/Models/PersonName.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonName : Properties.IPersonName -{ - - protected readonly PersonNameFirst _First; // {-_-}SingletonClass - protected readonly PersonNameMiddle _Middle; // {-_-}SingletonClass - protected readonly PersonNameLast _Last; // {-_-}SingletonClass - protected readonly PersonNameAlias _Alias; // {-_-}SingletonClass - - public PersonNameFirst First => _First; // {-_-}SingletonClass - public PersonNameMiddle Middle => _Middle; // {-_-}SingletonClass - public PersonNameLast Last => _Last; // {-_-}SingletonClass - public PersonNameAlias Alias => _Alias; // {-_-}SingletonClass - - [JsonConstructor] - public PersonName - ( - PersonNameFirst first, - PersonNameMiddle middle, - PersonNameLast last, - PersonNameAlias alias - ) - { - _First = first; // {-_-}SingletonClass - _Middle = middle; // {-_-}SingletonClass - _Last = last; // {-_-}SingletonClass - _Alias = alias; // {-_-}SingletonClass - } - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonNameAlias.cs b/Shared/Models/PersonNameAlias.cs deleted file mode 100644 index 04b4370..0000000 --- a/Shared/Models/PersonNameAlias.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonNameAlias : Properties.IPersonNameAlias -{ - - protected readonly string _Value; // {{1}}SingletonValue - - public string Value => _Value; // {{1}}SingletonValue - - [JsonConstructor] - public PersonNameAlias - ( - string value - ) => _Value = value; // {{1}}SingletonValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonNameFirst.cs b/Shared/Models/PersonNameFirst.cs deleted file mode 100644 index d2ae739..0000000 --- a/Shared/Models/PersonNameFirst.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonNameFirst : Properties.IPersonNameFirst -{ - - protected readonly string _Value; // {{1}}SingletonValue - - public string Value => _Value; // {{1}}SingletonValue - - [JsonConstructor] - public PersonNameFirst - ( - string value - ) => _Value = value; // {{1}}SingletonValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonNameLast.cs b/Shared/Models/PersonNameLast.cs deleted file mode 100644 index db4fb32..0000000 --- a/Shared/Models/PersonNameLast.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonNameLast : Properties.IPersonNameLast -{ - - protected readonly string _Value; // {{1}}SingletonValue - - public string Value => _Value; // {{1}}SingletonValue - - [JsonConstructor] - public PersonNameLast - ( - string value - ) => _Value = value; // {{1}}SingletonValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonNameMiddle.cs b/Shared/Models/PersonNameMiddle.cs deleted file mode 100644 index 65f3ddf..0000000 --- a/Shared/Models/PersonNameMiddle.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonNameMiddle : Properties.IPersonNameMiddle -{ - - protected readonly string _Value; // {{1}}SingletonValue - - public string Value => _Value; // {{1}}SingletonValue - - [JsonConstructor] - public PersonNameMiddle - ( - string value - ) => _Value = value; // {{1}}SingletonValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonNumber.cs b/Shared/Models/PersonNumber.cs deleted file mode 100644 index b742404..0000000 --- a/Shared/Models/PersonNumber.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonNumber : Properties.IPersonNumber -{ - - protected readonly string _Value; // <{1}>PluralValue - - public string Value => _Value; // <{1}>PluralValue - - [JsonConstructor] - public PersonNumber - ( - string value - ) => _Value = value; // <{1}>PluralValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/PersonURL.cs b/Shared/Models/PersonURL.cs deleted file mode 100644 index d0dcdac..0000000 --- a/Shared/Models/PersonURL.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace View_by_Distance.Shared.Models; - -public class PersonURL : Properties.IPersonURL -{ - - protected readonly string _Value; // <{1}>PluralValue - - public string Value => _Value; // <{1}>PluralValue - - [JsonConstructor] - public PersonURL - ( - string value - ) => _Value = value; // <{1}>PluralValue - - public override string ToString() - { - string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); - return result; - } // ... - -} \ No newline at end of file diff --git a/Shared/Models/Properties/IPerson.cs b/Shared/Models/Properties/IPerson.cs deleted file mode 100644 index 8d5111e..0000000 --- a/Shared/Models/Properties/IPerson.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPerson -{ - - public PersonId Id { get; } //long - public PersonBirthday Birthday { get; } //DateTime - public PersonName Name { get; } //JsonValueKind.Object - public List Comments { get; } //string - public List URLs { get; } //string - public List Numbers { get; } //string - public List Emails { get; } //string - public List Addresses { get; } //JsonValueKind.Array - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonAddress.cs b/Shared/Models/Properties/IPersonAddress.cs deleted file mode 100644 index c303926..0000000 --- a/Shared/Models/Properties/IPersonAddress.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonAddress -{ - - public PersonAddressStreet Street { get; } //string - public PersonAddressCity City { get; } //string - public PersonAddressState State { get; } //string - public PersonAddressZipCode ZipCode { get; } //string - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonAddressCity.cs b/Shared/Models/Properties/IPersonAddressCity.cs deleted file mode 100644 index 9560f7c..0000000 --- a/Shared/Models/Properties/IPersonAddressCity.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonAddressCity -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonAddressState.cs b/Shared/Models/Properties/IPersonAddressState.cs deleted file mode 100644 index f47f233..0000000 --- a/Shared/Models/Properties/IPersonAddressState.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonAddressState -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonAddressStreet.cs b/Shared/Models/Properties/IPersonAddressStreet.cs deleted file mode 100644 index 43780ae..0000000 --- a/Shared/Models/Properties/IPersonAddressStreet.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonAddressStreet -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonAddressZipCode.cs b/Shared/Models/Properties/IPersonAddressZipCode.cs deleted file mode 100644 index 3b7de2b..0000000 --- a/Shared/Models/Properties/IPersonAddressZipCode.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonAddressZipCode -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonComment.cs b/Shared/Models/Properties/IPersonComment.cs deleted file mode 100644 index 8f2d490..0000000 --- a/Shared/Models/Properties/IPersonComment.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonComment -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonContainer.cs b/Shared/Models/Properties/IPersonContainer.cs index b90183d..a436eb2 100644 --- a/Shared/Models/Properties/IPersonContainer.cs +++ b/Shared/Models/Properties/IPersonContainer.cs @@ -9,7 +9,6 @@ public interface IPersonContainer public string DisplayDirectoryName { init; get; } public long? Key { init; get; } public bool? KeyIsMaxBirthday { init; get; } - public Person? Person { init; get; } public PersonDirectory? PersonDirectory { init; get; } } \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonEmail.cs b/Shared/Models/Properties/IPersonEmail.cs deleted file mode 100644 index 9bc6729..0000000 --- a/Shared/Models/Properties/IPersonEmail.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonEmail -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonId.cs b/Shared/Models/Properties/IPersonId.cs deleted file mode 100644 index 8a26cca..0000000 --- a/Shared/Models/Properties/IPersonId.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonId -{ - - public long Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonName.cs b/Shared/Models/Properties/IPersonName.cs deleted file mode 100644 index 67ef7c8..0000000 --- a/Shared/Models/Properties/IPersonName.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonName -{ - - public PersonNameFirst First { get; } //string - public PersonNameMiddle Middle { get; } //string - public PersonNameLast Last { get; } //string - public PersonNameAlias Alias { get; } //string - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonNameAlias.cs b/Shared/Models/Properties/IPersonNameAlias.cs deleted file mode 100644 index d6674e8..0000000 --- a/Shared/Models/Properties/IPersonNameAlias.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonNameAlias -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonNameFirst.cs b/Shared/Models/Properties/IPersonNameFirst.cs deleted file mode 100644 index 961c6eb..0000000 --- a/Shared/Models/Properties/IPersonNameFirst.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonNameFirst -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonNameLast.cs b/Shared/Models/Properties/IPersonNameLast.cs deleted file mode 100644 index 170ced9..0000000 --- a/Shared/Models/Properties/IPersonNameLast.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonNameLast -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonNameMiddle.cs b/Shared/Models/Properties/IPersonNameMiddle.cs deleted file mode 100644 index 338b428..0000000 --- a/Shared/Models/Properties/IPersonNameMiddle.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonNameMiddle -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonNumber.cs b/Shared/Models/Properties/IPersonNumber.cs deleted file mode 100644 index 71d90b1..0000000 --- a/Shared/Models/Properties/IPersonNumber.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonNumber -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Properties/IPersonURL.cs b/Shared/Models/Properties/IPersonURL.cs deleted file mode 100644 index 91026af..0000000 --- a/Shared/Models/Properties/IPersonURL.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Properties; - -public interface IPersonURL -{ - - public string Value { get; } - -} // ... \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPerson.cs b/Shared/Models/Stateless/Methods/IPerson.cs index 71d7ec8..908af6d 100644 --- a/Shared/Models/Stateless/Methods/IPerson.cs +++ b/Shared/Models/Stateless/Methods/IPerson.cs @@ -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(), 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)); - } \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonAddress.cs b/Shared/Models/Stateless/Methods/IPersonAddress.cs deleted file mode 100644 index b213f56..0000000 --- a/Shared/Models/Stateless/Methods/IPersonAddress.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -public interface IPersonAddress -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonAddressCity.cs b/Shared/Models/Stateless/Methods/IPersonAddressCity.cs deleted file mode 100644 index be77078..0000000 --- a/Shared/Models/Stateless/Methods/IPersonAddressCity.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonAddressState.cs b/Shared/Models/Stateless/Methods/IPersonAddressState.cs deleted file mode 100644 index e6f0628..0000000 --- a/Shared/Models/Stateless/Methods/IPersonAddressState.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonAddressStreet.cs b/Shared/Models/Stateless/Methods/IPersonAddressStreet.cs deleted file mode 100644 index 666ba58..0000000 --- a/Shared/Models/Stateless/Methods/IPersonAddressStreet.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonAddressZipCode.cs b/Shared/Models/Stateless/Methods/IPersonAddressZipCode.cs deleted file mode 100644 index 2538ed7..0000000 --- a/Shared/Models/Stateless/Methods/IPersonAddressZipCode.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonBirthday.cs b/Shared/Models/Stateless/Methods/IPersonBirthday.cs index dc5ae79..757e7f3 100644 --- a/Shared/Models/Stateless/Methods/IPersonBirthday.cs +++ b/Shared/Models/Stateless/Methods/IPersonBirthday.cs @@ -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); } \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonComment.cs b/Shared/Models/Stateless/Methods/IPersonComment.cs deleted file mode 100644 index fa4f7dd..0000000 --- a/Shared/Models/Stateless/Methods/IPersonComment.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonContainer.cs b/Shared/Models/Stateless/Methods/IPersonContainer.cs index a342065..3a85733 100644 --- a/Shared/Models/Stateless/Methods/IPersonContainer.cs +++ b/Shared/Models/Stateless/Methods/IPersonContainer.cs @@ -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 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 TestStatic_GetPersonKeyFormattedToPersonFullName(string personBirthdayFormat, ReadOnlyCollection personContainers) => - GetPersonKeyFormattedToPersonFullName(personBirthdayFormat, personContainers); - static ReadOnlyDictionary GetPersonKeyFormattedToPersonFullName(string personBirthdayFormat, ReadOnlyCollection personContainers) => - PersonContainer.GetPersonKeyFormattedToPersonFullName(personBirthdayFormat, personContainers); - } \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonEmail.cs b/Shared/Models/Stateless/Methods/IPersonEmail.cs deleted file mode 100644 index 2afd35e..0000000 --- a/Shared/Models/Stateless/Methods/IPersonEmail.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonId.cs b/Shared/Models/Stateless/Methods/IPersonId.cs deleted file mode 100644 index cd66a76..0000000 --- a/Shared/Models/Stateless/Methods/IPersonId.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonName.cs b/Shared/Models/Stateless/Methods/IPersonName.cs deleted file mode 100644 index 736346c..0000000 --- a/Shared/Models/Stateless/Methods/IPersonName.cs +++ /dev/null @@ -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); - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonNameAlias.cs b/Shared/Models/Stateless/Methods/IPersonNameAlias.cs deleted file mode 100644 index ecf2860..0000000 --- a/Shared/Models/Stateless/Methods/IPersonNameAlias.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonNameFirst.cs b/Shared/Models/Stateless/Methods/IPersonNameFirst.cs deleted file mode 100644 index 57e4270..0000000 --- a/Shared/Models/Stateless/Methods/IPersonNameFirst.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonNameLast.cs b/Shared/Models/Stateless/Methods/IPersonNameLast.cs deleted file mode 100644 index e5b9c8e..0000000 --- a/Shared/Models/Stateless/Methods/IPersonNameLast.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonNameMiddle.cs b/Shared/Models/Stateless/Methods/IPersonNameMiddle.cs deleted file mode 100644 index c7a82f2..0000000 --- a/Shared/Models/Stateless/Methods/IPersonNameMiddle.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonNumber.cs b/Shared/Models/Stateless/Methods/IPersonNumber.cs deleted file mode 100644 index da7d722..0000000 --- a/Shared/Models/Stateless/Methods/IPersonNumber.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/IPersonURL.cs b/Shared/Models/Stateless/Methods/IPersonURL.cs deleted file mode 100644 index 6e83f50..0000000 --- a/Shared/Models/Stateless/Methods/IPersonURL.cs +++ /dev/null @@ -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 - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/Person.cs b/Shared/Models/Stateless/Methods/Person.cs deleted file mode 100644 index a32b3e0..0000000 --- a/Shared/Models/Stateless/Methods/Person.cs +++ /dev/null @@ -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 urls = new(); - Models.PersonId id = new(personKey); - List emails = new(); - List numbers = new(); - List comments = new(); - List 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(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; - } - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonAddress.cs b/Shared/Models/Stateless/Methods/PersonAddress.cs deleted file mode 100644 index 4837701..0000000 --- a/Shared/Models/Stateless/Methods/PersonAddress.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonAddress -{ - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonAddressCity.cs b/Shared/Models/Stateless/Methods/PersonAddressCity.cs deleted file mode 100644 index 6e54fdb..0000000 --- a/Shared/Models/Stateless/Methods/PersonAddressCity.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonAddressCity -{ - - internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonAddressState.cs b/Shared/Models/Stateless/Methods/PersonAddressState.cs deleted file mode 100644 index c4748cc..0000000 --- a/Shared/Models/Stateless/Methods/PersonAddressState.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonAddressState -{ - - internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonAddressStreet.cs b/Shared/Models/Stateless/Methods/PersonAddressStreet.cs deleted file mode 100644 index d0aea22..0000000 --- a/Shared/Models/Stateless/Methods/PersonAddressStreet.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonAddressStreet -{ - - internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonAddressZipCode.cs b/Shared/Models/Stateless/Methods/PersonAddressZipCode.cs deleted file mode 100644 index e61d34d..0000000 --- a/Shared/Models/Stateless/Methods/PersonAddressZipCode.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonAddressZipCode -{ - - internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonBirthday.cs b/Shared/Models/Stateless/Methods/PersonBirthday.cs index 4123b89..5a3b218 100644 --- a/Shared/Models/Stateless/Methods/PersonBirthday.cs +++ b/Shared/Models/Stateless/Methods/PersonBirthday.cs @@ -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('#')))) diff --git a/Shared/Models/Stateless/Methods/PersonComment.cs b/Shared/Models/Stateless/Methods/PersonComment.cs deleted file mode 100644 index d1fb129..0000000 --- a/Shared/Models/Stateless/Methods/PersonComment.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonComment -{ - - internal static string GetDefaultValue() => string.Empty; // <{1}>PluralValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonContainer.cs b/Shared/Models/Stateless/Methods/PersonContainer.cs index 0411791..aa347e8 100644 --- a/Shared/Models/Stateless/Methods/PersonContainer.cs +++ b/Shared/Models/Stateless/Methods/PersonContainer.cs @@ -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 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 GetPersonContainersCollections(string facesFileNameExtension, PersonDirectory personDirectory, char numberSign, string personDisplayDirectory, string personDisplayDirectoryName, int? approximateYears, List<(string PersonKeyFormatted, Models.PersonBirthday PersonBirthday)> collection) { List 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 GetPersonKeys(IEnumerable personContainers) { List 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 GetPersonKeyFormattedToPersonFullName(string personBirthdayFormat, ReadOnlyCollection personContainers) - { - Dictionary 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); - } - } \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonEmail.cs b/Shared/Models/Stateless/Methods/PersonEmail.cs deleted file mode 100644 index e6dbf9a..0000000 --- a/Shared/Models/Stateless/Methods/PersonEmail.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonEmail -{ - - internal static string GetDefaultValue() => string.Empty; // <{1}>PluralValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonId.cs b/Shared/Models/Stateless/Methods/PersonId.cs deleted file mode 100644 index 0c1c42e..0000000 --- a/Shared/Models/Stateless/Methods/PersonId.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonId -{ - - internal static long GetDefaultValue() => long.MinValue; // {{1}}SingletonValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonName.cs b/Shared/Models/Stateless/Methods/PersonName.cs deleted file mode 100644 index 992d121..0000000 --- a/Shared/Models/Stateless/Methods/PersonName.cs +++ /dev/null @@ -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(); - } - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonNameAlias.cs b/Shared/Models/Stateless/Methods/PersonNameAlias.cs deleted file mode 100644 index b0492e4..0000000 --- a/Shared/Models/Stateless/Methods/PersonNameAlias.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonNameAlias -{ - - internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonNameFirst.cs b/Shared/Models/Stateless/Methods/PersonNameFirst.cs deleted file mode 100644 index d4a79da..0000000 --- a/Shared/Models/Stateless/Methods/PersonNameFirst.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonNameFirst -{ - - internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonNameLast.cs b/Shared/Models/Stateless/Methods/PersonNameLast.cs deleted file mode 100644 index 9a6be21..0000000 --- a/Shared/Models/Stateless/Methods/PersonNameLast.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonNameLast -{ - - internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonNameMiddle.cs b/Shared/Models/Stateless/Methods/PersonNameMiddle.cs deleted file mode 100644 index 75c1e45..0000000 --- a/Shared/Models/Stateless/Methods/PersonNameMiddle.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonNameMiddle -{ - - internal static string GetDefaultValue() => string.Empty; // {{1}}SingletonValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonNumber.cs b/Shared/Models/Stateless/Methods/PersonNumber.cs deleted file mode 100644 index ee6e223..0000000 --- a/Shared/Models/Stateless/Methods/PersonNumber.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonNumber -{ - - internal static string GetDefaultValue() => string.Empty; // <{1}>PluralValue - - // ... - -} \ No newline at end of file diff --git a/Shared/Models/Stateless/Methods/PersonURL.cs b/Shared/Models/Stateless/Methods/PersonURL.cs deleted file mode 100644 index 53ffd76..0000000 --- a/Shared/Models/Stateless/Methods/PersonURL.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace View_by_Distance.Shared.Models.Stateless.Methods; - -internal abstract class PersonURL -{ - - internal static string GetDefaultValue() => string.Empty; // <{1}>PluralValue - - // ... - -} \ No newline at end of file diff --git a/Tests/UnitTestHardCoded.cs b/Tests/UnitTestHardCoded.cs index 2248109..7792579 100644 --- a/Tests/UnitTestHardCoded.cs +++ b/Tests/UnitTestHardCoded.cs @@ -107,7 +107,7 @@ public partial class UnitTestHardCoded string personDisplayDirectoryName = Path.GetFileName(personDisplayDirectory); string personBirthdayFormat = _Configuration.PropertyConfiguration.PersonBirthdayFormat; string[] personKeyDirectories = Directory.GetDirectories(personDisplayDirectory, "*", SearchOption.TopDirectoryOnly); - List<(string, PersonBirthday)> collection = IPersonBirthday.GetPersonBirthdays(personBirthdayFormat, personKeyDirectories, personDisplayDirectory, personDisplayDirectoryName); + List<(string, PersonBirthday)> collection = IPersonBirthday.GetPersonBirthdays(personBirthdayFormat, personKeyDirectories, personDisplayDirectoryName); int? approximateYears = IAge.GetApproximateYears(personCharacters, personDisplayDirectoryName); if (approximateYears is null) throw new NullReferenceException(nameof(approximateYears)); diff --git a/View-by-Distance-MKLink-Console.sln b/View-by-Distance-MKLink-Console.sln index f0d0a1e..108c9e6 100644 --- a/View-by-Distance-MKLink-Console.sln +++ b/View-by-Distance-MKLink-Console.sln @@ -45,8 +45,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Move-By-Id", "Move-By-Id\Mo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Offset-Date-Time-Original", "Offset-Date-Time-Original\Offset-Date-Time-Original.csproj", "{6B68758E-1AF1-401F-844A-C1199A0B6303}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Person", "Person\Person.csproj", "{C5003A39-334B-444B-9873-39B26E58D667}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotoPrism", "PhotoPrism\PhotoPrism.csproj", "{DF4B0776-E0E5-4220-8721-8D1E491FF263}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrepareForOld", "PrepareForOld\PrepareForOld.csproj", "{F73F9468-0139-4B05-99CE-C6C0403D03E5}"