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

@ -28,7 +28,7 @@ public class NotCopyCopy
{ }
_AppSettings = appSettings;
if (appSettings.MaxDegreeOfParallelism is null)
throw new Exception($"{nameof(appSettings.MaxDegreeOfParallelism)} is null!");
throw new ArgumentNullException(nameof(appSettings.MaxDegreeOfParallelism));
_IsEnvironment = isEnvironment;
_Exceptions = new List<string>();
_Log = Serilog.Log.ForContext<NotCopyCopy>();
@ -43,7 +43,7 @@ public class NotCopyCopy
PredictorModel? predictorModel = null;
_Configuration = configuration;
if (propertyConfiguration.PopulatePropertyId is null)
throw new Exception($"{nameof(propertyConfiguration.PopulatePropertyId)} is null!");
throw new ArgumentNullException(nameof(propertyConfiguration.PopulatePropertyId));
if (!_IsEnvironment.Development)
throw new Exception("This program only allows development environments!");
PropertyLogic propertyLogic = GetPropertyLogic();
@ -100,22 +100,22 @@ public class NotCopyCopy
private static void Verify(Models.Configuration configuration)
{
if (Path.GetPathRoot(configuration.SelectedSource) == configuration.SelectedSource)
throw new Exception($"{nameof(configuration.SelectedSource)} should have at least one level!");
throw new ArgumentNullException(nameof(configuration.SelectedSource));
if (string.IsNullOrEmpty(configuration.CompareSource) || !Directory.Exists(configuration.CompareSource))
throw new Exception($"{nameof(configuration.CompareSource)} must have a value and exits!");
throw new ArgumentNullException(nameof(configuration.CompareSource));
if (string.IsNullOrEmpty(configuration.EmptyDestination) || Directory.Exists(configuration.EmptyDestination))
throw new Exception($"{nameof(configuration.EmptyDestination)} can't exit!");
throw new ArgumentNullException(nameof(configuration.EmptyDestination));
if (string.IsNullOrEmpty(configuration.SelectedSource) || !Directory.Exists(configuration.SelectedSource))
throw new Exception($"{nameof(configuration.SelectedSource)} must have a value and exits!");
throw new ArgumentNullException(nameof(configuration.SelectedSource));
if (configuration.SelectedSource.Length != configuration.CompareSource.Length)
throw new Exception($"{nameof(configuration.SelectedSource)} and {nameof(configuration.CompareSource)} must be the same length!");
throw new ArgumentNullException(nameof(configuration.SelectedSource));
}
private long LogDelta(long ticks, string methodName)
{
long result;
if (_Log is null)
throw new Exception($"{nameof(_Log)} is null!");
throw new ArgumentNullException(nameof(_Log));
double delta = new TimeSpan(DateTime.Now.Ticks - ticks).TotalMilliseconds;
_Log.Debug($"{methodName} took {Math.Floor(delta)} millisecond(s)");
result = DateTime.Now.Ticks;
@ -126,9 +126,9 @@ public class NotCopyCopy
{
PropertyLogic result;
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));
result = new(_AppSettings.MaxDegreeOfParallelism.Value, _Configuration.PropertyConfiguration);
return result;
}
@ -137,7 +137,7 @@ public class NotCopyCopy
{
List<(string Source, string[] Destination)> results = new();
if (_Configuration?.PropertyConfiguration is null)
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
string key;
string fileName;
A_Property? property;