Re-write
This commit is contained in:
@ -26,23 +26,22 @@ public class NotCopyCopy
|
||||
_AppSettings = appSettings;
|
||||
_IsEnvironment = isEnvironment;
|
||||
_Log = Serilog.Log.ForContext<NotCopyCopy>();
|
||||
Property.Models.Configuration propertyConfiguration = Property.Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory);
|
||||
Property.Models.Configuration propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
|
||||
Property.Models.Configuration.Verify(propertyConfiguration);
|
||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||
Verify(configuration);
|
||||
bool reverse = false;
|
||||
Model? model = null;
|
||||
PredictorModel? predictorModel = null;
|
||||
string outputExtension = ".jpg";
|
||||
_Configuration = configuration;
|
||||
if (propertyConfiguration.PopulatePropertyId is null)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.PopulatePropertyId));
|
||||
PredictorModel? predictorModel = null;
|
||||
if (!_IsEnvironment.Development)
|
||||
throw new Exception("This program only allows development environments!");
|
||||
PropertyLogic propertyLogic = GetPropertyLogic(reverse, model, predictorModel);
|
||||
A_Property propertyLogic = GetPropertyLogic(reverse, model, outputExtension, predictorModel);
|
||||
propertyConfiguration.ChangeRootDirectory(configuration.CompareSource);
|
||||
List<Container> compareContainers = Property.Models.Stateless.A_Property.Get(propertyConfiguration, propertyLogic);
|
||||
List<Shared.Models.Container> compareContainers = A_Property.Get(propertyConfiguration, propertyLogic);
|
||||
propertyConfiguration.ChangeRootDirectory(configuration.SelectedSource);
|
||||
List<Container> selectedContainers = Property.Models.Stateless.A_Property.Get(propertyConfiguration, propertyLogic);
|
||||
List<Shared.Models.Container> selectedContainers = A_Property.Get(propertyConfiguration, propertyLogic);
|
||||
if (compareContainers.Count == selectedContainers.Count)
|
||||
throw new Exception();
|
||||
string directoryName;
|
||||
@ -103,12 +102,12 @@ public class NotCopyCopy
|
||||
throw new NullReferenceException(nameof(configuration.SelectedSource));
|
||||
}
|
||||
|
||||
private PropertyLogic GetPropertyLogic(bool reverse, Model? model, PredictorModel? predictorModel)
|
||||
private A_Property GetPropertyLogic(bool reverse, Model? model, string outputExtension, PredictorModel? predictorModel)
|
||||
{
|
||||
PropertyLogic result;
|
||||
A_Property result;
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, reverse, model, predictorModel);
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, outputExtension, reverse, model, predictorModel);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -119,12 +118,12 @@ public class NotCopyCopy
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
|
||||
string key;
|
||||
string fileName;
|
||||
A_Property? property;
|
||||
Shared.Models.Property? property;
|
||||
string destinationDirectory;
|
||||
List<string> directoryNames;
|
||||
List<string> destinationCollection;
|
||||
string filteredSourceDirectoryFile;
|
||||
Dictionary<string, A_Property> keyValuePairs = new();
|
||||
Dictionary<string, Shared.Models.Property> keyValuePairs = new();
|
||||
foreach (Property.Models.DirectoryInfo group in compareSourceGroupCollection)
|
||||
{
|
||||
for (int i = 0; i < group.SourceDirectoryFileHolderCollection.Length; i++)
|
||||
@ -150,7 +149,7 @@ public class NotCopyCopy
|
||||
if (keyValuePairs.ContainsKey(key) && keyValuePairs[key].LastWriteTime == property.LastWriteTime)
|
||||
continue;
|
||||
destinationDirectory = string.Concat(_Configuration.EmptyDestination, group.SourceDirectory[_Configuration.SelectedSource.Length..]);
|
||||
directoryNames = Property.Models.Stateless.IPath.GetDirectoryNames(destinationDirectory);
|
||||
directoryNames = Shared.Models.Stateless.Methods.IPath.GetDirectoryNames(destinationDirectory);
|
||||
destinationCollection.AddRange(directoryNames);
|
||||
destinationCollection.Add(fileName);
|
||||
results.Add(new(filteredSourceDirectoryFile, destinationCollection.ToArray()));
|
||||
|
Reference in New Issue
Block a user