VerifyPersonContainersDisplayDirectoryAllFiles, SaveOne, SaveParents, GetRelations, CleanDisplayDirectoryAllFilesAndWriteTicksGed
829 lines
38 KiB
C#
829 lines
38 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using Phares.Shared;
|
|
using Serilog;
|
|
using System.Diagnostics;
|
|
using System.Globalization;
|
|
using System.Reflection;
|
|
using View_by_Distance.Shared.Models;
|
|
using View_by_Distance.Shared.Models.Stateless.Methods;
|
|
using View_by_Distance.Tests.Models;
|
|
|
|
namespace View_by_Distance.Tests;
|
|
|
|
[TestClass]
|
|
public partial class UnitTestHardCoded
|
|
{
|
|
|
|
private readonly ILogger _Logger;
|
|
private readonly AppSettings _AppSettings;
|
|
private readonly string _WorkingDirectory;
|
|
private readonly Configuration _Configuration;
|
|
private readonly IsEnvironment _IsEnvironment;
|
|
private readonly IConfigurationRoot _ConfigurationRoot;
|
|
private readonly Property.Models.Configuration _PropertyConfiguration;
|
|
|
|
public UnitTestHardCoded()
|
|
{
|
|
ILogger logger;
|
|
AppSettings appSettings;
|
|
string workingDirectory;
|
|
Configuration configuration;
|
|
IsEnvironment isEnvironment;
|
|
IConfigurationRoot configurationRoot;
|
|
LoggerConfiguration loggerConfiguration = new();
|
|
Property.Models.Configuration propertyConfiguration;
|
|
Assembly assembly = Assembly.GetExecutingAssembly();
|
|
bool debuggerWasAttachedAtLineZero = Debugger.IsAttached || assembly.Location.Contains(@"\bin\Debug");
|
|
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<UnitTestHardCoded>();
|
|
configurationRoot = configurationBuilder.Build();
|
|
appSettings = Models.Binder.AppSettings.Get(configurationRoot);
|
|
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
|
|
throw new Exception("Working directory name must have a value!");
|
|
workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName);
|
|
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
|
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot);
|
|
Log.Logger = loggerConfiguration.CreateLogger();
|
|
logger = Log.ForContext<UnitTestHardCoded>();
|
|
propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
|
|
configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration);
|
|
logger.Information("Complete");
|
|
_Logger = logger;
|
|
_AppSettings = appSettings;
|
|
_Configuration = configuration;
|
|
_IsEnvironment = isEnvironment;
|
|
_WorkingDirectory = workingDirectory;
|
|
_ConfigurationRoot = configurationRoot;
|
|
_PropertyConfiguration = propertyConfiguration;
|
|
}
|
|
|
|
private static void NonThrowTryCatch()
|
|
{
|
|
try
|
|
{ throw new Exception(); }
|
|
catch (Exception) { }
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodNull()
|
|
{
|
|
Assert.IsFalse(_Logger is null);
|
|
Assert.IsFalse(_AppSettings is null);
|
|
Assert.IsFalse(_Configuration is null);
|
|
Assert.IsFalse(_IsEnvironment is null);
|
|
Assert.IsFalse(_WorkingDirectory is null);
|
|
Assert.IsFalse(_ConfigurationRoot is null);
|
|
Assert.IsFalse(_PropertyConfiguration is null);
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodDel()
|
|
{
|
|
string directory = "F:/Tmp/Phares/Compare/Images 2022-09-15 - 7390c13 - III - Results/E) Distance/2022-09-15/7680 x 4320/7680x4320 - Hog - Large/()/(637992984751968513)";
|
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
|
{
|
|
for (int i = 1; i < 11; i++)
|
|
_ = IPath.DeleteEmptyDirectories(directory);
|
|
Assert.IsTrue(true);
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodGetApproximateYears()
|
|
{
|
|
string personDisplayDirectory = "D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/{}/^/Sydney Dupray^9";
|
|
if (Directory.Exists(Directory.GetDirectoryRoot(personDisplayDirectory)) && Directory.Exists(personDisplayDirectory))
|
|
{
|
|
char numberSign = '#';
|
|
string? minusOne = null;
|
|
char[] personCharacters = new char[] { '^' };
|
|
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);
|
|
int? approximateYears = IAge.GetApproximateYears(personCharacters, personDisplayDirectoryName);
|
|
if (approximateYears is null)
|
|
throw new NullReferenceException(nameof(approximateYears));
|
|
Assert.IsNotNull(approximateYears);
|
|
Assert.IsTrue(approximateYears.Value == 9);
|
|
string? change = IPersonContainer.VerifyAge(numberSign, personDisplayDirectory, minusOne, personDisplayDirectoryName, approximateYears, collection);
|
|
Assert.IsNull(change);
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodDel2()
|
|
{
|
|
string directory = "F:/Tmp/Phares/Compare/Images 2022-09-15 - 7390c13 - III - Results/E) Distance/2022-09-15/7680 x 4320/7680x4320 - Hog - Large/()/(637992984751968513)";
|
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
|
{
|
|
for (int i = 1; i < 11; i++)
|
|
_ = IPath.DeleteEmptyDirectories(directory);
|
|
Assert.IsTrue(true);
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
private static (string?, string, string) Get(string[] segments)
|
|
{
|
|
(string?, string, string) result;
|
|
if ((!segments[0].Contains('#') && (segments[3].Contains('~') || segments[3].Contains('#'))) || (segments[0].Contains('#') && !segments[3].Contains('#')))
|
|
result = new(null, segments[3], segments[4]);
|
|
else
|
|
result = new(segments[0], segments[3], segments[4]);
|
|
return result;
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMoveToVerify()
|
|
{
|
|
string http;
|
|
string[] lines;
|
|
string? minusOne;
|
|
string? minusTwo;
|
|
string[] segments;
|
|
string[] beforeSegments;
|
|
string[] matchDirectories;
|
|
string? personKeyFormattedNew;
|
|
string? personDisplayDirectory;
|
|
string personDisplayDirectoryNew;
|
|
string personDisplayDirectoryNameNew;
|
|
string personKeyFormattedDirectoryNew;
|
|
string sourceDirectory = @"";
|
|
string sourceFile = @"\People - C.tsv";
|
|
if (!File.Exists(sourceFile))
|
|
lines = Array.Empty<string>();
|
|
else
|
|
lines = File.ReadAllLines(sourceFile);
|
|
for (int i = 0; i < lines.Length; i++)
|
|
{
|
|
if (!lines[i].Contains("https://"))
|
|
continue;
|
|
segments = lines[i].Split('\t');
|
|
beforeSegments = lines[i - 1].Split('\t');
|
|
if (beforeSegments.Length < 4 || segments.Length < 5)
|
|
continue;
|
|
matchDirectories = Directory.GetDirectories(sourceDirectory, beforeSegments[0], SearchOption.AllDirectories);
|
|
if (matchDirectories.Length != 1)
|
|
continue;
|
|
personDisplayDirectory = Path.GetDirectoryName(matchDirectories[0]);
|
|
if (personDisplayDirectory is null)
|
|
continue;
|
|
minusOne = Path.GetDirectoryName(personDisplayDirectory);
|
|
if (minusOne is null)
|
|
continue;
|
|
minusTwo = Path.GetDirectoryName(minusOne);
|
|
if (minusTwo is null)
|
|
continue;
|
|
(personKeyFormattedNew, personDisplayDirectoryNameNew, http) = Get(segments);
|
|
if (personKeyFormattedNew is null)
|
|
continue;
|
|
personDisplayDirectoryNew = Path.Combine(minusTwo, "Verify", personDisplayDirectoryNameNew);
|
|
if (Directory.Exists(personDisplayDirectoryNew))
|
|
continue;
|
|
personKeyFormattedDirectoryNew = Path.Combine(personDisplayDirectoryNew, personKeyFormattedNew);
|
|
Directory.Move(personDisplayDirectory, personDisplayDirectoryNew);
|
|
_ = Directory.CreateDirectory(personKeyFormattedDirectoryNew);
|
|
File.WriteAllText(Path.Combine(personKeyFormattedDirectoryNew, "Facebook.txt"), http);
|
|
}
|
|
Assert.IsNotNull(lines);
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodRenameAbandoned()
|
|
{
|
|
string directory = "D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/{}/!/Abandoned";
|
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
|
{
|
|
string checkFile;
|
|
string[] files = Directory.GetFiles(directory, "*.abd", SearchOption.TopDirectoryOnly);
|
|
foreach (string file in files)
|
|
{
|
|
checkFile = file[..^4];
|
|
if (File.Exists(checkFile))
|
|
continue;
|
|
File.Move(file, checkFile);
|
|
}
|
|
Assert.IsTrue(true);
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodRenameDelete()
|
|
{
|
|
string directory = "D:/1-Images-A/Images-dd514b88-Results/A) Property/dd514b88/{}";
|
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
|
{
|
|
string checkFile;
|
|
string[] files = Directory.GetFiles(directory, "*.del", SearchOption.AllDirectories);
|
|
foreach (string file in files)
|
|
{
|
|
checkFile = file[..^4];
|
|
if (File.Exists(checkFile))
|
|
continue;
|
|
File.Move(file, checkFile);
|
|
}
|
|
Assert.IsTrue(true);
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodRenameOld()
|
|
{
|
|
string directory = "D:/2-Images-B/Not-Copy-Copy-dd514b88-Results/E) Distance/dd514b88/()";
|
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
|
{
|
|
string checkFile;
|
|
string[] files = Directory.GetFiles(directory, "*.old", SearchOption.AllDirectories);
|
|
foreach (string file in files)
|
|
{
|
|
checkFile = file[..^4];
|
|
if (File.Exists(checkFile))
|
|
continue;
|
|
File.Move(file, checkFile);
|
|
}
|
|
Assert.IsTrue(true);
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodAncestryGenealogicalDataCommunication()
|
|
{
|
|
string directory = "D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/([])";
|
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
|
{
|
|
bool first = true;
|
|
List<string> mappedLines;
|
|
GenealogicalDataCommunication genealogicalDataCommunication;
|
|
GenealogicalDataCommunicationLines genealogicalDataCommunicationLines;
|
|
GenealogicalDataCommunicationCollections genealogicalDataCommunicationCollections;
|
|
List<(bool, string)> genealogicalDataCommunicationFiles = new()
|
|
{
|
|
// new(false, Path.Combine(directory, "Ancestry-Roberts/Roberts Family Tree.ged")),
|
|
// new(false, Path.Combine(directory, "Ancestry-Phares/Phares Jr Family Tree.ged")),
|
|
// new(true, Path.Combine(directory, "Code-638160708345114583/638160708345114583.ged")),
|
|
// new(true, Path.Combine(directory, "Code-638160728606500015/638160728606500015.ged")),
|
|
// new(true, Path.Combine(directory, "Code-638160738845419877/638160738845419877.ged")),
|
|
new(true, Path.Combine(directory, "Code-638160743318283885/638160743318283885.ged")),
|
|
// new(true, Path.Combine(directory, "Code-638245446208013055/638245446208013055.ged")),
|
|
// new(false, Path.Combine(directory, "Ancestry-Porterfield/Porterfield Family Tree.ged")),
|
|
// new(true, Path.Combine(directory, "Code-638160708345114583/638160708345114583-Export.ged")),
|
|
// new(true, Path.Combine(directory, "Code-638160738845419877/638160738845419877-Export.ged")),
|
|
// new(true, Path.Combine(directory, "Code-638160743318283885/638160743318283885-Export.ged")),
|
|
// new(true, Path.Combine(directory, "Code-638245446208013055/638245446208013055-Export.ged")),
|
|
};
|
|
foreach ((bool requireNickName, string genealogicalDataCommunicationFile) in genealogicalDataCommunicationFiles)
|
|
{
|
|
genealogicalDataCommunicationCollections = IGenealogicalDataCommunication.GetIndividuals(genealogicalDataCommunicationFile, requireNickName);
|
|
foreach (KeyValuePair<string, string[]> keyValuePair in genealogicalDataCommunicationCollections.Individuals)
|
|
{
|
|
genealogicalDataCommunicationLines = IGenealogicalDataCommunication.GetGenealogicalDataCommunicationLines(keyValuePair.Value);
|
|
Assert.IsNotNull(genealogicalDataCommunicationLines.Name);
|
|
genealogicalDataCommunication = IGenealogicalDataCommunication.GetGenealogicalDataCommunication(first, genealogicalDataCommunicationLines);
|
|
Assert.IsNotNull(genealogicalDataCommunication.Name);
|
|
}
|
|
mappedLines = IGenealogicalDataCommunication.GetMappedLines(genealogicalDataCommunicationFile, requireNickName);
|
|
if (IPath.WriteAllText($"{genealogicalDataCommunicationFile}.cln", string.Join(Environment.NewLine, mappedLines), updateDateWhenMatches: false, compareBeforeWrite: true))
|
|
continue;
|
|
}
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodAncestryGenealogicalDataCommunicationCleanToExport()
|
|
{
|
|
DateTime dateTime = DateTime.Now;
|
|
string saveDirectory = "D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/([])";
|
|
if (Directory.Exists(Path.GetPathRoot(saveDirectory)) && Directory.Exists(saveDirectory))
|
|
{
|
|
int age;
|
|
long personKey;
|
|
string ageGroup;
|
|
string fileName;
|
|
bool first = true;
|
|
string? directory;
|
|
PersonName? personName;
|
|
string personKeyFormatted;
|
|
// bool isDefaultName = false;
|
|
GenealogicalDataCommunication genealogicalDataCommunication;
|
|
GenealogicalDataCommunicationLines genealogicalDataCommunicationLines;
|
|
GenealogicalDataCommunicationCollections genealogicalDataCommunicationCollections;
|
|
List<(bool, bool, string)> genealogicalDataCommunicationFiles = new()
|
|
{
|
|
// new(false, false, Path.Combine(saveDirectory, "Ancestry-Roberts/Roberts Family Tree.ged.cln")),
|
|
// new(false, false, Path.Combine(saveDirectory, "Ancestry-Phares/Phares Jr Family Tree.ged.cln")),
|
|
// new(true, true, Path.Combine(saveDirectory, "Code-638160708345114583/638160708345114583.ged.cln")),
|
|
// new(true, true, Path.Combine(saveDirectory, "Code-638160728606500015/638160728606500015.ged.cln")),
|
|
// new(true, true, Path.Combine(saveDirectory, "Code-638160738845419877/638160738845419877.ged.cln")),
|
|
new(true, true, Path.Combine(saveDirectory, "Code-638160743318283885/638160743318283885.ged.cln")),
|
|
// new(true, true, Path.Combine(saveDirectory, "Code-638245446208013055/638245446208013055.ged.cln")),
|
|
// new(false, false, Path.Combine(saveDirectory, "Ancestry-Porterfield/Porterfield Family Tree.ged.cln")),
|
|
// new(true, true, Path.Combine(saveDirectory, "Code-638160708345114583/638160708345114583-Export.ged.cln")),
|
|
// new(true, true, Path.Combine(saveDirectory, "Code-638160738845419877/638160738845419877-Export.ged.cln")),
|
|
// new(true, true, Path.Combine(saveDirectory, "Code-638160743318283885/638160743318283885-Export.ged.cln")),
|
|
// new(true, true, Path.Combine(saveDirectory, "Code-638245446208013055/638245446208013055-Export.ged.cln")),
|
|
};
|
|
foreach ((bool verify, bool requireNickName, string genealogicalDataCommunicationFile) in genealogicalDataCommunicationFiles)
|
|
{
|
|
fileName = Path.GetFileNameWithoutExtension(genealogicalDataCommunicationFile).Split(' ')[0];
|
|
genealogicalDataCommunicationCollections = IGenealogicalDataCommunication.GetIndividuals(genealogicalDataCommunicationFile, requireNickName);
|
|
foreach (KeyValuePair<string, string[]> keyValuePair in genealogicalDataCommunicationCollections.Individuals)
|
|
{
|
|
genealogicalDataCommunicationLines = IGenealogicalDataCommunication.GetGenealogicalDataCommunicationLines(keyValuePair.Value);
|
|
Assert.IsNotNull(genealogicalDataCommunicationLines.Name);
|
|
genealogicalDataCommunication = IGenealogicalDataCommunication.GetGenealogicalDataCommunication(first, genealogicalDataCommunicationLines);
|
|
Assert.IsNotNull(genealogicalDataCommunication.Name);
|
|
if (genealogicalDataCommunication.Birth is null)
|
|
continue;
|
|
personName = IPersonName.GetPersonName(genealogicalDataCommunication);
|
|
if (personName is null)
|
|
continue;
|
|
personKey = genealogicalDataCommunication.Birth.Value.Ticks;
|
|
(age, _) = IAge.GetAge(dateTime.Ticks, personKey);
|
|
personKeyFormatted = IPersonBirthday.GetFormatted(_PropertyConfiguration.PersonBirthdayFormat, personKey);
|
|
if (age < 25)
|
|
ageGroup = "1) Less-25";
|
|
else if (age < 50)
|
|
ageGroup = "2) Less-50";
|
|
else if (age < 100)
|
|
ageGroup = "3) Less-100";
|
|
else if (age < 200)
|
|
ageGroup = "4) Less-200";
|
|
else
|
|
ageGroup = "5) Else";
|
|
directory = Path.Combine(saveDirectory, fileName, ageGroup, $"{personName.First.Value} {personName.Last.Value}^{age}", personKeyFormatted);
|
|
if (!Directory.Exists(directory))
|
|
_ = Directory.CreateDirectory(directory);
|
|
// IGenealogicalDataCommunication.WriteFile(personKeyFormatted, personName, keyValuePair.Value, isDefaultName, directory, genealogicalDataCommunication, verify, first);
|
|
}
|
|
}
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
private static string[] GetFamily() => new string[] {
|
|
"UBertha Scott (Barry Scott) 10/2/1900-8/19/1993",
|
|
"MEarl Daniel Herman 1/5/1918-10/19/1962",
|
|
"FGlendola Koch 8/10/1919-5/16/1910",
|
|
"MLawrence Koch 5/14/1916-6/29/2003",
|
|
"MEarl Herman Jr. (Sonny Herman) 6/24/1937-12/05/2007",
|
|
"FBetty Herman 11/24/1941-11/25/2008",
|
|
"FCindy Hoylman 12/4/1958",
|
|
"MBill Hoylman 6/29/1959",
|
|
"MJoshua Hoylman 7/17/1978",
|
|
"FSasha Hoylman 1/21/1981",
|
|
"FLyla Hoylman 1/30/2000",
|
|
"MWilliam Hoylman 1/2/2006",
|
|
"MJon Hoylman 8/17/2007",
|
|
"FAmanda Westphal 3/14/1981",
|
|
"MMatthew Westphal 06/09/1981",
|
|
"MVincent Westphal 12/16/2009",
|
|
"MJim Herman 6/8/1960",
|
|
"MJames Parmenter 5/21/1973-7/15/1999",
|
|
"MChristopher Parmenter 11/5/1976",
|
|
"FAlexa Parmenter 10/07/2009",
|
|
"MMathew Parmenter 03/21/2004",
|
|
"MGreg Herman 4/12/1979",
|
|
"MChad Herman 1/2/1983",
|
|
"FPiper Marie 4/20/2002",
|
|
"MDale Herman 8/28/1962",
|
|
"FNancee Herman 3/25/1964",
|
|
"FSara Herman 3/2/1992",
|
|
"MNolan Herman 10/6/1995",
|
|
"MNathan Herman 5/22/1997",
|
|
"UNeven Herman 2/23/2000",
|
|
"MRodney Herman 4/29/1964",
|
|
"FTeresa Davies 08/17/1978",
|
|
"FNicole Mangold 9/14/1988",
|
|
"MTJ Mangold 1/3/1991",
|
|
"FBrook Lynn 11/20/2010",
|
|
"FTiffany Herman 3/25/1990",
|
|
"MAndrew Herman 5/25/2007",
|
|
"MCarson James 1/26/2012",
|
|
"FPenny Mews 6/21/1966",
|
|
"MThomas Arthur 2/22/1998",
|
|
"MDanny Herman 10/6/1941",
|
|
"MDan Herman 1/19/1963",
|
|
"MDaniel Lee Herman 11/10/1983",
|
|
"FDestini Marie Herman 4/21/1985",
|
|
"MDavid Earl Jensen (Timmy Jensen) 3/10/1964",
|
|
"MDarrin Hansen 6/1/1966",
|
|
"FTasha Hansen 12/10/1983",
|
|
"FCheri Lynch 1/19/1973",
|
|
"FHannah Marie 10/5/1996",
|
|
"FHolly Marie 1/25/1979",
|
|
"FEarline Wheeler 7/18/1944",
|
|
"MDewey Wheeler 9/3/1941",
|
|
"MMark Wheeler 8/19/1962",
|
|
"MMichael Shane Wheeler 1/31/1985",
|
|
"FCadence Lynn Wheeler 9/16/2003",
|
|
"FMacy Marie Wheeler 9/16/2003",
|
|
"FKarmin Herman 9/25/1963",
|
|
"MJon Herman 8/5/1959",
|
|
"FChelsea Marie Herman 1/1/1989",
|
|
"MMatthew Jon Herman 2/23/1992",
|
|
"FBonnie Sherwood 10/12/1965",
|
|
"MRandy Sherwood 7/9/1959",
|
|
"MAustin James Sherwood 12/20/1994",
|
|
"FStephanie Marie Sherwood 2/8/1999",
|
|
"FCelia Harken 5/12/1950",
|
|
"MLarry Harken 4/12/1949",
|
|
"FCelena Vesely 5/11/1976",
|
|
"MBen Vesely 9/5/1975",
|
|
"MSammual Edward Vesely 5/7/2006",
|
|
"MElijah John Vesely 1/25/2008",
|
|
"MGlen Herman 5/5/1952",
|
|
"FKathryn Melvina Holst 11/23/1920-03/08/2010",
|
|
"FDonna Owens 4/8/1942",
|
|
"MMike Owens 9/2/1935",
|
|
"FAngie Georgie 4/24/1960",
|
|
"MJohn Georgie 4/12/1965",
|
|
"FSarah Etheridge Georgie 11/28/1980",
|
|
"MHaiden Michael Kilpatrick 6/26/1998",
|
|
"FEmmalea Kathryn Georgie 8/17/2003",
|
|
"MJames Etheridge 8/25/1983",
|
|
"UShawnessy Etheridge 11/9/1995",
|
|
"FHaley Etheridge 5/7/1997",
|
|
"MDenise Engbroten 8/17/1962",
|
|
"FAshley Koffman 6/18/1982",
|
|
"MEric Koffman 6/28/1982",
|
|
"MEvan Koffman 7/21/1985",
|
|
"FHeather Shook 8/3/1978",
|
|
"MGage Shook 10/9/2000",
|
|
"FGrace LeAnn Shook 3/14/2002",
|
|
"FJanet Schwab 9/13/45-4/20/2007",
|
|
"MAlan Schwab 7/31/1964",
|
|
"MRandy Schwab 8/1/1967",
|
|
"FMadison Lee Schwab 12/6/1997",
|
|
"FMorgan Lynn Schwab 5/13/2000",
|
|
"FKristen Fralich 12/14/1971",
|
|
"MAaron Fralich 6/26/1966",
|
|
"FAbigail Kristine Fralich 3/8/1998",
|
|
"MDavid Dixon 11/6/1945",
|
|
"FMary Dixon 4/1/1949",
|
|
"MRon Dixon 9/22/1966",
|
|
"MRyan Dixon 6/30/1988",
|
|
"FMegan Dixon 4/30/1990",
|
|
"UTatum Dixon 4/30/1990",
|
|
"MJoshua David Dixon 10/5/1995",
|
|
"FKelly Norman Dixon 7/5/1967",
|
|
"FKaitlyn Dixon 10/16/2000",
|
|
"FPeggy Swails 9/22/1968",
|
|
"MJohn Swails 11/25/1968",
|
|
"MMariah Swails 2/10/1991",
|
|
"MJohnathan Drake 4/18/1994",
|
|
"FDawson Swails 8/18/1998",
|
|
"FMarisa Swails 9/7/1999",
|
|
"MRaymond Schwab 7/20/1947",
|
|
"FBonnie Schwab 1/15/1947",
|
|
"MScott Schwab 3/27/1966",
|
|
"FBonnie Schwab 1/15/1947",
|
|
"MAustin Scott Schwab 7/13/1991",
|
|
"MAndrew Paul Schwab 3/26/1995",
|
|
"FAddyson Grace Schwab 8/27/1999",
|
|
"MAaron Patrick Schwab 6/5/2001",
|
|
"FDebra Sottos 3/29/1969",
|
|
"MMike Sottos 8/4/1972-7/31/2006",
|
|
"MLogan Ray Nolin 3/23/1991",
|
|
"MSeth Michael Sottos 7/27/2000",
|
|
"FGrace Adelia Lou 9/29/2001",
|
|
"FClaire Marie Jeane 7/07/2003",
|
|
"FEmma Rose Jacquelin 4/04/2005",
|
|
"FRose Olivia Mae 1/6/2007",
|
|
"FTeresa Justice 4/16/1971",
|
|
"MKevin Justice 7/6/1967",
|
|
"MNoah Gale Justice 9/17/1998",
|
|
"MBenjamin Kevin Justice 1/18/2001",
|
|
"MKenny Schwab 7/28/1948",
|
|
"FBonnie Schwab 9/11/1947",
|
|
"FDiane Schwab 6/10/1966",
|
|
"FMary Anderegg 4/24/1970",
|
|
"MScott Anderegg 10/4/1967",
|
|
"FHanna Catherine Anderegg 1/31/2001",
|
|
"FMadison Alyse Anderegg 9/20/2003",
|
|
"FShelly Whittle 6/24/1972",
|
|
"MBrant Whittle 3/5/1971",
|
|
"FKendra Kay Whittle 8/31/1999",
|
|
"MDrake Thomas Whittle 7/16/1991",
|
|
"UKelesy Taylor Whittle 2/2/1995",
|
|
"FRoberta Garrett 11/7/1951",
|
|
"MCharley Garrett 6/2/1951",
|
|
"MTravis Barker 6/9/1970",
|
|
"FJulie Barker 3/1/1971",
|
|
"FKayla Barker 3/31/1991",
|
|
"UAlli Leighton Barker 3/10/1997",
|
|
"MGarrett Ambrose Barker 4/11/2000",
|
|
"MCharley Garrett Jr. 2/9/76-10/21/2000",
|
|
"MBlake Mitchell Garrett 8/21/1994",
|
|
"FMakenzie Faye Garrett 2/16/2000",
|
|
"MRobert Dean Rush 12/11/1950-3/20/1976",
|
|
"MDean Herman 12/25/1922-4/24/1908",
|
|
"FThelma Herman 6/9/1926-10/25/1909",
|
|
"FElizabeth Leach 8/12/1948",
|
|
"MGary Leach 6/24/1945",
|
|
"FStephen Herman 7/19/1951",
|
|
"FDiane Herman 8/31/1957",
|
|
"FMolly Elizabeth Herman 10/11/1983",
|
|
"MThaddeus Benjamin Herman 3/9/1986",
|
|
"MMaryam Safajoo Herman 2/7/1987",
|
|
"FGeorgia Marie Herman 10/4/1988",
|
|
"MTimothy Herman 2/22/1958",
|
|
"MJon Herman 8/5/1959",
|
|
"FKarmin Herman 9/25/1963",
|
|
"FChelsea Marie Herman 1/1/1989",
|
|
"MMatthew Jon Herman 2/23/1992",
|
|
"MBen Herman 5/27/1962",
|
|
"FSydney Herman 7/12/1992",
|
|
"FHaley Anderson Carlisle 6/24/1989",
|
|
"FJennifer Cedillo 12/31/1966",
|
|
"MDave Cedillo 7/17/1966",
|
|
"FLenore Pearson 3/2/1925",
|
|
"MChester Pearson 2/7/1925",
|
|
"FAmy Scofield 7/28/1950",
|
|
"MRick Scofield 7/9/1954",
|
|
"UTracey Eickstaedt 3/19/1971",
|
|
"MTroy Eickstaedt 4/11/1970",
|
|
"FHaley Morgan Eickstaedt 9/11/1994",
|
|
"MDominique Dawn Eickstaedt 4/10/1998",
|
|
"FAmber Dawn Scofield 10/9/1978",
|
|
"MDalton Rickie Wenzel 8/25/2000",
|
|
"MShane Scofield 6/19/1985", // Nope
|
|
"FAshley Scofield 7/13/1984",
|
|
"FKathy Pettus 1/28/1955",
|
|
"MEd Pettus 11/5/1951",
|
|
"MEddie Pettus 9/10/1982",
|
|
"MMichael Pettus 8/15/1987",
|
|
"FRuthMary Tibbetts 2/1/1929",
|
|
"MJames Tibbetts 7/24/1922-10/15/1981",
|
|
"MDave Tibbetts 11/12/1956",
|
|
"FGale Tibbetts 11/26/1958", // https://www.facebook.com/gale.tibbetts.18/photos // https://scontent-lax3-2.xx.fbcdn.net/v/t1.6435-9/92647697_1914827555328335_6217595516130164736_n.jpg?_nc_cat=107&ccb=1-7&_nc_sid=8bfeb9&_nc_ohc=CGu6LkY9MisAX__EerY&_nc_ht=scontent-lax3-2.xx&oh=00_AfD-o-blr_-6HXChsCosOq_n-iqWvmPzh_vmOFVnax1ntA&oe=64530587
|
|
"FJessica Ann Tibbetts 9/8/1990",
|
|
"MJonathon Tibbetts 8/11/1994",
|
|
"FErin Tibbetts 7/15/1998",
|
|
"MElmer John Herman 1/6/1931-10/12/1977",
|
|
"FNorma Herman 6/5/1933",
|
|
"FLannie Bosveld 2/3/1954",
|
|
"MTom Bosveld 10/7/1949",
|
|
"MJeremy Bosveld 2/14/1973",
|
|
"UAmbjour Hazen 10/16/1991",
|
|
"UJordan Hazen 8/22/1991-12/23/2007",
|
|
"FKira Hazen 9/02/1993",
|
|
"MDevan Hazen 8/14/1999",
|
|
"MEthan Hazen 8/14/1999",
|
|
"FApril Hill 6/9/1980",
|
|
"MRandall Hill 1/16/1978", // https://www.facebook.com/randall.directory.hill/about_contact_and_basic_info // https://www.facebook.com/photo.php?fbid=10154576010477639&set=pb.530957638.-2207520000.&type=3 // https://scontent-lax3-1.xx.fbcdn.net/v/t1.18169-9/16265790_10154576010477639_102119672782426718_n.jpg?_nc_cat=102&ccb=1-7&_nc_sid=174925&_nc_ohc=cWEECl9DMhoAX_qlUB-&_nc_ht=scontent-lax3-1.xx&oh=00_AfC4PZ-tytVowtRSu1AJtkxRkQb0_j0WSDk4MKquqs0img&oe=64531181
|
|
"FBrenda Olson 8/27/1958", // https://www.facebook.com/barbara.olson.96/about_contact_and_basic_info
|
|
"MChris Olson 11/13/1951",
|
|
"FShilo Zeches 4/9/1980",
|
|
"FAddison Zeches 9/14/2003",
|
|
"FFrancis Zeches 6/2/2006",
|
|
"FBarbara Olson 12/25/1981",
|
|
"MAllan Olson 4/5/1977",
|
|
"MJacob Olson 12/1/1906",
|
|
"FJayden Olson 10/5/1909",
|
|
"FRachael Zeches 8/28/1983",
|
|
"MMarc Allan Zeches 6/9/2005",
|
|
"FCynthia Bott (Charlie Bott) 4/7/1964",
|
|
"FStephanie Martinez 3/13/1983",
|
|
"FIsidro Martinez (David Martinez) 1/6/1980",
|
|
"FNorma Herman 6/5/1933",
|
|
"UNayeli Teresa Herman 10/6/2001",
|
|
"FStephanie Herman Jr. 11/5/2003",
|
|
"MDavid Herman 6/29/2006",
|
|
"FKimberly Zoe 4/6/1984",
|
|
"MRobert Zoe Jr. 10/17/2005",
|
|
"MBlake Austin Zoe 3/20/2007",
|
|
"FSara 10/8/1988",
|
|
"FKeri Lee 3/30/1992",
|
|
"FMarcia Lamprecht 1/28/1933",
|
|
"MButch Darel Peirce 1/3/1936",
|
|
"MNorman Lamprecht 3/29/1930-3/26/2002",
|
|
"FJulie Arabzadeh 8/21/1950",
|
|
"FJeana Arabzadeh 3/20/1978",
|
|
"FJoyce Kamali 1/8/1952",
|
|
"MEarl Rodriguez 7/27/1919",
|
|
"FKai Kamali 9/6/1974",
|
|
"FLauren Lamprecht 12/4/1956",
|
|
"FLaura Lamprecht 5/22/1980",
|
|
"FLeland Lamprecht 4/6/1983",
|
|
"MNorman Herman 2/17/1935",
|
|
"FJan Herman 7/20/1930",
|
|
"FBonnie Glicco 9/19/1956",
|
|
"MCalvin Glicco 1/6/1954",
|
|
"FAnn Marie Glicco 4/25/1978",
|
|
"FJessica Glicco 11/14/1981",
|
|
"MThomas Glicco 10/11/2000",
|
|
"MGabriel Glicco 1/4/2004",
|
|
"FMackenzie Glicco 8/7/2007",
|
|
"MMark Herman 9/9/1957",
|
|
"MBrandt Moss 5/4/1996",
|
|
"MChristopher Herman 7/25/1979",
|
|
"FKari Herman 5/12/1982",
|
|
"MMyles McKissack 9/16/2008",
|
|
"MLogan McKissack 10/9/2011",
|
|
"MChris Woolery 3/11/1988",
|
|
"FAdalin Woolery 3/14/2011",
|
|
"MGerald Billy 3/31/1937-8/29/1982",
|
|
"FMary Ann Herman 6/2/1934",
|
|
"MMike Herman 8/27/1955",
|
|
"FCarolyn Hardin 1/4/1951",
|
|
"MMark Herman 2/7/1957",
|
|
"MKyle Herman 6/18/1989",
|
|
"MEric Herman 4/16/1993",
|
|
"MJoe Herman 1/14/1959",
|
|
"FLisa Herman 4/26/1962-3/2/2011",
|
|
"MBrett Herman 2/2/1989",
|
|
"FJill Elisabeth Herman 8/18/1997",
|
|
"MJeff Herman 4/14/1961",
|
|
"MKeith Herman 12/20/1941",
|
|
"FMary Ann Herman 5/10/1943",
|
|
"FCarol Herman 3/1/1943-9/30/1990",
|
|
"MBrian Herman 6/30/1965",
|
|
"FStuart Herman 12/22/1987",
|
|
"MTrevor Herman 1/10/1990",
|
|
"MCletus Barry 1/12/1922-4/30/1999",
|
|
"FAgnes Barry 10/20/1923",
|
|
"FJanet Barry 7/22/1947",
|
|
"MJack Herman 1/27/1905",
|
|
"FHelen Herman 8/22/1908-4/13/1997",
|
|
"FJoyce Waddell 05/13/1946",
|
|
"MDewey Lynn Waddell 9/10/1970",
|
|
"MJonathon G Waddell 9/27/1971",
|
|
};
|
|
|
|
[TestMethod]
|
|
public void TestMethodFamily()
|
|
{
|
|
DateTime dateTime = DateTime.Now;
|
|
string saveDirectory = $"D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/([])/Norman-{dateTime.Ticks}";
|
|
if (Directory.Exists(Path.GetPathRoot(saveDirectory)) && Directory.Exists(saveDirectory))
|
|
{
|
|
int age;
|
|
string name;
|
|
long personKey;
|
|
DateTime? death;
|
|
string ageGroup;
|
|
string? directory;
|
|
// bool first = true;
|
|
string[] dateSegments;
|
|
// bool verify = false;
|
|
DateTime parseDateTime;
|
|
PersonName? personName;
|
|
string[] spaceSegments;
|
|
string personKeyFormatted;
|
|
// bool isDefaultName = false;
|
|
PersonBirthday personBirthday;
|
|
string[] family = GetFamily();
|
|
GenealogicalDataCommunication genealogicalDataCommunication;
|
|
foreach (string familyMember in family)
|
|
{
|
|
spaceSegments = familyMember[1..].Split(' ');
|
|
dateSegments = spaceSegments[^1].Split('-');
|
|
name = string.Join(' ', spaceSegments[..^1]);
|
|
if (!DateTime.TryParse(dateSegments[0], out parseDateTime))
|
|
continue;
|
|
personName = IPerson.GetPersonName(name);
|
|
if (personName is null)
|
|
continue;
|
|
personBirthday = new(parseDateTime);
|
|
personKey = personBirthday.Value.Ticks;
|
|
personKeyFormatted = IPersonBirthday.GetFormatted(_PropertyConfiguration.PersonBirthdayFormat, personKey);
|
|
(age, _) = IAge.GetAge(dateTime.Ticks, personKey);
|
|
if (dateSegments.Length == 1)
|
|
death = null;
|
|
else
|
|
{
|
|
if (!DateTime.TryParse(dateSegments[0], out parseDateTime))
|
|
continue;
|
|
death = parseDateTime;
|
|
}
|
|
if (age < 25)
|
|
ageGroup = "1) Less-25";
|
|
else if (age < 50)
|
|
ageGroup = "2) Less-50";
|
|
else if (age < 100)
|
|
ageGroup = "3) Less-100";
|
|
else if (age < 200)
|
|
ageGroup = "4) Less-200";
|
|
else
|
|
ageGroup = "5) Else";
|
|
directory = Path.Combine(saveDirectory, "Norman", ageGroup, $"{personName.First.Value} {personName.Last.Value}^{age}", personKeyFormatted);
|
|
if (!Directory.Exists(directory))
|
|
_ = Directory.CreateDirectory(directory);
|
|
genealogicalDataCommunication = new(personBirthday.Value,
|
|
null,
|
|
death,
|
|
null,
|
|
null,
|
|
null,
|
|
"",
|
|
'U',
|
|
null,
|
|
null,
|
|
null);
|
|
// IGenealogicalDataCommunication.WriteFile(personKeyFormatted, personName, null, isDefaultName, directory, genealogicalDataCommunication, verify, first);
|
|
}
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[Ignore]
|
|
[TestMethod]
|
|
public void TestMethodGroup()
|
|
{
|
|
// const int Number = 0;
|
|
// const int Partial = 1;
|
|
// const int Approximate = 5;
|
|
// const int Exact = 9;
|
|
// //
|
|
// const int Alive = 0;
|
|
// const int Dead = 5;
|
|
// //
|
|
// const int Unknown = 0;
|
|
// const int Male = 5;
|
|
// const int Female = 9;
|
|
// foreach (var item in new string[] { "Number", "Partial", "Approximate", "Exact" })
|
|
foreach (string status in new string[] { "Alive", "Dead" })
|
|
{
|
|
foreach (string sex in new string[] { "Unknown", "Male", "Female" })
|
|
_ = Directory.CreateDirectory($"D:/{status}-{sex}");
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodRename()
|
|
{
|
|
// string directory = "D:/2-Images-B/Not-Copy-Copy-dd514b88";
|
|
string directory = "D:/1-Images-A/Images-dd514b88";
|
|
// string directory = "D:/2-Images-B/Not-Copy-Copy-dd514b88";
|
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
|
{
|
|
string[] directories = Directory.GetDirectories(directory, "*;*", SearchOption.AllDirectories);
|
|
foreach (string subDirectory in directories.OrderByDescending(l => l.Length - l.Replace(@"\", string.Empty).Length))
|
|
{
|
|
if (!subDirectory.EndsWith(";9"))
|
|
continue;
|
|
Directory.Move(subDirectory, $"{subDirectory[..^2]} !9");
|
|
}
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodRenameForUnkown()
|
|
{
|
|
string directory = "D:/1-Images-A/Images-dd514b88-Results/E) Distance/dd514b88/(RectInt-2023-06-19-less-0.99)";
|
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
|
{
|
|
string[] files = Directory.GetFiles(directory, "*.unk", SearchOption.AllDirectories);
|
|
foreach (string file in files)
|
|
File.Move(file, file[..^4]);
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodRenameForTicks()
|
|
{
|
|
string directory = "D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/([])/ged";
|
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
|
{
|
|
string checkName;
|
|
DateTime dateTime;
|
|
string weekOfYear;
|
|
string checkDirectoy;
|
|
Calendar calendar = new CultureInfo("en-US").Calendar;
|
|
string[] files = Directory.GetFiles(directory, "*.ged", SearchOption.TopDirectoryOnly);
|
|
foreach (string file in files)
|
|
{
|
|
if (!long.TryParse(Path.GetFileNameWithoutExtension(file), out long ticks))
|
|
continue;
|
|
dateTime = new(ticks);
|
|
weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
|
checkDirectoy = Path.Combine(directory, dateTime.Year.ToString(), $"{dateTime.Year}-Week-{weekOfYear}");
|
|
checkName = Path.Combine(checkDirectoy, Path.GetFileName(file));
|
|
if (!Directory.Exists(checkDirectoy))
|
|
_ = Directory.CreateDirectory(checkDirectoy);
|
|
if (File.Exists(checkName))
|
|
continue;
|
|
File.Move(file, checkName);
|
|
}
|
|
}
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
} |