Removed E2_Navigate, G_Index, G2_Identify and
NotCopyCopy
This commit is contained in:
parent
e9d2c6374e
commit
83151770f7
@ -22,8 +22,6 @@ public class Configuration
|
||||
[Display(Name = "Julie Phares Copy Birthdays"), Required] public string[] JLinks { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Distance Results"), Required] public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Image Faces Results"), Required] public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Index"), Required] public bool? LoadOrCreateThenSaveIndex { get; set; }
|
||||
[Display(Name = "Mapped Max Index"), Required] public int? MappedMaxIndex { get; set; }
|
||||
[Display(Name = "Mixed Year Relative Paths"), Required] public string[] MixedYearRelativePaths { get; set; }
|
||||
[Display(Name = "Model Directory"), Required] public string ModelDirectory { get; set; }
|
||||
[Display(Name = "Model Name"), Required] public string ModelName { get; set; }
|
||||
@ -86,8 +84,6 @@ public class Configuration
|
||||
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions ??= Array.Empty<string>();
|
||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions ??= Array.Empty<string>();
|
||||
if (configuration.LoadOrCreateThenSaveIndex is null)
|
||||
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
||||
if (configuration.MixedYearRelativePaths is null)
|
||||
throw new NullReferenceException(nameof(configuration.MixedYearRelativePaths));
|
||||
if (configuration.NumberOfJitters is null)
|
||||
@ -144,8 +140,6 @@ public class Configuration
|
||||
configuration.JLinks,
|
||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions,
|
||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions,
|
||||
configuration.LoadOrCreateThenSaveIndex.Value,
|
||||
configuration.MappedMaxIndex,
|
||||
configuration.MixedYearRelativePaths,
|
||||
configuration.ModelDirectory,
|
||||
configuration.ModelName,
|
||||
|
@ -21,8 +21,6 @@ public class Configuration
|
||||
public string[] JLinks { init; get; }
|
||||
public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { init; get; }
|
||||
public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { init; get; }
|
||||
public bool LoadOrCreateThenSaveIndex { init; get; }
|
||||
public int? MappedMaxIndex { init; get; }
|
||||
public string[] MixedYearRelativePaths { init; get; }
|
||||
public string ModelDirectory { init; get; }
|
||||
public string ModelName { init; get; }
|
||||
@ -65,8 +63,6 @@ public class Configuration
|
||||
string[] jLinks,
|
||||
string[] loadOrCreateThenSaveDistanceResultsForOutputResolutions,
|
||||
string[] loadOrCreateThenSaveImageFacesResultsForOutputResolutions,
|
||||
bool loadOrCreateThenSaveIndex,
|
||||
int? mappedMaxIndex,
|
||||
string[] mixedYearRelativePaths,
|
||||
string modelDirectory,
|
||||
string modelName,
|
||||
@ -108,8 +104,6 @@ public class Configuration
|
||||
JLinks = jLinks;
|
||||
LoadOrCreateThenSaveDistanceResultsForOutputResolutions = loadOrCreateThenSaveDistanceResultsForOutputResolutions;
|
||||
LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = loadOrCreateThenSaveImageFacesResultsForOutputResolutions;
|
||||
LoadOrCreateThenSaveIndex = loadOrCreateThenSaveIndex;
|
||||
MappedMaxIndex = mappedMaxIndex;
|
||||
MixedYearRelativePaths = mixedYearRelativePaths;
|
||||
ModelDirectory = modelDirectory;
|
||||
ModelName = modelName;
|
||||
|
@ -22,10 +22,8 @@ public partial class DlibDotNet
|
||||
{
|
||||
|
||||
private readonly D_Face _Faces;
|
||||
private readonly G_Index _Index;
|
||||
private readonly C_Resize _Resize;
|
||||
private readonly F_Random _Random;
|
||||
private readonly E3_Rename _Rename;
|
||||
private readonly IConsole _Console;
|
||||
private readonly E_Distance _Distance;
|
||||
private readonly Serilog.ILogger? _Log;
|
||||
@ -62,9 +60,7 @@ public partial class DlibDotNet
|
||||
Verify(configuration);
|
||||
VerifyExtra(args, propertyConfiguration, configuration);
|
||||
_Configuration = configuration;
|
||||
_Index = new(configuration);
|
||||
_Random = new(configuration);
|
||||
_Rename = new(configuration);
|
||||
if (configuration.IgnoreExtensions is null)
|
||||
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
||||
string propertyRoot = Property.Models.Stateless.IResult.GetResultsGroupDirectory(propertyConfiguration, nameof(A_Property), create: false);
|
||||
@ -121,12 +117,6 @@ public partial class DlibDotNet
|
||||
Storage storage = new(rootDirectory, rootResultsDirectory, peopleRootDirectory);
|
||||
_PersonContainers = Shared.Models.Stateless.Methods.IPersonContainer.GetPersonContainers(storage, configuration.PersonBirthdayFormat, configuration.PersonCharacters.ToArray(), _Faces.FileNameExtension);
|
||||
}
|
||||
if (!isSilent && configuration.TestDistanceResults)
|
||||
{
|
||||
E2_Navigate e2Navigate = new(console, configuration, argZero);
|
||||
e2Navigate.Navigate(propertyConfiguration, configuration.OutputResolutions[0]);
|
||||
_Log.Information(propertyConfiguration.RootDirectory);
|
||||
}
|
||||
{
|
||||
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) = C_Resize.GetTuple(
|
||||
configuration.OutputExtension,
|
||||
@ -144,16 +134,6 @@ public partial class DlibDotNet
|
||||
Search(ticks, argZero, propertyRoot);
|
||||
if (!_PropertyRootExistedBefore && !_IsEnvironment.Development && _Exceptions.Count == 0 && _ArgZeroIsConfigurationRootDirectory)
|
||||
{
|
||||
List<string[]> directoryCollections = _Rename.GetDirectoryRenameCollections(
|
||||
propertyConfiguration,
|
||||
relativePath: string.Empty,
|
||||
newDirectoryName: string.Empty,
|
||||
jsonFiles4InfoAny: false);
|
||||
foreach (string[] directoryCollection in directoryCollections)
|
||||
{
|
||||
_Log.Information(string.Concat("Cleaning <", directoryCollection[0], ">"));
|
||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(directoryCollection[0]);
|
||||
}
|
||||
string d2FacePartsRootDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(propertyConfiguration, nameof(D2_FaceParts));
|
||||
_Log.Information(string.Concat("Cleaning <", d2FacePartsRootDirectory, ">"));
|
||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(d2FacePartsRootDirectory);
|
||||
@ -225,8 +205,6 @@ public partial class DlibDotNet
|
||||
throw new NullReferenceException(nameof(configuration.PredictorModelName));
|
||||
if (string.IsNullOrEmpty(configuration.ModelDirectory) || !Directory.Exists(configuration.ModelDirectory))
|
||||
throw new NullReferenceException(nameof(configuration.ModelDirectory));
|
||||
if (configuration.MappedMaxIndex.HasValue && configuration.LoadOrCreateThenSaveIndex && !_IsEnvironment.DebuggerWasAttachedDuringConstructor)
|
||||
throw new NullReferenceException(nameof(configuration.MappedMaxIndex));
|
||||
}
|
||||
|
||||
private void VerifyExtra(List<string> args, Property.Models.Configuration propertyConfiguration, Models.Configuration configuration)
|
||||
@ -1116,11 +1094,6 @@ public partial class DlibDotNet
|
||||
_Random.Random(_Configuration.PropertyConfiguration, outputResolution, personKeyToIds, mappingCollection);
|
||||
if (_IsEnvironment.Development)
|
||||
continue;
|
||||
G2_Identify identify = new(_Configuration);
|
||||
List<G2_Identify> identifiedCollection = identify.GetIdentifiedCollection(_IsEnvironment, _Configuration.PropertyConfiguration, _Faces.FileNameExtension);
|
||||
identify.WriteAllText(_Configuration.PropertyConfiguration, _Configuration.OutputResolutions[0], identifiedCollection);
|
||||
if (_Configuration.LoadOrCreateThenSaveIndex)
|
||||
_Index.SetIndex(_Configuration.PropertyConfiguration, _Configuration.OutputResolutions[0]);
|
||||
if (!_IsEnvironment.Development)
|
||||
{
|
||||
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(Path.Combine(aResultsFullGroupDirectory, "{}"));
|
||||
@ -1132,6 +1105,4 @@ public partial class DlibDotNet
|
||||
}
|
||||
}
|
||||
|
||||
internal void RenameQueue() => _Rename.RenameQueue(_Configuration.PropertyConfiguration);
|
||||
|
||||
}
|
@ -30,10 +30,8 @@ public class Configuration
|
||||
[Display(Name = "Julie Phares Copy Birthdays"), Required] public string[] JLinks { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Distance Results"), Required] public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Image Faces Results"), Required] public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Index"), Required] public bool? LoadOrCreateThenSaveIndex { get; set; }
|
||||
[Display(Name = "Location Digits"), Required] public int? LocationDigits { get; set; }
|
||||
[Display(Name = "Location Factor"), Required] public int? LocationFactor { get; set; }
|
||||
[Display(Name = "Mapped Max Index"), Required] public int? MappedMaxIndex { get; set; }
|
||||
[Display(Name = "Mapping Default Name"), Required] public string MappingDefaultName { get; set; }
|
||||
[Display(Name = "Mapping Use Deterministic Hash Code Unknown Face Key Value Pairs for Add to Mapping"), Required] public bool? MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping { get; set; }
|
||||
[Display(Name = "Mapping Use Deterministic Hash Code Unknown Face Key Value Pairs for Save Mapping"), Required] public bool? MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping { get; set; }
|
||||
@ -130,8 +128,6 @@ public class Configuration
|
||||
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions ??= Array.Empty<string>();
|
||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions ??= Array.Empty<string>();
|
||||
if (configuration.LoadOrCreateThenSaveIndex is null)
|
||||
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
||||
if (configuration.LocationDigits is null)
|
||||
throw new NullReferenceException(nameof(configuration.LocationDigits));
|
||||
if (configuration.LocationFactor is null)
|
||||
@ -235,10 +231,8 @@ public class Configuration
|
||||
configuration.JLinks,
|
||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions,
|
||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions,
|
||||
configuration.LoadOrCreateThenSaveIndex.Value,
|
||||
configuration.LocationDigits.Value,
|
||||
configuration.LocationFactor.Value,
|
||||
configuration.MappedMaxIndex,
|
||||
configuration.MappingDefaultName,
|
||||
configuration.MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping.Value,
|
||||
configuration.MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping.Value,
|
||||
|
@ -29,10 +29,8 @@ public class Configuration
|
||||
public string[] JLinks { init; get; }
|
||||
public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { init; get; }
|
||||
public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { init; get; }
|
||||
public bool LoadOrCreateThenSaveIndex { init; get; }
|
||||
public int LocationDigits { init; get; }
|
||||
public int LocationFactor { init; get; }
|
||||
public int? MappedMaxIndex { init; get; }
|
||||
public string MappingDefaultName { init; get; }
|
||||
public bool MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping { init; get; }
|
||||
public bool MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping { init; get; }
|
||||
@ -99,10 +97,8 @@ public class Configuration
|
||||
string[] jLinks,
|
||||
string[] loadOrCreateThenSaveDistanceResultsForOutputResolutions,
|
||||
string[] loadOrCreateThenSaveImageFacesResultsForOutputResolutions,
|
||||
bool loadOrCreateThenSaveIndex,
|
||||
int locationDigits,
|
||||
int locationFactor,
|
||||
int? mappedMaxIndex,
|
||||
string mappingDefaultName,
|
||||
bool mappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping,
|
||||
bool mappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping,
|
||||
@ -168,10 +164,8 @@ public class Configuration
|
||||
JLinks = jLinks;
|
||||
LoadOrCreateThenSaveDistanceResultsForOutputResolutions = loadOrCreateThenSaveDistanceResultsForOutputResolutions;
|
||||
LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = loadOrCreateThenSaveImageFacesResultsForOutputResolutions;
|
||||
LoadOrCreateThenSaveIndex = loadOrCreateThenSaveIndex;
|
||||
LocationDigits = locationDigits;
|
||||
LocationFactor = locationFactor;
|
||||
MappedMaxIndex = mappedMaxIndex;
|
||||
MappingDefaultName = mappingDefaultName;
|
||||
MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping = mappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping;
|
||||
MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping = mappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping;
|
||||
|
@ -1,232 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using View_by_Distance.Distance.Models;
|
||||
using View_by_Distance.Face.Models;
|
||||
using View_by_Distance.Instance.Models.Stateless;
|
||||
using View_by_Distance.Metadata.Models;
|
||||
using View_by_Distance.Resize.Models;
|
||||
using View_by_Distance.Shared.Models;
|
||||
using View_by_Distance.Shared.Models.Methods;
|
||||
|
||||
namespace View_by_Distance.Instance.Models;
|
||||
|
||||
/// <summary>
|
||||
// N/A
|
||||
/// </summary>
|
||||
internal class E2_Navigate
|
||||
{
|
||||
|
||||
private readonly string _ArgZero;
|
||||
private readonly E3_Rename _Rename;
|
||||
private readonly IConsole _Console;
|
||||
private readonly Serilog.ILogger? _Log;
|
||||
private readonly Configuration _Configuration;
|
||||
|
||||
internal E2_Navigate(IConsole console, Configuration configuration, string argZero)
|
||||
{
|
||||
_Console = console;
|
||||
_ArgZero = argZero;
|
||||
_Configuration = configuration;
|
||||
_Rename = new E3_Rename(configuration);
|
||||
_Log = Serilog.Log.ForContext<E2_Navigate>();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
private void DisplayTags(Property.Models.Configuration configuration, string outputResolution, string[] directories, Dictionary<ConsoleKey, int> directoryKeyValuePairs, string[] files, Dictionary<ConsoleKey, int> fileKeyValuePairs)
|
||||
{
|
||||
if (_Log is null)
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
bool all = false;
|
||||
FileSystem fileSystem;
|
||||
string requestPath = "/RootResultsDirectory";
|
||||
string? rootResultsDirectory = Path.GetDirectoryName(Property.Models.Stateless.IResult.GetResultsGroupDirectory(configuration, nameof(B_Metadata)));
|
||||
if (string.IsNullOrEmpty(rootResultsDirectory))
|
||||
throw new Exception();
|
||||
string rootResultsDirectoryAbsoluteUri = new Uri(rootResultsDirectory).AbsoluteUri;
|
||||
string dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
string cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
(string RootResultsDirectoryAbsoluteUri, string C_ResizeContentDirectory, string D_FacesContentDirectory, string E_DistanceCollectionDirectory) tuple = new(rootResultsDirectoryAbsoluteUri, cResizeContentDirectory, dFacesContentDirectory, eDistanceCollectionDirectory);
|
||||
List<FileSystem> fileSystemCollection = Shared.Models.Stateless.Methods.IFileSystem.GetFileSystemCollection(requestPath, tuple, directories, files, all);
|
||||
Queue<FileSystem> queue = new(fileSystemCollection);
|
||||
foreach (KeyValuePair<ConsoleKey, int> element in directoryKeyValuePairs)
|
||||
{
|
||||
fileSystem = queue.Dequeue();
|
||||
_Log.Warn(string.Concat(element.Key, " - D) ", " <", fileSystem.Display, ">"));
|
||||
// _Log.Info(string.Join(Environment.NewLine, from l in fileSystem where !string.IsNullOrEmpty(l) select l));
|
||||
_Log.Info(string.Empty);
|
||||
}
|
||||
foreach (KeyValuePair<ConsoleKey, int> element in fileKeyValuePairs)
|
||||
{
|
||||
fileSystem = queue.Dequeue();
|
||||
_Log.Warn(string.Concat(element.Key, " - F) [", fileSystem.Display, '}'));
|
||||
// _Log.Info(string.Join(Environment.NewLine, from l in fileSystem where !string.IsNullOrEmpty(l) select l));
|
||||
_Log.Info(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayFaces(Property.Models.Configuration configuration, string outputResolution, string selectedFileFullName)
|
||||
{
|
||||
if (_Log is null)
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
string requestPath = "/RootResultsDirectory";
|
||||
string? rootResultsDirectory = Path.GetDirectoryName(Property.Models.Stateless.IResult.GetResultsGroupDirectory(configuration, nameof(B_Metadata)));
|
||||
if (string.IsNullOrEmpty(rootResultsDirectory))
|
||||
throw new Exception();
|
||||
string rootResultsDirectoryAbsoluteUri = new Uri(rootResultsDirectory).AbsoluteUri;
|
||||
string dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
string cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
(string RootResultsDirectoryAbsoluteUri, string C_ResizeContentDirectory, string D_FacesContentDirectory, string E_DistanceCollectionDirectory) tuple = new(rootResultsDirectoryAbsoluteUri, cResizeContentDirectory, dFacesContentDirectory, eDistanceCollectionDirectory);
|
||||
FaceFileSystem[] faceFileSystemCollection = Shared.Models.Stateless.Methods.IFaceFileSystem.GetFaceFileSystemCollection(requestPath, tuple, selectedFileFullName);
|
||||
for (int i = 0; i < faceFileSystemCollection.Length; i++)
|
||||
{
|
||||
_Log.Warn(string.Concat(i, " - F) [", faceFileSystemCollection[i].Display, '}'));
|
||||
// _Log.Info(string.Join(Environment.NewLine, from l in fileSystemCollection[i] where !string.IsNullOrEmpty(l) select l));
|
||||
_Log.Info(string.Empty);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
private string Rename(Property.Models.Configuration configuration, string subSourceDirectory)
|
||||
{
|
||||
string result;
|
||||
if (_Log is null)
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
_Log.Warn(string.Concat("What is the new name for [", Path.GetFileName(subSourceDirectory), "]<", subSourceDirectory, ">?"));
|
||||
string? newDirectoryName = _Console.ReadLine();
|
||||
_Log.Warn("Are you sure y[es] || n[o]?");
|
||||
if (string.IsNullOrEmpty(newDirectoryName) || _Console.ReadKey() != ConsoleKey.Y)
|
||||
{
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn("No changes made.");
|
||||
result = subSourceDirectory;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Log.Warn(string.Empty);
|
||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
string relativePath = Shared.Models.Stateless.Methods.IPath.GetRelativePath(subSourceDirectory, eDistanceCollectionDirectory.Length);
|
||||
if (relativePath.Length == 1)
|
||||
throw new Exception();
|
||||
if (Directory.Exists(Path.Combine(string.Concat(_Configuration.PropertyConfiguration.RootDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName)))
|
||||
{
|
||||
_Log.Warn("\"To\" directory already exits!");
|
||||
result = subSourceDirectory;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Rename.DirectoryRename(configuration, relativePath, newDirectoryName);
|
||||
_Log.Warn("Renamed...");
|
||||
string? directoryName = Path.GetDirectoryName(subSourceDirectory);
|
||||
if (string.IsNullOrEmpty(directoryName))
|
||||
throw new Exception();
|
||||
result = Path.Combine(directoryName, newDirectoryName);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void Navigate(Property.Models.Configuration configuration, string outputResolution)
|
||||
{
|
||||
if (_Log is null)
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
string[] subFiles;
|
||||
ConsoleKey consoleKey;
|
||||
string[] subDirectories;
|
||||
string selectedFileFullName;
|
||||
string rootDirectory = string.Empty;
|
||||
string? subSourceDirectory = string.Empty;
|
||||
Dictionary<ConsoleKey, int> fileKeyValuePairs = new();
|
||||
Dictionary<ConsoleKey, int> directoryKeyValuePairs = new();
|
||||
string eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), _Configuration.OutputResolutions[0], includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
if (!Directory.Exists(eDistanceCollectionDirectory))
|
||||
_ = Directory.CreateDirectory(eDistanceCollectionDirectory);
|
||||
for (int z = 0; z < int.MaxValue; z++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(subSourceDirectory))
|
||||
{
|
||||
rootDirectory = eDistanceCollectionDirectory;
|
||||
subSourceDirectory = rootDirectory;
|
||||
}
|
||||
subFiles = Directory.GetFiles(subSourceDirectory, "*.json", SearchOption.TopDirectoryOnly);
|
||||
subDirectories = Directory.GetDirectories(subSourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
directoryKeyValuePairs.Clear();
|
||||
for (int i = (int)ConsoleKey.A; i < (subDirectories.Length + (int)ConsoleKey.A) && i <= (int)ConsoleKey.RightWindows; i++)
|
||||
directoryKeyValuePairs.Add((ConsoleKey)i, i - (int)ConsoleKey.A);
|
||||
fileKeyValuePairs.Clear();
|
||||
for (int i = (int)ConsoleKey.A + subDirectories.Length; i < (subFiles.Length + (int)ConsoleKey.A + subDirectories.Length) && i <= (int)ConsoleKey.RightWindows; i++)
|
||||
fileKeyValuePairs.Add((ConsoleKey)i, i - (int)ConsoleKey.A);
|
||||
if (!directoryKeyValuePairs.Any() && !fileKeyValuePairs.Any())
|
||||
break;
|
||||
_Log.Warn("");
|
||||
DisplayTags(configuration, outputResolution, subDirectories, directoryKeyValuePairs, subFiles, fileKeyValuePairs);
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn("Select a file system object. Enter \"Backspace\" to go up a directory, \"F2\" to rename and \"Esc\" to end navigation.");
|
||||
consoleKey = _Console.ReadKey();
|
||||
_Log.Warn(string.Empty);
|
||||
if (consoleKey == ConsoleKey.Escape)
|
||||
break;
|
||||
if (consoleKey == ConsoleKey.F2)
|
||||
{
|
||||
if (subSourceDirectory == rootDirectory)
|
||||
{
|
||||
_Log.Warn("Root directory can not be renamed! Try again.");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
subSourceDirectory = Rename(configuration, subSourceDirectory);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (consoleKey is ConsoleKey.Backspace or ConsoleKey.LeftArrow)
|
||||
{
|
||||
if (subSourceDirectory != rootDirectory)
|
||||
subSourceDirectory = Path.GetDirectoryName(subSourceDirectory);
|
||||
else
|
||||
{
|
||||
_Log.Warn("At root directory. Try again.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (directoryKeyValuePairs.ContainsKey(consoleKey))
|
||||
{
|
||||
subSourceDirectory = subDirectories[directoryKeyValuePairs[consoleKey]];
|
||||
_Log.Warn(string.Concat(">>> [", Path.GetFileName(subSourceDirectory), "]<", subSourceDirectory, ">?"));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!fileKeyValuePairs.ContainsKey(consoleKey))
|
||||
{
|
||||
subSourceDirectory = _ArgZero;
|
||||
_Log.Warn("Invalid selection. Try again.");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedFileFullName = subFiles[fileKeyValuePairs[consoleKey]];
|
||||
_Log.Warn(string.Concat(">>> [", Path.GetFileName(selectedFileFullName), "]<", selectedFileFullName, ">?"));
|
||||
DisplayFaces(configuration, outputResolution, selectedFileFullName);
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn(string.Empty);
|
||||
_Log.Warn("Go up a directory? Enter escape end.");
|
||||
consoleKey = _Console.ReadKey();
|
||||
if (consoleKey == ConsoleKey.Escape)
|
||||
break;
|
||||
subSourceDirectory = Path.GetDirectoryName(subSourceDirectory);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,336 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using View_by_Distance.Distance.Models;
|
||||
using View_by_Distance.Face.Models;
|
||||
using View_by_Distance.FaceParts.Models;
|
||||
using View_by_Distance.Metadata.Models;
|
||||
using View_by_Distance.Resize.Models;
|
||||
|
||||
namespace View_by_Distance.Instance.Models;
|
||||
|
||||
/// <summary>
|
||||
// N/A
|
||||
/// </summary>
|
||||
internal class E3_Rename
|
||||
{
|
||||
|
||||
private readonly Serilog.ILogger? _Log;
|
||||
private readonly Configuration _Configuration;
|
||||
private readonly JsonSerializerOptions _WriteIndentedJsonSerializerOptions;
|
||||
|
||||
internal E3_Rename(Configuration configuration)
|
||||
{
|
||||
_Configuration = configuration;
|
||||
_Log = Serilog.Log.ForContext<G2_Identify>();
|
||||
_WriteIndentedJsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
internal string[] GetDirectoryRenameCollection(Property.Models.Configuration configuration, string relativePath, string newDirectoryName, bool jsonFiles4InfoAny)
|
||||
{
|
||||
List<string> results = new();
|
||||
bool add;
|
||||
string to;
|
||||
string dFacesContentDirectory;
|
||||
string cResizeContentDirectory;
|
||||
string dFacesCollectionDirectory;
|
||||
string cResizeSingletonDirectory;
|
||||
string eDistanceContentDirectory;
|
||||
string aPropertySingletonDirectory;
|
||||
string d2FacePartsContentDirectory;
|
||||
string bMetadataSingletonDirectory;
|
||||
string eDistanceCollectionDirectory;
|
||||
string g2IdentifyCollectionDirectory;
|
||||
add = Directory.Exists(string.Concat(Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()"), relativePath));
|
||||
bMetadataSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(B_Metadata), "{}");
|
||||
if (Directory.Exists(bMetadataSingletonDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(bMetadataSingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(Property.Models.A_Property), "{}");
|
||||
if (Directory.Exists(aPropertySingletonDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(aPropertySingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), _Configuration.ValidResolutions[0], includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
if (Directory.Exists(cResizeContentDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(cResizeContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
foreach (string outputResolution in _Configuration.ValidResolutions)
|
||||
{
|
||||
cResizeSingletonDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
||||
if (Directory.Exists(cResizeSingletonDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(cResizeSingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
if (Directory.Exists(dFacesContentDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(dFacesContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
if (Directory.Exists(dFacesCollectionDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(dFacesCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
d2FacePartsContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D2_FaceParts), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
if (add && _Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution) && Directory.Exists(d2FacePartsContentDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(d2FacePartsContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
eDistanceContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
if (Directory.Exists(eDistanceContentDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(eDistanceContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
if (Directory.Exists(eDistanceCollectionDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(eDistanceCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
g2IdentifyCollectionDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(G2_Identify), "[]");
|
||||
if (add && jsonFiles4InfoAny && Directory.Exists(g2IdentifyCollectionDirectory))
|
||||
{
|
||||
to = Path.Combine(string.Concat(g2IdentifyCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(to);
|
||||
}
|
||||
}
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
internal List<string[]> GetDirectoryRenameCollections(Property.Models.Configuration configuration, string relativePath, string newDirectoryName, bool jsonFiles4InfoAny)
|
||||
{
|
||||
List<string[]> results = new();
|
||||
bool add;
|
||||
string to;
|
||||
bool exists;
|
||||
string from;
|
||||
string dFacesContentDirectory;
|
||||
string cResizeContentDirectory;
|
||||
string dFacesCollectionDirectory;
|
||||
string cResizeSingletonDirectory;
|
||||
string eDistanceContentDirectory;
|
||||
string bMetadataSingletonDirectory;
|
||||
string aPropertySingletonDirectory;
|
||||
string d2FacePartsContentDirectory;
|
||||
string eDistanceCollectionDirectory;
|
||||
string g2IdentifyCollectionDirectory;
|
||||
if (!string.IsNullOrEmpty(relativePath))
|
||||
{
|
||||
from = string.Concat(_Configuration.PropertyConfiguration.RootDirectory, relativePath);
|
||||
to = Path.Combine(string.Concat(_Configuration.PropertyConfiguration.RootDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
foreach (string outputResolution in _Configuration.ValidResolutions)
|
||||
{
|
||||
add = Directory.Exists(string.Concat(Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()"), relativePath));
|
||||
bMetadataSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(B_Metadata), "{}");
|
||||
from = string.Concat(bMetadataSingletonDirectory, relativePath);
|
||||
exists = Directory.Exists(bMetadataSingletonDirectory);
|
||||
if (exists)
|
||||
{
|
||||
to = Path.Combine(string.Concat(bMetadataSingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(Property.Models.A_Property), "{}");
|
||||
from = string.Concat(aPropertySingletonDirectory, relativePath);
|
||||
exists = Directory.Exists(aPropertySingletonDirectory);
|
||||
if (exists)
|
||||
{
|
||||
to = Path.Combine(string.Concat(aPropertySingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
cResizeContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "()");
|
||||
from = string.Concat(cResizeContentDirectory, relativePath);
|
||||
exists = Directory.Exists(cResizeContentDirectory);
|
||||
if (exists)
|
||||
{
|
||||
to = Path.Combine(string.Concat(cResizeContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
cResizeSingletonDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(C_Resize), outputResolution, includeResizeGroup: true, includeModel: false, includePredictorModel: false), "{}");
|
||||
from = string.Concat(cResizeSingletonDirectory, relativePath);
|
||||
exists = Directory.Exists(cResizeSingletonDirectory);
|
||||
if (exists)
|
||||
{
|
||||
to = Path.Combine(string.Concat(cResizeSingletonDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
dFacesContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
from = string.Concat(dFacesContentDirectory, relativePath);
|
||||
exists = Directory.Exists(dFacesContentDirectory);
|
||||
if (exists)
|
||||
{
|
||||
to = Path.Combine(string.Concat(dFacesContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
dFacesCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D_Face), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
from = string.Concat(dFacesCollectionDirectory, relativePath);
|
||||
exists = Directory.Exists(dFacesCollectionDirectory);
|
||||
if (exists)
|
||||
{
|
||||
to = Path.Combine(string.Concat(dFacesCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
d2FacePartsContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(D2_FaceParts), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
from = string.Concat(d2FacePartsContentDirectory, relativePath);
|
||||
exists = Directory.Exists(d2FacePartsContentDirectory);
|
||||
if (!exists && add && _Configuration.SaveFaceLandmarkForOutputResolutions.Contains(outputResolution))
|
||||
results.Add(new string[] { from });
|
||||
else if (exists)
|
||||
{
|
||||
to = Path.Combine(string.Concat(d2FacePartsContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
eDistanceContentDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "()");
|
||||
from = string.Concat(eDistanceContentDirectory, relativePath);
|
||||
exists = Directory.Exists(eDistanceContentDirectory);
|
||||
if (exists)
|
||||
{
|
||||
to = Path.Combine(string.Concat(eDistanceContentDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
eDistanceCollectionDirectory = Path.Combine(Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(configuration, nameof(E_Distance), outputResolution, includeResizeGroup: true, includeModel: true, includePredictorModel: true), "[]");
|
||||
from = string.Concat(eDistanceCollectionDirectory, relativePath);
|
||||
exists = Directory.Exists(eDistanceCollectionDirectory);
|
||||
if (exists)
|
||||
{
|
||||
to = Path.Combine(string.Concat(eDistanceCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
g2IdentifyCollectionDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(G2_Identify), "[]");
|
||||
from = string.Concat(g2IdentifyCollectionDirectory, relativePath);
|
||||
exists = Directory.Exists(g2IdentifyCollectionDirectory);
|
||||
if (!exists && add && jsonFiles4InfoAny)
|
||||
results.Add(new string[] { from });
|
||||
else if (exists)
|
||||
{
|
||||
to = Path.Combine(string.Concat(g2IdentifyCollectionDirectory, Path.GetDirectoryName(relativePath)), newDirectoryName);
|
||||
results.Add(new string[] { from, to });
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
internal void DirectoryRename(Property.Models.Configuration configuration, string relativePath, string newDirectoryName)
|
||||
{
|
||||
string json;
|
||||
FileInfo current;
|
||||
FileInfo fileInfo;
|
||||
string error = "Error";
|
||||
string target = "Target";
|
||||
string pending = "Pending";
|
||||
DirectoryInfo directoryInfo;
|
||||
IEnumerator<FileInfo> fileInfoCollection;
|
||||
string oldValue = string.Concat("\"", relativePath);
|
||||
string oldDirectoryName = Path.GetFileName(relativePath);
|
||||
string traceFileName = string.Concat(DateTime.Now.Ticks, ".tsv");
|
||||
string directoryName = Path.GetFileName(_Configuration.PropertyConfiguration.RootDirectory);
|
||||
string? relativePathParent = Path.GetDirectoryName(relativePath);
|
||||
if (string.IsNullOrEmpty(relativePathParent))
|
||||
throw new Exception();
|
||||
string newValue = string.Concat("\"", Path.Combine(relativePathParent, newDirectoryName));
|
||||
string e3RenameContentDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(E3_Rename), "()");
|
||||
string jsonRootDirectory = Path.Combine(string.Concat(_Configuration.PropertyConfiguration.RootDirectory, " - Copied"), string.Concat(directoryName, " - 4) Info"), _Configuration.PropertyConfiguration.DateGroup, "[]");
|
||||
directoryInfo = new DirectoryInfo(jsonRootDirectory);
|
||||
if (!directoryInfo.Exists)
|
||||
directoryInfo.Create();
|
||||
IEnumerator<FileInfo> fileInfoCollection4 = directoryInfo.EnumerateFiles("*.json", SearchOption.AllDirectories).GetEnumerator();
|
||||
bool fileInfoCollection4MoveNext = fileInfoCollection4.MoveNext();
|
||||
if (!fileInfoCollection4MoveNext)
|
||||
current = new(string.Empty);
|
||||
else
|
||||
current = fileInfoCollection4.Current;
|
||||
List<string[]> directoryCollections = GetDirectoryRenameCollections(configuration, relativePath, newDirectoryName, fileInfoCollection4MoveNext);
|
||||
if ((from l in directoryCollections where l.Length != 2 select true).Any())
|
||||
throw new Exception();
|
||||
if (!Directory.Exists(e3RenameContentDirectory))
|
||||
{
|
||||
_ = Directory.CreateDirectory(e3RenameContentDirectory);
|
||||
_ = Directory.CreateDirectory(Path.Combine(e3RenameContentDirectory, error));
|
||||
_ = Directory.CreateDirectory(Path.Combine(e3RenameContentDirectory, target));
|
||||
_ = Directory.CreateDirectory(Path.Combine(e3RenameContentDirectory, "Test"));
|
||||
_ = Directory.CreateDirectory(Path.Combine(e3RenameContentDirectory, pending));
|
||||
}
|
||||
string fRandomSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(F_Random), "{}");
|
||||
string[] files = Directory.GetFiles(fRandomSingletonDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
File.Delete(file);
|
||||
File.WriteAllText(Path.Combine(e3RenameContentDirectory, pending, traceFileName), string.Concat(relativePath, newDirectoryName, Environment.NewLine));
|
||||
try
|
||||
{
|
||||
foreach (string[] directoryCollection in directoryCollections)
|
||||
{
|
||||
directoryInfo = new DirectoryInfo(directoryCollection[0]);
|
||||
if (!directoryInfo.Exists)
|
||||
continue;
|
||||
fileInfoCollection = directoryInfo.EnumerateFiles("*.json", SearchOption.AllDirectories).GetEnumerator();
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
if (fileInfoCollection.MoveNext())
|
||||
fileInfo = fileInfoCollection.Current;
|
||||
else if (fileInfoCollection4MoveNext && fileInfoCollection4.MoveNext())
|
||||
fileInfo = fileInfoCollection4.Current;
|
||||
else if (fileInfoCollection4MoveNext && current is not null)
|
||||
{
|
||||
fileInfo = current;
|
||||
current = new(string.Empty);
|
||||
}
|
||||
else
|
||||
break;
|
||||
json = Shared.Models.Stateless.Methods.IIndex.GetJson(fileInfo.FullName, fileInfo);
|
||||
if (json.Contains(oldValue))
|
||||
{
|
||||
json = json.Replace(oldValue, newValue);
|
||||
if (!Shared.Models.Stateless.Methods.IPath.WriteAllText(fileInfo.FullName, json, updateDateWhenMatches: true, compareBeforeWrite: true))
|
||||
continue;
|
||||
File.SetLastWriteTime(fileInfo.FullName, fileInfo.LastWriteTime);
|
||||
}
|
||||
}
|
||||
Directory.Move(directoryCollection[0], directoryCollection[1]);
|
||||
}
|
||||
File.Move(Path.Combine(e3RenameContentDirectory, pending, traceFileName), Path.Combine(e3RenameContentDirectory, target, traceFileName));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
File.Move(Path.Combine(e3RenameContentDirectory, pending, traceFileName), Path.Combine(e3RenameContentDirectory, error, traceFileName));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal void RenameQueue(Property.Models.Configuration configuration)
|
||||
{
|
||||
string[] lines;
|
||||
string[] segments;
|
||||
string e3RenameContentDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(E3_Rename), "()");
|
||||
string[] files = Directory.GetFiles(e3RenameContentDirectory, "*.tsv", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
{
|
||||
lines = File.ReadAllLines(file);
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (string.IsNullOrEmpty(line) || !line.Contains('\t'))
|
||||
continue;
|
||||
segments = line.Split('\t');
|
||||
if (segments.Length != 2)
|
||||
throw new Exception();
|
||||
DirectoryRename(configuration, segments[0], segments[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,234 +0,0 @@
|
||||
using Phares.Shared;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using View_by_Distance.Shared.Models;
|
||||
using View_by_Distance.Shared.Models.Methods;
|
||||
|
||||
namespace View_by_Distance.Instance.Models;
|
||||
|
||||
/// <summary>
|
||||
// List<G2_Identify>
|
||||
/// </summary>
|
||||
public class G2_Identify : Shared.Models.Properties.IIdentify, IIdentify
|
||||
{
|
||||
|
||||
protected int _DirectoryCount;
|
||||
protected string _ParentDirectoryName;
|
||||
protected string _Person;
|
||||
protected string _PossibleYear;
|
||||
protected string _RelativePath;
|
||||
public int DirectoryCount => _DirectoryCount;
|
||||
public string ParentDirectoryName => _ParentDirectoryName;
|
||||
public string Person => _Person;
|
||||
public string PossibleYear => _PossibleYear;
|
||||
public string RelativePath => _RelativePath;
|
||||
|
||||
private readonly Serilog.ILogger? _Log;
|
||||
private readonly Configuration _Configuration;
|
||||
private readonly JsonSerializerOptions _WriteIndentedJsonSerializerOptions;
|
||||
|
||||
#nullable disable
|
||||
[JsonConstructor]
|
||||
public G2_Identify(int directoryCount, string parentDirectoryName, string person, string possibleYear, string relativePath)
|
||||
{
|
||||
_DirectoryCount = directoryCount;
|
||||
_ParentDirectoryName = parentDirectoryName;
|
||||
_Person = person;
|
||||
_PossibleYear = possibleYear;
|
||||
_RelativePath = relativePath;
|
||||
}
|
||||
|
||||
internal G2_Identify(Configuration configuration)
|
||||
{
|
||||
_DirectoryCount = 0;
|
||||
_ParentDirectoryName = string.Empty;
|
||||
_Person = string.Empty;
|
||||
_PossibleYear = string.Empty;
|
||||
_RelativePath = string.Empty;
|
||||
_Configuration = configuration;
|
||||
_Log = Serilog.Log.ForContext<G2_Identify>();
|
||||
_WriteIndentedJsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
private FileInfo GetNamed()
|
||||
{
|
||||
FileInfo result;
|
||||
string[] jsonFiles = Directory.GetFiles(_Configuration.PropertyConfiguration.RootDirectory, "*Named*.json", SearchOption.TopDirectoryOnly);
|
||||
if (!jsonFiles.Any())
|
||||
result = null;
|
||||
else
|
||||
result = new FileInfo(jsonFiles[0]);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CheckLastWriteTimes(IsEnvironment isEnvironment, string facesFileNameExtension, FileInfo named, string g2IdentifySingletonDirectory)
|
||||
{
|
||||
string json;
|
||||
FileInfo fileInfo;
|
||||
DateTime dateTime = DateTime.MinValue;
|
||||
string[] jsonFiles = Directory.GetFiles(g2IdentifySingletonDirectory, "*.json", SearchOption.AllDirectories);
|
||||
foreach (string jsonFile in jsonFiles)
|
||||
{
|
||||
fileInfo = new(jsonFile);
|
||||
if (dateTime < fileInfo.LastWriteTime)
|
||||
dateTime = fileInfo.LastWriteTime;
|
||||
}
|
||||
if (named.LastWriteTime > dateTime)
|
||||
{
|
||||
if (!isEnvironment.DebuggerWasAttachedDuringConstructor)
|
||||
throw new Exception("Only allowed when debugger is attached during constructor!");
|
||||
foreach (string file in jsonFiles)
|
||||
File.Delete(file);
|
||||
}
|
||||
json = File.ReadAllText(named.FullName);
|
||||
Dictionary<string, string[]> resultKeyValuePairs = new();
|
||||
string rootDirectory = _Configuration.PropertyConfiguration.RootDirectory;
|
||||
string peopleRootDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(A2_People));
|
||||
string rootResultsDirectory = Path.GetDirectoryName(Path.GetDirectoryName(peopleRootDirectory));
|
||||
if (rootResultsDirectory is null)
|
||||
throw new Exception();
|
||||
Storage storage = new(rootDirectory, rootResultsDirectory, peopleRootDirectory);
|
||||
PersonContainer[] personContainers = Shared.Models.Stateless.Methods.IPersonContainer.GetPersonContainers(storage, _Configuration.PersonBirthdayFormat, _Configuration.PersonCharacters.ToArray(), facesFileNameExtension);
|
||||
string[] peopleBirthDates = (from l in personContainers select Shared.Models.Stateless.Methods.IPersonBirthday.GetFormatted(_Configuration.PersonBirthdayFormat, l.Person.Birthday)).ToArray();
|
||||
Dictionary<string, string[]> sourceKeyValuePairs = JsonSerializer.Deserialize<Dictionary<string, string[]>>(json);
|
||||
foreach (KeyValuePair<string, string[]> keyValuePair in sourceKeyValuePairs)
|
||||
{
|
||||
if (!(from l in keyValuePair.Value where peopleBirthDates.Contains(l) select false).Any())
|
||||
continue;
|
||||
resultKeyValuePairs.Add(keyValuePair.Key, keyValuePair.Value);
|
||||
}
|
||||
if (resultKeyValuePairs.Count != sourceKeyValuePairs.Count)
|
||||
{
|
||||
json = JsonSerializer.Serialize(resultKeyValuePairs, _WriteIndentedJsonSerializerOptions);
|
||||
if (!isEnvironment.DebuggerWasAttachedDuringConstructor)
|
||||
throw new Exception("Only allowed when debugger is attached during constructor!");
|
||||
_ = Shared.Models.Stateless.Methods.IPath.WriteAllText(named.FullName, json, updateDateWhenMatches: true, compareBeforeWrite: true);
|
||||
}
|
||||
}
|
||||
|
||||
internal List<G2_Identify> GetIdentifiedCollection(IsEnvironment isEnvironment, Property.Models.Configuration configuration, string facesFileNameExtension)
|
||||
{
|
||||
List<G2_Identify> results = new();
|
||||
string json;
|
||||
string[] people;
|
||||
string[] jsonFiles;
|
||||
int directoryCount;
|
||||
string possibleYear;
|
||||
G2_Identify identify;
|
||||
FileInfo named = GetNamed();
|
||||
string testDirectoryFullName;
|
||||
string checkDirectoryFullName;
|
||||
Dictionary<int, string[]> keyValuePairs;
|
||||
List<string> missing = new();
|
||||
List<G_Index> indices = new();
|
||||
string directoryName = Path.GetFileName(_Configuration.PropertyConfiguration.RootDirectory);
|
||||
string g2IdentifySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(G2_Identify), "[]");
|
||||
string jsonRootDirectory = Path.Combine(string.Concat(_Configuration.PropertyConfiguration.RootDirectory, " - Copied"), string.Concat(directoryName, " - 4) Info"), _Configuration.PropertyConfiguration.DateGroup, "[]");
|
||||
if (named is not null && named.Exists)
|
||||
CheckLastWriteTimes(isEnvironment, facesFileNameExtension, named, g2IdentifySingletonDirectory);
|
||||
if (Directory.Exists(jsonRootDirectory))
|
||||
{
|
||||
jsonFiles = Directory.GetFiles(jsonRootDirectory, "*.json", SearchOption.AllDirectories);
|
||||
for (int i = 0; i < jsonFiles.Length; i++)
|
||||
{
|
||||
json = Shared.Models.Stateless.Methods.IIndex.GetJson(jsonFiles[i], fileInfo: null);
|
||||
indices.AddRange(JsonSerializer.Deserialize<List<G_Index>>(json));
|
||||
}
|
||||
if (named is not null && named.Exists)
|
||||
{
|
||||
json = File.ReadAllText(named.FullName);
|
||||
keyValuePairs = JsonSerializer.Deserialize<Dictionary<int, string[]>>(json);
|
||||
foreach (G_Index index in indices)
|
||||
{
|
||||
if (index?.Index is null)
|
||||
continue;
|
||||
if (!keyValuePairs.ContainsKey(index.Index.Value))
|
||||
{
|
||||
missing.Add(index.Index.Value.ToString());
|
||||
continue;
|
||||
}
|
||||
if (index.RelativePaths is null)
|
||||
{
|
||||
missing.Add(index.Index.Value.ToString());
|
||||
continue;
|
||||
}
|
||||
people = keyValuePairs[index.Index.Value];
|
||||
foreach (string relativePath in index.RelativePaths)
|
||||
{
|
||||
foreach (string person in people)
|
||||
{
|
||||
directoryCount = 0;
|
||||
checkDirectoryFullName = string.Concat(_Configuration.PropertyConfiguration.RootDirectory, relativePath);
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
testDirectoryFullName = Path.GetDirectoryName(checkDirectoryFullName);
|
||||
if (testDirectoryFullName == _Configuration.PropertyConfiguration.RootDirectory)
|
||||
break;
|
||||
directoryCount += 1;
|
||||
checkDirectoryFullName = testDirectoryFullName;
|
||||
}
|
||||
possibleYear = checkDirectoryFullName.Split(' ').Last();
|
||||
if (possibleYear.Length != 4)
|
||||
possibleYear = "0000";
|
||||
identify = new G2_Identify(directoryCount, Path.GetFileName(checkDirectoryFullName), person, possibleYear, relativePath);
|
||||
results.Add(identify);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
results = (from l in results orderby l.PossibleYear descending, l.DirectoryCount, l.ParentDirectoryName, l.RelativePath select l).ToList();
|
||||
return results;
|
||||
}
|
||||
|
||||
internal void WriteAllText(Property.Models.Configuration configuration, string outputResolution, List<G2_Identify> identifiedCollection)
|
||||
{
|
||||
string key;
|
||||
string json;
|
||||
string jsonFile;
|
||||
string directoryFullName;
|
||||
string fileNameWithoutExtension;
|
||||
string aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(Property.Models.A_Property), "{}");
|
||||
string g2IdentifyCollectionDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(configuration, nameof(G2_Identify), "[]");
|
||||
Dictionary<string, List<KeyValuePair<string, string>>> keyValuePairs = new();
|
||||
foreach (G2_Identify identified in identifiedCollection)
|
||||
{
|
||||
key = Path.GetDirectoryName(identified.RelativePath);
|
||||
if (!keyValuePairs.ContainsKey(key))
|
||||
keyValuePairs.Add(key, new List<KeyValuePair<string, string>>());
|
||||
keyValuePairs[key].Add(new KeyValuePair<string, string>(identified.RelativePath, identified.Person));
|
||||
}
|
||||
foreach (KeyValuePair<string, List<KeyValuePair<string, string>>> keyValuePair in keyValuePairs)
|
||||
{
|
||||
directoryFullName = string.Concat(aPropertySingletonDirectory, keyValuePair.Key);
|
||||
if (!Directory.Exists(directoryFullName))
|
||||
continue;
|
||||
foreach (KeyValuePair<string, string> keyValue in keyValuePair.Value)
|
||||
{
|
||||
fileNameWithoutExtension = Path.GetFileNameWithoutExtension(keyValue.Key);
|
||||
jsonFile = Path.Combine(directoryFullName, $"{fileNameWithoutExtension}.json");
|
||||
if (!File.Exists(jsonFile))
|
||||
{
|
||||
directoryFullName = string.Empty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(directoryFullName))
|
||||
continue;
|
||||
directoryFullName = Path.GetDirectoryName(string.Concat(g2IdentifyCollectionDirectory, keyValuePair.Key));
|
||||
if (!Directory.Exists(directoryFullName))
|
||||
_ = Directory.CreateDirectory(directoryFullName);
|
||||
jsonFile = string.Concat(g2IdentifyCollectionDirectory, keyValuePair.Key, ".json");
|
||||
json = JsonSerializer.Serialize(keyValuePair.Value, _WriteIndentedJsonSerializerOptions);
|
||||
if (!Shared.Models.Stateless.Methods.IPath.WriteAllText(jsonFile, json, updateDateWhenMatches: true, compareBeforeWrite: true))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,202 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using View_by_Distance.Shared.Models.Methods;
|
||||
|
||||
namespace View_by_Distance.Instance.Models;
|
||||
|
||||
/// <summary>
|
||||
// G_Index && G_Index[]
|
||||
/// </summary>
|
||||
public class G_Index : Shared.Models.Properties.IIndex, IIndex
|
||||
{
|
||||
|
||||
private readonly Serilog.ILogger? _Log;
|
||||
private readonly Configuration _Configuration;
|
||||
private readonly JsonSerializerOptions _WriteIndentedJsonSerializerOptions;
|
||||
|
||||
protected DateTime? _DateTime;
|
||||
protected int? _Index;
|
||||
protected List<string> _RelativePaths;
|
||||
public DateTime? DateTime => _DateTime;
|
||||
public int? Index => _Index;
|
||||
public List<string> RelativePaths => _RelativePaths;
|
||||
|
||||
#nullable disable
|
||||
[JsonConstructor]
|
||||
public G_Index(DateTime? dateTime, int? index, List<string> relativePaths)
|
||||
{
|
||||
_DateTime = dateTime;
|
||||
_Index = index;
|
||||
_RelativePaths = relativePaths;
|
||||
}
|
||||
|
||||
internal G_Index()
|
||||
{
|
||||
_DateTime = null;
|
||||
_Index = null;
|
||||
_RelativePaths = new();
|
||||
}
|
||||
|
||||
internal G_Index(Configuration configuration)
|
||||
{
|
||||
_Configuration = configuration;
|
||||
_Log = Serilog.Log.ForContext<G_Index>();
|
||||
_WriteIndentedJsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
private G_Index GetIndexInfo(FileInfo fileInfo, List<string> parseExceptions)
|
||||
{
|
||||
G_Index result;
|
||||
List<int> indices = new();
|
||||
string json = File.ReadAllText(fileInfo.FullName);
|
||||
try
|
||||
{
|
||||
result = JsonSerializer.Deserialize<G_Index>(json);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result = null;
|
||||
parseExceptions.Add(nameof(G_Index));
|
||||
}
|
||||
if (_Configuration.MappedMaxIndex.HasValue && result.Index.HasValue && _Configuration.MappedMaxIndex.Value < result.Index.Value)
|
||||
{
|
||||
result = null;
|
||||
File.Delete(fileInfo.FullName);
|
||||
}
|
||||
else if (result.Index is null)
|
||||
result = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
private void WriteNeeded(List<int> indices, List<Tuple<List<string>, string, Shared.Models.Property>> neededTuples)
|
||||
{
|
||||
string json;
|
||||
DateTime dateTime;
|
||||
Shared.Models.Property property;
|
||||
G_Index indexInfo;
|
||||
int maxIndexPlusOne;
|
||||
DateTime?[] dateTimes;
|
||||
if (indices.Any())
|
||||
maxIndexPlusOne = indices.Max() + 1;
|
||||
else
|
||||
{
|
||||
maxIndexPlusOne = 1000000;
|
||||
throw new Exception("Are you sure exception. Use debugger to step over.");
|
||||
}
|
||||
foreach (Tuple<List<string>, string, Shared.Models.Property> tuple in neededTuples)
|
||||
{
|
||||
maxIndexPlusOne += 1;
|
||||
property = tuple.Item3;
|
||||
dateTimes = new DateTime?[] { property.CreationTime, property.LastWriteTime, property.DateTime, property.DateTimeDigitized, property.DateTimeOriginal, property.GPSDateStamp };
|
||||
dateTime = (from l in dateTimes where l.HasValue select l.Value).Min();
|
||||
indexInfo = new(dateTime, maxIndexPlusOne, tuple.Item1);
|
||||
json = JsonSerializer.Serialize(indexInfo, _WriteIndentedJsonSerializerOptions);
|
||||
if (!Shared.Models.Stateless.Methods.IPath.WriteAllText(tuple.Item2, json, updateDateWhenMatches: true, compareBeforeWrite: true))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteGroup(Property.Models.Configuration configuration, string outputResolution, List<Tuple<string, Dictionary<int, G_Index>>> indexInfoTuples)
|
||||
{
|
||||
string json;
|
||||
G_Index[] indices;
|
||||
List<string> directoryInfoCollection;
|
||||
foreach (Tuple<string, Dictionary<int, G_Index>> tuple in indexInfoTuples)
|
||||
{
|
||||
indices = (from l in tuple.Item2 select l.Value).ToArray();
|
||||
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, tuple.Item1, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: string.Empty, collectionDescription: "Unknown A");
|
||||
json = JsonSerializer.Serialize(indices, _WriteIndentedJsonSerializerOptions);
|
||||
if (!Shared.Models.Stateless.Methods.IPath.WriteAllText(string.Concat(directoryInfoCollection[0].Replace("<>", "[]"), ".json"), json, updateDateWhenMatches: true, compareBeforeWrite: true))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
private void AppendTSV(Property.Models.Configuration configuration, string outputResolution, Dictionary<string, List<Tuple<string, Shared.Models.Property>>> filePropertiesKeyValuePairs)
|
||||
{
|
||||
Shared.Models.Property property;
|
||||
DateTime?[] dateTimes;
|
||||
DateTime? maximumDateTime;
|
||||
DateTime? minimumDateTime;
|
||||
List<string> directoryInfoCollection;
|
||||
long ticks = System.DateTime.Now.Ticks;
|
||||
foreach (KeyValuePair<string, List<Tuple<string, Shared.Models.Property>>> tuples in filePropertiesKeyValuePairs)
|
||||
{
|
||||
maximumDateTime = null;
|
||||
minimumDateTime = null;
|
||||
foreach (Tuple<string, Shared.Models.Property> tuple in tuples.Value)
|
||||
{
|
||||
property = tuple.Item2;
|
||||
dateTimes = new DateTime?[] { maximumDateTime, minimumDateTime, property.CreationTime, property.LastWriteTime, property.DateTime, property.DateTimeDigitized, property.DateTimeOriginal, property.GPSDateStamp };
|
||||
maximumDateTime = (from l in dateTimes where l.HasValue select l.Value).Max();
|
||||
minimumDateTime = (from l in dateTimes where l.HasValue select l.Value).Min();
|
||||
}
|
||||
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, tuples.Key, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: "Unkown B", collectionDescription: string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetIndex(Property.Models.Configuration configuration, string outputResolution)
|
||||
{
|
||||
Dictionary<string, List<Tuple<string, Shared.Models.Property>>> filePropertiesKeyValuePairs = new();
|
||||
FileInfo fileInfo;
|
||||
G_Index indexInfo;
|
||||
List<int> indices = new();
|
||||
Dictionary<int, G_Index> valuePairs;
|
||||
List<string> directoryInfoCollection;
|
||||
List<string> parseExceptions = new();
|
||||
List<Tuple<List<string>, string, Shared.Models.Property>> neededTuples = new();
|
||||
List<Tuple<string, Dictionary<int, G_Index>>> indexInfoTuples = new();
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
if (!neededTuples.Any() && !parseExceptions.Any())
|
||||
break;
|
||||
indices.Clear();
|
||||
indexInfoTuples.Clear();
|
||||
parseExceptions.Clear();
|
||||
}
|
||||
neededTuples.Clear();
|
||||
foreach (KeyValuePair<string, List<Tuple<string, Shared.Models.Property>>> tuples in filePropertiesKeyValuePairs)
|
||||
{
|
||||
valuePairs = new Dictionary<int, G_Index>();
|
||||
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, tuples.Key, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: "Unknown C", collectionDescription: string.Empty);
|
||||
foreach (Tuple<string, Shared.Models.Property> tuple in tuples.Value)
|
||||
{
|
||||
fileInfo = new FileInfo(Path.Combine(directoryInfoCollection[0].Replace("<>", "{}"), string.Concat(Path.GetFileNameWithoutExtension(tuple.Item1), ".json")));
|
||||
if (_Configuration.PropertiesChangedForIndex)
|
||||
indexInfo = null;
|
||||
else if (!fileInfo.Exists)
|
||||
indexInfo = null;
|
||||
else
|
||||
indexInfo = GetIndexInfo(fileInfo, parseExceptions);
|
||||
if (indexInfo?.Index is not null)
|
||||
{
|
||||
indices.Add(indexInfo.Index.Value);
|
||||
valuePairs.Add(indexInfo.Index.Value, indexInfo);
|
||||
}
|
||||
else
|
||||
neededTuples.Add(new Tuple<List<string>, string, Shared.Models.Property>(new List<string> { tuple.Item1 }, fileInfo.FullName, tuple.Item2));
|
||||
}
|
||||
indexInfoTuples.Add(new Tuple<string, Dictionary<int, G_Index>>(tuples.Key, valuePairs));
|
||||
}
|
||||
if (_Configuration.MappedMaxIndex.HasValue)
|
||||
break;
|
||||
WriteNeeded(indices, neededTuples);
|
||||
}
|
||||
if (parseExceptions.Any())
|
||||
throw new Exception(string.Join(Environment.NewLine, parseExceptions));
|
||||
if (neededTuples.Any())
|
||||
throw new Exception();
|
||||
WriteGroup(configuration, outputResolution, indexInfoTuples);
|
||||
AppendTSV(configuration, outputResolution, filePropertiesKeyValuePairs);
|
||||
}
|
||||
|
||||
string Shared.Models.Stateless.Methods.IIndex.TestStatic_GetJson(string jsonFileFullName, FileInfo fileInfo) => throw new NotImplementedException();
|
||||
|
||||
}
|
@ -68,10 +68,8 @@
|
||||
"ForceMetadataLastWriteTimeToCreationTime": false,
|
||||
"ForcePropertyLastWriteTimeToCreationTime": false,
|
||||
"ForceResizeLastWriteTimeToCreationTime": false,
|
||||
"LoadOrCreateThenSaveIndex": false,
|
||||
"LocationDigits": 9,
|
||||
"LocationFactor": 10000,
|
||||
"MappedMaxIndex": 1034720,
|
||||
"MappingDefaultName": "John Doe~25",
|
||||
"MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping": false,
|
||||
"MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping": false,
|
||||
|
1
Not-Copy-Copy/.vscode/format-report.json
vendored
1
Not-Copy-Copy/.vscode/format-report.json
vendored
@ -1 +0,0 @@
|
||||
[]
|
30
Not-Copy-Copy/.vscode/launch.json
vendored
30
Not-Copy-Copy/.vscode/launch.json
vendored
@ -1,30 +0,0 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||
"name": ".NET Core Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/bin/Debug/net7.0/win-x64/Not-Copy-Copy.dll",
|
||||
"args": [],
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
},
|
||||
"cwd": "${workspaceFolder}",
|
||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
||||
"console": "externalTerminal",
|
||||
"stopAtEntry": false
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"processName": "Not-Copy-Copy"
|
||||
}
|
||||
]
|
||||
}
|
11
Not-Copy-Copy/.vscode/settings.json
vendored
11
Not-Copy-Copy/.vscode/settings.json
vendored
@ -1,11 +0,0 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"Barrick",
|
||||
"Beichler",
|
||||
"Bohdi",
|
||||
"Dlib",
|
||||
"Phares",
|
||||
"Serilog",
|
||||
"Vericruz"
|
||||
]
|
||||
}
|
42
Not-Copy-Copy/.vscode/tasks.json
vendored
42
Not-Copy-Copy/.vscode/tasks.json
vendored
@ -1,42 +0,0 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/Not-Copy-Copy.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/Not-Copy-Copy.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"${workspaceFolder}/Not-Copy-Copy.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Not.Copy.Copy.Models;
|
||||
|
||||
public class AppSettings
|
||||
{
|
||||
|
||||
public string Company { init; get; }
|
||||
public int MaxDegreeOfParallelism { init; get; }
|
||||
public string WorkingDirectoryName { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public AppSettings(string company, int maxDegreeOfParallelism, string workingDirectoryName)
|
||||
{
|
||||
Company = company;
|
||||
MaxDegreeOfParallelism = maxDegreeOfParallelism;
|
||||
WorkingDirectoryName = workingDirectoryName;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace View_by_Distance.Not.Copy.Copy.Models.Binder;
|
||||
|
||||
public class AppSettings
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string Company { get; set; }
|
||||
public int? MaxDegreeOfParallelism { get; set; }
|
||||
public string WorkingDirectoryName { get; set; }
|
||||
|
||||
#nullable restore
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Models.AppSettings Get(AppSettings? appSettings)
|
||||
{
|
||||
Models.AppSettings result;
|
||||
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||
result = new(
|
||||
appSettings.Company,
|
||||
appSettings.MaxDegreeOfParallelism.Value,
|
||||
appSettings.WorkingDirectoryName
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||
{
|
||||
Models.AppSettings result;
|
||||
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||
result = Get(appSettings);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace View_by_Distance.Not.Copy.Copy.Models.Binder;
|
||||
|
||||
public class Configuration
|
||||
{
|
||||
|
||||
#nullable disable
|
||||
|
||||
[Display(Name = "Compare Source"), Required] public string CompareSource { get; set; }
|
||||
[Display(Name = "Empty Destination"), Required] public string EmptyDestination { get; set; }
|
||||
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; }
|
||||
[Display(Name = "Selected Source"), Required] public string SelectedSource { get; set; }
|
||||
|
||||
#nullable restore
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Not.Copy.Copy.Models;
|
||||
|
||||
public class Configuration
|
||||
{
|
||||
|
||||
protected string _CompareSource;
|
||||
protected string _EmptyDestination;
|
||||
protected Property.Models.Configuration _PropertyConfiguration;
|
||||
protected string _SelectedSource;
|
||||
public string CompareSource => _CompareSource;
|
||||
public string EmptyDestination => _EmptyDestination;
|
||||
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
|
||||
public string SelectedSource => _SelectedSource;
|
||||
|
||||
[JsonConstructor]
|
||||
public Configuration(string compareSource, string emptyDestination, Property.Models.Configuration propertyConfiguration, string selectedSource)
|
||||
{
|
||||
_CompareSource = compareSource;
|
||||
_EmptyDestination = emptyDestination;
|
||||
_PropertyConfiguration = propertyConfiguration;
|
||||
_SelectedSource = selectedSource;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Set(Property.Models.Configuration configuration) => _PropertyConfiguration = configuration;
|
||||
|
||||
public void SetAndUpdate(Property.Models.Configuration configuration)
|
||||
{
|
||||
_PropertyConfiguration.Update();
|
||||
_CompareSource = Path.GetFullPath(_CompareSource);
|
||||
_SelectedSource = Path.GetFullPath(_SelectedSource);
|
||||
_EmptyDestination = Path.GetFullPath(_EmptyDestination);
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Phares.Shared;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace View_by_Distance.Not.Copy.Copy.Models.Stateless;
|
||||
|
||||
public abstract class Configuration
|
||||
{
|
||||
|
||||
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, string workingDirectory, Property.Models.Configuration propertyConfiguration)
|
||||
{
|
||||
Models.Configuration? result;
|
||||
string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment);
|
||||
string section = string.Concat(environmentName, ":", nameof(Binder.Configuration));
|
||||
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
|
||||
Binder.Configuration? configuration = configurationSection.Get<Binder.Configuration>();
|
||||
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
|
||||
result = JsonSerializer.Deserialize<Models.Configuration>(json);
|
||||
if (result is null)
|
||||
throw new Exception(json);
|
||||
string jsonThis = result.ToString();
|
||||
result.SetAndUpdate(propertyConfiguration);
|
||||
if (jsonThis != json)
|
||||
{
|
||||
int? check = null;
|
||||
int min = new int[] { json.Length, jsonThis.Length }.Min();
|
||||
for (int i = 0; i < min; i++)
|
||||
{
|
||||
if (json[i] == jsonThis[i])
|
||||
continue;
|
||||
check = i;
|
||||
break;
|
||||
}
|
||||
if (check is null)
|
||||
throw new Exception();
|
||||
string a = json[..check.Value].Split(',')[^1];
|
||||
string b = json[check.Value..].Split(',')[0];
|
||||
throw new Exception($"{a}{b}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace View_by_Distance.Not.Copy.Copy.Models.Stateless;
|
||||
|
||||
public static class SerilogExtensionMethods
|
||||
{
|
||||
|
||||
internal static void Warn(this Serilog.ILogger log, string messageTemplate) => log.Warning(messageTemplate);
|
||||
|
||||
internal static void Info(this Serilog.ILogger log, string messageTemplate) => log.Information(messageTemplate);
|
||||
|
||||
}
|
@ -1,148 +0,0 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Phares.Shared;
|
||||
using View_by_Distance.Not.Copy.Copy.Models;
|
||||
using View_by_Distance.Property.Models;
|
||||
using View_by_Distance.Shared.Models.Methods;
|
||||
|
||||
namespace View_by_Distance.Not.Copy.Copy;
|
||||
|
||||
public class NotCopyCopy
|
||||
{
|
||||
|
||||
private readonly Serilog.ILogger? _Log;
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly IsEnvironment _IsEnvironment;
|
||||
private readonly Models.Configuration _Configuration;
|
||||
|
||||
public NotCopyCopy(List<string> args, IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, AppSettings appSettings, string workingDirectory, bool isSilent, IConsole console)
|
||||
{
|
||||
if (isSilent)
|
||||
{ }
|
||||
if (args is null)
|
||||
{ }
|
||||
if (console is null)
|
||||
{ }
|
||||
_AppSettings = appSettings;
|
||||
_IsEnvironment = isEnvironment;
|
||||
_Log = Serilog.Log.ForContext<NotCopyCopy>();
|
||||
Property.Models.Configuration propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
|
||||
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
|
||||
_Log.Information(propertyConfiguration.RootDirectory);
|
||||
Property.Models.Configuration.Verify(propertyConfiguration, requireExist: true);
|
||||
Verify(configuration);
|
||||
_Configuration = configuration;
|
||||
if (!_IsEnvironment.Development)
|
||||
throw new Exception("This program only allows development environments!");
|
||||
propertyConfiguration.ChangeRootDirectory(configuration.CompareSource);
|
||||
string aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(A_Property), "{}");
|
||||
(_, Shared.Models.Container[] compareContainers) = Shared.Models.Stateless.Methods.IContainer.GetContainers(propertyConfiguration, aPropertySingletonDirectory);
|
||||
propertyConfiguration.ChangeRootDirectory(configuration.SelectedSource);
|
||||
(_, Shared.Models.Container[] selectedContainers) = Shared.Models.Stateless.Methods.IContainer.GetContainers(propertyConfiguration, aPropertySingletonDirectory);
|
||||
if (compareContainers.Length == selectedContainers.Length)
|
||||
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)
|
||||
{
|
||||
directoryName = Path.Combine(destination.Take(destination.Length - 1).ToArray());
|
||||
if (distinct.Contains(directoryName))
|
||||
continue;
|
||||
distinct.Add(directoryName);
|
||||
if (!Directory.Exists(directoryName))
|
||||
_ = Directory.CreateDirectory(directoryName);
|
||||
}
|
||||
_Log.Information($"Ready to copy {copyCollection.Count} file(s)?");
|
||||
for (int y = 0; y < int.MaxValue; y++)
|
||||
{
|
||||
_Log.Information("Press \"Y\" key to to copy file(s)");
|
||||
if (Console.ReadKey().Key == ConsoleKey.Y)
|
||||
break;
|
||||
}
|
||||
_Log.Information(". . .");
|
||||
int copied = 0;
|
||||
string fullFileName;
|
||||
foreach ((string source, string[] destination) in copyCollection)
|
||||
{
|
||||
if (copied % 500 == 0)
|
||||
_Log.Information($"{copied})");
|
||||
fullFileName = Path.Combine(destination);
|
||||
if (File.Exists(fullFileName))
|
||||
continue;
|
||||
File.Copy(source, fullFileName);
|
||||
copied += 1;
|
||||
}
|
||||
_Log.Information($"{copied} file(s) copied");
|
||||
for (int y = 0; y < int.MaxValue; y++)
|
||||
{
|
||||
_Log.Information("Press \"Y\" key to continue or close console");
|
||||
if (Console.ReadKey().Key == ConsoleKey.Y)
|
||||
break;
|
||||
}
|
||||
_Log.Information(". . .");
|
||||
}
|
||||
|
||||
private static void Verify(Models.Configuration configuration)
|
||||
{
|
||||
if (Path.GetPathRoot(configuration.SelectedSource) == configuration.SelectedSource)
|
||||
throw new NullReferenceException(nameof(configuration.SelectedSource));
|
||||
if (string.IsNullOrEmpty(configuration.CompareSource) || !Directory.Exists(configuration.CompareSource))
|
||||
throw new NullReferenceException(nameof(configuration.CompareSource));
|
||||
if (string.IsNullOrEmpty(configuration.EmptyDestination) || Directory.Exists(configuration.EmptyDestination))
|
||||
throw new NullReferenceException(nameof(configuration.EmptyDestination));
|
||||
if (string.IsNullOrEmpty(configuration.SelectedSource) || !Directory.Exists(configuration.SelectedSource))
|
||||
throw new NullReferenceException(nameof(configuration.SelectedSource));
|
||||
if (configuration.SelectedSource.Length != configuration.CompareSource.Length)
|
||||
throw new NullReferenceException(nameof(configuration.SelectedSource));
|
||||
}
|
||||
|
||||
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 NullReferenceException(nameof(_Configuration.PropertyConfiguration));
|
||||
string key;
|
||||
string fileName;
|
||||
string[] directoryNames;
|
||||
string destinationDirectory;
|
||||
Shared.Models.Property? property;
|
||||
List<string> destinationCollection;
|
||||
string filteredSourceDirectoryFile;
|
||||
Dictionary<string, Shared.Models.Property> keyValuePairs = new();
|
||||
foreach (Property.Models.DirectoryInfo group in compareSourceGroupCollection)
|
||||
{
|
||||
for (int i = 0; i < group.SourceDirectoryFileHolderCollection.Length; i++)
|
||||
{
|
||||
property = group.PropertyCollection[i];
|
||||
if (property is null)
|
||||
continue;
|
||||
key = string.Concat(group.SourceDirectory[_Configuration.CompareSource.Length..], Path.GetFileName(group.FilteredSourceDirectoryFiles[i]));
|
||||
keyValuePairs.Add(key, property);
|
||||
}
|
||||
}
|
||||
foreach (Property.Models.DirectoryInfo group in selectedSourceGroupCollection)
|
||||
{
|
||||
for (int i = 0; i < group.SourceDirectoryFileHolderCollection.Length; i++)
|
||||
{
|
||||
destinationCollection = new();
|
||||
property = group.PropertyCollection[i];
|
||||
if (property is null)
|
||||
continue;
|
||||
filteredSourceDirectoryFile = group.FilteredSourceDirectoryFiles[i];
|
||||
fileName = Path.GetFileName(filteredSourceDirectoryFile);
|
||||
key = string.Concat(group.SourceDirectory[_Configuration.SelectedSource.Length..], fileName);
|
||||
if (keyValuePairs.ContainsKey(key) && keyValuePairs[key].LastWriteTime == property.LastWriteTime)
|
||||
continue;
|
||||
destinationDirectory = string.Concat(_Configuration.EmptyDestination, group.SourceDirectory[_Configuration.SelectedSource.Length..]);
|
||||
directoryNames = Shared.Models.Stateless.Methods.IPath.GetDirectoryNames(destinationDirectory);
|
||||
destinationCollection.AddRange(directoryNames);
|
||||
destinationCollection.Add(fileName);
|
||||
results.Add(new(filteredSourceDirectoryFile, destinationCollection.ToArray()));
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PackageId>Phares.View.by.Distance.Not.Copy.Copy</PackageId>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
<Version>7.0.101.1</Version>
|
||||
<Authors>Mike Phares</Authors>
|
||||
<Company>Phares</Company>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
||||
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
||||
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsWindows)'=='true'">
|
||||
<DefineConstants>Windows</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsOSX)'=='true'">
|
||||
<DefineConstants>OSX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsLinux)'=='true'">
|
||||
<DefineConstants>Linux</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
|
||||
<SupportedPlatform Include="browser" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
|
||||
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="MetadataExtractor" Version="2.7.2" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||
<ProjectReference Include="..\Property\Property.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="appsettings.Development.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,126 +0,0 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Phares.Shared;
|
||||
using Serilog;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using View_by_Distance.Not.Copy.Copy.Models;
|
||||
using View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
namespace View_by_Distance.Not.Copy.Copy;
|
||||
|
||||
public class Program
|
||||
{
|
||||
|
||||
public static void Secondary(List<string> args)
|
||||
{
|
||||
LoggerConfiguration loggerConfiguration = new();
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
bool debuggerWasAttachedAtLineZero = Debugger.IsAttached || assembly.Location.Contains(@"\bin\Debug");
|
||||
IsEnvironment isEnvironment = new(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: debuggerWasAttachedAtLineZero, nullASPNetCoreEnvironmentIsProduction: !debuggerWasAttachedAtLineZero);
|
||||
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables()
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile(isEnvironment.AppSettingsFileName, optional: false, reloadOnChange: true);
|
||||
IConfigurationRoot configurationRoot = configurationBuilder.Build();
|
||||
AppSettings appSettings = Models.Binder.AppSettings.Get(configurationRoot);
|
||||
if (appSettings.MaxDegreeOfParallelism > Environment.ProcessorCount)
|
||||
throw new Exception("MaxDegreeOfParallelism must be =< Environment.ProcessorCount!");
|
||||
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
|
||||
throw new Exception("Working directory name must have a value!");
|
||||
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName);
|
||||
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
||||
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot);
|
||||
Log.Logger = loggerConfiguration.CreateLogger();
|
||||
ILogger log = Log.ForContext<Program>();
|
||||
int silentIndex = args.IndexOf("s");
|
||||
if (silentIndex > -1)
|
||||
args.RemoveAt(silentIndex);
|
||||
try
|
||||
{
|
||||
if (args is null)
|
||||
throw new Exception("args is null!");
|
||||
#nullable disable
|
||||
if (IProperty.IsWrongYear("-".Split(' '), "2021").Item1.HasValue)
|
||||
throw new Exception("-");
|
||||
if (IProperty.IsWrongYear("Christmass".Split(' '), "2021").Item1.HasValue)
|
||||
throw new Exception("Christmass");
|
||||
if (IProperty.IsWrongYear("Christmass 2021".Split(' '), "2021").Item1.Value)
|
||||
throw new Exception("Christmass");
|
||||
if (IProperty.IsWrongYear("Christmass ~2021".Split(' '), "2021").Item1.Value)
|
||||
throw new Exception("Christmass");
|
||||
if (IProperty.IsWrongYear("Christmass ~2021.4".Split(' '), "2021").Item1.Value)
|
||||
throw new Exception("Christmass");
|
||||
if (!IProperty.IsWrongYear("Christmass 2021".Split(' '), "2025").Item1.Value)
|
||||
throw new Exception("Christmass");
|
||||
if (!IProperty.IsWrongYear("Christmass ~2021".Split(' '), "2025").Item1.Value)
|
||||
throw new Exception("Christmass");
|
||||
if (!IProperty.IsWrongYear("Christmass ~2021.4".Split(' '), "2025").Item1.Value)
|
||||
throw new Exception("Christmass");
|
||||
if (IProperty.IsWrongYear("England 2017".Split(' '), "2017").Item1.Value)
|
||||
throw new Exception("England");
|
||||
if (IProperty.IsWrongYear("Logan Michael".Split(' '), "2021").Item1.HasValue)
|
||||
throw new Exception("Logan Michael");
|
||||
if (IProperty.IsWrongYear("Logan Michael 2021".Split(' '), "2021").Item1.Value)
|
||||
throw new Exception("Logan Michael");
|
||||
if (IProperty.IsWrongYear("Logan Michael ~2021".Split(' '), "2021").Item1.Value)
|
||||
throw new Exception("Logan Michael");
|
||||
if (IProperty.IsWrongYear("Logan Michael ~2021.4".Split(' '), "2021").Item1.Value)
|
||||
throw new Exception("Logan Michael");
|
||||
if (!IProperty.IsWrongYear("Logan Michael 2021".Split(' '), "2025").Item1.Value)
|
||||
throw new Exception("Logan Michael");
|
||||
if (!IProperty.IsWrongYear("Logan Michael ~2021".Split(' '), "2025").Item1.Value)
|
||||
throw new Exception("Logan Michael");
|
||||
if (!IProperty.IsWrongYear("Logan Michael ~2021.4".Split(' '), "2025").Item1.Value)
|
||||
throw new Exception("Logan Michael");
|
||||
if (IProperty.IsWrongYear("Logan Michael ~2021.4".Split(' '), "2021").Item2[0] != "~2021.4")
|
||||
throw new Exception("Logan Michael");
|
||||
if (IProperty.IsWrongYear("Chelsea's 2nd Birthday =2014".Split(' '), "2014").Item1.Value)
|
||||
throw new Exception("Chelsea");
|
||||
#nullable restore
|
||||
if (IPath.GetDirectoryNames(@"C:\Tmp")[0] != @"C:\")
|
||||
throw new Exception();
|
||||
if (IPath.GetDirectoryNames(@"C:\Tmp")[1] != "Tmp")
|
||||
throw new Exception();
|
||||
if (IPath.GetDirectoryNames(@"C:\Tmp\mike.txt")[1] != "Tmp")
|
||||
throw new Exception();
|
||||
if (IPath.GetDirectoryNames(@"C:\Tmp\a.txt")[1] != "Tmp")
|
||||
throw new Exception();
|
||||
if (IPath.GetDirectoryNames(@"C:\Tmp\Mike\a.txt")[2] != "Mike")
|
||||
throw new Exception();
|
||||
if (IPath.GetDirectoryNames(@"I:\Images 2019-06-08 - 34a9240ac28b52da97428d7725153a80a757ee6b - II\=2010.2 Summer\Dsc_8558.jpg")[0] != @"I:\")
|
||||
throw new Exception();
|
||||
if (IPath.GetDirectoryNames(@"I:\Images 2019-06-08 - 34a9240ac28b52da97428d7725153a80a757ee6b - II\=2010.2 Summer\Dsc_8558.jpg")[1] != @"Images 2019-06-08 - 34a9240ac28b52da97428d7725153a80a757ee6b - II")
|
||||
throw new Exception();
|
||||
if (IPath.GetDirectoryNames(@"I:\Images 2019-06-08 - 34a9240ac28b52da97428d7725153a80a757ee6b - II\=2010.2 Summer\Dsc_8558.jpg")[2] != @"=2010.2 Summer")
|
||||
throw new Exception();
|
||||
if (IPath.GetDirectoryNames(@"I:\Images 2019-06-08 - 34a9240ac28b52da97428d7725153a80a757ee6b - II\=2010.2 Summer")[2] != @"=2010.2 Summer")
|
||||
throw new Exception();
|
||||
Shared.Models.Console console = new();
|
||||
NotCopyCopy _ = new(args, isEnvironment, configurationRoot, appSettings, workingDirectory, silentIndex > -1, console);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Fatal(string.Concat(ex.Message, Environment.NewLine, ex.StackTrace));
|
||||
}
|
||||
finally
|
||||
{
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
if (silentIndex > -1)
|
||||
log.Debug("Done. Bye");
|
||||
else
|
||||
{
|
||||
log.Debug("Done. Press 'Enter' to end");
|
||||
_ = Console.ReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
if (args is not null)
|
||||
Secondary(args.ToList());
|
||||
else
|
||||
Secondary(new List<string>());
|
||||
}
|
||||
|
||||
}
|
@ -1,337 +0,0 @@
|
||||
{
|
||||
"Company": "Mike Phares",
|
||||
"Linux": {},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Log4netProvider": "Debug",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"MaxDegreeOfParallelism": 6,
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
"Serilog.Sinks.Console",
|
||||
"Serilog.Sinks.File"
|
||||
],
|
||||
"MinimumLevel": "Debug",
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "Debug",
|
||||
"Args": {
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Console",
|
||||
"Args": {
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "%workingDirectory% - Log/log-.txt",
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}",
|
||||
"rollingInterval": "Hour"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Enrich": [
|
||||
"FromLogContext",
|
||||
"WithMachineName",
|
||||
"WithThreadId"
|
||||
],
|
||||
"Properties": {
|
||||
"Application": "Sample"
|
||||
}
|
||||
},
|
||||
"WorkingDirectoryName": "PharesApps",
|
||||
"Windows": {
|
||||
"Configuration": {
|
||||
"DateGroup": "45f4401",
|
||||
"FileNameDirectorySeparator": ".Z.",
|
||||
"ForcePropertyLastWriteTimeToCreationTime": false,
|
||||
"MaxImagesInDirectoryForTopLevelFirstPass": 10,
|
||||
"Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]",
|
||||
"PopulatePropertyId": false,
|
||||
"PropertiesChangedForProperty": false,
|
||||
"CompareSource": "E:/Images 2021-10-29 - 34a9240ac28b52da97428d7725153a80a757ee6b - III",
|
||||
"SelectedSource": "E:/Images 2018-05-12 - b01d4763d8853b6d6057a3870b2723449726da75 - III",
|
||||
"EmptyDestination": "E:/. Not-Copy-Copy/Images 2018-05-12 - b01d4763d8853b6d6057a3870b2723449726da75 - Not-Copy-Copy",
|
||||
"WriteBitmapDataBytes": false,
|
||||
"IgnoreExtensions": [
|
||||
".gif",
|
||||
".GIF"
|
||||
],
|
||||
"PropertyContentCollectionFiles": [],
|
||||
"ValidImageFormatExtensions": [
|
||||
".bmp",
|
||||
".BMP",
|
||||
".gif",
|
||||
".GIF",
|
||||
".jpeg",
|
||||
".JPEG",
|
||||
".jpg",
|
||||
".JPG",
|
||||
".png",
|
||||
".PNG",
|
||||
".tiff",
|
||||
".TIFF"
|
||||
],
|
||||
"ValidMetadataExtensions": [
|
||||
".3gp",
|
||||
".3GP",
|
||||
".avi",
|
||||
".AVI",
|
||||
".bmp",
|
||||
".BMP",
|
||||
".gif",
|
||||
".GIF",
|
||||
".ico",
|
||||
".ICO",
|
||||
".jpeg",
|
||||
".JPEG",
|
||||
".jpg",
|
||||
".JPG",
|
||||
".m4v",
|
||||
".M4V",
|
||||
".mov",
|
||||
".MOV",
|
||||
".mp4",
|
||||
".MP4",
|
||||
".mta",
|
||||
".MTA",
|
||||
".png",
|
||||
".PNG",
|
||||
".tiff",
|
||||
".TIFF"
|
||||
],
|
||||
"VerifyToSeason": [
|
||||
". 2000",
|
||||
". 2001",
|
||||
". 2002",
|
||||
". 2003",
|
||||
". 2004",
|
||||
". 2005",
|
||||
". 2006",
|
||||
". 2007",
|
||||
". 2008",
|
||||
". 2009",
|
||||
". 2010",
|
||||
". 2011",
|
||||
". 2012",
|
||||
". 2013",
|
||||
". 2014",
|
||||
". 2015",
|
||||
". 2016",
|
||||
". 2017",
|
||||
". 2018",
|
||||
". 2019",
|
||||
". 2020",
|
||||
". 2021",
|
||||
". 2022",
|
||||
". 2023",
|
||||
". 2024",
|
||||
". 2025",
|
||||
". 2026",
|
||||
". 2027",
|
||||
". 2028",
|
||||
". 2029",
|
||||
"2000.0 Winter",
|
||||
"2002.1 Spring",
|
||||
"2002.4 Winter",
|
||||
"2003.0 Winter",
|
||||
"2003.1 Spring",
|
||||
"2003.3 Fall",
|
||||
"2003.4 Winter",
|
||||
"2004.0 Winter",
|
||||
"2005.1 Spring",
|
||||
"2005.2 Summer",
|
||||
"2005.3 Fall",
|
||||
"2005.4 Winter",
|
||||
"2006.0 Winter",
|
||||
"2006.1 Spring",
|
||||
"2006.3 Fall",
|
||||
"2007.0 Winter",
|
||||
"2007.2 Summer Logan Michael",
|
||||
"2007.2 Summer",
|
||||
"2007.3 Fall Logan Michael",
|
||||
"2007.4 Winter Logan Michael",
|
||||
"2008.0 Winter Logan Michael",
|
||||
"2008.1 Spring Logan Michael",
|
||||
"2008.2 Summer Logan Michael",
|
||||
"2008.2 Summer",
|
||||
"2008.3 Fall Logan Michael",
|
||||
"2009.0 Winter Logan Michael",
|
||||
"2009.0 Winter",
|
||||
"2009.1 Spring Logan Michael",
|
||||
"2009.1 Spring",
|
||||
"2009.2 Summer Logan Michael",
|
||||
"2009.2 Summer",
|
||||
"2009.3 Fall Logan Michael",
|
||||
"2009.3 Fall",
|
||||
"2009.4 Winter Logan Michael",
|
||||
"2009.4 Winter",
|
||||
"2010.0 Winter Logan Michael",
|
||||
"2010.0 Winter",
|
||||
"2010.1 Spring Logan Michael",
|
||||
"2010.1 Spring",
|
||||
"2010.2 Summer",
|
||||
"2010.3 Fall Logan Michael",
|
||||
"2010.3 Fall",
|
||||
"2010.4 Winter",
|
||||
"2011.0 Winter",
|
||||
"2011.1 Spring",
|
||||
"2011.2 Summer",
|
||||
"2011.3 Fall",
|
||||
"2011.4 Winter",
|
||||
"2012.0 Winter Chelsea 2012",
|
||||
"2012.0 Winter Chelsea",
|
||||
"2012.0 Winter",
|
||||
"2012.1 Spring Chelsea",
|
||||
"2012.1 Spring",
|
||||
"2012.2 Summer Chelsea",
|
||||
"2012.2 Summer",
|
||||
"2012.3 Fall Chelsea",
|
||||
"2012.3 Fall",
|
||||
"2012.4 Winter Chelsea",
|
||||
"2012.4 Winter",
|
||||
"2013.0 Winter Chelsea 2013",
|
||||
"2013.0 Winter Chelsea",
|
||||
"2013.0 Winter",
|
||||
"2013.1 Spring",
|
||||
"2013.2 Summer Chelsea",
|
||||
"2013.2 Summer",
|
||||
"2013.3 Fall Chelsea",
|
||||
"2013.3 Fall",
|
||||
"2013.4 Winter",
|
||||
"2014.0 Winter",
|
||||
"2014.1 Spring",
|
||||
"2014.2 Summer",
|
||||
"2014.3 Fall",
|
||||
"2014.4 Winter",
|
||||
"2015.0 Winter",
|
||||
"2015.1 Spring",
|
||||
"2015.2 Summer",
|
||||
"2015.3 Fall",
|
||||
"2015.4 Winter",
|
||||
"2016.0 Winter",
|
||||
"2016.1 Spring",
|
||||
"2016.2 Summer",
|
||||
"2016.3 Fall",
|
||||
"2016.4 Winter",
|
||||
"2017.1 Spring",
|
||||
"2017.2 Summer",
|
||||
"2017.3 Fall",
|
||||
"2017.4 Winter",
|
||||
"2018.0 Winter",
|
||||
"2018.1 Spring",
|
||||
"2018.3 Fall",
|
||||
"2018.4 Winter",
|
||||
"2019.0 Winter",
|
||||
"2019.1 Spring",
|
||||
"2019.2 Summer",
|
||||
"2019.3 Fall",
|
||||
"2019.4 Winter",
|
||||
"2020.0 Winter",
|
||||
"2020.1 Spring",
|
||||
"2020.2 Summer",
|
||||
"2020.3 Fall",
|
||||
"2020.4 Winter",
|
||||
"2021.1 Spring",
|
||||
"2021.2 Summer",
|
||||
"2021.3 Fall",
|
||||
"2021.4 Winter",
|
||||
"2022.0 Winter",
|
||||
"2022.1 Spring",
|
||||
"Anthem 2015",
|
||||
"April 2010",
|
||||
"April 2013",
|
||||
"December 2006",
|
||||
"December 2010",
|
||||
"Fall 2005",
|
||||
"Fall 2015",
|
||||
"Fall 2016",
|
||||
"Fall 2017",
|
||||
"Fall 2018",
|
||||
"Fall 2019",
|
||||
"Fall 2020",
|
||||
"Fall 2021",
|
||||
"February 2010",
|
||||
"January 2015",
|
||||
"July 2010",
|
||||
"June 2010",
|
||||
"Kids 2005",
|
||||
"March 2013",
|
||||
"May 2010",
|
||||
"May 2011",
|
||||
"May 2013",
|
||||
"October 2005",
|
||||
"October 2014",
|
||||
"Spring 2013",
|
||||
"Spring 2014",
|
||||
"Spring 2016",
|
||||
"Spring 2018",
|
||||
"Spring 2019",
|
||||
"Spring 2020",
|
||||
"Summer 2011",
|
||||
"Summer 2012",
|
||||
"Summer 2013",
|
||||
"Summer 2014",
|
||||
"Summer 2015",
|
||||
"Summer 2016",
|
||||
"Summer 2017",
|
||||
"Summer 2018",
|
||||
"Summer 2020",
|
||||
"Summer 2021",
|
||||
"Winter 2015",
|
||||
"Winter 2016",
|
||||
"Winter 2017",
|
||||
"Winter 2018",
|
||||
"Winter 2019-2020",
|
||||
"Winter 2020",
|
||||
"zzz 2005.0 Winter Tracy Pictures",
|
||||
"zzz 2005.1 Spring Tracy Pictures",
|
||||
"zzz 2005.2 Summer Tracy Pictures",
|
||||
"zzz 2005.3 Fall Tracy Pictures",
|
||||
"zzz 2005.4 Winter Tracy Pictures",
|
||||
"zzz 2006.1 Spring Tracy Pictures",
|
||||
"zzz 2007.0 Winter Tracy Pictures",
|
||||
"zzz 2007.2 Summer Tracy Pictures",
|
||||
"zzz 2008.0 Winter Tracy Pictures",
|
||||
"zzz 2008.2 Summer Tracy Pictures",
|
||||
"zzz 2009.0 Winter Tracy Pictures",
|
||||
"zzz 2009.2 Summer Tracy Pictures",
|
||||
"zzz 2009.3 Fall Tracy Pictures",
|
||||
"zzz 2009.4 Winter Tracy Pictures",
|
||||
"zzz 2010.0 Winter Tracy Pictures",
|
||||
"zzz 2010.1 Spring Tracy Pictures",
|
||||
"zzz 2010.2 Summer Tracy Pictures",
|
||||
"zzz 2010.3 Fall Tracy Pictures",
|
||||
"zzz 2011.0 Winter Tracy Pictures",
|
||||
"zzz 2011.1 Spring Tracy Pictures",
|
||||
"zzz 2011.2 Summer Tracy Pictures",
|
||||
"zzz 2011.3 Fall Tracy Pictures",
|
||||
"zzz 2011.4 Winter Tracy Pictures",
|
||||
"zzz 2012.0 Winter Tracy Pictures",
|
||||
"zzz 2012.1 Spring Tracy Pictures",
|
||||
"zzz 2012.2 Summer Tracy Pictures",
|
||||
"zzz 2012.3 Fall Tracy Pictures",
|
||||
"zzz 2012.4 Winter Tracy Pictures",
|
||||
"zzz 2013.0 Winter Tracy Pictures",
|
||||
"zzz 2013.1 Spring Tracy Pictures",
|
||||
"zzz 2013.2 Summer Tracy Pictures",
|
||||
"zzz 2013.3 Fall Tracy Pictures",
|
||||
"zzz 2013.4 Winter Tracy Pictures",
|
||||
"zzz 2014.0 Winter Tracy Pictures",
|
||||
"zzz 2014.1 Spring Tracy Pictures",
|
||||
"zzz 2014.2 Summer Tracy Pictures",
|
||||
"zzz 2014.3 Fall Tracy Pictures",
|
||||
"zzz 2014.4 Winter Tracy Pictures",
|
||||
"zzz 2015.0 Winter Tracy Pictures"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
namespace View_by_Distance.Property.Models;
|
||||
|
||||
public class DirectoryInfo
|
||||
{
|
||||
|
||||
protected readonly Shared.Models.FileHolder[] _SourceDirectoryFileHolderCollection;
|
||||
protected readonly string[] _FilteredSourceDirectoryFiles;
|
||||
protected readonly int _G;
|
||||
protected readonly bool[] _Moved;
|
||||
protected readonly bool?[] _Changed;
|
||||
protected readonly Shared.Models.Property?[] _PropertyCollection;
|
||||
protected readonly FileInfo?[] _PropertyFileHolderCollection;
|
||||
protected readonly int _R;
|
||||
protected readonly string _SourceDirectory;
|
||||
protected readonly bool[] _ValidImageFormatExtensionCollection;
|
||||
protected readonly bool[] _WrongYear;
|
||||
public Shared.Models.FileHolder[] SourceDirectoryFileHolderCollection => _SourceDirectoryFileHolderCollection;
|
||||
[Obsolete($"Use {nameof(SourceDirectoryFileHolderCollection)}")]
|
||||
public string[] FilteredSourceDirectoryFiles => _FilteredSourceDirectoryFiles;
|
||||
public int G => _G;
|
||||
public bool[] Moved => _Moved;
|
||||
public bool?[] Changed => _Changed;
|
||||
public Shared.Models.Property?[] PropertyCollection => _PropertyCollection;
|
||||
public FileInfo?[] PropertyFileHolderCollection => _PropertyFileHolderCollection;
|
||||
public int R => _R;
|
||||
public string SourceDirectory => _SourceDirectory;
|
||||
public bool[] ValidImageFormatExtensionCollection => _ValidImageFormatExtensionCollection;
|
||||
public bool[] WrongYear => _WrongYear;
|
||||
|
||||
public DirectoryInfo(int g, string sourceDirectory, string[] filteredSourceDirectoryFiles, int r)
|
||||
{
|
||||
int length = filteredSourceDirectoryFiles.Length;
|
||||
_G = g;
|
||||
_R = r;
|
||||
_Changed = Array.Empty<bool?>();
|
||||
_SourceDirectory = sourceDirectory;
|
||||
_Moved = Enumerable.Repeat(false, length).ToArray();
|
||||
_WrongYear = Enumerable.Repeat(false, length).ToArray();
|
||||
_FilteredSourceDirectoryFiles = filteredSourceDirectoryFiles;
|
||||
_ValidImageFormatExtensionCollection = Enumerable.Repeat(false, length).ToArray();
|
||||
_PropertyFileHolderCollection = Enumerable.Repeat<FileInfo?>(null, length).ToArray();
|
||||
_PropertyCollection = Enumerable.Repeat<Shared.Models.Property?>(null, length).ToArray();
|
||||
_SourceDirectoryFileHolderCollection = (from l in filteredSourceDirectoryFiles select new Shared.Models.FileHolder(l)).ToArray();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -22,8 +22,6 @@ public class Configuration
|
||||
[Display(Name = "Julie Phares Copy Birthdays"), Required] public string[] JLinks { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Distance Results"), Required] public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Image Faces Results"), Required] public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Index"), Required] public bool? LoadOrCreateThenSaveIndex { get; set; }
|
||||
[Display(Name = "Mapped Max Index"), Required] public int? MappedMaxIndex { get; set; }
|
||||
[Display(Name = "Mixed Year Relative Paths"), Required] public string[] MixedYearRelativePaths { get; set; }
|
||||
[Display(Name = "Model Directory"), Required] public string ModelDirectory { get; set; }
|
||||
[Display(Name = "Model Name"), Required] public string ModelName { get; set; }
|
||||
@ -85,8 +83,6 @@ public class Configuration
|
||||
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions ??= Array.Empty<string>();
|
||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions ??= Array.Empty<string>();
|
||||
if (configuration.LoadOrCreateThenSaveIndex is null)
|
||||
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
||||
if (configuration.MixedYearRelativePaths is null)
|
||||
throw new NullReferenceException(nameof(configuration.MixedYearRelativePaths));
|
||||
if (configuration.NumberOfJitters is null)
|
||||
@ -141,8 +137,6 @@ public class Configuration
|
||||
configuration.JLinks,
|
||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions,
|
||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions,
|
||||
configuration.LoadOrCreateThenSaveIndex.Value,
|
||||
configuration.MappedMaxIndex,
|
||||
configuration.MixedYearRelativePaths,
|
||||
configuration.ModelDirectory,
|
||||
configuration.ModelName,
|
||||
|
@ -21,8 +21,6 @@ public class Configuration
|
||||
public string[] JLinks { init; get; }
|
||||
public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { init; get; }
|
||||
public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { init; get; }
|
||||
public bool LoadOrCreateThenSaveIndex { init; get; }
|
||||
public int? MappedMaxIndex { init; get; }
|
||||
public string[] MixedYearRelativePaths { init; get; }
|
||||
public string ModelDirectory { init; get; }
|
||||
public string ModelName { init; get; }
|
||||
@ -64,8 +62,6 @@ public class Configuration
|
||||
string[] jLinks,
|
||||
string[] loadOrCreateThenSaveDistanceResultsForOutputResolutions,
|
||||
string[] loadOrCreateThenSaveImageFacesResultsForOutputResolutions,
|
||||
bool loadOrCreateThenSaveIndex,
|
||||
int? mappedMaxIndex,
|
||||
string[] mixedYearRelativePaths,
|
||||
string modelDirectory,
|
||||
string modelName,
|
||||
@ -106,8 +102,6 @@ public class Configuration
|
||||
JLinks = jLinks;
|
||||
LoadOrCreateThenSaveDistanceResultsForOutputResolutions = loadOrCreateThenSaveDistanceResultsForOutputResolutions;
|
||||
LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = loadOrCreateThenSaveImageFacesResultsForOutputResolutions;
|
||||
LoadOrCreateThenSaveIndex = loadOrCreateThenSaveIndex;
|
||||
MappedMaxIndex = mappedMaxIndex;
|
||||
MixedYearRelativePaths = mixedYearRelativePaths;
|
||||
ModelDirectory = modelDirectory;
|
||||
ModelName = modelName;
|
||||
|
@ -28,10 +28,8 @@ public class Configuration
|
||||
[Display(Name = "Julie Phares Copy Birthdays"), Required] public string[] JLinks { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Distance Results"), Required] public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Image Faces Results"), Required] public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { get; set; }
|
||||
[Display(Name = "Load Or Create Then Save Index"), Required] public bool? LoadOrCreateThenSaveIndex { get; set; }
|
||||
[Display(Name = "Location Digits"), Required] public int? LocationDigits { get; set; }
|
||||
[Display(Name = "Location Factor"), Required] public int? LocationFactor { get; set; }
|
||||
[Display(Name = "Mapped Max Index"), Required] public int? MappedMaxIndex { get; set; }
|
||||
[Display(Name = "Mapping Default Name"), Required] public string MappingDefaultName { get; set; }
|
||||
[Display(Name = "Mapping Use Deterministic Hash Code Unknown Face Key Value Pairs for Add to Mapping"), Required] public bool? MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping { get; set; }
|
||||
[Display(Name = "Mapping Use Deterministic Hash Code Unknown Face Key Value Pairs for Save Mapping"), Required] public bool? MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping { get; set; }
|
||||
@ -118,8 +116,6 @@ public class Configuration
|
||||
throw new NullReferenceException(nameof(configuration.IgnoreRelativePaths));
|
||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions ??= Array.Empty<string>();
|
||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions ??= Array.Empty<string>();
|
||||
if (configuration.LoadOrCreateThenSaveIndex is null)
|
||||
throw new NullReferenceException(nameof(configuration.LoadOrCreateThenSaveIndex));
|
||||
if (configuration.LocationDigits is null)
|
||||
throw new NullReferenceException(nameof(configuration.LocationDigits));
|
||||
if (configuration.LocationFactor is null)
|
||||
@ -211,10 +207,8 @@ public class Configuration
|
||||
configuration.JLinks,
|
||||
configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions,
|
||||
configuration.LoadOrCreateThenSaveImageFacesResultsForOutputResolutions,
|
||||
configuration.LoadOrCreateThenSaveIndex.Value,
|
||||
configuration.LocationDigits.Value,
|
||||
configuration.LocationFactor.Value,
|
||||
configuration.MappedMaxIndex,
|
||||
configuration.MappingDefaultName,
|
||||
configuration.MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping.Value,
|
||||
configuration.MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping.Value,
|
||||
|
@ -27,10 +27,8 @@ public class Configuration
|
||||
public string[] JLinks { init; get; }
|
||||
public string[] LoadOrCreateThenSaveDistanceResultsForOutputResolutions { init; get; }
|
||||
public string[] LoadOrCreateThenSaveImageFacesResultsForOutputResolutions { init; get; }
|
||||
public bool LoadOrCreateThenSaveIndex { init; get; }
|
||||
public int LocationDigits { init; get; }
|
||||
public int LocationFactor { init; get; }
|
||||
public int? MappedMaxIndex { init; get; }
|
||||
public string MappingDefaultName { init; get; }
|
||||
public bool MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping { init; get; }
|
||||
public bool MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping { init; get; }
|
||||
@ -91,10 +89,8 @@ public class Configuration
|
||||
string[] jLinks,
|
||||
string[] loadOrCreateThenSaveDistanceResultsForOutputResolutions,
|
||||
string[] loadOrCreateThenSaveImageFacesResultsForOutputResolutions,
|
||||
bool loadOrCreateThenSaveIndex,
|
||||
int locationDigits,
|
||||
int locationFactor,
|
||||
int? mappedMaxIndex,
|
||||
string mappingDefaultName,
|
||||
bool mappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping,
|
||||
bool mappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping,
|
||||
@ -154,10 +150,8 @@ public class Configuration
|
||||
JLinks = jLinks;
|
||||
LoadOrCreateThenSaveDistanceResultsForOutputResolutions = loadOrCreateThenSaveDistanceResultsForOutputResolutions;
|
||||
LoadOrCreateThenSaveImageFacesResultsForOutputResolutions = loadOrCreateThenSaveImageFacesResultsForOutputResolutions;
|
||||
LoadOrCreateThenSaveIndex = loadOrCreateThenSaveIndex;
|
||||
LocationDigits = locationDigits;
|
||||
LocationFactor = locationFactor;
|
||||
MappedMaxIndex = mappedMaxIndex;
|
||||
MappingDefaultName = mappingDefaultName;
|
||||
MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping = mappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForAddToMapping;
|
||||
MappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping = mappingUseDeterministicHashCodeUnknownFaceKeyValuePairsForSaveMapping;
|
||||
|
@ -29,8 +29,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Map", "Map\Map.csproj", "{9
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Metadata", "Metadata\Metadata.csproj", "{961D11A0-44C8-48CD-BEEE-A6E6903AE58F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Not-Copy-Copy", "Not-Copy-Copy\Not-Copy-Copy.csproj", "{BF81D265-36E3-4DCA-891B-A0D875C1E68A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotoPrism", "PhotoPrism\PhotoPrism.csproj", "{DF4B0776-E0E5-4220-8721-8D1E491FF263}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrepareForOld", "PrepareForOld\PrepareForOld.csproj", "{F73F9468-0139-4B05-99CE-C6C0403D03E5}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user