After testing E_Distance.SaveGroupedFaceEncodings

This commit is contained in:
2022-08-07 12:29:46 -07:00
parent 2158b4cfc2
commit daf5f428b9
57 changed files with 2626 additions and 660 deletions

View File

@ -30,7 +30,7 @@ public class PrepareForOld
string spellingB;
_AppSettings = appSettings;
if (appSettings.MaxDegreeOfParallelism is null)
throw new Exception($"{nameof(appSettings.MaxDegreeOfParallelism)} is null!");
throw new ArgumentNullException(nameof(appSettings.MaxDegreeOfParallelism));
_SpellingFindReplace = new();
_IsEnvironment = isEnvironment;
_Exceptions = new List<string>();
@ -42,7 +42,7 @@ public class PrepareForOld
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
Verify(configuration);
if (propertyConfiguration.IgnoreExtensions is null)
throw new Exception($"{nameof(propertyConfiguration.IgnoreExtensions)} is null!");
throw new ArgumentNullException(nameof(propertyConfiguration.IgnoreExtensions));
for (int i = 0; i < configuration.Spelling.Length; i++)
{
spellingA = configuration.Spelling[i];
@ -109,7 +109,7 @@ public class PrepareForOld
private static void Verify(Models.Configuration configuration)
{
if (configuration.Spelling is null || !configuration.Spelling.Any())
throw new Exception($"{nameof(configuration.Spelling)} should have at least one!");
throw new ArgumentNullException(nameof(configuration.Spelling));
}
private static List<Models.SaveTabSeparatedValues.ImageExifInfo> GetExifCollection(string infoDirectory, string infoDirectoryExtra, bool checkDistinct)
@ -141,7 +141,7 @@ public class PrepareForOld
{
List<(int Index, long Ticks, string RelativeDirectory, string FileNameWithoutExtension, string Extension, string RegexResult)> results = new();
if (_Configuration?.PropertyConfiguration is null)
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
long ticks;
string json;
string extension;
@ -224,14 +224,14 @@ public class PrepareForOld
private void SaveTabSeparatedValues(Property.Models.Configuration configuration, string aPropertySingletonDirectory)
{
if (_Log is null)
throw new Exception($"{nameof(_Log)} is null!");
throw new ArgumentNullException(nameof(_Log));
if (_AppSettings.MaxDegreeOfParallelism is null)
throw new Exception($"{nameof(_AppSettings.MaxDegreeOfParallelism)} is null!");
throw new ArgumentNullException(nameof(_AppSettings.MaxDegreeOfParallelism));
if (_Configuration?.PropertyConfiguration is null)
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
string? rootDirectoryParent = Path.GetDirectoryName(_Configuration.PropertyConfiguration.RootDirectory);
if (string.IsNullOrEmpty(rootDirectoryParent))
throw new Exception($"{nameof(rootDirectoryParent)} is null!");
throw new ArgumentNullException(nameof(rootDirectoryParent));
int z = 0;
int mappedIndex;
int? propertyId;
@ -414,7 +414,7 @@ public class PrepareForOld
JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
Dictionary<int, string[]>? source = JsonSerializer.Deserialize<Dictionary<int, string[]>>(json);
if (source is null)
throw new Exception($"{nameof(source)} is null!");
throw new ArgumentNullException(nameof(source));
{
int propertyId;
foreach (KeyValuePair<int, string[]> keyValuePair in source)
@ -469,12 +469,12 @@ public class PrepareForOld
private void ReSaveJsonFiles()
{
if (_Log is null)
throw new Exception($"{nameof(_Log)} is null!");
throw new ArgumentNullException(nameof(_Log));
if (_Configuration?.PropertyConfiguration is null)
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
string? rootDirectoryParent = Path.GetDirectoryName(_Configuration.PropertyConfiguration.RootDirectory);
if (string.IsNullOrEmpty(rootDirectoryParent))
throw new Exception($"{nameof(rootDirectoryParent)} is null!");
throw new ArgumentNullException(nameof(rootDirectoryParent));
int z = 0;
int propertyId;
List<int> missingIndices = new();
@ -523,14 +523,14 @@ public class PrepareForOld
private void CopyMissingImagesLogs()
{
if (_Log is null)
throw new Exception($"{nameof(_Log)} is null!");
throw new ArgumentNullException(nameof(_Log));
if (_Configuration?.PropertyConfiguration is null)
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
string? rootDirectoryParent = Path.GetDirectoryName(_Configuration.PropertyConfiguration.RootDirectory);
if (_Configuration?.PropertyConfiguration is null)
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
if (string.IsNullOrEmpty(rootDirectoryParent))
throw new Exception($"{nameof(rootDirectoryParent)} is null!");
throw new ArgumentNullException(nameof(rootDirectoryParent));
int z = 0;
int propertyId;
Dictionary<int, int> findReplace = new();
@ -591,14 +591,14 @@ public class PrepareForOld
private void VerifyAgainstIndexInfoJsonFiles(Property.Models.Configuration configuration, string aPropertySingletonDirectory)
{
if (_Log is null)
throw new Exception($"{nameof(_Log)} is null!");
throw new ArgumentNullException(nameof(_Log));
if (_AppSettings.MaxDegreeOfParallelism is null)
throw new Exception($"{nameof(_AppSettings.MaxDegreeOfParallelism)} is null!");
throw new ArgumentNullException(nameof(_AppSettings.MaxDegreeOfParallelism));
if (_Configuration?.PropertyConfiguration is null)
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
string? rootDirectoryParent = Path.GetDirectoryName(_Configuration.PropertyConfiguration.RootDirectory);
if (string.IsNullOrEmpty(rootDirectoryParent))
throw new Exception($"{nameof(rootDirectoryParent)} is null!");
throw new ArgumentNullException(nameof(rootDirectoryParent));
int z = 0;
int? propertyId;
long? propertyTicks;