Ready to test
This commit is contained in:
@ -37,35 +37,25 @@ public class NotCopyCopy
|
||||
Property.Models.Configuration.Verify(propertyConfiguration);
|
||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||
Verify(configuration);
|
||||
bool reverse = false;
|
||||
string modelName = nameof(modelName);
|
||||
string predictorModelName = nameof(predictorModelName);
|
||||
_Configuration = configuration;
|
||||
if (propertyConfiguration.MaxImagesInDirectoryForTopLevelFirstPass is null)
|
||||
throw new Exception($"{nameof(propertyConfiguration.MaxImagesInDirectoryForTopLevelFirstPass)} is null!");
|
||||
if (propertyConfiguration.PopulatePropertyId is null)
|
||||
throw new Exception($"{nameof(propertyConfiguration.PopulatePropertyId)} is null!");
|
||||
if (!_IsEnvironment.Development)
|
||||
throw new Exception("This program only allows development environments!");
|
||||
string searchPattern = "*";
|
||||
long ticks = DateTime.Now.Ticks;
|
||||
List<string> topDirectories = new();
|
||||
List<Group> compareSourceGroupCollection;
|
||||
List<Group> selectedSourceGroupCollection;
|
||||
PropertyLogic propertyLogic = GetPropertyLogic();
|
||||
List<(int g, string sourceDirectory, string[] sourceDirectoryFiles, int r)> groupCollection;
|
||||
groupCollection = Property.Models.Stateless.A_Property.GetGroupCollection(_Configuration.CompareSource, searchPattern, topDirectories, propertyConfiguration.MaxImagesInDirectoryForTopLevelFirstPass.Value, reverse: false);
|
||||
if (appSettings.MaxDegreeOfParallelism.Value < 2)
|
||||
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.A_Property.GetGroupCollection));
|
||||
compareSourceGroupCollection = propertyLogic.GetParallelWork(propertyConfiguration, topDirectories, groupCollection, firstPass: true, filterOnFirstPass: true);
|
||||
if (appSettings.MaxDegreeOfParallelism.Value < 2)
|
||||
ticks = LogDelta(ticks, nameof(PropertyLogic.GetParallelWork));
|
||||
topDirectories.Clear();
|
||||
groupCollection = Property.Models.Stateless.A_Property.GetGroupCollection(configuration.SelectedSource, searchPattern, topDirectories, propertyConfiguration.MaxImagesInDirectoryForTopLevelFirstPass.Value, reverse: false);
|
||||
if (appSettings.MaxDegreeOfParallelism.Value < 2)
|
||||
ticks = LogDelta(ticks, nameof(Property.Models.Stateless.A_Property.GetGroupCollection));
|
||||
selectedSourceGroupCollection = propertyLogic.GetParallelWork(propertyConfiguration, topDirectories, groupCollection, firstPass: true, filterOnFirstPass: true);
|
||||
if (appSettings.MaxDegreeOfParallelism.Value < 2)
|
||||
ticks = LogDelta(ticks, nameof(PropertyLogic.GetParallelWork));
|
||||
propertyConfiguration.ChangeRootDirectory(configuration.CompareSource);
|
||||
List<PropertyHolder[]> comparePropertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, modelName, predictorModelName, propertyLogic);
|
||||
propertyConfiguration.ChangeRootDirectory(configuration.SelectedSource);
|
||||
List<PropertyHolder[]> selectedPropertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, modelName, predictorModelName, propertyLogic);
|
||||
if (comparePropertyHolderCollections.Count == selectedPropertyHolderCollections.Count)
|
||||
throw new Exception();
|
||||
string directoryName;
|
||||
List<string> distinct = new();
|
||||
List<Property.Models.DirectoryInfo> compareSourceGroupCollection = new();
|
||||
List<Property.Models.DirectoryInfo> selectedSourceGroupCollection = new();
|
||||
List<(string Source, string[] Destination)> copyCollection = GetCopyCollection(compareSourceGroupCollection, selectedSourceGroupCollection);
|
||||
foreach ((string source, string[] destination) in copyCollection)
|
||||
{
|
||||
@ -134,20 +124,19 @@ public class NotCopyCopy
|
||||
private PropertyLogic GetPropertyLogic()
|
||||
{
|
||||
PropertyLogic result;
|
||||
|
||||
string[] verifyToSeason = Array.Empty<string>();
|
||||
|
||||
if (_AppSettings.MaxDegreeOfParallelism is null)
|
||||
throw new Exception($"{nameof(_AppSettings.MaxDegreeOfParallelism)} is null!");
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism.Value, _Configuration.PropertyConfiguration, verifyToSeason);
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism.Value, _Configuration.PropertyConfiguration);
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<(string Source, string[] Destination)> GetCopyCollection(List<Group> compareSourceGroupCollection, List<Group> selectedSourceGroupCollection)
|
||||
private List<(string Source, string[] Destination)> GetCopyCollection(List<Property.Models.DirectoryInfo> compareSourceGroupCollection, List<Property.Models.DirectoryInfo> selectedSourceGroupCollection)
|
||||
{
|
||||
List<(string Source, string[] Destination)> results = new();
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new Exception($"{nameof(_Configuration.PropertyConfiguration)} must be set!");
|
||||
string key;
|
||||
string fileName;
|
||||
A_Property? property;
|
||||
@ -156,9 +145,9 @@ public class NotCopyCopy
|
||||
List<string> destinationCollection;
|
||||
string filteredSourceDirectoryFile;
|
||||
Dictionary<string, A_Property> keyValuePairs = new();
|
||||
foreach (Group group in compareSourceGroupCollection)
|
||||
foreach (Property.Models.DirectoryInfo group in compareSourceGroupCollection)
|
||||
{
|
||||
for (int i = 0; i < group.FilteredSourceDirectoryFiles.Length; i++)
|
||||
for (int i = 0; i < group.SourceDirectoryFileInfoCollection.Length; i++)
|
||||
{
|
||||
property = group.PropertyCollection[i];
|
||||
if (property is null)
|
||||
@ -167,9 +156,9 @@ public class NotCopyCopy
|
||||
keyValuePairs.Add(key, property);
|
||||
}
|
||||
}
|
||||
foreach (Group group in selectedSourceGroupCollection)
|
||||
foreach (Property.Models.DirectoryInfo group in selectedSourceGroupCollection)
|
||||
{
|
||||
for (int i = 0; i < group.FilteredSourceDirectoryFiles.Length; i++)
|
||||
for (int i = 0; i < group.SourceDirectoryFileInfoCollection.Length; i++)
|
||||
{
|
||||
destinationCollection = new();
|
||||
property = group.PropertyCollection[i];
|
||||
|
Reference in New Issue
Block a user