diff --git a/Compare/appsettings.Development.json b/Compare/appsettings.Development.json
index b7a7b8a..f01b7d8 100644
--- a/Compare/appsettings.Development.json
+++ b/Compare/appsettings.Development.json
@@ -79,7 +79,7 @@
"/zzz Phares Slides/Slides 2015-06-10/Magazine 01"
],
"Configuration": {
- "DateGroup": "2022-12-30",
+ "DateGroup": "45f4401",
"DiffPropertyDirectory": "",
"FileNameDirectorySeparator": ".Z.",
"ForcePropertyLastWriteTimeToCreationTime": false,
@@ -87,7 +87,7 @@
"Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]",
"PopulatePropertyId": true,
"PropertiesChangedForProperty": false,
- "RootDirectory": "C:/Tmp/Phares/Compare/Images-ec5a909",
+ "RootDirectory": "C:/Tmp/Phares/Compare/Images-45f4401",
"WriteBitmapDataBytes": false,
"IgnoreExtensions": [
".gif",
diff --git a/Compare/appsettings.json b/Compare/appsettings.json
index 6a27fb4..a30afe4 100644
--- a/Compare/appsettings.json
+++ b/Compare/appsettings.json
@@ -50,7 +50,7 @@
"WorkingDirectoryName": "PharesApps",
"Windows": {
"Configuration": {
- "DateGroup": "2022-12-30",
+ "DateGroup": "45f4401",
"DiffPropertyDirectory": "",
"FileNameDirectorySeparator": ".Z.",
"ForcePropertyLastWriteTimeToCreationTime": false,
diff --git a/Date-Group/appsettings.Development.json b/Date-Group/appsettings.Development.json
index 45e4914..af9d749 100644
--- a/Date-Group/appsettings.Development.json
+++ b/Date-Group/appsettings.Development.json
@@ -55,7 +55,7 @@
"ByHash": false,
"BySeason": true,
"ByWeek": false,
- "DateGroup": "2022-12-30",
+ "DateGroup": "45f4401",
"FileNameDirectorySeparator": ".Z.",
"ForcePropertyLastWriteTimeToCreationTime": false,
"KeepFullPath": false,
@@ -68,11 +68,12 @@
"ResultContent": "()",
"ResultSingleton": "{}",
"xRootDirectory": "C:/Tmp/phares/Pictures",
- "xxRootDirectory": "C:/Tmp/Phares/Compare/Images-ec5a909",
- "xxxRootDirectory": "F:/Tmp/Phares/Compare/Not-Copy-Copy-ec5a909",
- "xxxxRootDirectory": "C:/Tmp/Phares/Compare/Not-Copy-Copy-ec5a909",
+ "xxRootDirectory": "C:/Tmp/Phares/Compare/Images-45f4401",
+ "xxxRootDirectory": "F:/Tmp/Phares/Compare/Not-Copy-Copy-45f4401",
+ "xxxxRootDirectory": "C:/Tmp/Phares/Compare/Not-Copy-Copy-45f4401",
"xxxxxRootDirectory": "F:/Tmp/Phares/2022-11-03-DCIM/DCIM/100D3400 2022",
- "RootDirectory": "E:/- - - Videos/-",
+ "xxxxxxRootDirectory": "E:/- - - Videos/-",
+ "RootDirectory": "D:/2) Images B/Not-Copy-Copy/New folder/-",
"WriteBitmapDataBytes": false,
"IgnoreExtensions": [
".gif",
diff --git a/Date-Group/appsettings.json b/Date-Group/appsettings.json
index e6378eb..0c13308 100644
--- a/Date-Group/appsettings.json
+++ b/Date-Group/appsettings.json
@@ -55,7 +55,7 @@
"ByHash": false,
"BySeason": false,
"ByWeek": false,
- "DateGroup": "2022-12-30",
+ "DateGroup": "45f4401",
"FileNameDirectorySeparator": ".Z.",
"ForcePropertyLastWriteTimeToCreationTime": false,
"KeepFullPath": false,
@@ -68,8 +68,8 @@
"ResultContent": "()",
"ResultSingleton": "{}",
"xRootDirectory": "C:/Tmp/phares/Pictures",
- "xxRootDirectory": "C:/Tmp/Phares/Compare/Images-ec5a909",
- "RootDirectory": "F:/Tmp/Phares/Compare/Not-Copy-Copy-ec5a909",
+ "xxRootDirectory": "C:/Tmp/Phares/Compare/Images-45f4401",
+ "RootDirectory": "F:/Tmp/Phares/Compare/Not-Copy-Copy-45f4401",
"xxxxRootDirectory": "F:/Tmp/Phares/2022-11-03-DCIM/DCIM/100D3400 2022",
"WriteBitmapDataBytes": false,
"IgnoreExtensions": [
diff --git a/Delete-By-Distinct/appsettings.Development.json b/Delete-By-Distinct/appsettings.Development.json
index 4db6fe4..abe28f4 100644
--- a/Delete-By-Distinct/appsettings.Development.json
+++ b/Delete-By-Distinct/appsettings.Development.json
@@ -1,6 +1,6 @@
{
"xCompareRootDirectory": "",
- "CompareRootDirectory": "D:/7) Question/- - - Images",
+ "CompareRootDirectory": "D:/2) Images B/Not-Copy-Copy-45f4401",
"Logging": {
"LogLevel": {
"Log4netProvider": "Debug"
@@ -14,8 +14,8 @@
"Windows": {
"Configuration": {
"xRootDirectory": "D:/2) Images B/Corrupt",
- "xxRootDirectory": "D:/2) Images B/Not-Copy-Copy-ec5a909",
- "RootDirectory": "D:/1) Images A/Images-ec5a909",
+ "xxRootDirectory": "D:/2) Images B/Not-Copy-Copy-45f4401",
+ "RootDirectory": "D:/1) Images A/Images-45f4401",
"VerifyToSeason": [
". 2000",
". 2001",
diff --git a/Delete-By-Distinct/appsettings.json b/Delete-By-Distinct/appsettings.json
index e5e938e..8179129 100644
--- a/Delete-By-Distinct/appsettings.json
+++ b/Delete-By-Distinct/appsettings.json
@@ -52,7 +52,7 @@
"WorkingDirectoryName": "PharesApps",
"Windows": {
"Configuration": {
- "DateGroup": "2022-12-30",
+ "DateGroup": "45f4401",
"DiffPropertyDirectory": "",
"FileNameDirectorySeparator": ".Z.",
"ForcePropertyLastWriteTimeToCreationTime": false,
@@ -65,7 +65,7 @@
"ResultCollection": "[]",
"ResultContent": "()",
"ResultSingleton": "{}",
- "RootDirectory": "C:/Tmp/Phares/Compare/Images-ec5a909",
+ "RootDirectory": "C:/Tmp/Phares/Compare/Images-45f4401",
"WriteBitmapDataBytes": false,
"IgnoreExtensions": [
".gif",
diff --git a/Delete-By-Relative/appsettings.Development.json b/Delete-By-Relative/appsettings.Development.json
index 6cab14c..8787b3a 100644
--- a/Delete-By-Relative/appsettings.Development.json
+++ b/Delete-By-Relative/appsettings.Development.json
@@ -1,7 +1,7 @@
{
- "xCompareRootDirectory": "D:/Tmp/Phares/Not-Copy-Copy-ec5a909",
+ "xCompareRootDirectory": "D:/Tmp/Phares/Not-Copy-Copy-45f4401",
"xxCompareRootDirectory": "E:/www/Images - Results/C) Resize/2021-11-03/2256 x 1496/()",
- "xxxCompareRootDirectory": "C:/Tmp/Phares/Compare/.Delete-Not-Copy-Copy-ec5a909",
+ "xxxCompareRootDirectory": "C:/Tmp/Phares/Compare/.Delete-Not-Copy-Copy-45f4401",
"CompareRootDirectory": "C:/Tmp/Phares/Compare/Not-Copy-Copy-Duplicates",
"Logging": {
"LogLevel": {
diff --git a/Delete-By-Relative/appsettings.json b/Delete-By-Relative/appsettings.json
index bf86653..8b70714 100644
--- a/Delete-By-Relative/appsettings.json
+++ b/Delete-By-Relative/appsettings.json
@@ -51,7 +51,7 @@
"WorkingDirectoryName": "PharesApps",
"Windows": {
"Configuration": {
- "DateGroup": "2022-12-30",
+ "DateGroup": "45f4401",
"DiffPropertyDirectory": "",
"FileNameDirectorySeparator": ".Z.",
"ForcePropertyLastWriteTimeToCreationTime": false,
@@ -64,7 +64,7 @@
"ResultCollection": "[]",
"ResultContent": "()",
"ResultSingleton": "{}",
- "RootDirectory": "C:/Tmp/Phares/Compare/Images-ec5a909",
+ "RootDirectory": "C:/Tmp/Phares/Compare/Images-45f4401",
"WriteBitmapDataBytes": false,
"IgnoreExtensions": [
".gif",
diff --git a/Distance/Distance.csproj b/Distance/Distance.csproj
index a28a166..a1af407 100644
--- a/Distance/Distance.csproj
+++ b/Distance/Distance.csproj
@@ -38,7 +38,6 @@
-
diff --git a/Distance/Models/MapLogicSupport.cs b/Distance/Models/MapLogicSupport.cs
index 6e8f6e7..cc2e6d4 100644
--- a/Distance/Models/MapLogicSupport.cs
+++ b/Distance/Models/MapLogicSupport.cs
@@ -4,7 +4,6 @@ using View_by_Distance.FaceRecognitionDotNet;
using View_by_Distance.Map.Models;
using View_by_Distance.Shared.Models;
using View_by_Distance.Shared.Models.Properties;
-using WindowsShortcutFactory;
namespace View_by_Distance.Distance.Models;
@@ -363,55 +362,4 @@ public class MapLogicSupport : Shared.Models.Methods.IMapLogicSupport
return result;
}
- private static bool TryToFind(string a2PeopleSingletonDirectory, string file, string path)
- {
- bool result = false;
- string? pathName = Path.GetFileName(path);
- string? group = Path.GetDirectoryName(path);
- string? groupName = Path.GetFileName(group);
- if (pathName is not null && group is not null && groupName is not null)
- {
- WindowsShortcut windowsShortcut;
- string checkDirectory = Path.Combine(a2PeopleSingletonDirectory, groupName, pathName);
- if (Directory.Exists(checkDirectory))
- {
- try
- {
- windowsShortcut = new() { Path = checkDirectory };
- windowsShortcut.Save(file);
- windowsShortcut.Dispose();
- result = true;
- }
- catch (Exception)
- { }
- }
- }
- return result;
- }
-
- public static void BeforeSaveFilteredOriginalImagesFromJLinks(string[] jLinks, string a2PeopleSingletonDirectory)
- {
- string[] files;
- string checkDirectory;
- WindowsShortcut windowsShortcut;
- foreach (string directoryName in jLinks)
- {
- checkDirectory = Path.Combine(a2PeopleSingletonDirectory, directoryName);
- if (!Directory.Exists(checkDirectory))
- continue;
- files = Directory.GetFiles(checkDirectory, "*.lnk", SearchOption.TopDirectoryOnly);
- foreach (string file in files)
- {
- windowsShortcut = WindowsShortcut.Load(file);
- if (windowsShortcut.Path is null)
- continue;
- if (!Directory.Exists(windowsShortcut.Path))
- {
- if (!TryToFind(a2PeopleSingletonDirectory, file, windowsShortcut.Path))
- continue;
- }
- }
- }
- }
-
}
\ No newline at end of file
diff --git a/Drag-Drop/Form.cs b/Drag-Drop/Form.cs
index 8dc2494..143b12b 100644
--- a/Drag-Drop/Form.cs
+++ b/Drag-Drop/Form.cs
@@ -394,7 +394,7 @@ public partial class Form : System.Windows.Forms.Form
string? directoryName;
foreach (string path in paths)
{
- name = Path.GetFileName(path);
+ name = Path.GetFileName(path).Trim();
if (name.Length < 1 || (!name.StartsWith("zzz =20") && !name.StartsWith("=20") && !name.StartsWith("#20")))
// if (name.Length < 1 || !name.Contains(".Z.#20"))
continue;
@@ -463,33 +463,22 @@ public partial class Form : System.Windows.Forms.Form
_ProgressBar.Visible = false;
}
- void Form1_DragDrop(object? sender, DragEventArgs e)
+ private static void MoveMatches(string argZero)
{
- try
+ string moveDirectory;
+ string checkDirectory;
+ int length = argZero.Length;
+ string compareDirectory = "D:/";
+ string[] directories = Directory.GetDirectories(argZero, "*", SearchOption.TopDirectoryOnly);
+ foreach (string directory in directories)
{
- if (e.Data is null || e.Data.GetData(DataFormats.FileDrop) is not string[] paths)
- _TextBox.Text = string.Empty;
- else
- {
- if (paths.All(l => l.Contains("=20")) || paths.All(l => l.Contains("#20")))
- // if (paths.All(l => l.Contains('#')))
- Rename2000(paths);
- else
- {
- List directories = GetDirectoriesOrDoDragDrop(paths);
- if (directories.Any())
- {
- RenameFilesInDirectories(directories);
- string? parentDirectory = Path.GetDirectoryName(directories[0]);
- if (parentDirectory is not null && parentDirectory != Path.GetPathRoot(directories[0]))
- _ = IPath.DeleteEmptyDirectories(parentDirectory);
- }
- }
- }
- }
- catch (Exception)
- {
- throw;
+ if (!string.IsNullOrEmpty(directory))
+ continue;
+ checkDirectory = string.Concat(compareDirectory, directory[length..]);
+ if (!Directory.Exists(checkDirectory))
+ continue;
+ moveDirectory = string.Concat(compareDirectory[..^1], directory[length..]);
+ Directory.Move(checkDirectory, moveDirectory);
}
}
@@ -526,4 +515,36 @@ public partial class Form : System.Windows.Forms.Form
return results;
}
+ void Form1_DragDrop(object? sender, DragEventArgs e)
+ {
+ try
+ {
+ if (e.Data is null || e.Data.GetData(DataFormats.FileDrop) is not string[] paths)
+ _TextBox.Text = string.Empty;
+ else
+ {
+ if (paths.Length == 0 && paths[0].Contains("~~~"))
+ MoveMatches(paths[0]);
+ else if (paths.All(l => l.Contains("=20")) || paths.All(l => l.Contains("#20")))
+ // if (paths.All(l => l.Contains('#')))
+ Rename2000(paths);
+ else
+ {
+ List directories = GetDirectoriesOrDoDragDrop(paths);
+ if (directories.Any())
+ {
+ RenameFilesInDirectories(directories);
+ string? parentDirectory = Path.GetDirectoryName(directories[0]);
+ if (parentDirectory is not null && parentDirectory != Path.GetPathRoot(directories[0]))
+ _ = IPath.DeleteEmptyDirectories(parentDirectory);
+ }
+ }
+ }
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ }
+
}
\ No newline at end of file
diff --git a/Duplicate-Search/appsettings.Development.json b/Duplicate-Search/appsettings.Development.json
index 0b0bec5..4ebdb15 100644
--- a/Duplicate-Search/appsettings.Development.json
+++ b/Duplicate-Search/appsettings.Development.json
@@ -124,8 +124,8 @@
],
"Windows": {
"Configuration": {
- "xRootDirectory": "F:/Tmp/Phares/Compare/Images-ec5a909",
- "xxRootDirectory": "F:/Tmp/Phares/Compare/Not-Copy-Copy-ec5a909",
+ "xRootDirectory": "F:/Tmp/Phares/Compare/Images-45f4401",
+ "xxRootDirectory": "F:/Tmp/Phares/Compare/Not-Copy-Copy-45f4401",
"RootDirectory": "E:/",
"VerifyToSeason": [
". 2000",
diff --git a/Duplicate-Search/appsettings.json b/Duplicate-Search/appsettings.json
index 62f67c4..1167843 100644
--- a/Duplicate-Search/appsettings.json
+++ b/Duplicate-Search/appsettings.json
@@ -53,7 +53,7 @@
"WorkingDirectoryName": "PharesApps",
"Windows": {
"Configuration": {
- "DateGroup": "2022-12-30",
+ "DateGroup": "45f4401",
"DiffPropertyDirectory": "",
"FileNameDirectorySeparator": ".Z.",
"ForcePropertyLastWriteTimeToCreationTime": false,
@@ -66,7 +66,7 @@
"ResultCollection": "[]",
"ResultContent": "()",
"ResultSingleton": "{}",
- "RootDirectory": "C:/Tmp/Phares/Compare/Images-ec5a909",
+ "RootDirectory": "C:/Tmp/Phares/Compare/Images-45f4401",
"WriteBitmapDataBytes": false,
"IgnoreExtensions": [
".gif",
diff --git a/Instance/DlibDotNet.cs b/Instance/DlibDotNet.cs
index 4373639..b6c272a 100644
--- a/Instance/DlibDotNet.cs
+++ b/Instance/DlibDotNet.cs
@@ -63,7 +63,7 @@ public partial class DlibDotNet
Models.Configuration configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration);
_Log.Information(propertyConfiguration.RootDirectory);
Property.Models.Configuration.Verify(propertyConfiguration, requireExist: false);
- OpenPossibleDuplicates(configuration);
+ Verify(configuration);
VerifyExtra(args, propertyConfiguration, configuration);
_Configuration = configuration;
_Index = new(configuration);
@@ -206,7 +206,7 @@ public partial class DlibDotNet
return result;
}
- private void OpenPossibleDuplicates(Models.Configuration configuration)
+ private void Verify(Models.Configuration configuration)
{
if (!configuration.OutputResolutions.Any() || string.IsNullOrEmpty(configuration.OutputResolutions[0]) || !configuration.ValidResolutions.Contains(configuration.OutputResolutions[0]))
throw new NullReferenceException($"{nameof(configuration.OutputResolutions)} must be _FileNameToCollection valid outputResolution!");
@@ -274,7 +274,8 @@ public partial class DlibDotNet
configuration.MappingDefaultName,
configuration.PersonBirthdayFirstYear,
configuration.PersonBirthdayFormat,
- configuration.PersonCharacters,
+ configuration.PersonCharacters.ToArray(),
+ configuration.PersonCharactersCopyCount,
configuration.RangeDaysDeltaTolerance,
configuration.RangeDistanceTolerance,
configuration.SaveSortingWithoutPerson,
@@ -783,6 +784,52 @@ public partial class DlibDotNet
}
}
+ private void RenameAbandoned(string argZero, Container[] containers)
+ {
+ List renameCollection = new();
+ foreach (Container container in containers)
+ {
+ if (!container.Items.Any())
+ continue;
+ if (!_ArgZeroIsConfigurationRootDirectory && !container.SourceDirectory.StartsWith(argZero))
+ continue;
+ foreach (Item item in container.Items)
+ {
+ if (item.Abandoned is not null && item.Abandoned.Value)
+ renameCollection.Add(item.SourceDirectoryFileHolder.FullName);
+ }
+ }
+ if (renameCollection.Any())
+ {
+ foreach (string rename in renameCollection)
+ File.Move(rename, $"{rename}.abd");
+ throw new Exception($"Renamed {renameCollection.Count}(s) files!");
+ }
+ }
+
+ private void RenameMoved(string argZero, Container[] containers)
+ {
+ List renameCollection = new();
+ foreach (Container container in containers)
+ {
+ if (!container.Items.Any())
+ continue;
+ if (!_ArgZeroIsConfigurationRootDirectory && !container.SourceDirectory.StartsWith(argZero))
+ continue;
+ foreach (Item item in container.Items)
+ {
+ if (item.Moved is not null && item.Moved.Value)
+ renameCollection.Add(item.SourceDirectoryFileHolder.FullName);
+ }
+ }
+ if (renameCollection.Any())
+ {
+ foreach (string rename in renameCollection)
+ File.Move(rename, $"{rename}.mvd");
+ throw new Exception($"Renamed {renameCollection.Count}(s) files!");
+ }
+ }
+
private List GetFilteredDistinctFaces(string argZero, Container[] containers)
{
List results = new();
@@ -845,13 +892,12 @@ public partial class DlibDotNet
return items;
}
- private void MapLogic(string argZero, long ticks, Container[] containers, string a2PeopleSingletonDirectory, string dResultsFullGroupDirectory, string d2ResultsFullGroupDirectory, string fPhotoPrismContentDirectory, MapLogicSupport mapLogicSupport, MapLogic mapLogic, string outputResolution, List distinctFilteredFaces, Mapping[] mappingCollection, int totalNotMapped)
+ private void MapLogic(string argZero, long ticks, Container[] containers, string a2PeopleSingletonDirectory, string dResultsFullGroupDirectory, string d2ResultsFullGroupDirectory, string fPhotoPrismContentDirectory, MapLogicSupport mapLogicSupport, MapLogic mapLogic, string outputResolution, List distinctFilteredFaces, Mapping[] mappingCollection, int totalNotMapped, Dictionary personKeyToCount)
{
int? useFiltersCounter = null;
SortingContainer[] sortingContainers;
string dFacesContentDirectory = Path.Combine(dResultsFullGroupDirectory, "()");
string d2FacePartsContentDirectory = Path.Combine(d2ResultsFullGroupDirectory, "()");
- Dictionary personKeyToCount = mapLogic.GetPersonKeyToCount(mappingCollection);
string dFacesCollectionDirectory = Path.Combine(dResultsFullGroupDirectory, "[]", _Configuration.PropertyConfiguration.ResultAllInOne);
Dictionary> idToNormalizedRectangleToMapping = MapLogicSupport.GetIdToNormalizedRectangleToFace(mappingCollection);
if (Directory.Exists(fPhotoPrismContentDirectory))
@@ -861,13 +907,11 @@ public partial class DlibDotNet
List- filteredItems = GetItems(argZero, containers);
mapLogic.SaveShortcutsForOutputResolutions(filteredItems, mappingCollection, personKeyToCount);
}
- if (_Configuration.PersonCharactersToCopyTo.Length == 1 && _Configuration.PersonCharacters.ToArray().Contains(_Configuration.PersonCharactersToCopyTo[0]))
- mapLogic.CopyAtLeastOneMappedFiles(_Configuration.PersonCharactersToCopyTo[0], dFacesContentDirectory, a2PeopleSingletonDirectory, mappingCollection);
+ if (_Configuration.PersonCharactersCopyCount > 0 && !string.IsNullOrEmpty(_Configuration.PersonCharacters))
+ mapLogic.CopyAtLeastOneMappedFiles(dFacesContentDirectory, a2PeopleSingletonDirectory, mappingCollection);
mapLogic.CopyManualFiles(dFacesContentDirectory, idToNormalizedRectangleToMapping);
if (_Configuration.SaveMappedForOutputResolutions.Contains(outputResolution))
mapLogic.SaveMapped(dFacesContentDirectory, d2FacePartsContentDirectory, mappingCollection, idToNormalizedRectangleToMapping, personKeyToCount, totalNotMapped);
- if (_Configuration.SaveFilteredOriginalImagesFromJLinksForOutputResolutions.Contains(outputResolution))
- mapLogic.SaveFilteredOriginalImagesFromJLinks(_Configuration.JLinks, _PersonContainers, a2PeopleSingletonDirectory, mappingCollection, personKeyToCount, totalNotMapped);
if (_Configuration.SaveFaceDistancesForOutputResolutions.Contains(outputResolution))
{
MapLogicSupport.SetFaceDistances(_AppSettings.MaxDegreeOfParallelism, ticks, distinctFilteredFaces);
@@ -1014,6 +1058,7 @@ public partial class DlibDotNet
string key;
double? percent;
Rectangle? rectangle;
+ List delete = new();
Rectangle intersectRectangle;
(string File, int NormalizedRectangle) item;
Dictionary distinct = new();
@@ -1038,21 +1083,28 @@ public partial class DlibDotNet
percent = intersectRectangle.Width * intersectRectangle.Height;
}
}
- if (!_Configuration.DeletePossibleDuplicates)
- duplicates.Add(new(locationContainer.PersonKey, locationContainer.Id, locationContainer.File, percent));
- else
- {
- if (File.Exists(item.File))
- File.Delete(item.File);
- if (File.Exists(locationContainer.File))
- File.Delete(locationContainer.File);
- }
+ delete.Add(item.File);
+ delete.Add(locationContainer.File);
+ duplicates.Add(new(locationContainer.PersonKey, locationContainer.Id, locationContainer.File, percent));
continue;
}
distinct.Add(key, new(locationContainer.File, locationContainer.NormalizedRectangle));
}
- if (duplicates.Any() && _IsEnvironment.Development)
- OpenPossibleDuplicates(duplicates);
+ if (!_Configuration.DeletePossibleDuplicates)
+ {
+ if (duplicates.Any() && _IsEnvironment.Development)
+ OpenPossibleDuplicates(duplicates);
+ }
+ else
+ {
+ if (delete.Count > 5)
+ throw new Exception("Something maybe wrong!");
+ foreach (string file in delete)
+ {
+ if (File.Exists(file))
+ File.Delete(file);
+ }
+ }
}
private List> GetCollection(long ticks, string? a2PeopleContentDirectory, string eDistanceContentDirectory)
@@ -1107,9 +1159,7 @@ public partial class DlibDotNet
int f;
int j;
int t;
- int totalNotMapped;
Container[] containers;
- Mapping[] mappingCollection;
string eDistanceContentDirectory;
string? a2PeopleContentDirectory;
string aResultsFullGroupDirectory;
@@ -1119,7 +1169,6 @@ public partial class DlibDotNet
string d2ResultsFullGroupDirectory;
string fPhotoPrismContentDirectory;
string fPhotoPrismSingletonDirectory;
- List distinctFilteredFaces;
string a2PeopleSingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(A2_People), "{}");
int totalSeconds = (int)Math.Floor(new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds);
string message = $") Building Container(s) - {totalSeconds} total second(s)";
@@ -1130,6 +1179,8 @@ public partial class DlibDotNet
progressBar.Tick();
(j, f, t, containers) = Property.Models.Stateless.Container.GetContainers(_Configuration.PropertyConfiguration, propertyLogic);
}
+ RenameMoved(argZero, containers);
+ RenameAbandoned(argZero, containers);
Container? container = AreAllSameEndsWith(argZero, containers);
if (!_ArgZeroIsConfigurationRootDirectory || container is null)
{
@@ -1168,25 +1219,26 @@ public partial class DlibDotNet
FullDoWork(argZero, propertyRoot, ticks, propertyLogic, t, containers, a2PeopleContentDirectory, eDistanceContentDirectory);
_Distance.Clear();
mapLogic ??= new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _MapConfiguration, ticks, _PersonContainers, a2PeopleSingletonDirectory, eDistanceContentDirectory, mapLogicSupport);
+ SetMapping(_FileNameToCollection, argZero, containers);
+ List distinctFilteredFaces = GetFilteredDistinctFaces(argZero, containers);
+ Mapping[] mappingCollection = MapLogicSupport.GetSelectedMappingCollection(distinctFilteredFaces);
+ Dictionary personKeyToCount = mapLogic.GetPersonKeyToCount(mappingCollection);
+ int totalNotMapped = mapLogic.UpdateMappingFromPerson(mappingCollection);
+ if (a2PeopleContentDirectory is not null && false)
+ mapLogic.CreateTree(ticks, a2PeopleContentDirectory);
foreach (string outputResolution in _Configuration.OutputResolutions)
{
if (_PropertyRootExistedBefore || container is not null)
break;
(aResultsFullGroupDirectory, bResultsFullGroupDirectory, cResultsFullGroupDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory) = GetResultsFullGroupDirectories(outputResolution);
- if (_Configuration.SaveFilteredOriginalImagesFromJLinksForOutputResolutions.Contains(outputResolution))
- MapLogicSupport.BeforeSaveFilteredOriginalImagesFromJLinks(_Configuration.JLinks, a2PeopleSingletonDirectory);
- SetMapping(_FileNameToCollection, argZero, containers);
- distinctFilteredFaces = GetFilteredDistinctFaces(argZero, containers);
- mappingCollection = MapLogicSupport.GetSelectedMappingCollection(distinctFilteredFaces);
- totalNotMapped = mapLogic.UpdateMappingFromPerson(mappingCollection);
- if (a2PeopleContentDirectory is not null)
- mapLogic.CreateTree(ticks, a2PeopleContentDirectory);
+ if (!string.IsNullOrEmpty(a2PeopleContentDirectory) && _Configuration.SaveFilteredOriginalImagesFromJLinksForOutputResolutions.Contains(outputResolution))
+ mapLogic.SaveFilteredOriginalImagesFromJLinks(_Configuration.JLinks, _PersonContainers, a2PeopleContentDirectory, mappingCollection, personKeyToCount, totalNotMapped);
if (_ArgZeroIsConfigurationRootDirectory
&& _Configuration.SaveResizedSubfiles
&& outputResolution == _Configuration.OutputResolutions[0]
&& _Configuration.LoadOrCreateThenSaveDistanceResultsForOutputResolutions.Contains(outputResolution)
&& _Exceptions.Count == 0)
- MapLogic(argZero, ticks, containers, a2PeopleSingletonDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory, fPhotoPrismContentDirectory, mapLogicSupport, mapLogic, outputResolution, distinctFilteredFaces, mappingCollection, totalNotMapped);
+ MapLogic(argZero, ticks, containers, a2PeopleSingletonDirectory, dResultsFullGroupDirectory, d2ResultsFullGroupDirectory, fPhotoPrismContentDirectory, mapLogicSupport, mapLogic, outputResolution, distinctFilteredFaces, mappingCollection, totalNotMapped, personKeyToCount);
if (_Configuration.SaveRandomForOutputResolutions.Contains(outputResolution))
_Random.Random(_Configuration.PropertyConfiguration, mapLogic, outputResolution, mappingCollection);
if (_IsEnvironment.Development)
diff --git a/Instance/Models/Binder/Configuration.cs b/Instance/Models/Binder/Configuration.cs
index 8232abe..437fa31 100644
--- a/Instance/Models/Binder/Configuration.cs
+++ b/Instance/Models/Binder/Configuration.cs
@@ -51,7 +51,7 @@ public class Configuration
[Display(Name = "Person Birthday First Year"), Required] public int? PersonBirthdayFirstYear { get; set; }
[Display(Name = "Person Birthday Format"), Required] public string PersonBirthdayFormat { get; set; }
[Display(Name = "Person Characters"), Required] public string PersonCharacters { get; set; }
- [Display(Name = "Person Characters To Copy To"), Required] public string PersonCharactersToCopyTo { get; set; }
+ [Display(Name = "Person Characters Copy Count"), Required] public int? PersonCharactersCopyCount { get; set; }
[Display(Name = "PersonKey Format"), Required] public string PersonKeyFormat { get; set; }
[Display(Name = "Predictor Model Name"), Required] public string PredictorModelName { get; set; }
[Display(Name = "Properties Changed For Distance"), Required] public bool? PropertiesChangedForDistance { get; set; }
@@ -164,8 +164,8 @@ public class Configuration
throw new NullReferenceException(nameof(configuration.PersonBirthdayFormat));
if (configuration.PersonCharacters is null)
throw new NullReferenceException(nameof(configuration.PersonCharacters));
- if (configuration.PersonCharactersToCopyTo is null)
- throw new NullReferenceException(nameof(configuration.PersonCharactersToCopyTo));
+ if (configuration.PersonCharactersCopyCount is null)
+ throw new NullReferenceException(nameof(configuration.PersonCharactersCopyCount));
if (configuration.PersonKeyFormat is null)
throw new NullReferenceException(nameof(configuration.PersonKeyFormat));
if (configuration.PropertiesChangedForDistance is null)
@@ -254,7 +254,7 @@ public class Configuration
configuration.PersonBirthdayFirstYear.Value,
configuration.PersonBirthdayFormat,
configuration.PersonCharacters,
- configuration.PersonCharactersToCopyTo,
+ configuration.PersonCharactersCopyCount.Value,
configuration.PersonKeyFormat,
configuration.PredictorModelName,
configuration.PropertiesChangedForDistance.Value,
diff --git a/Instance/Models/Configuration.cs b/Instance/Models/Configuration.cs
index a70fe59..5d46b26 100644
--- a/Instance/Models/Configuration.cs
+++ b/Instance/Models/Configuration.cs
@@ -48,7 +48,7 @@ public class Configuration
public int PersonBirthdayFirstYear { init; get; }
public string PersonBirthdayFormat { init; get; }
public string PersonCharacters { init; get; }
- public string PersonCharactersToCopyTo { init; get; }
+ public int PersonCharactersCopyCount { init; get; }
public string PersonKeyFormat { init; get; }
public string PredictorModelName { init; get; }
public bool PropertiesChangedForDistance { init; get; }
@@ -118,7 +118,7 @@ public class Configuration
int personBirthdayFirstYear,
string personBirthdayFormat,
string personCharacters,
- string personCharactersToCopyTo,
+ int personCharactersCopyCount,
string personKeyFormat,
string predictorModelName,
bool propertiesChangedForDistance,
@@ -187,7 +187,7 @@ public class Configuration
PersonBirthdayFirstYear = personBirthdayFirstYear;
PersonBirthdayFormat = personBirthdayFormat;
PersonCharacters = personCharacters;
- PersonCharactersToCopyTo = personCharactersToCopyTo;
+ PersonCharactersCopyCount = personCharactersCopyCount;
PersonKeyFormat = personKeyFormat;
PredictorModelName = predictorModelName;
PropertiesChangedForDistance = propertiesChangedForDistance;
diff --git a/Instance/appsettings.Development.json b/Instance/appsettings.Development.json
index a5dcde5..a1bd74b 100644
--- a/Instance/appsettings.Development.json
+++ b/Instance/appsettings.Development.json
@@ -10,24 +10,18 @@
},
"Windows": {
"Configuration": {
- "DeletePossibleDuplicates": false,
+ "DateGroup": "45f4401",
+ "DeletePossibleDuplicates": true,
"DistanceRenameToMatch": true,
"DistanceMoveUnableToMatch": true,
"PersonCharacters": "!#]^_`~+",
- "PersonCharactersToCopyTo": "x",
- "xPersonCharactersToCopyTo": "!",
- "xxPersonCharactersToCopyTo": "#",
- "xxxPersonCharactersToCopyTo": "]",
- "xxxxPersonCharactersToCopyTo": "^",
- "xxxxxPersonCharactersToCopyTo": "_",
- "xxxxxxPersonCharactersToCopyTo": "`",
- "xxxxxxxPersonCharactersToCopyTo": "~",
- "xxxxxxxxPersonCharactersToCopyTo": "+",
+ "PersonCharactersCopyCount": 0,
+ "xPersonCharactersCopyCount": 2,
"xRootDirectory": "D:/Tmp/phares/Pictures",
"xxRootDirectory": "D:/Tmp/Phares/Compare/Corrupt",
- "xxxRootDirectory": "D:/2) Images B/Not-Copy-Copy-ec5a909",
- "RootDirectory": "D:/1) Images A/Images-ec5a909",
- "xxxxxRootDirectory": "D:/1) Images A/Images-ec5a909/Facebook/=2022.3 Facebook",
+ "RootDirectory": "D:/2) Images B/Not-Copy-Copy-45f4401",
+ "xxxxRootDirectory": "D:/1) Images A/Images-45f4401",
+ "xxxxxRootDirectory": "D:/1) Images A/Images-45f4401/Facebook/=2022.3 Facebook",
"SaveSortingWithoutPerson": true,
"JLinks": [
"Julie"
@@ -44,12 +38,12 @@
"PropertyContentCollectionFiles": [],
"RangeDaysDeltaTolerance": [
0,
- 1,
+ 2100,
123456
],
"RangeDistanceTolerance": [
0,
- 0.4,
+ 0.3,
0.6
],
"RangeFaceAreaPermilleTolerance": [
diff --git a/Instance/appsettings.json b/Instance/appsettings.json
index ed6dd6e..e780ead 100644
--- a/Instance/appsettings.json
+++ b/Instance/appsettings.json
@@ -53,7 +53,7 @@
"CheckDFaceAndUpWriteDates": false,
"CheckJsonForDistanceResults": false,
"CrossDirectoryMaxItemsInDistanceCollection": 7,
- "DateGroup": "2022-12-30",
+ "DateGroup": "DateGroup",
"DeletePossibleDuplicates": false,
"DistanceFactor": 8,
"DistanceMoveUnableToMatch": false,
@@ -89,7 +89,7 @@
"PersonBirthdayFirstYear": 1500,
"PersonBirthdayFormat": "yyyy-MM-dd_HH",
"PersonCharacters": "!#]^_`~+",
- "PersonCharactersToCopyTo": "~",
+ "PersonCharactersCopyCount": 0,
"PersonKeyFormat": "yyyy-MM-dd_HH",
"PopulatePropertyId": true,
"PredictorModelName": "Large",
diff --git a/Map/Models/Configuration.cs b/Map/Models/Configuration.cs
index e44bcf7..270d9d3 100644
--- a/Map/Models/Configuration.cs
+++ b/Map/Models/Configuration.cs
@@ -12,9 +12,10 @@ public class Configuration
public string FacesFileNameExtension { init; get; }
public string FacesHiddenFileNameExtension { init; get; }
public string MappingDefaultName { init; get; }
- public string PersonCharacters { init; get; }
public int PersonBirthdayFirstYear { init; get; }
public string PersonBirthdayFormat { init; get; }
+ public char[] PersonCharacters { init; get; }
+ public int PersonCharactersCopyCount { init; get; }
public int RangeDaysDeltaTolerance { init; get; }
public double RangeDistanceTolerance { init; get; }
public bool SaveSortingWithoutPerson { init; get; }
@@ -27,7 +28,8 @@ public class Configuration
string mappingDefaultName,
int personBirthdayFirstYear,
string personBirthdayFormat,
- string personCharacters,
+ char[] personCharacters,
+ int personCharactersCopyCount,
int[] rangeDaysDeltaTolerance,
double[] rangeDistanceTolerance,
bool saveSortingWithoutPerson,
@@ -49,6 +51,7 @@ public class Configuration
SaveSortingWithoutPerson = saveSortingWithoutPerson;
SortingMinimumToUseSigma = sortingMinimumToUseSigma;
RangeDaysDeltaTolerance = rangeDaysDeltaTolerance[1];
+ PersonCharactersCopyCount = personCharactersCopyCount;
FacePartsFileNameExtension = facePartsFileNameExtension;
FacesHiddenFileNameExtension = facesHiddenFileNameExtension;
}
diff --git a/Map/Models/MapLogic.cs b/Map/Models/MapLogic.cs
index 0e6002a..b176410 100644
--- a/Map/Models/MapLogic.cs
+++ b/Map/Models/MapLogic.cs
@@ -859,7 +859,7 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
}
}
- public void CopyAtLeastOneMappedFiles(char personCharactersToCopyTo, string dFacesContentDirectory, string a2PeopleSingletonDirectory, Mapping[] mappingCollection)
+ public void CopyAtLeastOneMappedFiles(string dFacesContentDirectory, string a2PeopleSingletonDirectory, Mapping[] mappingCollection)
{
if (_Configuration is null)
throw new NullReferenceException(nameof(_Configuration));
@@ -897,13 +897,13 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
continue;
if (!_PersonKeyToPersonContainer.TryGetValue(personKey, out personContainer))
continue;
- if (personContainer.Char is null || personContainer.Char != personCharactersToCopyTo)
+ if (personContainer.Char is null || !_Configuration.PersonCharacters.Contains(personContainer.Char.Value))
continue;
if (personContainer.DisplayDirectoryAllFiles.Any(l => l.EndsWith(faceFileName)))
continue;
if (!File.Exists(faceFile))
continue;
- directory = Path.Combine(a2PeopleSingletonDirectory, personCharactersToCopyTo.ToString(), personContainer.DisplayDirectoryName);
+ directory = Path.Combine(a2PeopleSingletonDirectory, personContainer.Char.Value.ToString(), personContainer.DisplayDirectoryName);
if (!Directory.Exists(directory))
continue;
fileName = Path.Combine(directory, faceFileName);
@@ -952,7 +952,7 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
return new(personKeyFormatted, personBirthday);
}
- private List GetPersonKeyFormattedCollection(string[] jLinks, string a2PeopleSingletonDirectory, PersonContainer[] personContainers, Dictionary personKeyToCount)
+ private List GetPersonKeyFormattedCollection(string[] jLinks, string a2PeopleContentDirectory, PersonContainer[] personContainers, Dictionary personKeyToCount)
{
if (_Configuration is null)
throw new NullReferenceException(nameof(_Configuration));
@@ -970,7 +970,7 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
List<(long, string)> collection = new();
foreach (string directoryName in jLinks)
{
- checkDirectory = Path.Combine(a2PeopleSingletonDirectory, directoryName);
+ checkDirectory = Path.Combine(a2PeopleContentDirectory, directoryName);
if (!Directory.Exists(checkDirectory))
continue;
checkDirectories = Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly);
@@ -1012,7 +1012,7 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
return results;
}
- private (int, FileHolder, int, string, string, string, string)[] GetCollectionForSaveFilteredOriginalImagesFromJLinks(string[] jLinks, string a2PeopleSingletonDirectory, PersonContainer[] personContainers, Mapping[] mappingCollection, Dictionary personKeyToCount)
+ private (int, FileHolder, int, string, string, string, string)[] GetCollectionForSaveFilteredOriginalImagesFromJLinks(string[] jLinks, string a2PeopleContentDirectory, PersonContainer[] personContainers, Mapping[] mappingCollection, Dictionary personKeyToCount)
{
if (_Configuration is null)
throw new NullReferenceException(nameof(_Configuration));
@@ -1023,7 +1023,7 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
string personDirectory;
string personKeyFormatted;
bool usePersonKeyAndDeterministicHashCodeKey = false;
- List personKeyFormattedCollection = GetPersonKeyFormattedCollection(jLinks, a2PeopleSingletonDirectory, personContainers, personKeyToCount);
+ List personKeyFormattedCollection = GetPersonKeyFormattedCollection(jLinks, a2PeopleContentDirectory, personContainers, personKeyToCount);
List<(int Id, FileHolder ImageFileHolder, int ApproximateYears, string PersonKeyFormatted, string CheckFile, string Directory, string PersonDirectory)> collection = new();
foreach (Mapping mapping in mappingCollection)
{
@@ -1061,14 +1061,66 @@ public class MapLogic : Shared.Models.Methods.IMapLogic
return results;
}
- public void SaveFilteredOriginalImagesFromJLinks(string[] jLinks, PersonContainer[] personContainers, string a2PeopleSingletonDirectory, Mapping[] mappingCollection, Dictionary personKeyToCount, int totalNotMapped)
+ private static bool TryToFind(string a2PeopleSingletonDirectory, string file, string path)
+ {
+ bool result = false;
+ string? pathName = Path.GetFileName(path);
+ string? group = Path.GetDirectoryName(path);
+ string? groupName = Path.GetFileName(group);
+ if (pathName is not null && group is not null && groupName is not null)
+ {
+ WindowsShortcut windowsShortcut;
+ string checkDirectory = Path.Combine(a2PeopleSingletonDirectory, groupName, pathName);
+ if (Directory.Exists(checkDirectory))
+ {
+ try
+ {
+ windowsShortcut = new() { Path = checkDirectory };
+ windowsShortcut.Save(file);
+ windowsShortcut.Dispose();
+ result = true;
+ }
+ catch (Exception)
+ { }
+ }
+ }
+ return result;
+ }
+
+ private static void BeforeSaveFilteredOriginalImagesFromJLinks(string[] jLinks, string a2PeopleContentDirectory)
+ {
+ string[] files;
+ string checkDirectory;
+ WindowsShortcut windowsShortcut;
+ foreach (string directoryName in jLinks)
+ {
+ checkDirectory = Path.Combine(a2PeopleContentDirectory, directoryName);
+ if (!Directory.Exists(checkDirectory))
+ continue;
+ files = Directory.GetFiles(checkDirectory, "*.lnk", SearchOption.TopDirectoryOnly);
+ foreach (string file in files)
+ {
+ windowsShortcut = WindowsShortcut.Load(file);
+ if (windowsShortcut.Path is null)
+ continue;
+ if (!Directory.Exists(windowsShortcut.Path))
+ {
+ if (!TryToFind(a2PeopleContentDirectory, file, windowsShortcut.Path))
+ continue;
+ }
+ }
+ }
+ }
+
+ public void SaveFilteredOriginalImagesFromJLinks(string[] jLinks, PersonContainer[] personContainers, string a2PeopleContentDirectory, Mapping[] mappingCollection, Dictionary personKeyToCount, int totalNotMapped)
{
if (_Configuration is null)
throw new NullReferenceException(nameof(_Configuration));
SaveContainer? saveContainer;
List distinctCollection = new();
List saveContainers = new();
- (int, FileHolder, int, string, string, string, string)[] collection = GetCollectionForSaveFilteredOriginalImagesFromJLinks(jLinks, a2PeopleSingletonDirectory, personContainers, mappingCollection, personKeyToCount);
+ BeforeSaveFilteredOriginalImagesFromJLinks(jLinks, a2PeopleContentDirectory);
+ (int, FileHolder, int, string, string, string, string)[] collection = GetCollectionForSaveFilteredOriginalImagesFromJLinks(jLinks, a2PeopleContentDirectory, personContainers, mappingCollection, personKeyToCount);
foreach ((int id, FileHolder imageFileHolder, int approximateYears, string personKeyFormatted, string directory, string personDirectory, string checkFile) in collection)
{
if (distinctCollection.Contains(id))
diff --git a/Not-Copy-Copy/appsettings.Development.json b/Not-Copy-Copy/appsettings.Development.json
index fd3d651..97c0bba 100644
--- a/Not-Copy-Copy/appsettings.Development.json
+++ b/Not-Copy-Copy/appsettings.Development.json
@@ -50,7 +50,7 @@
"WorkingDirectoryName": "PharesApps",
"Windows": {
"Configuration": {
- "DateGroup": "2022-12-30",
+ "DateGroup": "45f4401",
"FileNameDirectorySeparator": ".Z.",
"ForcePropertyLastWriteTimeToCreationTime": false,
"MaxImagesInDirectoryForTopLevelFirstPass": 10,
diff --git a/PrepareForOld/appsettings.Development.json b/PrepareForOld/appsettings.Development.json
index 3586e7b..95022a4 100644
--- a/PrepareForOld/appsettings.Development.json
+++ b/PrepareForOld/appsettings.Development.json
@@ -50,7 +50,7 @@
"WorkingDirectoryName": "PharesApps",
"Windows": {
"Configuration": {
- "DateGroup": "2022-12-30",
+ "DateGroup": "45f4401",
"FileNameDirectorySeparator": ".Z.",
"ForcePropertyLastWriteTimeToCreationTime": false,
"KeepFullPath": false,
diff --git a/Property/Models/Stateless/Container.cs b/Property/Models/Stateless/Container.cs
index 9123122..b4e67a1 100644
--- a/Property/Models/Stateless/Container.cs
+++ b/Property/Models/Stateless/Container.cs
@@ -78,13 +78,11 @@ public class Container
return result;
}
- private static (int, Shared.Models.Container[]) GetContainers(Configuration configuration, A_Property propertyLogic, string aPropertySingletonDirectory, List<(int, string, FileHolder[])> fileHolderGroupCollection, List<(string, List<(string, Shared.Models.Property?)>)> collectionFromJson)
+ private static Shared.Models.Container[] GetContainers(Configuration configuration, A_Property propertyLogic, string aPropertySingletonDirectory, List<(int, string, FileHolder[])> fileHolderGroupCollection, List<(string, List<(string, Shared.Models.Property?)>)> collectionFromJson)
{
- int result = 0;
Shared.Models.Container[] results;
Item item;
int length;
- int additional;
string inferred;
List
- items;
const int last = 9;
@@ -155,7 +153,6 @@ public class Container
}
if (items.Any())
{
- result += items.Count;
if (keySourceDirectories.Distinct().Count() != 1)
continue;
container = new(last, items, keySourceDirectories[0]);
@@ -183,15 +180,13 @@ public class Container
{
if (!keyValuePairs.ContainsKey(sourceDirectory))
{
- result += items.Count;
container = new(g, items, sourceDirectory);
keyValuePairs.Add(sourceDirectory, container);
}
else
{
container = keyValuePairs[sourceDirectory];
- (items, additional) = Shared.Models.Stateless.Methods.IItem.GetMerged(container.Items, items);
- result += additional;
+ items = Shared.Models.Stateless.Methods.IItem.GetMerged(container.Items, items);
container = new(container.G, items, container.SourceDirectory);
keyValuePairs[sourceDirectory] = container;
}
@@ -200,7 +195,7 @@ public class Container
if (fileHolderKeyValuePairs.Any())
throw new NotSupportedException("Unmapped left!");
results = (from l in keyValuePairs orderby l.Value.G, l.Value.Items.Count select l.Value).ToArray();
- return new(result, results);
+ return results;
}
private static void SetCollections(string aPropertySingletonDirectory, List otherCollection, List<(string, string[])> jsonCollection)
@@ -253,7 +248,8 @@ public class Container
DeleteAbandoned(configuration, aPropertySingletonDirectory, otherCollection, fileHolderGroupCollection);
List<(string sourceDirectory, List<(string sourceDirectoryFile, Shared.Models.Property? property)> collection)> collectionFromJson;
collectionFromJson = GetCollection(aPropertySingletonDirectory, jsonCollection);
- (int t, results) = GetContainers(configuration, propertyLogic, aPropertySingletonDirectory, fileHolderGroupCollection, collectionFromJson);
+ results = GetContainers(configuration, propertyLogic, aPropertySingletonDirectory, fileHolderGroupCollection, collectionFromJson);
+ int t = (from l in results select l.Items.Count).Sum();
int j = jsonCollection.Select(l => l.Item2.Length).Sum();
return (j, f, t, results);
}
diff --git a/Shared/Models/Stateless/Methods/IItem.cs b/Shared/Models/Stateless/Methods/IItem.cs
index 586871e..a522725 100644
--- a/Shared/Models/Stateless/Methods/IItem.cs
+++ b/Shared/Models/Stateless/Methods/IItem.cs
@@ -7,9 +7,9 @@ public interface IItem
GetWrongYearFlag(isWrongYear);
static string GetWrongYearFlag(bool? isWrongYear) => isWrongYear is null ? "#" : isWrongYear.Value ? "~" : "=";
- (List, int) TestStatic_GetMerged(List itemsA, List itemsB) =>
+ List TestStatic_GetMerged(List itemsA, List itemsB) =>
GetMerged(itemsA, itemsB);
- static (List, int) GetMerged(List itemsA, List itemsB) =>
+ static List GetMerged(List itemsA, List itemsB) =>
Item.GetMerged(itemsA, itemsB);
}
\ No newline at end of file
diff --git a/Shared/Models/Stateless/Methods/Item.cs b/Shared/Models/Stateless/Methods/Item.cs
index 50b416e..96cec08 100644
--- a/Shared/Models/Stateless/Methods/Item.cs
+++ b/Shared/Models/Stateless/Methods/Item.cs
@@ -3,9 +3,8 @@ namespace View_by_Distance.Shared.Models.Stateless.Methods;
internal abstract class Item
{
- internal static (List, int) GetMerged(List itemsA, List itemsB)
+ internal static List GetMerged(List itemsA, List itemsB)
{
- int result = 0;
List results = new();
List collection = new();
foreach (Models.Item item in itemsA)
@@ -17,10 +16,9 @@ internal abstract class Item
{
if (collection.Contains(item.ImageFileHolder.FullName))
continue;
- result++;
results.Add(item);
}
- return new(results, result);
+ return results;
}
}
\ No newline at end of file