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

@ -31,7 +31,7 @@ public class DateGroup
{ }
_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<DateGroup>();
@ -46,11 +46,11 @@ public class DateGroup
PredictorModel? predictorModel = null;
_Configuration = configuration;
if (configuration.ByHash is null)
throw new Exception($"{nameof(configuration.ByHash)} is null!");
throw new ArgumentNullException(nameof(configuration.ByHash));
if (configuration.ByCreateDateShortcut is null)
throw new Exception($"{nameof(configuration.ByCreateDateShortcut)} is null!");
throw new ArgumentNullException(nameof(configuration.ByCreateDateShortcut));
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!");
long ticks = DateTime.Now.Ticks;
@ -94,21 +94,21 @@ public class DateGroup
private static void Verify(Models.Configuration configuration)
{
if (configuration.ByCreateDateShortcut is null)
throw new Exception($"{nameof(configuration.ByCreateDateShortcut)} is null!");
throw new ArgumentNullException(nameof(configuration.ByCreateDateShortcut));
if (configuration.ByDay is null)
throw new Exception($"{nameof(configuration.ByDay)} is null!");
throw new ArgumentNullException(nameof(configuration.ByDay));
if (configuration.ByHash is null)
throw new Exception($"{nameof(configuration.ByHash)} is null!");
throw new ArgumentNullException(nameof(configuration.ByHash));
if (configuration.BySeason is null)
throw new Exception($"{nameof(configuration.BySeason)} is null!");
throw new ArgumentNullException(nameof(configuration.BySeason));
if (configuration.ByWeek is null)
throw new Exception($"{nameof(configuration.ByWeek)} is null!");
throw new ArgumentNullException(nameof(configuration.ByWeek));
if (!configuration.ByCreateDateShortcut.Value && !configuration.ByDay.Value && !configuration.ByWeek.Value && !configuration.BySeason.Value && !configuration.ByHash.Value)
throw new Exception("Change configuration!");
if (configuration.KeepFullPath is null)
throw new Exception($"{nameof(configuration.KeepFullPath)} is null!");
throw new ArgumentNullException(nameof(configuration.KeepFullPath));
if (configuration?.PropertyConfiguration?.PopulatePropertyId is null)
throw new Exception($"{nameof(configuration.PropertyConfiguration.PopulatePropertyId)} must be set!");
throw new ArgumentNullException(nameof(configuration.PropertyConfiguration.PopulatePropertyId));
if (configuration.PropertyConfiguration.PopulatePropertyId.Value && !configuration.ByCreateDateShortcut.Value && !configuration.ByHash.Value)
throw new Exception("Change configuration!");
if (!configuration.PropertyConfiguration.PopulatePropertyId.Value && configuration.ByHash.Value)
@ -153,7 +153,7 @@ public class DateGroup
{
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;
@ -164,17 +164,17 @@ public class DateGroup
{
List<(string Source, string[] Destination)> results = new();
if (_Configuration.ByCreateDateShortcut is null)
throw new Exception($"{nameof(_Configuration.ByCreateDateShortcut)} is null!");
throw new ArgumentNullException(nameof(_Configuration.ByCreateDateShortcut));
if (_Configuration.ByDay is null)
throw new Exception($"{nameof(_Configuration.ByDay)} is null!");
throw new ArgumentNullException(nameof(_Configuration.ByDay));
if (_Configuration.ByHash is null)
throw new Exception($"{nameof(_Configuration.ByHash)} is null!");
throw new ArgumentNullException(nameof(_Configuration.ByHash));
if (_Configuration.BySeason is null)
throw new Exception($"{nameof(_Configuration.BySeason)} is null!");
throw new ArgumentNullException(nameof(_Configuration.BySeason));
if (_Configuration.ByWeek is null)
throw new Exception($"{nameof(_Configuration.ByWeek)} is null!");
throw new ArgumentNullException(nameof(_Configuration.ByWeek));
if (_Configuration.KeepFullPath is null)
throw new Exception($"{nameof(_Configuration.KeepFullPath)} is null!");
throw new ArgumentNullException(nameof(_Configuration.KeepFullPath));
char flag;
string day;
int season;
@ -332,9 +332,9 @@ public class DateGroup
{
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;
}
@ -343,9 +343,9 @@ public class DateGroup
{
List<(string Source, string[] Destination)> results = new();
if (_Configuration.KeepFullPath is null)
throw new Exception($"{nameof(_Configuration.KeepFullPath)} is null!");
throw new ArgumentNullException(nameof(_Configuration.KeepFullPath));
if (_Configuration?.PropertyConfiguration is null)
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
string? topDirectory;
string? checkDirectory;
string sourceDirectory;
@ -380,9 +380,9 @@ public class DateGroup
private void MoveFiles(List<string> topDirectories, List<Property.Models.DirectoryInfo> groupCollection)
{
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 directoryName;
List<string> distinct = new();
List<(string Source, string[] Destination)> fileMoveCollectionAll = GetFileMoveCollectionAll(topDirectories, groupCollection);