Removed old GetRectangle
RectangleIntersectMinimums AddUserSecrets
This commit is contained in:
@ -38,7 +38,8 @@ public partial class UnitTestHardCoded
|
||||
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables()
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile(isEnvironment.AppSettingsFileName, 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))
|
||||
@ -83,10 +84,13 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodDel()
|
||||
{
|
||||
string source = @"F:\Tmp\Phares\Compare\Images 2022-09-15 - 7390c13 - III - Results\E) Distance\2022-09-15\7680 x 4320\7680x4320 - Hog - Large\()\(637992984751968513)";
|
||||
for (int i = 1; i < 11; i++)
|
||||
_ = IPath.DeleteEmptyDirectories(source);
|
||||
Assert.IsTrue(true);
|
||||
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();
|
||||
}
|
||||
|
||||
@ -114,50 +118,16 @@ public partial class UnitTestHardCoded
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethodDamn()
|
||||
{
|
||||
// string name;
|
||||
// string[] directories;
|
||||
// string? directoryName;
|
||||
// string checkDirectory;
|
||||
// string sourceDirectory = @"F:\Tmp\Phares\Compare\Images 2022-09-15 - 7390c13 - III - Results\E) Distance\2022-09-15\7680 x 4320\7680x4320 - Hog - Large\()";
|
||||
// directories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
// foreach (string directory in directories)
|
||||
// {
|
||||
// directoryName = Path.GetDirectoryName(directory);
|
||||
// if (directoryName is null)
|
||||
// continue;
|
||||
// name = Path.GetFileName(directory);
|
||||
// if (name.Length is 1 or 20)
|
||||
// continue;
|
||||
// checkDirectory = Path.Combine(directoryName, "b", name);
|
||||
// Directory.Move(directory, checkDirectory);
|
||||
// }
|
||||
// directories = Directory.GetDirectories(Path.Combine(sourceDirectory, "b"), "*", SearchOption.TopDirectoryOnly);
|
||||
// foreach (string directory in directories)
|
||||
// {
|
||||
// directoryName = Path.GetDirectoryName(directory);
|
||||
// if (directoryName is null)
|
||||
// continue;
|
||||
// name = Path.GetFileName(directory);
|
||||
// if (name.Length is 1 or 20)
|
||||
// continue;
|
||||
// checkDirectory = Path.Combine(directoryName, $"{name[..^4]})");
|
||||
// if (Directory.Exists(checkDirectory))
|
||||
// continue;
|
||||
// Directory.Move(directory, checkDirectory);
|
||||
// }
|
||||
// Assert.IsTrue(true);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethodDel2()
|
||||
{
|
||||
string source = @"F:\Tmp\Phares\Compare\Images 2022-09-15 - 7390c13 - III - Results\E) Distance\2022-09-15\7680 x 4320\7680x4320 - Hog - Large\()\(637992984751968513)";
|
||||
for (int i = 1; i < 11; i++)
|
||||
_ = IPath.DeleteEmptyDirectories(source);
|
||||
Assert.IsTrue(true);
|
||||
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();
|
||||
}
|
||||
|
||||
@ -230,87 +200,100 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodRenameAbandoned()
|
||||
{
|
||||
string checkFile;
|
||||
string source = @"D:\1) Images A\Images-1e85c0ba-Results\A2) People\1e85c0ba\{}\!\Abandoned";
|
||||
string[] files = Directory.GetFiles(source, "*.abd", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
string directory = @"D:\1) Images A\Images-1e85c0ba-Results\A2) People\1e85c0ba\{}\!\Abandoned";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
checkFile = file[..^4];
|
||||
if (File.Exists(checkFile))
|
||||
continue;
|
||||
File.Move(file, checkFile);
|
||||
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);
|
||||
}
|
||||
Assert.IsTrue(true);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethodRenameDelete()
|
||||
{
|
||||
string checkFile;
|
||||
string source = @"D:\1) Images A\Images-1e85c0ba-Results\A) Property\1e85c0ba\{}";
|
||||
string[] files = Directory.GetFiles(source, "*.del", SearchOption.AllDirectories);
|
||||
foreach (string file in files)
|
||||
string directory = @"D:\1) Images A\Images-1e85c0ba-Results\A) Property\1e85c0ba\{}";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
checkFile = file[..^4];
|
||||
if (File.Exists(checkFile))
|
||||
continue;
|
||||
File.Move(file, checkFile);
|
||||
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);
|
||||
}
|
||||
Assert.IsTrue(true);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethodRenameOld()
|
||||
{
|
||||
string checkFile;
|
||||
string source = @"D:\2) Images B\Not-Copy-Copy-1e85c0ba-Results\E) Distance\1e85c0ba\()";
|
||||
string[] files = Directory.GetFiles(source, "*.old", SearchOption.AllDirectories);
|
||||
foreach (string file in files)
|
||||
string directory = @"D:\2) Images B\Not-Copy-Copy-1e85c0ba-Results\E) Distance\1e85c0ba\()";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
checkFile = file[..^4];
|
||||
if (File.Exists(checkFile))
|
||||
continue;
|
||||
File.Move(file, checkFile);
|
||||
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);
|
||||
}
|
||||
Assert.IsTrue(true);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethodAncestryGenealogicalDataCommunication()
|
||||
{
|
||||
List<string> mappedLines;
|
||||
Dictionary<string, List<string>> individuals;
|
||||
GenealogicalDataCommunication genealogicalDataCommunication;
|
||||
GenealogicalDataCommunicationLines genealogicalDataCommunicationLines;
|
||||
List<(bool, string)> genealogicalDataCommunicationFiles = new()
|
||||
string directory = "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
new(false, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Ancestry-Roberts/Roberts Family Tree.ged"),
|
||||
new(false, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Ancestry-Phares/Phares Jr Family Tree.ged"),
|
||||
new(true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160708345114583/638160708345114583.ged"),
|
||||
new(true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160728606500015/638160728606500015.ged"),
|
||||
new(true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160738845419877/638160738845419877.ged"),
|
||||
new(true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160743318283885/638160743318283885.ged"),
|
||||
new(false, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Ancestry-Porterfield/Porterfield Family Tree.ged"),
|
||||
new(true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160708345114583/638160708345114583-Export.ged"),
|
||||
new(true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160738845419877/638160738845419877-Export.ged"),
|
||||
new(true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160743318283885/638160743318283885-Export.ged"),
|
||||
};
|
||||
foreach ((bool requireNickName, string genealogicalDataCommunicationFile) in genealogicalDataCommunicationFiles)
|
||||
{
|
||||
(_, individuals, _) = IGenealogicalDataCommunication.GetIndividuals(genealogicalDataCommunicationFile, requireNickName);
|
||||
foreach (KeyValuePair<string, List<string>> keyValuePair in individuals)
|
||||
List<string> mappedLines;
|
||||
Dictionary<string, List<string>> individuals;
|
||||
GenealogicalDataCommunication genealogicalDataCommunication;
|
||||
GenealogicalDataCommunicationLines genealogicalDataCommunicationLines;
|
||||
List<(bool, string)> genealogicalDataCommunicationFiles = new()
|
||||
{
|
||||
genealogicalDataCommunicationLines = IGenealogicalDataCommunication.GetGenealogicalDataCommunicationLines(keyValuePair.Value);
|
||||
Assert.IsNotNull(genealogicalDataCommunicationLines.Name);
|
||||
genealogicalDataCommunication = IGenealogicalDataCommunication.GetGenealogicalDataCommunication(genealogicalDataCommunicationLines);
|
||||
Assert.IsNotNull(genealogicalDataCommunication.Name);
|
||||
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(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")),
|
||||
};
|
||||
foreach ((bool requireNickName, string genealogicalDataCommunicationFile) in genealogicalDataCommunicationFiles)
|
||||
{
|
||||
(_, individuals, _) = IGenealogicalDataCommunication.GetIndividuals(genealogicalDataCommunicationFile, requireNickName);
|
||||
foreach (KeyValuePair<string, List<string>> keyValuePair in individuals)
|
||||
{
|
||||
genealogicalDataCommunicationLines = IGenealogicalDataCommunication.GetGenealogicalDataCommunicationLines(keyValuePair.Value);
|
||||
Assert.IsNotNull(genealogicalDataCommunicationLines.Name);
|
||||
genealogicalDataCommunication = IGenealogicalDataCommunication.GetGenealogicalDataCommunication(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;
|
||||
}
|
||||
mappedLines = IGenealogicalDataCommunication.GetMappedLines(genealogicalDataCommunicationFile, requireNickName);
|
||||
if (IPath.WriteAllText($"{genealogicalDataCommunicationFile}.cln", string.Join(Environment.NewLine, mappedLines), updateDateWhenMatches: false, compareBeforeWrite: true))
|
||||
continue;
|
||||
}
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
@ -318,71 +301,74 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodAncestryGenealogicalDataCommunicationCleanToExport()
|
||||
{
|
||||
int age;
|
||||
long personKey;
|
||||
string ageGroup;
|
||||
string fileName;
|
||||
string? directory;
|
||||
bool first = true;
|
||||
PersonName? personName;
|
||||
string personKeyFormatted;
|
||||
bool isDefaultName = false;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
Dictionary<string, List<string>> individuals;
|
||||
GenealogicalDataCommunication genealogicalDataCommunication;
|
||||
GenealogicalDataCommunicationLines genealogicalDataCommunicationLines;
|
||||
string saveDirectory = $"D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Ancestry-{dateTime.Ticks}";
|
||||
List<(bool, bool, string)> genealogicalDataCommunicationFiles = new()
|
||||
string saveDirectory = "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])";
|
||||
if (Directory.Exists(Path.GetPathRoot(saveDirectory)) && Directory.Exists(saveDirectory))
|
||||
{
|
||||
new(false, false, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Ancestry-Roberts/Roberts Family Tree.ged.cln"),
|
||||
new(false, false, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Ancestry-Phares/Phares Jr Family Tree.ged.cln"),
|
||||
new(true, true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160708345114583/638160708345114583.ged.cln"),
|
||||
new(true, true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160728606500015/638160728606500015.ged.cln"),
|
||||
new(true, true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160738845419877/638160738845419877.ged.cln"),
|
||||
new(true, true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160743318283885/638160743318283885.ged.cln"),
|
||||
new(false, false, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Ancestry-Porterfield/Porterfield Family Tree.ged.cln"),
|
||||
new(true, true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160708345114583/638160708345114583-Export.ged.cln"),
|
||||
new(true, true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160738845419877/638160738845419877-Export.ged.cln"),
|
||||
new(true, true, "D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Code-638160743318283885/638160743318283885-Export.ged.cln"),
|
||||
};
|
||||
foreach ((bool verify, bool requireNickName, string genealogicalDataCommunicationFile) in genealogicalDataCommunicationFiles)
|
||||
{
|
||||
fileName = Path.GetFileNameWithoutExtension(genealogicalDataCommunicationFile).Split(' ')[0];
|
||||
(_, individuals, _) = IGenealogicalDataCommunication.GetIndividuals(genealogicalDataCommunicationFile, requireNickName);
|
||||
foreach (KeyValuePair<string, List<string>> keyValuePair in individuals)
|
||||
int age;
|
||||
long personKey;
|
||||
string ageGroup;
|
||||
string fileName;
|
||||
string? directory;
|
||||
bool first = true;
|
||||
PersonName? personName;
|
||||
string personKeyFormatted;
|
||||
bool isDefaultName = false;
|
||||
Dictionary<string, List<string>> individuals;
|
||||
GenealogicalDataCommunication genealogicalDataCommunication;
|
||||
GenealogicalDataCommunicationLines genealogicalDataCommunicationLines;
|
||||
List<(bool, bool, string)> genealogicalDataCommunicationFiles = new()
|
||||
{
|
||||
genealogicalDataCommunicationLines = IGenealogicalDataCommunication.GetGenealogicalDataCommunicationLines(keyValuePair.Value);
|
||||
Assert.IsNotNull(genealogicalDataCommunicationLines.Name);
|
||||
genealogicalDataCommunication = IGenealogicalDataCommunication.GetGenealogicalDataCommunication(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);
|
||||
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(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")),
|
||||
};
|
||||
foreach ((bool verify, bool requireNickName, string genealogicalDataCommunicationFile) in genealogicalDataCommunicationFiles)
|
||||
{
|
||||
fileName = Path.GetFileNameWithoutExtension(genealogicalDataCommunicationFile).Split(' ')[0];
|
||||
(_, individuals, _) = IGenealogicalDataCommunication.GetIndividuals(genealogicalDataCommunicationFile, requireNickName);
|
||||
foreach (KeyValuePair<string, List<string>> keyValuePair in individuals)
|
||||
{
|
||||
genealogicalDataCommunicationLines = IGenealogicalDataCommunication.GetGenealogicalDataCommunicationLines(keyValuePair.Value);
|
||||
Assert.IsNotNull(genealogicalDataCommunicationLines.Name);
|
||||
genealogicalDataCommunication = IGenealogicalDataCommunication.GetGenealogicalDataCommunication(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[]{
|
||||
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",
|
||||
@ -592,7 +578,7 @@ public partial class UnitTestHardCoded
|
||||
"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.d.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
|
||||
"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",
|
||||
@ -675,66 +661,70 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodFamily()
|
||||
{
|
||||
int age;
|
||||
string name;
|
||||
long personKey;
|
||||
DateTime? death;
|
||||
string ageGroup;
|
||||
bool first = true;
|
||||
string? directory;
|
||||
bool verify = false;
|
||||
string[] dateSegments;
|
||||
DateTime parseDateTime;
|
||||
PersonName? personName;
|
||||
string[] spaceSegments;
|
||||
string personKeyFormatted;
|
||||
bool isDefaultName = false;
|
||||
PersonBirthday personBirthday;
|
||||
string[] family = GetFamily();
|
||||
DateTime dateTime = DateTime.Now;
|
||||
GenealogicalDataCommunication genealogicalDataCommunication;
|
||||
string saveDirectory = $"D:/1) Images A/Images-1e85c0ba-Results/A2) People/1e85c0ba/([])/Norman-{dateTime.Ticks}";
|
||||
foreach (string familyMember in family)
|
||||
if (Directory.Exists(Path.GetPathRoot(saveDirectory)) && Directory.Exists(saveDirectory))
|
||||
{
|
||||
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
|
||||
int age;
|
||||
string name;
|
||||
long personKey;
|
||||
DateTime? death;
|
||||
string ageGroup;
|
||||
bool first = true;
|
||||
string? directory;
|
||||
bool verify = false;
|
||||
string[] dateSegments;
|
||||
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;
|
||||
death = parseDateTime;
|
||||
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(null, null, null, null, null, null, null, 'U', personBirthday.Value, death, null);
|
||||
IGenealogicalDataCommunication.WriteFile(personKeyFormatted, personName, null, isDefaultName, directory, genealogicalDataCommunication, verify, first);
|
||||
}
|
||||
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(null, null, null, null, null, null, null, 'U', personBirthday.Value, death, null);
|
||||
IGenealogicalDataCommunication.WriteFile(personKeyFormatted, personName, null, isDefaultName, directory, genealogicalDataCommunication, verify, first);
|
||||
}
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[TestMethod]
|
||||
public void TestMethodGroup()
|
||||
{
|
||||
@ -761,14 +751,18 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodRename()
|
||||
{
|
||||
// string[] directories = Directory.GetDirectories(@"D:\2) Images B\Not-Copy-Copy-1e85c0ba", "*;*", SearchOption.AllDirectories);
|
||||
string[] directories = Directory.GetDirectories(@"D:\1) Images A\Images-1e85c0ba", "*;*", SearchOption.AllDirectories);
|
||||
// string[] directories = Directory.GetDirectories(@"D:\2) Images B\Not-Copy-Copy-1e85c0ba", "*", SearchOption.AllDirectories);
|
||||
foreach (string directory in directories.OrderByDescending(l => l.Length - l.Replace(@"\", string.Empty).Length))
|
||||
// string directory = @"D:\2) Images B\Not-Copy-Copy-1e85c0ba";
|
||||
string directory = @"D:\1) Images A\Images-1e85c0ba";
|
||||
// string directory = @"D:\2) Images B\Not-Copy-Copy-1e85c0ba";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
if (!directory.EndsWith(";9"))
|
||||
continue;
|
||||
Directory.Move(directory, $"{directory[..^2]} !9");
|
||||
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();
|
||||
}
|
||||
@ -776,9 +770,13 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodRenameForUnkown()
|
||||
{
|
||||
string[] files = Directory.GetFiles(@"D:\1) Images A\Images-1e85c0ba-Results\E) Distance\1e85c0ba\(Bad-2023-06-18-less-0.4)", "*.unk", SearchOption.AllDirectories);
|
||||
foreach (string file in files)
|
||||
File.Move(file, file[..^4]);
|
||||
string directory = @"D:\1) Images A\Images-1e85c0ba-Results\E) Distance\1e85c0ba\(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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user