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

@ -35,7 +35,7 @@ public class Compare
string[] segments;
_AppSettings = appSettings;
if (appSettings.MaxDegreeOfParallelism is null)
throw new Exception($"{nameof(appSettings.MaxDegreeOfParallelism)} is null!");
throw new ArgumentNullException(nameof(appSettings.MaxDegreeOfParallelism));
_RenameFindReplace = new();
_RenameBFindReplace = new();
_RenameCFindReplace = new();
@ -56,7 +56,7 @@ public class Compare
Model? model = null;
PredictorModel? predictorModel = null;
if (propertyConfiguration.PopulatePropertyId is null)
throw new Exception($"{nameof(propertyConfiguration.PopulatePropertyId)} is null!");
throw new ArgumentNullException(nameof(propertyConfiguration.PopulatePropertyId));
foreach (string spelling in configuration.Spelling)
{
segments = spelling.Split('|');
@ -372,14 +372,14 @@ public class Compare
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 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;
@ -390,9 +390,9 @@ public class Compare
{
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);
string fromPrepareForOld = "34720-637858334555170379.tsv";
string fromPrepareForOldFile = Path.Combine(_Configuration.PropertyConfiguration.RootDirectory, fromPrepareForOld);
@ -432,11 +432,11 @@ public class Compare
private void SaveDiffFilesOrSaveLogAndMoveFiles(Property.Models.Configuration configuration)
{
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 aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(A_Property), "{}");
_Log.Information(aPropertySingletonDirectory);
_Log.Information("to");
@ -510,7 +510,7 @@ public class Compare
private void ChangeExtensionFromDeleteToJson(string aPropertySingletonDirectory)
{
if (_AppSettings.MaxDegreeOfParallelism is null)
throw new Exception($"{nameof(_AppSettings.MaxDegreeOfParallelism)} is null!");
throw new ArgumentNullException(nameof(_AppSettings.MaxDegreeOfParallelism));
string searchPattern = "*.delete";
long ticks = DateTime.Now.Ticks;
List<string> topDirectories = new();
@ -647,7 +647,7 @@ public class Compare
private bool PossiblyCorrect(List<string> topDirectories, List<(int g, string sourceDirectory, string[] sourceDirectoryFiles, int r)> groupCollection)
{
if (_Configuration?.PropertyConfiguration is null)
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
bool result = false;
string corrected;
string correctedMoveTo;
@ -695,7 +695,7 @@ public class Compare
private List<string> GetMissingVerifyToSeasonCollection(List<string> _, List<(int g, string sourceDirectory, string[] sourceDirectoryFiles, int r)> groupCollection)
{
if (_Configuration?.PropertyConfiguration is null)
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
List<string> results = new();
string check;
foreach ((int _, string sourceDirectory, string[] _, int _) in groupCollection)
@ -715,7 +715,7 @@ public class Compare
private void CreateWindowsShortcuts((long Ticks, string FilteredSourceDirectoryFile, string PropertyDirectory, int PropertyId)[] collection, bool keepAll)
{
if (_Log is null)
throw new Exception($"{nameof(_Log)} is null!");
throw new ArgumentNullException(nameof(_Log));
int z = 0;
string fileName;
WindowsShortcut windowsShortcut;
@ -753,9 +753,9 @@ public class Compare
private void ThirdPassToMove(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections, string aPropertyContentCollectionDirectory)
{
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));
int stay = 0;
string fileName;
string id = " - Id";
@ -831,7 +831,7 @@ public class Compare
private void FourthPassCreateWindowsShortcuts(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections, bool saveToCollection, bool keepAll)
{
if (_Log is null)
throw new Exception($"{nameof(_Log)} is null!");
throw new ArgumentNullException(nameof(_Log));
int stay = 0;
A_Property? property;
ConsoleKey? consoleKey = null;