Ready to test
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace View_by_Distance.Property.Models.Stateless;
|
||||
|
||||
public static class A_Property
|
||||
@ -26,10 +28,7 @@ public static class A_Property
|
||||
string[] sourceDirectoryFiles;
|
||||
List<string[]> fileCollections = new();
|
||||
if (!topDirectories.Any())
|
||||
{
|
||||
topDirectories.Add(rootDirectory);
|
||||
topDirectories.AddRange(from l in Directory.GetDirectories(rootDirectory, "*", SearchOption.TopDirectoryOnly) select Path.GetFullPath(l));
|
||||
}
|
||||
for (int g = 1; g < 5; g++)
|
||||
{
|
||||
if (g == 4)
|
||||
@ -105,6 +104,151 @@ public static class A_Property
|
||||
return results;
|
||||
}
|
||||
|
||||
public static List<(int g, string sourceDirectory, string[] sourceDirectoryFiles, int r)> GetJsonGroupCollection(string rootDirectory)
|
||||
{
|
||||
List<(int g, string sourceDirectory, string[] sourceDirectoryFiles, int r)> results;
|
||||
bool reverse = false;
|
||||
string searchPattern = "*.json";
|
||||
List<string> topDirectories = new();
|
||||
int maxImagesInDirectoryForTopLevelFirstPass = 50;
|
||||
results = GetGroupCollection(rootDirectory, searchPattern, topDirectories, maxImagesInDirectoryForTopLevelFirstPass, reverse);
|
||||
return results;
|
||||
}
|
||||
|
||||
public static List<(int g, string sourceDirectory, FileInfo[] sourceDirectoryFiles, int r)> GetFileInfoGroupCollection(Models.Configuration configuration, bool reverse, string searchPattern, List<string> topDirectories)
|
||||
{
|
||||
if (configuration.MaxImagesInDirectoryForTopLevelFirstPass is null)
|
||||
throw new Exception($"{nameof(configuration.MaxImagesInDirectoryForTopLevelFirstPass)} is null!");
|
||||
List<(int g, string sourceDirectory, FileInfo[] sourceDirectoryFiles, int r)> results = new();
|
||||
List<(int g, string sourceDirectory, string[] sourceDirectoryFiles, int r)>? collection = GetGroupCollection(configuration.RootDirectory, searchPattern, topDirectories, configuration.MaxImagesInDirectoryForTopLevelFirstPass.Value, reverse);
|
||||
foreach ((int g, string sourceDirectory, string[] sourceDirectoryFiles, int r) in collection)
|
||||
results.Add(new(g, sourceDirectory, (from l in sourceDirectoryFiles select new FileInfo(l)).ToArray(), r));
|
||||
return results;
|
||||
}
|
||||
|
||||
private static List<(int g, string sourceDirectory, List<(string sourceDirectoryFile, Models.A_Property? property)> collection, int r)> GetCollection(string rootDirectory, List<(int g, string sourceDirectory, string[] SourceDirectoryFiles, int r)> jsonCollection)
|
||||
{
|
||||
List<(int, string, List<(string, Models.A_Property?)>, int)> results = new();
|
||||
int length = rootDirectory.Length;
|
||||
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = Environment.ProcessorCount };
|
||||
_ = Parallel.For(0, jsonCollection.Count, parallelOptions, i => ParallelFor(jsonCollection, i, length, results));
|
||||
return results;
|
||||
}
|
||||
|
||||
private static List<PropertyHolder[]> Populate(Models.Configuration configuration, string aPropertySingletonDirectory, List<(int, string, FileInfo[], int)> fileInfoGroupCollection, List<(int, string, List<(string, Models.A_Property?)>, int)> collectionFromJson)
|
||||
{
|
||||
List<PropertyHolder[]> results = new();
|
||||
if (configuration.PropertiesChangedForProperty is null)
|
||||
throw new Exception($"{configuration.PropertiesChangedForProperty} is null");
|
||||
int length;
|
||||
string inferred;
|
||||
string relativePath;
|
||||
FileInfo keyFileInfo;
|
||||
string keySourceDirectory;
|
||||
List<PropertyHolder> propertyHolderCollection;
|
||||
Dictionary<string, (string SourceDirectory, FileInfo FileInfo)> fileInfoKeyValuePairs = new();
|
||||
length = configuration.RootDirectory.Length;
|
||||
foreach ((int g, string sourceDirectory, FileInfo[] sourceDirectoryFileInfoCollection, int r) in fileInfoGroupCollection)
|
||||
{
|
||||
foreach (FileInfo sourceDirectoryFileInfo in sourceDirectoryFileInfoCollection)
|
||||
{
|
||||
relativePath = $"{XPath.GetRelativePath(sourceDirectoryFileInfo.FullName, length)}.json";
|
||||
fileInfoKeyValuePairs.Add(relativePath, new(sourceDirectory, sourceDirectoryFileInfo));
|
||||
}
|
||||
}
|
||||
length = aPropertySingletonDirectory.Length;
|
||||
foreach ((int g, string _, List<(string, Models.A_Property?)> collection, int r) in collectionFromJson)
|
||||
{
|
||||
if (!collection.Any())
|
||||
continue;
|
||||
propertyHolderCollection = new();
|
||||
foreach ((string sourceDirectoryFile, Models.A_Property? property) in collection)
|
||||
{
|
||||
relativePath = XPath.GetRelativePath(sourceDirectoryFile, length);
|
||||
if (!fileInfoKeyValuePairs.ContainsKey(relativePath))
|
||||
{
|
||||
inferred = string.Concat(configuration.RootDirectory, relativePath);
|
||||
keyFileInfo = new(inferred[..^5]);
|
||||
keySourceDirectory = string.Concat(keyFileInfo.DirectoryName);
|
||||
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, true, null, null, null, null));
|
||||
}
|
||||
else
|
||||
{
|
||||
keyFileInfo = fileInfoKeyValuePairs[relativePath].FileInfo;
|
||||
keySourceDirectory = fileInfoKeyValuePairs[relativePath].SourceDirectory;
|
||||
if (!fileInfoKeyValuePairs.Remove(relativePath))
|
||||
throw new Exception();
|
||||
if (property?.Id is null || property?.Width is null || property?.Height is null)
|
||||
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, false, null, null, null, null));
|
||||
else if (configuration.PropertiesChangedForProperty.Value || property.LastWriteTime != keyFileInfo.LastWriteTime || property.FileSize != keyFileInfo.Length)
|
||||
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, false, true, null, null, null));
|
||||
else
|
||||
propertyHolderCollection.Add(new(g, keySourceDirectory, sourceDirectoryFile, relativePath, r, keyFileInfo, property, false, false, null, null, null));
|
||||
}
|
||||
}
|
||||
if (propertyHolderCollection.Any())
|
||||
results.Add(propertyHolderCollection.ToArray());
|
||||
}
|
||||
length = configuration.RootDirectory.Length;
|
||||
foreach ((int g, string sourceDirectory, FileInfo[] sourceDirectoryFileInfoCollection, int r) in fileInfoGroupCollection)
|
||||
{
|
||||
propertyHolderCollection = new();
|
||||
foreach (FileInfo sourceDirectoryFileInfo in sourceDirectoryFileInfoCollection)
|
||||
{
|
||||
relativePath = $"{XPath.GetRelativePath(sourceDirectoryFileInfo.FullName, length)}.json";
|
||||
if (!fileInfoKeyValuePairs.ContainsKey(relativePath))
|
||||
continue;
|
||||
if (!fileInfoKeyValuePairs.Remove(relativePath))
|
||||
throw new Exception();
|
||||
propertyHolderCollection.Add(new(g, sourceDirectory, relativePath, sourceDirectoryFileInfo.FullName, r, sourceDirectoryFileInfo, null, null, null, null, null, null));
|
||||
}
|
||||
if (propertyHolderCollection.Any())
|
||||
results.Add(propertyHolderCollection.ToArray());
|
||||
}
|
||||
if (fileInfoKeyValuePairs.Any())
|
||||
throw new Exception();
|
||||
results = (from l in results orderby l[0].G, l[0].R select l).ToList();
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void ParallelFor(List<(int, string, string[], int)> jsonCollection, int i, int length, List<(int, string, List<(string, Models.A_Property?)>, int)> results)
|
||||
{
|
||||
string key;
|
||||
string json;
|
||||
Models.A_Property? property;
|
||||
(int g, string sourceDirectory, string[] sourceDirectoryFiles, int r) = jsonCollection[i];
|
||||
List<(string, Models.A_Property?)> collection = new();
|
||||
foreach (string sourceDirectoryFile in sourceDirectoryFiles)
|
||||
{
|
||||
json = File.ReadAllText(sourceDirectoryFile);
|
||||
key = XPath.GetRelativePath(sourceDirectoryFile, length);
|
||||
property = JsonSerializer.Deserialize<Models.A_Property>(json);
|
||||
collection.Add(new(sourceDirectoryFile, property));
|
||||
}
|
||||
lock (results)
|
||||
results.Add(new(g, sourceDirectory, collection, r));
|
||||
}
|
||||
|
||||
public static List<PropertyHolder[]> Get(Models.Configuration configuration, bool reverse, string modelName, string predictorModelName, PropertyLogic propertyLogic)
|
||||
{
|
||||
List<PropertyHolder[]> results;
|
||||
string searchPattern = "*";
|
||||
long ticks = DateTime.Now.Ticks;
|
||||
List<string> topDirectories = new();
|
||||
List<(int g, string sourceDirectory, string[] sourceDirectoryFiles, int r)> jsonCollection;
|
||||
List<(int g, string sourceDirectory, FileInfo[] sourceDirectoryFiles, int r)> fileInfoGroupCollection;
|
||||
string aPropertySingletonDirectory = IResult.GetResultsDateGroupDirectory(configuration, nameof(A_Property), "{}");
|
||||
List<(int g, string sourceDirectory, List<(string sourceDirectoryFile, Models.A_Property? property)> collection, int r)> collectionFromJson;
|
||||
jsonCollection = GetJsonGroupCollection(aPropertySingletonDirectory);
|
||||
fileInfoGroupCollection = GetFileInfoGroupCollection(configuration, reverse, searchPattern, topDirectories);
|
||||
collectionFromJson = GetCollection(aPropertySingletonDirectory, jsonCollection);
|
||||
results = Populate(configuration, aPropertySingletonDirectory, fileInfoGroupCollection, collectionFromJson);
|
||||
propertyLogic.ParallelWork(configuration, modelName, predictorModelName, ticks, results, firstPass: false);
|
||||
if (propertyLogic.ExceptionsDirectories.Any())
|
||||
throw new Exception();
|
||||
return results;
|
||||
}
|
||||
|
||||
public static int GetDeterministicHashCode(byte[] value)
|
||||
{
|
||||
int result;
|
||||
@ -199,20 +343,20 @@ public static class A_Property
|
||||
result = DateTime.MinValue;
|
||||
else
|
||||
{
|
||||
List<DateTime> datetimes = new()
|
||||
List<DateTime> dateTimes = new()
|
||||
{
|
||||
property.CreationTime,
|
||||
property.LastWriteTime
|
||||
};
|
||||
if (property.DateTime.HasValue)
|
||||
datetimes.Add(property.DateTime.Value);
|
||||
dateTimes.Add(property.DateTime.Value);
|
||||
if (property.DateTimeDigitized.HasValue)
|
||||
datetimes.Add(property.DateTimeDigitized.Value);
|
||||
dateTimes.Add(property.DateTimeDigitized.Value);
|
||||
if (property.DateTimeOriginal.HasValue)
|
||||
datetimes.Add(property.DateTimeOriginal.Value);
|
||||
dateTimes.Add(property.DateTimeOriginal.Value);
|
||||
if (property.GPSDateStamp.HasValue)
|
||||
datetimes.Add(property.GPSDateStamp.Value);
|
||||
result = datetimes.Min();
|
||||
dateTimes.Add(property.GPSDateStamp.Value);
|
||||
result = dateTimes.Min();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -222,139 +366,17 @@ public static class A_Property
|
||||
public static DateTime GetMinimumDateTime(Models.A_Property? property)
|
||||
{
|
||||
DateTime result;
|
||||
List<DateTime> datetimes;
|
||||
List<DateTime> dateTimes;
|
||||
if (property is null)
|
||||
result = DateTime.MinValue;
|
||||
else
|
||||
{
|
||||
datetimes = GetDateTimes(property);
|
||||
result = datetimes.Min();
|
||||
dateTimes = GetDateTimes(property);
|
||||
result = dateTimes.Min();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string[] GetDirectoryRenameCollection(Models.Configuration configuration, string outputResolution, string bMetadata, string cResizeName)
|
||||
{
|
||||
List<string> results = new();
|
||||
string cResizeContentDirectory;
|
||||
string cResizeSingletonDirectory;
|
||||
string bMetadataSingletonDirectory;
|
||||
string aPropertySingletonDirectory;
|
||||
bMetadataSingletonDirectory = IResult.GetResultsDateGroupDirectory(configuration, bMetadata, "{}");
|
||||
if (Directory.Exists(bMetadataSingletonDirectory))
|
||||
results.Add(bMetadataSingletonDirectory);
|
||||
aPropertySingletonDirectory = IResult.GetResultsDateGroupDirectory(configuration, nameof(A_Property), "{}");
|
||||
if (Directory.Exists(aPropertySingletonDirectory))
|
||||
results.Add(aPropertySingletonDirectory);
|
||||
cResizeContentDirectory = Path.Combine(IResult.GetResultsFullGroupDirectory(configuration, cResizeName, outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
if (Directory.Exists(cResizeContentDirectory))
|
||||
results.Add(cResizeContentDirectory);
|
||||
cResizeSingletonDirectory = Path.Combine(IResult.GetResultsFullGroupDirectory(configuration, cResizeName, outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
||||
if (Directory.Exists(cResizeSingletonDirectory))
|
||||
results.Add(cResizeSingletonDirectory);
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
public static void SearchForAbandonedFilesFull(string argZero, string rootDirectory, bool onlyJson)
|
||||
{
|
||||
bool check;
|
||||
string[] files;
|
||||
string moveFile;
|
||||
string extension;
|
||||
string? directory;
|
||||
const int last = 6;
|
||||
string searchPattern;
|
||||
string searchDirectory;
|
||||
int lessThan = last + 1;
|
||||
string? parentDirectory;
|
||||
DirectoryInfo directoryInfo;
|
||||
string fileNameWithoutExtension;
|
||||
IEnumerator<FileInfo> enumerator;
|
||||
List<string[]> fileMovePaths = new();
|
||||
List<string> toReviewFiles = new();
|
||||
int rootDirectoryLength = rootDirectory.Length;
|
||||
for (int i = 1; i < lessThan; i++)
|
||||
{
|
||||
files = i switch
|
||||
{
|
||||
1 => Directory.GetFiles(rootDirectory, "*.json", SearchOption.AllDirectories),
|
||||
2 => Directory.GetFiles(rootDirectory, "*.nosj", SearchOption.AllDirectories),
|
||||
3 => Directory.GetFiles(rootDirectory, "*.jpeg", SearchOption.AllDirectories),
|
||||
4 => Directory.GetFiles(rootDirectory, "*.tvs", SearchOption.AllDirectories),
|
||||
5 => Directory.GetFiles(rootDirectory, "*.png", SearchOption.AllDirectories),
|
||||
last => Directory.GetFiles(rootDirectory, "*", SearchOption.AllDirectories),
|
||||
_ => Array.Empty<string>()
|
||||
};
|
||||
foreach (string file in files)
|
||||
{
|
||||
extension = Path.GetExtension(file);
|
||||
if (extension == ".delete")
|
||||
continue;
|
||||
directory = Path.GetDirectoryName(file);
|
||||
if (string.IsNullOrEmpty(directory))
|
||||
continue;
|
||||
fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
|
||||
if (file.EndsWith(" - R.png"))
|
||||
continue;
|
||||
if (fileNameWithoutExtension.Length < 1)
|
||||
continue;
|
||||
if (fileNameWithoutExtension[1..] != string.Concat(" - ", Path.GetFileNameWithoutExtension(directory)))
|
||||
{
|
||||
searchPattern = string.Concat(fileNameWithoutExtension, '*');
|
||||
searchDirectory = string.Concat(argZero, directory[rootDirectoryLength..]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fileNameWithoutExtension.Length < 4)
|
||||
continue;
|
||||
searchPattern = string.Concat(fileNameWithoutExtension[4..], '*');
|
||||
parentDirectory = Path.GetDirectoryName(directory);
|
||||
if (string.IsNullOrEmpty(parentDirectory))
|
||||
continue;
|
||||
searchDirectory = string.Concat(argZero, parentDirectory[rootDirectoryLength..]);
|
||||
}
|
||||
directoryInfo = new(searchDirectory);
|
||||
if (!directoryInfo.Exists)
|
||||
check = false;
|
||||
else
|
||||
{
|
||||
enumerator = directoryInfo.EnumerateFiles(searchPattern, SearchOption.TopDirectoryOnly).GetEnumerator();
|
||||
check = enumerator.MoveNext();
|
||||
}
|
||||
if (check)
|
||||
continue;
|
||||
toReviewFiles.Add(file);
|
||||
}
|
||||
if (toReviewFiles.Any())
|
||||
throw new Exception("Need to fix property having the extension before .json extension!");
|
||||
foreach (string toReviewFile in toReviewFiles)
|
||||
{
|
||||
extension = Path.GetExtension(toReviewFile);
|
||||
if (extension == ".delete")
|
||||
continue;
|
||||
directory = Path.GetDirectoryName(toReviewFile);
|
||||
if (string.IsNullOrEmpty(directory))
|
||||
continue;
|
||||
moveFile = Path.Combine(directory, Path.ChangeExtension(toReviewFile, ".delete"));
|
||||
if (i == last)
|
||||
fileMovePaths.Add(new string[] { toReviewFile, moveFile });
|
||||
else if (extension is ".nosj")
|
||||
File.Delete(toReviewFile);
|
||||
else
|
||||
{
|
||||
if (File.Exists(moveFile))
|
||||
File.Delete(moveFile);
|
||||
File.Move(toReviewFile, moveFile);
|
||||
}
|
||||
}
|
||||
toReviewFiles.Clear();
|
||||
if (onlyJson)
|
||||
break;
|
||||
}
|
||||
if (fileMovePaths.Any())
|
||||
throw new Exception(string.Join(',', (from l in fileMovePaths select l[0]).ToArray()));
|
||||
}
|
||||
|
||||
public static string GetDiffRootDirectory(string diffPropertyDirectory)
|
||||
{
|
||||
string result = string.Empty;
|
||||
@ -374,4 +396,96 @@ public static class A_Property
|
||||
return result;
|
||||
}
|
||||
|
||||
public static double GetStandardDeviation(IEnumerable<long> values, double average)
|
||||
{
|
||||
double result = 0;
|
||||
if (!values.Any())
|
||||
throw new Exception("Collection must have at least one value!");
|
||||
double sum = values.Sum(l => (l - average) * (l - average));
|
||||
result = Math.Sqrt(sum / values.Count());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static TimeSpan GetThreeStandardDeviationHigh(int minimum, PropertyHolder[] propertyHolderCollection)
|
||||
{
|
||||
TimeSpan result;
|
||||
List<long> ticksCollection = new();
|
||||
foreach (PropertyHolder propertyHolder in propertyHolderCollection)
|
||||
{
|
||||
if (propertyHolder.Property is null || propertyHolder.MinimumDateTime is null)
|
||||
continue;
|
||||
ticksCollection.Add(propertyHolder.MinimumDateTime.Value.Ticks);
|
||||
}
|
||||
long threeStandardDeviationHigh;
|
||||
long min;
|
||||
if (!ticksCollection.Any())
|
||||
min = 0;
|
||||
else
|
||||
min = ticksCollection.Min();
|
||||
if (ticksCollection.Count < minimum)
|
||||
threeStandardDeviationHigh = long.MaxValue;
|
||||
else
|
||||
{
|
||||
ticksCollection = (from l in ticksCollection select l - min).ToList();
|
||||
double sum = ticksCollection.Sum();
|
||||
double average = sum / ticksCollection.Count;
|
||||
double standardDeviation = GetStandardDeviation(ticksCollection, average);
|
||||
threeStandardDeviationHigh = (long)Math.Ceiling(average + min + (standardDeviation * 3));
|
||||
}
|
||||
result = new TimeSpan(threeStandardDeviationHigh - min);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static (int, List<DateTime>, List<PropertyHolder>) Get(PropertyHolder[] propertyHolderCollection, TimeSpan threeStandardDeviationHigh, int i)
|
||||
{
|
||||
List<PropertyHolder> results = new();
|
||||
int j = i;
|
||||
long? ticks;
|
||||
TimeSpan timeSpan;
|
||||
PropertyHolder propertyHolder;
|
||||
List<DateTime> dateTimes = new();
|
||||
PropertyHolder nextPropertyHolder;
|
||||
for (; j < propertyHolderCollection.Length; j++)
|
||||
{
|
||||
ticks = null;
|
||||
propertyHolder = propertyHolderCollection[j];
|
||||
if (propertyHolder.Property is null || propertyHolder.MinimumDateTime is null)
|
||||
continue;
|
||||
for (int k = j + 1; k < propertyHolderCollection.Length; k++)
|
||||
{
|
||||
nextPropertyHolder = propertyHolderCollection[k];
|
||||
if (nextPropertyHolder.Property is not null && nextPropertyHolder.MinimumDateTime is not null)
|
||||
{
|
||||
ticks = nextPropertyHolder.MinimumDateTime.Value.Ticks;
|
||||
break;
|
||||
}
|
||||
}
|
||||
results.Add(propertyHolder);
|
||||
dateTimes.Add(propertyHolder.MinimumDateTime.Value);
|
||||
if (ticks.HasValue)
|
||||
{
|
||||
timeSpan = new(ticks.Value - propertyHolder.MinimumDateTime.Value.Ticks);
|
||||
if (timeSpan > threeStandardDeviationHigh)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new(j, dateTimes, results);
|
||||
}
|
||||
|
||||
public static bool Any(List<PropertyHolder[]> propertyHolderCollections)
|
||||
{
|
||||
bool result = false;
|
||||
foreach (PropertyHolder[] propertyHolderCollection in propertyHolderCollections)
|
||||
{
|
||||
if (!propertyHolderCollection.Any())
|
||||
continue;
|
||||
if ((from l in propertyHolderCollection where l.Any() select true).Any())
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -15,10 +15,10 @@ public interface IResult
|
||||
string TestStatic_GetResultsDateGroupDirectory(Models.Configuration configuration, string description, string jsonGroup);
|
||||
static string GetResultsDateGroupDirectory(Models.Configuration configuration, string description, string jsonGroup) => Result.GetResultsDateGroupDirectory(configuration, description, jsonGroup);
|
||||
|
||||
string TestStatic_GetResultsFullGroupDirectory(Models.Configuration configuration, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel);
|
||||
static string GetResultsFullGroupDirectory(Models.Configuration configuration, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel) => Result.GetResultsFullGroupDirectory(configuration, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
||||
string TestStatic_GetResultsFullGroupDirectory(Models.Configuration configuration, string modelName, string predictorModelName, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel);
|
||||
static string GetResultsFullGroupDirectory(Models.Configuration configuration, string modelName, string predictorModelName, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel) => Result.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
||||
|
||||
List<string> TestStatic_GetDirectoryInfoCollection(Models.Configuration configuration, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription);
|
||||
static List<string> GetDirectoryInfoCollection(Models.Configuration configuration, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription) => Result.GetDirectoryInfoCollection(configuration, sourceDirectory, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel, contentDescription, singletonDescription, collectionDescription);
|
||||
static List<string> GetDirectoryInfoCollection(Models.Configuration configuration, string modelName, string predictorModelName, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription) => Result.GetDirectoryInfoCollection(configuration, modelName, predictorModelName, sourceDirectory, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel, contentDescription, singletonDescription, collectionDescription);
|
||||
|
||||
}
|
@ -33,14 +33,14 @@ internal class Result
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static string GetResultsFullGroupDirectory(Models.Configuration configuration, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel)
|
||||
internal static string GetResultsFullGroupDirectory(Models.Configuration configuration, string modelName, string predictorModelName, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel)
|
||||
{
|
||||
string result = GetResultsDateGroupDirectory(configuration, description);
|
||||
if (includeResizeGroup)
|
||||
result = Path.Combine(result, outputResolution);
|
||||
if (includeModel && includePredictorModel)
|
||||
{
|
||||
string dateGroupDirectory = string.Concat(outputResolution.Replace(" ", string.Empty), " - ", "_Configuration.ModelName", " - ", "_Configuration.PredictorModelName");
|
||||
string dateGroupDirectory = string.Concat(outputResolution.Replace(" ", string.Empty), " - ", modelName, " - ", predictorModelName);
|
||||
result = Path.Combine(result, dateGroupDirectory);
|
||||
}
|
||||
else if (includeModel)
|
||||
@ -52,17 +52,17 @@ internal class Result
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static List<string> GetDirectoryInfoCollection(Models.Configuration configuration, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription)
|
||||
internal static List<string> GetDirectoryInfoCollection(Models.Configuration configuration, string modelName, string predictorModelName, string sourceDirectory, string description, string outputResolution, bool includeResizeGroup, bool includeModel, bool includePredictorModel, string contentDescription, string singletonDescription, string collectionDescription)
|
||||
{
|
||||
List<string> results = new();
|
||||
string result = string.Empty;
|
||||
string checkDirectory;
|
||||
string sourceDirectorySegment = GetRelativePath(configuration, sourceDirectory);
|
||||
string dateGroupDirectory = IResult.GetResultsFullGroupDirectory(configuration, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
||||
string dateGroupDirectory = IResult.GetResultsFullGroupDirectory(configuration, modelName, predictorModelName, description, outputResolution, includeResizeGroup, includeModel, includePredictorModel);
|
||||
if (!string.IsNullOrEmpty(contentDescription))
|
||||
{
|
||||
result = string.Concat(Path.Combine(dateGroupDirectory, "<>"), sourceDirectorySegment);
|
||||
DirectoryInfo contentDirectoryInfo = new(result.Replace("<>", "()"));
|
||||
System.IO.DirectoryInfo contentDirectoryInfo = new(result.Replace("<>", "()"));
|
||||
if (!contentDirectoryInfo.Exists)
|
||||
contentDirectoryInfo.Create();
|
||||
checkDirectory = Path.Combine(dateGroupDirectory, string.Concat("() - ", contentDescription));
|
||||
@ -72,7 +72,7 @@ internal class Result
|
||||
if (!string.IsNullOrEmpty(singletonDescription))
|
||||
{
|
||||
result = string.Concat(Path.Combine(dateGroupDirectory, "<>"), sourceDirectorySegment);
|
||||
DirectoryInfo singletonDirectoryInfo = new(result.Replace("<>", "{}"));
|
||||
System.IO.DirectoryInfo singletonDirectoryInfo = new(result.Replace("<>", "{}"));
|
||||
if (!singletonDirectoryInfo.Exists)
|
||||
singletonDirectoryInfo.Create();
|
||||
checkDirectory = Path.Combine(dateGroupDirectory, string.Concat("{} - ", singletonDescription));
|
||||
@ -82,7 +82,7 @@ internal class Result
|
||||
if (!string.IsNullOrEmpty(collectionDescription))
|
||||
{
|
||||
result = string.Concat(Path.Combine(dateGroupDirectory, "<>"), sourceDirectorySegment);
|
||||
DirectoryInfo collectionDirectoryInfo = new(result.Replace("<>", "[]"));
|
||||
System.IO.DirectoryInfo collectionDirectoryInfo = new(result.Replace("<>", "[]"));
|
||||
if (!collectionDirectoryInfo.Exists)
|
||||
collectionDirectoryInfo.Create();
|
||||
checkDirectory = Path.Combine(dateGroupDirectory, string.Concat("[] - ", collectionDescription));
|
||||
|
Reference in New Issue
Block a user