AppSettings and Configuration changes,

major changes to E_Distance and minor for D_Face
This commit is contained in:
2022-08-19 21:37:36 -07:00
parent 004017b9dd
commit be7a6abbf4
60 changed files with 1269 additions and 1344 deletions

View File

@ -34,8 +34,6 @@ public class Compare
string renameTo;
string[] segments;
_AppSettings = appSettings;
if (appSettings.MaxDegreeOfParallelism is null)
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
_RenameFindReplace = new();
_RenameBFindReplace = new();
_RenameCFindReplace = new();
@ -106,7 +104,7 @@ public class Compare
_RenameCFindReplace.Add(new(renameFrom, renameTo));
}
groupCollection = Property.Models.Stateless.Container.GetGroupCollection(propertyConfiguration.RootDirectory, searchPattern, topDirectories);
if (appSettings.MaxDegreeOfParallelism.Value < 2)
if (appSettings.MaxDegreeOfParallelism < 2)
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.Container.GetGroupCollection));
_Log.Information($"{nameof(Property.Models.Stateless.Container.GetGroupCollection)} has finished");
_Configuration = configuration;
@ -118,7 +116,7 @@ public class Compare
topDirectories.Clear();
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(propertyConfiguration.RootDirectory);
groupCollection = Property.Models.Stateless.Container.GetGroupCollection(propertyConfiguration.RootDirectory, searchPattern, topDirectories);
if (appSettings.MaxDegreeOfParallelism.Value < 2)
if (appSettings.MaxDegreeOfParallelism < 2)
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.Container.GetGroupCollection));
}
_Log.Information($"{nameof(PossiblyRename)} has finished");
@ -127,7 +125,7 @@ public class Compare
topDirectories.Clear();
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(propertyConfiguration.RootDirectory);
groupCollection = Property.Models.Stateless.Container.GetGroupCollection(propertyConfiguration.RootDirectory, searchPattern, topDirectories);
if (appSettings.MaxDegreeOfParallelism.Value < 2)
if (appSettings.MaxDegreeOfParallelism < 2)
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.Container.GetGroupCollection));
}
_Log.Information($"{nameof(PossiblyRenameB)} has finished");
@ -136,7 +134,7 @@ public class Compare
topDirectories.Clear();
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(propertyConfiguration.RootDirectory);
groupCollection = Property.Models.Stateless.Container.GetGroupCollection(propertyConfiguration.RootDirectory, searchPattern, topDirectories);
if (appSettings.MaxDegreeOfParallelism.Value < 2)
if (appSettings.MaxDegreeOfParallelism < 2)
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.Container.GetGroupCollection));
}
_Log.Information($"{nameof(PossiblyRenameC)} has finished");
@ -145,7 +143,7 @@ public class Compare
topDirectories.Clear();
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(propertyConfiguration.RootDirectory);
groupCollection = Property.Models.Stateless.Container.GetGroupCollection(propertyConfiguration.RootDirectory, searchPattern, topDirectories);
if (appSettings.MaxDegreeOfParallelism.Value < 2)
if (appSettings.MaxDegreeOfParallelism < 2)
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.Container.GetGroupCollection));
}
_Log.Information($"{nameof(PossiblyCorrect)} has finished");
@ -158,7 +156,7 @@ public class Compare
topDirectories.Clear();
_ = Property.Models.Stateless.IPath.DeleteEmptyDirectories(propertyConfiguration.RootDirectory);
groupCollection = Property.Models.Stateless.Container.GetGroupCollection(propertyConfiguration.RootDirectory, searchPattern, topDirectories);
if (appSettings.MaxDegreeOfParallelism.Value < 2)
if (appSettings.MaxDegreeOfParallelism < 2)
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.Container.GetGroupCollection));
}
if (_IsEnvironment.Development && propertyConfiguration.PopulatePropertyId.Value && !propertyLogic.KeyValuePairs.Any())
@ -389,11 +387,9 @@ public class Compare
private PropertyLogic GetPropertyLogic(bool reverse, Model? model, PredictorModel? predictorModel)
{
PropertyLogic result;
if (_AppSettings.MaxDegreeOfParallelism is null)
throw new NullReferenceException(nameof(_AppSettings.MaxDegreeOfParallelism));
if (_Configuration?.PropertyConfiguration is null)
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
result = new(_AppSettings.MaxDegreeOfParallelism.Value, _Configuration.PropertyConfiguration, reverse, model, predictorModel);
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, reverse, model, predictorModel);
string fromPrepareForOld = "34720-637858334555170379.tsv";
string fromPrepareForOldFile = Path.Combine(_Configuration.PropertyConfiguration.RootDirectory, fromPrepareForOld);
if (File.Exists(fromPrepareForOldFile))
@ -433,8 +429,6 @@ public class Compare
{
if (_Log is null)
throw new NullReferenceException(nameof(_Log));
if (_AppSettings.MaxDegreeOfParallelism is null)
throw new NullReferenceException(nameof(_AppSettings.MaxDegreeOfParallelism));
if (_Configuration?.PropertyConfiguration is null)
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
string aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(A_Property), "{}");
@ -461,7 +455,7 @@ public class Compare
throw new Exception("Invalid directory should end with {}!");
diffRootDirectory = Property.Models.Stateless.A_Property.GetDiffRootDirectory(_Configuration.DiffPropertyDirectory);
}
PropertyCompare.Models.PropertyCompareLogic propertyCompareLogic = new(_AppSettings.MaxDegreeOfParallelism.Value, _Configuration.PropertyConfiguration, _SpellingFindReplace, diffRootDirectory);
PropertyCompare.Models.PropertyCompareLogic propertyCompareLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _SpellingFindReplace, diffRootDirectory);
if (string.IsNullOrEmpty(_Configuration.DiffPropertyDirectory) || !Directory.Exists(_Configuration.DiffPropertyDirectory))
diffPropertyCompareCollection = Array.Empty<PropertyCompare.Models.PropertyCompare>();
else
@ -509,14 +503,12 @@ public class Compare
private void ChangeExtensionFromDeleteToJson(string aPropertySingletonDirectory)
{
if (_AppSettings.MaxDegreeOfParallelism is null)
throw new NullReferenceException(nameof(_AppSettings.MaxDegreeOfParallelism));
string searchPattern = "*.delete";
long ticks = DateTime.Now.Ticks;
List<string> topDirectories = new();
List<(int g, string sourceDirectory, string[] sourceDirectoryFiles, int r)> groupCollection;
groupCollection = Property.Models.Stateless.Container.GetGroupCollection(aPropertySingletonDirectory, searchPattern, topDirectories);
if (_AppSettings.MaxDegreeOfParallelism.Value < 2)
if (_AppSettings.MaxDegreeOfParallelism < 2)
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.Container.GetGroupCollection));
foreach ((int g, string sourceDirectory, string[] sourceDirectoryFiles, int r) in groupCollection)
{