From d0cd52807d973cd49ffb36b79c4970c4b202bb72 Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Mon, 2 Jan 2023 14:58:22 -0700 Subject: [PATCH] Drag-Drop-Explorer --- .vscode/launch.json | 17 + Compare/Compare.csproj | 2 +- Date-Group/Date-Group.csproj | 2 +- Delete-By-Distinct/Delete-By-Distinct.csproj | 2 +- Delete-By-Distinct/DeleteByDistinct.cs | 4 +- .../appsettings.Development.json | 234 +------- Delete-By-Distinct/appsettings.json | 2 +- Delete-By-Relative/Delete-By-Relative.csproj | 2 +- Distance/Distance.csproj | 2 +- ...signer.cs => DragDropExplorer.Designer.cs} | 4 +- .../{Form.cs => DragDropExplorer.cs} | 20 +- Drag-Drop-Explorer/Program.cs | 2 +- .../.vscode/launch.json | 2 +- Drag-Drop-Search/.vscode/tasks.json | 41 ++ .../Drag-Drop-Search.csproj | 0 .../DragDropSearch.Designer.cs | 4 +- Drag-Drop-Search/DragDropSearch.cs | 204 +++++++ .../Models/AppSettings.cs | 0 .../Models/Binder/AppSettings.cs | 0 .../Models/Binder/Configuration.cs | 0 .../Models/Configuration.cs | 0 {Drag-Drop => Drag-Drop-Search}/Program.cs | 2 +- Drag-Drop/Form.cs | 550 ------------------ Duplicate-Search/Duplicate-Search.csproj | 2 +- Face/Face.csproj | 2 +- FaceParts/FaceParts.csproj | 2 +- .../FaceRecognitionDotNet.csproj | 2 +- Instance/Instance.csproj | 2 +- Map/Map.csproj | 2 +- Metadata/Metadata.csproj | 2 +- Not-Copy-Copy/Not-Copy-Copy.csproj | 2 +- PhotoPrism/PhotoPrism.csproj | 2 +- PrepareForOld/PrepareForOld.csproj | 2 +- Property-Compare/Property-Compare.csproj | 2 +- Property/Property.csproj | 2 +- Rename/.vscode/launch.json | 26 + {Drag-Drop => Rename}/.vscode/tasks.json | 6 +- Rename/Models/AppSettings.cs | 29 + Rename/Models/Binder/AppSettings.cs | 46 ++ Rename/Models/Binder/Configuration.cs | 59 ++ Rename/Models/Configuration.cs | 38 ++ .../Stateless/SerilogExtensionMethods.cs | 10 + Rename/Program.cs | 70 +++ Rename/Rename.cs | 270 +++++++++ Rename/Rename.csproj | 60 ++ Rename/appsettings.Development.json | 18 + Rename/appsettings.json | 118 ++++ Resize/Resize.csproj | 2 +- .../Models/MatchNginx.cs | 2 +- Shared/View-by-Distance.Shared.csproj | 2 +- Tests/UnitTestCalculations.cs | 2 + View-by-Distance-MKLink-Console.sln | 60 +- 52 files changed, 1092 insertions(+), 846 deletions(-) rename Drag-Drop-Explorer/{Form.Designer.cs => DragDropExplorer.Designer.cs} (93%) rename Drag-Drop-Explorer/{Form.cs => DragDropExplorer.cs} (87%) rename {Drag-Drop => Drag-Drop-Search}/.vscode/launch.json (96%) create mode 100644 Drag-Drop-Search/.vscode/tasks.json rename Drag-Drop/Drag-Drop.csproj => Drag-Drop-Search/Drag-Drop-Search.csproj (100%) rename Drag-Drop/Form.Designer.cs => Drag-Drop-Search/DragDropSearch.Designer.cs (94%) create mode 100644 Drag-Drop-Search/DragDropSearch.cs rename {Drag-Drop => Drag-Drop-Search}/Models/AppSettings.cs (100%) rename {Drag-Drop => Drag-Drop-Search}/Models/Binder/AppSettings.cs (100%) rename {Drag-Drop => Drag-Drop-Search}/Models/Binder/Configuration.cs (100%) rename {Drag-Drop => Drag-Drop-Search}/Models/Configuration.cs (100%) rename {Drag-Drop => Drag-Drop-Search}/Program.cs (97%) delete mode 100644 Drag-Drop/Form.cs create mode 100644 Rename/.vscode/launch.json rename {Drag-Drop => Rename}/.vscode/tasks.json (85%) create mode 100644 Rename/Models/AppSettings.cs create mode 100644 Rename/Models/Binder/AppSettings.cs create mode 100644 Rename/Models/Binder/Configuration.cs create mode 100644 Rename/Models/Configuration.cs create mode 100644 Rename/Models/Stateless/SerilogExtensionMethods.cs create mode 100644 Rename/Program.cs create mode 100644 Rename/Rename.cs create mode 100644 Rename/Rename.csproj create mode 100644 Rename/appsettings.Development.json create mode 100644 Rename/appsettings.json rename {Drag-Drop-Explorer => Shared}/Models/MatchNginx.cs (68%) diff --git a/.vscode/launch.json b/.vscode/launch.json index da63235..879078d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -175,6 +175,23 @@ "console": "externalTerminal", "stopAtEntry": false, "requireExactSource": false + }, + { + "name": "Rename", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/Rename/bin/Debug/net7.0/win-x64/Rename.dll", + "args": [ + "s" + ], + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "cwd": "${workspaceFolder}", + "console": "externalTerminal", + "stopAtEntry": false, + "requireExactSource": false } ] } diff --git a/Compare/Compare.csproj b/Compare/Compare.csproj index 657c642..dcedf7f 100644 --- a/Compare/Compare.csproj +++ b/Compare/Compare.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Compare false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Date-Group/Date-Group.csproj b/Date-Group/Date-Group.csproj index ba41a2a..22cc57c 100644 --- a/Date-Group/Date-Group.csproj +++ b/Date-Group/Date-Group.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Date.Group false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Delete-By-Distinct/Delete-By-Distinct.csproj b/Delete-By-Distinct/Delete-By-Distinct.csproj index 5c85d13..fb96bbf 100644 --- a/Delete-By-Distinct/Delete-By-Distinct.csproj +++ b/Delete-By-Distinct/Delete-By-Distinct.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Delete.By.Distinct false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Delete-By-Distinct/DeleteByDistinct.cs b/Delete-By-Distinct/DeleteByDistinct.cs index 4fba904..599df34 100644 --- a/Delete-By-Distinct/DeleteByDistinct.cs +++ b/Delete-By-Distinct/DeleteByDistinct.cs @@ -78,7 +78,8 @@ public class DeleteByDistinct if (!fileTicksToNames.TryGetValue(checkDate.Ticks, out fileNames)) throw new Exception(); } - checkName = fileInfo.Name.ToLower().Replace(".jpeg", ".jpg"); + checkName = fileInfo.Name[..10]; + // checkName = fileInfo.Name.ToLower().Replace(".jpeg", ".jpg"); if (fileNames.Contains(checkName)) deletedFiles.Add(file); else @@ -128,4 +129,5 @@ public class DeleteByDistinct } } } + } \ No newline at end of file diff --git a/Delete-By-Distinct/appsettings.Development.json b/Delete-By-Distinct/appsettings.Development.json index abe28f4..6acbfb2 100644 --- a/Delete-By-Distinct/appsettings.Development.json +++ b/Delete-By-Distinct/appsettings.Development.json @@ -1,13 +1,12 @@ { - "xCompareRootDirectory": "", - "CompareRootDirectory": "D:/2) Images B/Not-Copy-Copy-45f4401", + "CompareRootDirectory": "D:/7) Question/- - - Videos A", "Logging": { "LogLevel": { "Log4netProvider": "Debug" } }, "MaxDegreeOfParallelism": 6, - "SearchPattern": "*.j*", + "SearchPattern": "*.*", "Serilog": { "MinimumLevel": "Debug" }, @@ -15,231 +14,10 @@ "Configuration": { "xRootDirectory": "D:/2) Images B/Corrupt", "xxRootDirectory": "D:/2) Images B/Not-Copy-Copy-45f4401", - "RootDirectory": "D:/1) Images A/Images-45f4401", - "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" - ] + "xxxRootDirectory": "D:/1) Images A/Images-45f4401", + "RootDirectory": "E:/3) Videos A/Device Videos 2_0_0_3 - Current", + "xxxxxRootDirectory": "E:/4) Videos B/Device Videos 2_0_0_3 - Current - Ignore", + "VerifyToSeason": [] } } } \ No newline at end of file diff --git a/Delete-By-Distinct/appsettings.json b/Delete-By-Distinct/appsettings.json index 8179129..3041cc2 100644 --- a/Delete-By-Distinct/appsettings.json +++ b/Delete-By-Distinct/appsettings.json @@ -1,5 +1,5 @@ { - "CompareRootDirectory": "", + "ComparePathsFile": "", "Company": "Mike Phares", "Linux": {}, "Logging": { diff --git a/Delete-By-Relative/Delete-By-Relative.csproj b/Delete-By-Relative/Delete-By-Relative.csproj index 53272a2..9d8ee53 100644 --- a/Delete-By-Relative/Delete-By-Relative.csproj +++ b/Delete-By-Relative/Delete-By-Relative.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Delete.By.Relative false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Distance/Distance.csproj b/Distance/Distance.csproj index a1af407..835fa38 100644 --- a/Distance/Distance.csproj +++ b/Distance/Distance.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Distance false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Drag-Drop-Explorer/Form.Designer.cs b/Drag-Drop-Explorer/DragDropExplorer.Designer.cs similarity index 93% rename from Drag-Drop-Explorer/Form.Designer.cs rename to Drag-Drop-Explorer/DragDropExplorer.Designer.cs index d9d5817..e958bbd 100644 --- a/Drag-Drop-Explorer/Form.Designer.cs +++ b/Drag-Drop-Explorer/DragDropExplorer.Designer.cs @@ -1,6 +1,6 @@ namespace View_by_Distance.Drag_Drop_Explorer; -partial class Form +partial class DragDropExplorer { /// /// Required designer variable. @@ -32,7 +32,7 @@ partial class Form this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(640, 100); this.StartPosition = FormStartPosition.CenterScreen; - this.Text = "Form1"; + this.Text = "Drag Drop Explorer"; } #endregion diff --git a/Drag-Drop-Explorer/Form.cs b/Drag-Drop-Explorer/DragDropExplorer.cs similarity index 87% rename from Drag-Drop-Explorer/Form.cs rename to Drag-Drop-Explorer/DragDropExplorer.cs index f4b6b8c..6c66069 100644 --- a/Drag-Drop-Explorer/Form.cs +++ b/Drag-Drop-Explorer/DragDropExplorer.cs @@ -6,11 +6,12 @@ using System.Globalization; using System.Reflection; using System.Text.Json; using View_by_Distance.Drag_Drop_Explorer.Models; +using View_by_Distance.Shared.Models; using View_by_Distance.Shared.Models.Stateless.Methods; namespace View_by_Distance.Drag_Drop_Explorer; -public partial class Form : System.Windows.Forms.Form +public partial class DragDropExplorer : Form { private readonly ILogger _Logger; @@ -23,7 +24,7 @@ public partial class Form : System.Windows.Forms.Form private readonly string _WorkingDirectory; private readonly IsEnvironment _IsEnvironment; - public Form() + public DragDropExplorer() { InitializeComponent(); ILogger logger; @@ -48,17 +49,17 @@ public partial class Form : System.Windows.Forms.Form Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory); _ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot); Log.Logger = loggerConfiguration.CreateLogger(); - logger = Log.ForContext
(); + logger = Log.ForContext(); logger.Information("Complete"); _Logger = logger; _AppSettings = appSettings; - Text = "Drag Drop Explorer"; _IsEnvironment = isEnvironment; _WorkingDirectory = workingDirectory; - _ProgressBar = new() { Location = new(5, 5), Dock = DockStyle.Top, Visible = false }; - _FirstTextBox = new() { Location = new(5, 5), Dock = DockStyle.Top, Text = _IsEnvironment.Profile }; - _PathTextBox = new() { Location = new(5, 5), Dock = DockStyle.Top, Text = _AppSettings.WorkingDirectoryName }; - _JsonTextBox = new() { Location = new(5, 5), Dock = DockStyle.Top, Text = JsonSerializer.Serialize(_AppSettings, new JsonSerializerOptions { WriteIndented = true }), Multiline = true, MinimumSize = new(1, 80) }; + _ProgressBar = new() { TabIndex = 4, Location = new(5, 5), Dock = DockStyle.Top, Visible = false }; + string json = JsonSerializer.Serialize(_AppSettings, new JsonSerializerOptions { WriteIndented = true }); + _FirstTextBox = new() { TabIndex = 1, Text = _IsEnvironment.Profile, Location = new(5, 5), Dock = DockStyle.Top }; + _PathTextBox = new() { TabIndex = 2, Text = _AppSettings.WorkingDirectoryName, Location = new(5, 5), Dock = DockStyle.Top }; + _JsonTextBox = new() { TabIndex = 3, Text = json, Multiline = true, MinimumSize = new(1, 80), Location = new(5, 5), Dock = DockStyle.Top }; Load += new EventHandler(Form1_Load); Controls.Add(_ProgressBar); Controls.Add(_JsonTextBox); @@ -94,6 +95,7 @@ public partial class Form : System.Windows.Forms.Form { if (sender is TextBox textBox) { + textBox.Text = GetConverted(textBox.Text); if (textBox.Text == "ps") throw new NotImplementedException(); @@ -133,10 +135,10 @@ public partial class Form : System.Windows.Forms.Form { string converted; FileInfo fileInfo; - _FirstTextBox.Text = paths[0]; List files = new(); DateTime dateTime = DateTime.Now; List directories = new(); + _FirstTextBox.Text = GetConverted(paths[0]); string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); string directory = Path.Combine(_WorkingDirectory, $"{dateTime.Year}_{weekOfYear}"); if (!Directory.Exists(directory)) diff --git a/Drag-Drop-Explorer/Program.cs b/Drag-Drop-Explorer/Program.cs index b9465ee..a11572d 100644 --- a/Drag-Drop-Explorer/Program.cs +++ b/Drag-Drop-Explorer/Program.cs @@ -9,7 +9,7 @@ static class Program static void Main() { ApplicationConfiguration.Initialize(); - Application.Run(new Form()); + Application.Run(new DragDropExplorer()); } } \ No newline at end of file diff --git a/Drag-Drop/.vscode/launch.json b/Drag-Drop-Search/.vscode/launch.json similarity index 96% rename from Drag-Drop/.vscode/launch.json rename to Drag-Drop-Search/.vscode/launch.json index 05425f5..9b56686 100644 --- a/Drag-Drop/.vscode/launch.json +++ b/Drag-Drop-Search/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/bin/Debug/net7.0-windows/win-x64/Drag-Drop.dll", + "program": "${workspaceFolder}/bin/Debug/net7.0-windows/win-x64/Drag-Drop-Search.dll", "args": [], "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console diff --git a/Drag-Drop-Search/.vscode/tasks.json b/Drag-Drop-Search/.vscode/tasks.json new file mode 100644 index 0000000..bafa172 --- /dev/null +++ b/Drag-Drop-Search/.vscode/tasks.json @@ -0,0 +1,41 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/Drag-Drop-Search.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/Drag-Drop-Search.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/Drag-Drop-Search.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/Drag-Drop/Drag-Drop.csproj b/Drag-Drop-Search/Drag-Drop-Search.csproj similarity index 100% rename from Drag-Drop/Drag-Drop.csproj rename to Drag-Drop-Search/Drag-Drop-Search.csproj diff --git a/Drag-Drop/Form.Designer.cs b/Drag-Drop-Search/DragDropSearch.Designer.cs similarity index 94% rename from Drag-Drop/Form.Designer.cs rename to Drag-Drop-Search/DragDropSearch.Designer.cs index c93bd8b..dd874b6 100644 --- a/Drag-Drop/Form.Designer.cs +++ b/Drag-Drop-Search/DragDropSearch.Designer.cs @@ -1,6 +1,6 @@ namespace View_by_Distance.Drag_Drop; -partial class Form +partial class DragDropSearch { /// /// Required designer variable. @@ -32,7 +32,7 @@ partial class Form this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(640, 100); this.StartPosition = FormStartPosition.CenterScreen; - this.Text = "Form1"; + this.Text = "Drag Drop Search"; } #endregion diff --git a/Drag-Drop-Search/DragDropSearch.cs b/Drag-Drop-Search/DragDropSearch.cs new file mode 100644 index 0000000..e980d01 --- /dev/null +++ b/Drag-Drop-Search/DragDropSearch.cs @@ -0,0 +1,204 @@ +using Microsoft.Extensions.Configuration; +using Phares.Shared; +using Serilog; +using System.Diagnostics; +using System.Reflection; +using View_by_Distance.Drag_Drop.Models; +using View_by_Distance.Resize.Models; +using View_by_Distance.Shared.Models; +using View_by_Distance.Shared.Models.Stateless.Methods; + +namespace View_by_Distance.Drag_Drop; + +public partial class DragDropSearch : Form +{ + + private readonly ILogger _Logger; + private readonly TextBox _TextBox; + private readonly AppSettings _AppSettings; + private readonly ProgressBar _ProgressBar; + private readonly string _WorkingDirectory; + private readonly Configuration _Configuration; + private readonly IsEnvironment _IsEnvironment; + private readonly Dictionary _IdToItem; + private readonly string _ResizeFileNameExtension; + private readonly IConfigurationRoot _ConfigurationRoot; + private readonly Property.Models.Configuration _PropertyConfiguration; + + public DragDropSearch() + { + InitializeComponent(); + ILogger logger; + AppSettings appSettings; + string workingDirectory; + Configuration configuration; + IsEnvironment isEnvironment; + _IdToItem = new(); + IConfigurationRoot configurationRoot; + LoggerConfiguration loggerConfiguration = new(); + Property.Models.Configuration propertyConfiguration; + Assembly assembly = Assembly.GetExecutingAssembly(); + bool debuggerWasAttachedAtLineZero = Debugger.IsAttached || assembly.Location.Contains(@"\bin\Debug"); + 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); + configurationRoot = configurationBuilder.Build(); + appSettings = Models.Binder.AppSettings.Get(configurationRoot); + if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName)) + throw new Exception("Working path name must have parentDirectory value!"); + workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName); + Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory); + _ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot); + Log.Logger = loggerConfiguration.CreateLogger(); + logger = Log.ForContext(); + propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot); + configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration); + (_, _, string resizeFileNameExtension) = C_Resize.GetTuple(configuration.OutputExtension, configuration.OutputQuality); + logger.Information("Complete"); + _Logger = logger; + _AppSettings = appSettings; + _Configuration = configuration; + _IsEnvironment = isEnvironment; + _WorkingDirectory = workingDirectory; + _ConfigurationRoot = configurationRoot; + _PropertyConfiguration = propertyConfiguration; + _ResizeFileNameExtension = resizeFileNameExtension; + _TextBox = new() { Location = new(5, 5), Dock = DockStyle.Top }; + _ProgressBar = new() { Location = new(5, 5), Dock = DockStyle.Top, Visible = false }; + Load += new EventHandler(Form1_Load); + Controls.Add(_ProgressBar); + Controls.Add(_TextBox); + } + + void Form1_Load(object? sender, EventArgs e) + { + try + { + AllowDrop = true; + DragDrop += new DragEventHandler(Form1_DragDrop); + DragEnter += new DragEventHandler(Form1_DragEnter); + _TextBox.LostFocus += new EventHandler(TextBox_LostFocus); + } + catch (Exception) + { + throw; + } + } + + void TextBox_LostFocus(object? sender, EventArgs e) + { + try + { + if (_TextBox.Text == "ps") + throw new NotImplementedException(); + } + catch (Exception) + { + throw; + } + } + + void Form1_DragEnter(object? sender, DragEventArgs e) + { + try + { + if (e.Data is not null && e.Data.GetDataPresent(DataFormats.FileDrop)) + e.Effect = DragDropEffects.Copy; + } + catch (Exception) + { + throw; + } + } + + void LoadData() + { + Container[] containers; + Property.Models.A_Property propertyLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _ResizeFileNameExtension, _Configuration.Reverse); + (_, _, _, containers) = Property.Models.Stateless.Container.GetContainers(_Configuration.PropertyConfiguration, propertyLogic); + List collection = Program.GetItemCollection(_Configuration, containers); + foreach (Item item in collection) + { + if (item.Property?.Id is null) + continue; + if (_IdToItem.ContainsKey(item.Property.Id.Value)) + continue; + _IdToItem.Add(item.Property.Id.Value, item); + } + if (_Logger is null) + throw new NullReferenceException(nameof(_Logger)); + _Logger.Debug((_AppSettings is null).ToString()); + _Logger.Debug((_Configuration is null).ToString()); + _Logger.Debug((_IsEnvironment is null).ToString()); + _Logger.Debug((_WorkingDirectory is null).ToString()); + _Logger.Debug((_ConfigurationRoot is null).ToString()); + _Logger.Debug((_PropertyConfiguration is null).ToString()); + } + + public static string? GetFaceEncoding(string file) + { + string? result; + List results = new(); + const string comment = "Comment: "; + if (File.Exists(file)) + { + IReadOnlyList directories = MetadataExtractor.ImageMetadataReader.ReadMetadata(file); + foreach (MetadataExtractor.Directory directory in directories) + { + if (directory.Name != "PNG-tEXt") + continue; + foreach (MetadataExtractor.Tag tag in directory.Tags) + { + if (tag.Name != "Textual Data" || string.IsNullOrEmpty(tag.Description)) + continue; + if (!tag.Description.StartsWith(comment)) + continue; + results.Add(tag.Description); + } + } + } + result = results.Any() ? results[0][comment.Length..] : null; + return result; + } + + private void GetDirectoriesOrDoDragDrop(string[] paths) + { + string name; + string[] segments; + foreach (string path in paths) + { + name = Path.GetFileNameWithoutExtension(path); + Text = name; + segments = name.Split('.'); + if (!_IdToItem.Any()) + LoadData(); + if (int.TryParse(segments[0], out int id) && _IdToItem.TryGetValue(id, out Item? item)) + { + Text = item.ImageFileHolder.Name; + _TextBox.Text = item.ImageFileHolder.FullName; + if (item.ImageFileHolder.DirectoryName is not null) + _Logger.Information(item.ImageFileHolder.DirectoryName); + if (!string.IsNullOrEmpty(item.ImageFileHolder.DirectoryName)) + _ = Process.Start("explorer.exe", string.Concat("\"", item.ImageFileHolder.DirectoryName, "\"")); + } + } + } + + 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 + GetDirectoriesOrDoDragDrop(paths); + } + catch (Exception) + { + throw; + } + } + +} \ No newline at end of file diff --git a/Drag-Drop/Models/AppSettings.cs b/Drag-Drop-Search/Models/AppSettings.cs similarity index 100% rename from Drag-Drop/Models/AppSettings.cs rename to Drag-Drop-Search/Models/AppSettings.cs diff --git a/Drag-Drop/Models/Binder/AppSettings.cs b/Drag-Drop-Search/Models/Binder/AppSettings.cs similarity index 100% rename from Drag-Drop/Models/Binder/AppSettings.cs rename to Drag-Drop-Search/Models/Binder/AppSettings.cs diff --git a/Drag-Drop/Models/Binder/Configuration.cs b/Drag-Drop-Search/Models/Binder/Configuration.cs similarity index 100% rename from Drag-Drop/Models/Binder/Configuration.cs rename to Drag-Drop-Search/Models/Binder/Configuration.cs diff --git a/Drag-Drop/Models/Configuration.cs b/Drag-Drop-Search/Models/Configuration.cs similarity index 100% rename from Drag-Drop/Models/Configuration.cs rename to Drag-Drop-Search/Models/Configuration.cs diff --git a/Drag-Drop/Program.cs b/Drag-Drop-Search/Program.cs similarity index 97% rename from Drag-Drop/Program.cs rename to Drag-Drop-Search/Program.cs index 27591b5..881af4a 100644 --- a/Drag-Drop/Program.cs +++ b/Drag-Drop-Search/Program.cs @@ -11,7 +11,7 @@ static class Program static void Main() { ApplicationConfiguration.Initialize(); - Application.Run(new Form()); + Application.Run(new DragDropSearch()); } private static Item[] GetFilterItems(Models.Configuration configuration, Container container) diff --git a/Drag-Drop/Form.cs b/Drag-Drop/Form.cs deleted file mode 100644 index 143b12b..0000000 --- a/Drag-Drop/Form.cs +++ /dev/null @@ -1,550 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Phares.Shared; -using Serilog; -using System.Diagnostics; -using System.Globalization; -using System.Reflection; -using System.Text.Json; -using View_by_Distance.Drag_Drop.Models; -using View_by_Distance.FaceRecognitionDotNet; -using View_by_Distance.Resize.Models; -using View_by_Distance.Shared.Models; -using View_by_Distance.Shared.Models.Stateless.Methods; - -namespace View_by_Distance.Drag_Drop; - -public partial class Form : System.Windows.Forms.Form -{ - - private readonly ILogger _Logger; - private readonly TextBox _TextBox; - private readonly List _Lines; - private readonly AppSettings _AppSettings; - private readonly ProgressBar _ProgressBar; - private readonly string _WorkingDirectory; - private readonly Configuration _Configuration; - private readonly IsEnvironment _IsEnvironment; - private readonly ProgressBar _InnerProgressBar; - private readonly Dictionary _IdToItem; - private readonly string _ResizeFileNameExtension; - private readonly IConfigurationRoot _ConfigurationRoot; - private readonly Property.Models.Configuration _PropertyConfiguration; - - public Form() - { - InitializeComponent(); - _Lines = new(); - ILogger logger; - AppSettings appSettings; - string workingDirectory; - Configuration configuration; - IsEnvironment isEnvironment; - _IdToItem = new(); - IConfigurationRoot configurationRoot; - LoggerConfiguration loggerConfiguration = new(); - Property.Models.Configuration propertyConfiguration; - Assembly assembly = Assembly.GetExecutingAssembly(); - bool debuggerWasAttachedAtLineZero = Debugger.IsAttached || assembly.Location.Contains(@"\bin\Debug"); - 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); - configurationRoot = configurationBuilder.Build(); - appSettings = Models.Binder.AppSettings.Get(configurationRoot); - if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName)) - throw new Exception("Working path name must have parentDirectory value!"); - workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName); - Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory); - _ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot); - Log.Logger = loggerConfiguration.CreateLogger(); - logger = Log.ForContext(); - propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot); - configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration); - (_, _, string resizeFileNameExtension) = C_Resize.GetTuple(configuration.OutputExtension, configuration.OutputQuality); - logger.Information("Complete"); - _Logger = logger; - _AppSettings = appSettings; - _Configuration = configuration; - _IsEnvironment = isEnvironment; - _WorkingDirectory = workingDirectory; - _ConfigurationRoot = configurationRoot; - _PropertyConfiguration = propertyConfiguration; - _ResizeFileNameExtension = resizeFileNameExtension; - _TextBox = new() { Location = new(5, 5), Dock = DockStyle.Top }; - _ProgressBar = new() { Location = new(5, 5), Dock = DockStyle.Top, Visible = false }; - _InnerProgressBar = new() { Location = new(5, 5), Dock = DockStyle.Top, Visible = false }; - Load += new EventHandler(Form1_Load); - Controls.Add(_ProgressBar); - Controls.Add(_InnerProgressBar); - Controls.Add(_TextBox); - } - - void Form1_Load(object? sender, EventArgs e) - { - try - { - AllowDrop = true; - DragDrop += new DragEventHandler(Form1_DragDrop); - DragEnter += new DragEventHandler(Form1_DragEnter); - _TextBox.LostFocus += new EventHandler(TextBox_LostFocus); - } - catch (Exception) - { - throw; - } - } - - void TextBox_LostFocus(object? sender, EventArgs e) - { - try - { - if (_TextBox.Text == "ps") - throw new NotImplementedException(); - } - catch (Exception) - { - throw; - } - } - - void Form1_DragEnter(object? sender, DragEventArgs e) - { - try - { - if (e.Data is not null && e.Data.GetDataPresent(DataFormats.FileDrop)) - e.Effect = DragDropEffects.Copy; - } - catch (Exception) - { - throw; - } - } - - void LoadData() - { - Container[] containers; - Property.Models.A_Property propertyLogic = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _ResizeFileNameExtension, _Configuration.Reverse); - (_, _, _, containers) = Property.Models.Stateless.Container.GetContainers(_Configuration.PropertyConfiguration, propertyLogic); - List collection = Program.GetItemCollection(_Configuration, containers); - foreach (Item item in collection) - { - if (item.Property?.Id is null) - continue; - if (_IdToItem.ContainsKey(item.Property.Id.Value)) - continue; - _IdToItem.Add(item.Property.Id.Value, item); - } - if (_Logger is null) - throw new NullReferenceException(nameof(_Logger)); - _Logger.Debug((_AppSettings is null).ToString()); - _Logger.Debug((_Configuration is null).ToString()); - _Logger.Debug((_IsEnvironment is null).ToString()); - _Logger.Debug((_WorkingDirectory is null).ToString()); - _Logger.Debug((_ConfigurationRoot is null).ToString()); - _Logger.Debug((_PropertyConfiguration is null).ToString()); - } - - public static string? GetFaceEncoding(string file) - { - string? result; - List results = new(); - const string comment = "Comment: "; - if (File.Exists(file)) - { - IReadOnlyList directories = MetadataExtractor.ImageMetadataReader.ReadMetadata(file); - foreach (MetadataExtractor.Directory directory in directories) - { - if (directory.Name != "PNG-tEXt") - continue; - foreach (MetadataExtractor.Tag tag in directory.Tags) - { - if (tag.Name != "Textual Data" || string.IsNullOrEmpty(tag.Description)) - continue; - if (!tag.Description.StartsWith(comment)) - continue; - results.Add(tag.Description); - } - } - } - result = results.Any() ? results[0][comment.Length..] : null; - return result; - } - - private void RenameFilesInDirectory(string directory, string searchPattern) - { - int? id; - string? message; - string checkFile; - TimeSpan timeSpan; - DateTime? dateTime; - DateTime?[] dateTimes; - FileHolder fileHolder; - bool isIgnoreExtension; - string checkFileExtension; - DateTime? minimumDateTime; - const string jpg = ".jpg"; - _InnerProgressBar.Step = 1; - _InnerProgressBar.Value = 0; - const string jpeg = ".jpeg"; - _InnerProgressBar.Visible = true; - bool isValidImageFormatExtension; - bool nameWithoutExtensionIsIdFormat; - IReadOnlyList directories; - string[] files = Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly); - if (files.All(l => l.EndsWith(".id"))) - { - foreach (string file in files) - File.Delete(file); - } - _InnerProgressBar.Maximum = files.Length; - foreach (string file in files) - { - _InnerProgressBar.PerformStep(); - fileHolder = new(file); - _Lines.Add(fileHolder.NameWithoutExtension); - if (fileHolder.ExtensionLowered == ".id" || fileHolder.DirectoryName is null) - continue; - if (files.Contains($"{fileHolder.FullName}.id")) - continue; - isValidImageFormatExtension = _Configuration.PropertyConfiguration.ValidImageFormatExtensions.Contains(fileHolder.ExtensionLowered); - isIgnoreExtension = isValidImageFormatExtension && _Configuration.IgnoreExtensions.Contains(fileHolder.ExtensionLowered); - nameWithoutExtensionIsIdFormat = IProperty.NameWithoutExtensionIsIdFormat(fileHolder); - if (!isIgnoreExtension && isValidImageFormatExtension) - { - if (fileHolder.ExtensionLowered == jpeg) - { - if (File.Exists($"{fileHolder.FullName}.id")) - File.Move($"{fileHolder.FullName}.id", Path.Combine(fileHolder.DirectoryName, $"{fileHolder.NameWithoutExtension}{jpg}.id")); - File.Move(fileHolder.FullName, Path.Combine(fileHolder.DirectoryName, $"{fileHolder.NameWithoutExtension}{jpg}")); - } - if (nameWithoutExtensionIsIdFormat) - continue; - } - (dateTimes, id, message) = IProperty.Get(fileHolder, isIgnoreExtension, isValidImageFormatExtension); - minimumDateTime = dateTimes.Min(); - if (minimumDateTime is null || !isIgnoreExtension && isValidImageFormatExtension) - { - dateTime = IProperty.GetDateTimeFromName(fileHolder); - if (dateTime is null || minimumDateTime is null) - timeSpan = new TimeSpan(0); - else - timeSpan = new(Math.Abs(minimumDateTime.Value.Ticks - dateTime.Value.Ticks)); - } - else - { - if (!int.TryParse(Path.GetFileName(fileHolder.DirectoryName)[..4], out int year)) - year = minimumDateTime.Value.Year; - directories = MetadataExtractor.ImageMetadataReader.ReadMetadata(file); - dateTime = Metadata.Models.Stateless.Methods.IMetadata.GetMinimumDateTime(dateTimes, year, directories); - timeSpan = new TimeSpan(int.MaxValue); - } - if (dateTime is not null && timeSpan.TotalMinutes > 2) - { - checkFileExtension = fileHolder.ExtensionLowered == jpeg ? jpg : fileHolder.ExtensionLowered; - checkFile = Path.Combine(fileHolder.DirectoryName, $"{dateTime.Value:yyyy-MM-dd}.{dateTime.Value.Ticks}{checkFileExtension}"); - if (checkFile == fileHolder.FullName) - continue; - for (int i = 0; i < int.MaxValue; i++) - { - checkFile = Path.Combine(fileHolder.DirectoryName, $"{dateTime.Value:yyyy-MM-dd}.{dateTime.Value.Ticks + i}{checkFileExtension}"); - if (File.Exists(checkFile)) - continue; - break; - } - if (File.Exists(checkFile)) - continue; - File.Move(fileHolder.FullName, checkFile); - File.WriteAllText($"{checkFile}.id", $"{checkFile}{Environment.NewLine}{fileHolder.Name}"); - continue; - } - if (id is null) - continue; - checkFileExtension = fileHolder.ExtensionLowered == jpeg ? jpg : fileHolder.ExtensionLowered; - checkFile = Path.Combine(fileHolder.DirectoryName, $"{id.Value}{checkFileExtension}"); - if (checkFile == fileHolder.FullName || File.Exists(checkFile)) - continue; - File.Move(fileHolder.FullName, checkFile); - File.WriteAllText($"{checkFile}.id", $"{checkFile}{Environment.NewLine}{fileHolder.Name}"); - } - _InnerProgressBar.Visible = false; - } - - private List<(string, FaceDistance)> GetFileAndFaceDistanceCollection(string[] files) - { - // int? id; - string? json; - // string? message; - // DateTime? dateTime; - // FileHolder fileHolder; - // bool isIgnoreExtension; - // DateTime? minimumDateTime; - FaceDistance faceDistance; - // bool isValidImageFormatExtension; - List<(string, FaceDistance)> collection = new(); - Shared.Models.FaceEncoding? modelsFaceEncoding; - IReadOnlyList directories; - FaceRecognitionDotNet.FaceEncoding faceRecognitionDotNetFaceEncoding; - _ProgressBar.Maximum = files.Length; - foreach (string file in files) - { - _ProgressBar.PerformStep(); - directories = MetadataExtractor.ImageMetadataReader.ReadMetadata(file); - json = Metadata.Models.Stateless.Methods.IMetadata.GetFaceEncoding(directories); - if (json is null) - break; - modelsFaceEncoding = JsonSerializer.Deserialize(json); - if (modelsFaceEncoding is null) - throw new NotSupportedException(); - faceRecognitionDotNetFaceEncoding = FaceRecognition.LoadFaceEncoding(modelsFaceEncoding.RawEncoding); - faceDistance = new(faceRecognitionDotNetFaceEncoding); - collection.Add(new(file, faceDistance)); - // fileHolder = new(file); - // _Lines.Add(fileHolder.NameWithoutExtension); - // isValidImageFormatExtension = _Configuration.PropertyConfiguration.ValidImageFormatExtensions.Contains(fileHolder.ExtensionLowered); - // isIgnoreExtension = isValidImageFormatExtension && _Configuration.IgnoreExtensions.Contains(fileHolder.ExtensionLowered); - // if (isIgnoreExtension || !isValidImageFormatExtension) - // continue; - // if (fileHolder.CreationTime is null || fileHolder.Name.Contains(fileHolder.CreationTime.Value.ToString("yy"))) - // continue; - // if (fileHolder.LastWriteTime is null || fileHolder.Name.Contains(fileHolder.LastWriteTime.Value.ToString("yy"))) - // continue; - // if (fileHolder.NameWithoutExtension.Length == 1 || fileHolder.NameWithoutExtension[1..].All(l => char.IsNumber(l))) - // continue; - // if (fileHolder.DirectoryName is null) - // continue; - // dateTime = IProperty.GetDateTimeFromName(fileHolder); - // if (dateTime is not null && fileHolder.Name.Contains(dateTime.Value.ToString("yy"))) - // continue; - // (minimumDateTime, id, message) = IProperty.Get(fileHolder); - // if (minimumDateTime is null || id is null) - // continue; - // if (fileHolder.Name.Contains(minimumDateTime.Value.ToString("yy"))) - // continue; - // if (dateTime is not null && minimumDateTime.Value != dateTime.Value) - // continue; - } - return collection; - } - - private static List<(string File, double? Sum)> GetFileAndSum(List<(string File, FaceDistance FaceDistance)> collection) - { - List<(string File, double? Sum)> results = new(); - List lengths = new(); - List faceDistanceLengths; - int take = (int)(collection.Count * .3333); - List faceDistances = collection.Select(l => l.FaceDistance).ToList(); - foreach ((string file, FaceDistance faceDistance) in collection) - { - lengths.Clear(); - faceDistanceLengths = FaceRecognition.FaceDistances(faceDistances, faceDistance); - if (faceDistanceLengths.Count != faceDistances.Count) - throw new NotSupportedException(); - lengths.AddRange(from l in faceDistanceLengths orderby l.Length is not null, l.Length select l.Length); - results.Add(new(file, lengths.Take(take).Sum())); - } - return results; - } - - private void ChangeDate(string directory, DateTime dateTime, string searchPattern) - { - string[] files = Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly); - _ProgressBar.Step = 1; - _ProgressBar.Value = 0; - _ProgressBar.Visible = true; - List<(string File, double? Sum)> results; - List<(string File, FaceDistance FaceDistance)> collection = GetFileAndFaceDistanceCollection(files); - _ProgressBar.Maximum = files.Length; - if (collection.Count != files.Length) - results = new(); - else - results = GetFileAndSum(collection); - if (results.Count == files.Length) - { - foreach ((string file, double? sum) in results) - { - if (sum is null) - continue; - File.SetCreationTime(file, dateTime.AddSeconds(sum.Value)); - } - } - if (results.Count == files.Length) - { } - } - - private List GetBirthDates(string directory) - { - List results = new(); - string[] directoryNames = IPath.GetDirectoryNames(directory); - foreach (string directoryName in directoryNames) - { - if (directoryName.Length != _Configuration.PersonBirthdayFormat.Length) - continue; - if (!DateTime.TryParseExact(directoryName, _Configuration.PersonBirthdayFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime)) - continue; - results.Add(dateTime); - } - return results; - } - - private static void Rename2000(string[] paths) - { - string name; - string check; - string? directoryName; - foreach (string path in paths) - { - 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; - directoryName = Path.GetDirectoryName(path); - if (directoryName is null) - continue; - if (name.StartsWith("=20") || name.StartsWith("#20")) - check = Path.Combine(directoryName, name[1..]); - else - check = Path.Combine(directoryName, $"zzz {name[5..]}"); - // check = Path.Combine(directoryName, name.Replace("#", string.Empty)); - if (Directory.Exists(check) || File.Exists(check)) - continue; - if (!Directory.Exists(path)) - File.Move(path, check); - else - Directory.Move(path, check); - } - } - - private void RenameFilesInDirectories(List directories) - { - string directoryName; - ReadOnlySpan span; - _ProgressBar.Step = 1; - _ProgressBar.Visible = true; - _ProgressBar.Maximum = directories.Count; - for (int i = 1; i < 3; i++) - { - _ProgressBar.Value = 0; - foreach (string directory in directories) - { - _ProgressBar.PerformStep(); - if (directory.Length < 6) - continue; - directoryName = Path.GetFileName(directory); - if (directory.Contains("!---")) - span = "0"; - else - span = directory.AsSpan(directory.Length - 5, 3); - if (directoryName.Length != 1 || !int.TryParse(span, out int age)) - { - if (i == 1) - RenameFilesInDirectory(directory, "*Rename*"); - else if (i == 2) - RenameFilesInDirectory(directory, "*"); - else - continue; - } - else - { - if (i == 1) - { - List birthDates = GetBirthDates(directory); - if (birthDates.Count != 1) - continue; - ChangeDate(directory, birthDates[0].AddYears(age), "*"); - } - else - continue; - } - } - } - File.WriteAllLines($"D:/Tmp/Phares/{DateTime.Now.Ticks}.tsv", _Lines); - _Lines.Clear(); - _ProgressBar.Visible = false; - } - - private static void MoveMatches(string argZero) - { - string moveDirectory; - string checkDirectory; - int length = argZero.Length; - string compareDirectory = "D:/"; - string[] directories = Directory.GetDirectories(argZero, "*", SearchOption.TopDirectoryOnly); - foreach (string directory in directories) - { - 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); - } - } - - private List GetDirectoriesOrDoDragDrop(string[] paths) - { - List results = new(); - string name; - string[] segments; - foreach (string path in paths) - { - name = Path.GetFileNameWithoutExtension(path); - Text = name; - segments = name.Split('.'); - if (Directory.Exists(path)) - { - results.Add(path); - results.AddRange(Directory.GetDirectories(path, "*", SearchOption.AllDirectories)); - } - else - { - if (!_IdToItem.Any()) - LoadData(); - if (int.TryParse(segments[0], out int id) && _IdToItem.TryGetValue(id, out Item? item)) - { - Text = item.ImageFileHolder.Name; - _TextBox.Text = item.ImageFileHolder.FullName; - if (item.ImageFileHolder.DirectoryName is not null) - _Logger.Information(item.ImageFileHolder.DirectoryName); - if (!string.IsNullOrEmpty(item.ImageFileHolder.DirectoryName)) - _ = Process.Start("explorer.exe", string.Concat("\"", item.ImageFileHolder.DirectoryName, "\"")); - } - } - } - 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/Duplicate-Search.csproj b/Duplicate-Search/Duplicate-Search.csproj index 26ef879..9ad37e4 100644 --- a/Duplicate-Search/Duplicate-Search.csproj +++ b/Duplicate-Search/Duplicate-Search.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Duplicate-Search false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Face/Face.csproj b/Face/Face.csproj index 4265158..1f3c2ee 100644 --- a/Face/Face.csproj +++ b/Face/Face.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Face false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/FaceParts/FaceParts.csproj b/FaceParts/FaceParts.csproj index 0da8379..b020298 100644 --- a/FaceParts/FaceParts.csproj +++ b/FaceParts/FaceParts.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.FaceParts false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj b/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj index e577bd5..acbd3ed 100644 --- a/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj +++ b/FaceRecognitionDotNet/FaceRecognitionDotNet.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.FaceRecognitionDotNet false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Instance/Instance.csproj b/Instance/Instance.csproj index 29a70d3..d105b68 100644 --- a/Instance/Instance.csproj +++ b/Instance/Instance.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Instance false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Map/Map.csproj b/Map/Map.csproj index cfed8f3..5812419 100644 --- a/Map/Map.csproj +++ b/Map/Map.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Map false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Metadata/Metadata.csproj b/Metadata/Metadata.csproj index 93bd060..dc3a388 100644 --- a/Metadata/Metadata.csproj +++ b/Metadata/Metadata.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Metadata false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Not-Copy-Copy/Not-Copy-Copy.csproj b/Not-Copy-Copy/Not-Copy-Copy.csproj index 6d32614..b0c3e82 100644 --- a/Not-Copy-Copy/Not-Copy-Copy.csproj +++ b/Not-Copy-Copy/Not-Copy-Copy.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Not.Copy.Copy false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/PhotoPrism/PhotoPrism.csproj b/PhotoPrism/PhotoPrism.csproj index ad9d5e3..a08100c 100644 --- a/PhotoPrism/PhotoPrism.csproj +++ b/PhotoPrism/PhotoPrism.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.PhotoPrism false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/PrepareForOld/PrepareForOld.csproj b/PrepareForOld/PrepareForOld.csproj index f6de5f3..a93c90e 100644 --- a/PrepareForOld/PrepareForOld.csproj +++ b/PrepareForOld/PrepareForOld.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.PrepareForOld false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Property-Compare/Property-Compare.csproj b/Property-Compare/Property-Compare.csproj index 4a86252..9fad63c 100644 --- a/Property-Compare/Property-Compare.csproj +++ b/Property-Compare/Property-Compare.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Property.Compare false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Property/Property.csproj b/Property/Property.csproj index 3c84b45..78d5919 100644 --- a/Property/Property.csproj +++ b/Property/Property.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Property false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Rename/.vscode/launch.json b/Rename/.vscode/launch.json new file mode 100644 index 0000000..5c7c6b4 --- /dev/null +++ b/Rename/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "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/Rename.dll", + "args": [], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/Drag-Drop/.vscode/tasks.json b/Rename/.vscode/tasks.json similarity index 85% rename from Drag-Drop/.vscode/tasks.json rename to Rename/.vscode/tasks.json index d14de89..c51ceb7 100644 --- a/Drag-Drop/.vscode/tasks.json +++ b/Rename/.vscode/tasks.json @@ -7,7 +7,7 @@ "type": "process", "args": [ "build", - "${workspaceFolder}/Drag-Drop.csproj", + "${workspaceFolder}/Rename.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], @@ -19,7 +19,7 @@ "type": "process", "args": [ "publish", - "${workspaceFolder}/Drag-Drop.csproj", + "${workspaceFolder}/Rename.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], @@ -33,7 +33,7 @@ "watch", "run", "--project", - "${workspaceFolder}/Drag-Drop.csproj" + "${workspaceFolder}/Rename.csproj" ], "problemMatcher": "$msCompile" } diff --git a/Rename/Models/AppSettings.cs b/Rename/Models/AppSettings.cs new file mode 100644 index 0000000..1fa7d89 --- /dev/null +++ b/Rename/Models/AppSettings.cs @@ -0,0 +1,29 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace View_by_Distance.Rename.Models; + +public class AppSettings +{ + + public string Company { init; get; } + public string ComparePathsFile { init; get; } + public int MaxDegreeOfParallelism { init; get; } + public string WorkingDirectoryName { init; get; } + + [JsonConstructor] + public AppSettings(string company, string comparePathsFile, int maxDegreeOfParallelism, string workingDirectoryName) + { + Company = company; + ComparePathsFile = comparePathsFile; + MaxDegreeOfParallelism = maxDegreeOfParallelism; + WorkingDirectoryName = workingDirectoryName; + } + + public override string ToString() + { + string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); + return result; + } + +} \ No newline at end of file diff --git a/Rename/Models/Binder/AppSettings.cs b/Rename/Models/Binder/AppSettings.cs new file mode 100644 index 0000000..d98f86f --- /dev/null +++ b/Rename/Models/Binder/AppSettings.cs @@ -0,0 +1,46 @@ +using Microsoft.Extensions.Configuration; +using System.Text.Json; + +namespace View_by_Distance.Rename.Models.Binder; + +public class AppSettings +{ + +#nullable disable + + public string Company { get; set; } + public string ComparePathsFile { 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.ComparePathsFile, + appSettings.MaxDegreeOfParallelism.Value, + appSettings.WorkingDirectoryName + ); + return result; + } + + public static Models.AppSettings Get(IConfigurationRoot configurationRoot) + { + Models.AppSettings result; + AppSettings? appSettings = configurationRoot.Get(); + result = Get(appSettings); + return result; + } + +} \ No newline at end of file diff --git a/Rename/Models/Binder/Configuration.cs b/Rename/Models/Binder/Configuration.cs new file mode 100644 index 0000000..4a07478 --- /dev/null +++ b/Rename/Models/Binder/Configuration.cs @@ -0,0 +1,59 @@ +using Microsoft.Extensions.Configuration; +using Phares.Shared; +using System.ComponentModel.DataAnnotations; +using System.Text.Json; + +namespace View_by_Distance.Rename.Models.Binder; + +public class Configuration +{ + +#nullable disable + + [Display(Name = "Ignore Extensions"), Required] public string[] IgnoreExtensions { get; set; } + [Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; } + [Display(Name = "Person Birthday Format"), Required] public string PersonBirthdayFormat { get; set; } + +#nullable restore + + public override string ToString() + { + string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); + return result; + } + + private static Models.Configuration Get(Configuration? configuration) + { + Models.Configuration result; + if (configuration is null) + throw new NullReferenceException(nameof(configuration)); + if (configuration.IgnoreExtensions is null) + throw new NullReferenceException(nameof(configuration.IgnoreExtensions)); + if (configuration.PersonBirthdayFormat is null) + throw new NullReferenceException(nameof(configuration.PersonBirthdayFormat)); + result = new( + configuration.IgnoreExtensions, + configuration.PersonBirthdayFormat, + configuration.PropertyConfiguration); + return result; + } + + public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration) + { + Models.Configuration result; + Configuration? configuration; + if (isEnvironment is null) + configuration = configurationRoot.Get(); + else + { + string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment); + string section = string.Concat(environmentName, ":", nameof(Configuration)); + IConfigurationSection configurationSection = configurationRoot.GetSection(section); + configuration = configurationSection.Get(); + } + result = Get(configuration); + result.SetAndUpdate(propertyConfiguration); + return result; + } + +} \ No newline at end of file diff --git a/Rename/Models/Configuration.cs b/Rename/Models/Configuration.cs new file mode 100644 index 0000000..fa75f95 --- /dev/null +++ b/Rename/Models/Configuration.cs @@ -0,0 +1,38 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace View_by_Distance.Rename.Models; + +public class Configuration +{ + + protected Property.Models.Configuration _PropertyConfiguration; + public string[] IgnoreExtensions { init; get; } + public string PersonBirthdayFormat { init; get; } + + public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration; + + [JsonConstructor] + public Configuration( + string[] ignoreExtensions, + string personBirthdayFormat, + Property.Models.Configuration propertyConfiguration) + { + IgnoreExtensions = ignoreExtensions; + PersonBirthdayFormat = personBirthdayFormat; + _PropertyConfiguration = propertyConfiguration; + } + + public override string ToString() + { + string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); + return result; + } + + public void SetAndUpdate(Property.Models.Configuration configuration) + { + _PropertyConfiguration = configuration; + _PropertyConfiguration.Update(); + } + +} \ No newline at end of file diff --git a/Rename/Models/Stateless/SerilogExtensionMethods.cs b/Rename/Models/Stateless/SerilogExtensionMethods.cs new file mode 100644 index 0000000..1d99b9e --- /dev/null +++ b/Rename/Models/Stateless/SerilogExtensionMethods.cs @@ -0,0 +1,10 @@ +namespace View_by_Distance.Rename.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); + +} \ No newline at end of file diff --git a/Rename/Program.cs b/Rename/Program.cs new file mode 100644 index 0000000..70c7b6f --- /dev/null +++ b/Rename/Program.cs @@ -0,0 +1,70 @@ +using Microsoft.Extensions.Configuration; +using Phares.Shared; +using Serilog; +using System.Diagnostics; +using System.Reflection; +using View_by_Distance.Rename.Models; +using View_by_Distance.Shared.Models.Stateless.Methods; + +namespace View_by_Distance.Rename; + +public class Program +{ + + public static void Secondary(List 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(); + int silentIndex = args.IndexOf("s"); + if (silentIndex > -1) + args.RemoveAt(silentIndex); + try + { + if (args is null) + throw new Exception("args is null!"); + Shared.Models.Console console = new(); + _ = new Rename(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()); + } + +} \ No newline at end of file diff --git a/Rename/Rename.cs b/Rename/Rename.cs new file mode 100644 index 0000000..da627d9 --- /dev/null +++ b/Rename/Rename.cs @@ -0,0 +1,270 @@ +using Microsoft.Extensions.Configuration; +using Phares.Shared; +using Serilog; +using ShellProgressBar; +using View_by_Distance.Rename.Models; +using View_by_Distance.Shared.Models; +using View_by_Distance.Shared.Models.Methods; + +namespace View_by_Distance.Rename; + +public class Rename +{ + + private readonly AppSettings _AppSettings; + private readonly string _WorkingDirectory; + private readonly IsEnvironment _IsEnvironment; + private readonly Configuration _Configuration; + private readonly IConfigurationRoot _ConfigurationRoot; + private readonly Property.Models.Configuration _PropertyConfiguration; + + public Rename(List args, IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, AppSettings appSettings, string workingDirectory, bool isSilent, IConsole console) + { + if (isSilent) + { } + if (console is null) + { } + _AppSettings = appSettings; + _IsEnvironment = isEnvironment; + long ticks = DateTime.Now.Ticks; + _WorkingDirectory = workingDirectory; + _ConfigurationRoot = configurationRoot; + ILogger? log = Log.ForContext(); + Dictionary>> fileSizeToCollection = new(); + Property.Models.Configuration propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot); + Configuration configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration); + _PropertyConfiguration = propertyConfiguration; + _Configuration = configuration; + ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true }; + propertyConfiguration.Update(); + string? comparePathRoot = Path.GetDirectoryName(appSettings.ComparePathsFile); + if (comparePathRoot is null || comparePathRoot == propertyConfiguration.RootDirectory) + throw new Exception("Nested isn't allowed!"); + log.Information(propertyConfiguration.RootDirectory); + Verify(); + string json = File.ReadAllText(appSettings.ComparePathsFile); + MatchNginx[]? matchNginxCollection = System.Text.Json.JsonSerializer.Deserialize(json); + if (matchNginxCollection is null) + throw new NullReferenceException(nameof(matchNginxCollection)); + if (matchNginxCollection.Length == 0 && matchNginxCollection[0].ConvertedPath.Contains("~~~")) + MoveMatches(matchNginxCollection[0]); + else if (matchNginxCollection.All(l => l.Name.StartsWith("#")) || matchNginxCollection.All(l => l.Name.StartsWith(" #")) || matchNginxCollection.All(l => l.Name.StartsWith("=20")) || matchNginxCollection.All(l => l.Name.StartsWith("#20"))) + Rename2000(matchNginxCollection); + else if (matchNginxCollection.Any()) + { + List lines = RenameFilesInDirectories(options, matchNginxCollection); + File.WriteAllLines($"D:/Tmp/Phares/{DateTime.Now.Ticks}.tsv", lines); + if (comparePathRoot != Path.GetPathRoot(matchNginxCollection[0].ConvertedPath)) + _ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(comparePathRoot); + } + } + + private void Verify() + { + if (_AppSettings is null) + { } + if (_IsEnvironment is null) + { } + if (_Configuration is null) + { } + if (_ConfigurationRoot is null) + { } + if (_WorkingDirectory is null) + { } + } + + private static void MoveMatches(MatchNginx matchNginx) + { + string moveDirectory; + string checkDirectory; + string compareDirectory = "D:/"; + int length = matchNginx.ConvertedPath.Length; + string[] directories = Directory.GetDirectories(matchNginx.ConvertedPath, "*", SearchOption.TopDirectoryOnly); + foreach (string directory in directories) + { + 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); + } + } + + private (List<(FileHolder, string)>, int) RenameFilesInDirectory(ProgressBar progressBar, string[] files) + { + List<(FileHolder, string)> results = new(); + int? id; + string? message; + string checkFile; + TimeSpan timeSpan; + DateTime? dateTime; + DateTime?[] dateTimes; + FileHolder fileHolder; + bool isIgnoreExtension; + string checkFileExtension; + DateTime? minimumDateTime; + const string jpg = ".jpg"; + const string jpeg = ".jpeg"; + bool isValidImageFormatExtension; + bool nameWithoutExtensionIsIdFormat; + List distinctCollection = new(); + IReadOnlyList directories; + foreach (string file in files) + { + progressBar.Tick(); + fileHolder = new(file); + if (fileHolder.ExtensionLowered == ".id" || fileHolder.DirectoryName is null) + continue; + if (files.Contains($"{fileHolder.FullName}.id")) + continue; + isValidImageFormatExtension = _PropertyConfiguration.ValidImageFormatExtensions.Contains(fileHolder.ExtensionLowered); + isIgnoreExtension = isValidImageFormatExtension && _Configuration.IgnoreExtensions.Contains(fileHolder.ExtensionLowered); + nameWithoutExtensionIsIdFormat = Shared.Models.Stateless.Methods.IProperty.NameWithoutExtensionIsIdFormat(fileHolder); + if (!isIgnoreExtension && isValidImageFormatExtension) + { + if (fileHolder.ExtensionLowered == jpeg) + { + if (File.Exists($"{fileHolder.FullName}.id")) + File.Move($"{fileHolder.FullName}.id", Path.Combine(fileHolder.DirectoryName, $"{fileHolder.NameWithoutExtension}{jpg}.id")); + File.Move(fileHolder.FullName, Path.Combine(fileHolder.DirectoryName, $"{fileHolder.NameWithoutExtension}{jpg}")); + } + if (nameWithoutExtensionIsIdFormat) + continue; + } + (dateTimes, id, message) = Shared.Models.Stateless.Methods.IProperty.Get(fileHolder, isIgnoreExtension, isValidImageFormatExtension); + minimumDateTime = dateTimes.Min(); + if (minimumDateTime is null || !isIgnoreExtension && isValidImageFormatExtension) + { + dateTime = Shared.Models.Stateless.Methods.IProperty.GetDateTimeFromName(fileHolder); + if (dateTime is null || minimumDateTime is null) + timeSpan = new TimeSpan(0); + else + timeSpan = new(Math.Abs(minimumDateTime.Value.Ticks - dateTime.Value.Ticks)); + } + else + { + if (!int.TryParse(Path.GetFileName(fileHolder.DirectoryName)[..4], out int year)) + year = minimumDateTime.Value.Year; + try + { directories = MetadataExtractor.ImageMetadataReader.ReadMetadata(file); } + catch (Exception) { continue; } + dateTime = Metadata.Models.Stateless.Methods.IMetadata.GetMinimumDateTime(dateTimes, year, directories); + timeSpan = new TimeSpan(int.MaxValue); + } + if (dateTime is not null && timeSpan.TotalMinutes > 2) + { + checkFileExtension = fileHolder.ExtensionLowered == jpeg ? jpg : fileHolder.ExtensionLowered; + if (!isIgnoreExtension && isValidImageFormatExtension) + checkFile = Path.Combine(fileHolder.DirectoryName, $"{dateTime.Value:yyyy-MM-dd}.{dateTime.Value.Ticks}{checkFileExtension}"); + else + checkFile = Path.Combine(fileHolder.DirectoryName, $"{dateTime.Value:yyyy-MM-dd}.{dateTime.Value.Ticks}.{fileHolder.Length}{checkFileExtension}"); + if (checkFile == fileHolder.FullName) + continue; + if (distinctCollection.Contains(checkFile)) + continue; + distinctCollection.Add(checkFile); + results.Add(new(fileHolder, checkFile)); + continue; + } + if (id is null) + continue; + checkFileExtension = fileHolder.ExtensionLowered == jpeg ? jpg : fileHolder.ExtensionLowered; + checkFile = Path.Combine(fileHolder.DirectoryName, $"{id.Value}{checkFileExtension}"); + if (checkFile == fileHolder.FullName || File.Exists(checkFile)) + continue; + if (distinctCollection.Contains(checkFile)) + continue; + results.Add(new(fileHolder, checkFile)); + } + return new(results, distinctCollection.Count); + } + + private static void Rename2000(MatchNginx[] matchNginxCollection) + { + string name; + string check; + string? directoryName; + foreach (MatchNginx matchNginx in matchNginxCollection) + { + name = matchNginx.Name.Trim(); + if (name.Length < 1 || (!name.StartsWith("zzz =20") && !name.StartsWith("=20") && !name.StartsWith("#20"))) + // if (name.Length < 1 || !name.Contains(".Z.#20")) + continue; + directoryName = Path.GetDirectoryName(matchNginx.ConvertedPath); + if (directoryName is null) + continue; + if (name.StartsWith("=20") || name.StartsWith("#20")) + check = Path.Combine(directoryName, name[1..]); + else + check = Path.Combine(directoryName, $"zzz {name[5..]}"); + // check = Path.Combine(directoryName, name.Replace("#", string.Empty)); + if (Directory.Exists(check) || File.Exists(check)) + continue; + if (!Directory.Exists(matchNginx.ConvertedPath)) + File.Move(matchNginx.ConvertedPath, check); + else + Directory.Move(matchNginx.ConvertedPath, check); + } + } + + private static List GetAllFiles(MatchNginx[] matchNginxCollection) + { + List allFiles = new(); + string[] files; + string directoryName; + ReadOnlySpan span; + foreach (MatchNginx matchNginx in matchNginxCollection) + { + if (matchNginx.ConvertedPath.Length < 6) + continue; + directoryName = Path.GetFileName(matchNginx.ConvertedPath); + if (matchNginx.ConvertedPath.Contains("!---")) + span = "0"; + else + span = matchNginx.ConvertedPath.AsSpan(matchNginx.ConvertedPath.Length - 5, 3); + if (directoryName.Length == 1 && int.TryParse(span, out int age)) + continue; + if (File.Exists(matchNginx.ConvertedPath)) + continue; + files = Directory.GetFiles(matchNginx.ConvertedPath, "*", SearchOption.TopDirectoryOnly); + if (files.All(l => l.EndsWith(".id"))) + { + foreach (string file in files) + File.Delete(file); + continue; + } + allFiles.AddRange(files); + } + return allFiles; + } + + private List RenameFilesInDirectories(ProgressBarOptions options, MatchNginx[] matchNginxCollection) + { + List results = new(); + string[] files; + int distinctCount; + string message = "Renaming files"; + List<(FileHolder, string)> renameCollection; + List allFiles = GetAllFiles(matchNginxCollection); + using ProgressBar progressBar = new(matchNginxCollection.Length * 2, message, options); + for (int i = 1; i < 3; i++) + { + files = i == 2 ? allFiles.ToArray() : (from l in allFiles where l.Contains("Rename") select l).ToArray(); + (renameCollection, distinctCount) = RenameFilesInDirectory(progressBar, files); + foreach ((FileHolder fileHolder, string to) in renameCollection) + { + results.Add(fileHolder.NameWithoutExtension); + if (renameCollection.Count != distinctCount) + continue; + if (File.Exists(to)) + continue; + File.Move(fileHolder.FullName, to); + File.WriteAllText($"{to}.id", $"{to}{Environment.NewLine}{fileHolder.FullName}"); + } + } + return results; + } + +} \ No newline at end of file diff --git a/Rename/Rename.csproj b/Rename/Rename.csproj new file mode 100644 index 0000000..f112857 --- /dev/null +++ b/Rename/Rename.csproj @@ -0,0 +1,60 @@ + + + enable + 10.0 + enable + WinExe + win-x64 + net7.0 + + + Phares.View.by.Distance.Rename + false + 7.0.101.1 + Mike Phares + Phares + true + snupkg + + + true + true + true + + + Windows + + + OSX + + + Linux + + + + + + + + + + + + + + + + + + + + + + + Always + + + Always + + + \ No newline at end of file diff --git a/Rename/appsettings.Development.json b/Rename/appsettings.Development.json new file mode 100644 index 0000000..6a45fbc --- /dev/null +++ b/Rename/appsettings.Development.json @@ -0,0 +1,18 @@ +{ + "ComparePathsFile": "C:/Users/mikep/AppData/Local/PharesApps/Drag-Drop-Explorer/2023_01/638082668201867717.json", + "Logging": { + "LogLevel": { + "Log4netProvider": "Debug" + } + }, + "MaxDegreeOfParallelism": 6, + "Serilog": { + "MinimumLevel": "Debug" + }, + "Windows": { + "Configuration": { + "RootDirectory": "C:/", + "VerifyToSeason": [] + } + } +} \ No newline at end of file diff --git a/Rename/appsettings.json b/Rename/appsettings.json new file mode 100644 index 0000000..83ad436 --- /dev/null +++ b/Rename/appsettings.json @@ -0,0 +1,118 @@ +{ + "ComparePathsFile": "", + "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": "Information", + "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", + "DiffPropertyDirectory": "", + "FileNameDirectorySeparator": ".Z.", + "ForcePropertyLastWriteTimeToCreationTime": false, + "MaxImagesInDirectoryForTopLevelFirstPass": 10, + "OutputExtension": ".jpg", + "Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]", + "PersonBirthdayFormat": "yyyy-MM-dd_HH", + "PopulatePropertyId": true, + "PropertiesChangedForProperty": false, + "ResultAllInOne": "_ _ _", + "ResultCollection": "[]", + "ResultContent": "()", + "ResultSingleton": "{}", + "RootDirectory": "C:/Tmp/Phares/Compare/Images-45f4401", + "WriteBitmapDataBytes": false, + "IgnoreExtensions": [ + ".gif", + ".GIF" + ], + "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" + ] + } + } +} \ No newline at end of file diff --git a/Resize/Resize.csproj b/Resize/Resize.csproj index 57646c3..c6a7d21 100644 --- a/Resize/Resize.csproj +++ b/Resize/Resize.csproj @@ -10,7 +10,7 @@ Phares.View.by.Distance.Resize false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Drag-Drop-Explorer/Models/MatchNginx.cs b/Shared/Models/MatchNginx.cs similarity index 68% rename from Drag-Drop-Explorer/Models/MatchNginx.cs rename to Shared/Models/MatchNginx.cs index 74913e7..f2b7887 100644 --- a/Drag-Drop-Explorer/Models/MatchNginx.cs +++ b/Shared/Models/MatchNginx.cs @@ -1,4 +1,4 @@ -namespace View_by_Distance.Drag_Drop_Explorer; +namespace View_by_Distance.Shared.Models; public record MatchNginx(string Name, string Type, DateTime MTime, long Size, string ConvertedPath) { } \ No newline at end of file diff --git a/Shared/View-by-Distance.Shared.csproj b/Shared/View-by-Distance.Shared.csproj index 1fc9aea..9629e4d 100644 --- a/Shared/View-by-Distance.Shared.csproj +++ b/Shared/View-by-Distance.Shared.csproj @@ -9,7 +9,7 @@ Phares.View.by.Distance.Shared false - 6.0.100.1 + 7.0.101.1 Mike Phares Phares true diff --git a/Tests/UnitTestCalculations.cs b/Tests/UnitTestCalculations.cs index bbad3f3..6bcb568 100644 --- a/Tests/UnitTestCalculations.cs +++ b/Tests/UnitTestCalculations.cs @@ -80,6 +80,8 @@ public partial class UnitTestCalculations { PersonBirthday personBirthday = new(new(1980, 1, 17)); double? age = IPersonBirthday.GetAge(personBirthday); + if (age is null) + throw new NullReferenceException(nameof(age)); Assert.IsNotNull(age); Assert.IsTrue(age.Value > 42.6092); } diff --git a/View-by-Distance-MKLink-Console.sln b/View-by-Distance-MKLink-Console.sln index 4199953..d3d4524 100644 --- a/View-by-Distance-MKLink-Console.sln +++ b/View-by-Distance-MKLink-Console.sln @@ -3,49 +3,51 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30114.105 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "View-by-Distance.Shared", "shared\View-by-Distance.Shared.csproj", "{1D231660-33B4-4763-9C9F-C6ACC8BA600D}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Date-Group", "Date-Group\Date-Group.csproj", "{DFEDB5F9-AFFC-40A2-9FEC-9B84C83B63D9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Metadata", "Metadata\Metadata.csproj", "{961D11A0-44C8-48CD-BEEE-A6E6903AE58F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Delete-By-Distinct", "Delete-By-Distinct\Delete-By-Distinct.csproj", "{3F00BDD5-75F8-470C-ACED-1A26FDC8D7B3}" 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}") = "PrepareForOld", "PrepareForOld\PrepareForOld.csproj", "{F73F9468-0139-4B05-99CE-C6C0403D03E5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Property", "Property\Property.csproj", "{964B969A-719C-48AF-86C0-F97AF1397347}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Property-Compare", "Property-Compare\Property-Compare.csproj", "{692AA058-F142-44B0-88BC-F22AB5BE5EDF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Resize", "Resize\Resize.csproj", "{27D0D869-394D-4B07-83DF-2095B16026FC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{B4FB6B43-36EC-404D-B934-5C695C6E32CC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FaceRecognitionDotNet", "FaceRecognitionDotNet\FaceRecognitionDotNet.csproj", "{FAD03DA9-E8B1-4BBE-B8D0-2ADD2F2BC758}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestsWithFaceRecognitionDotNet", "TestsWithFaceRecognitionDotNet\TestsWithFaceRecognitionDotNet.csproj", "{A67D73C7-A1A1-4443-B681-776339CFA08A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Map", "Map\Map.csproj", "{960BBED6-BF2C-4337-8330-F858606F4343}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Instance", "Instance\Instance.csproj", "{8085C1EE-C4DB-43DE-8888-1C956D69CF91}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Delete-By-Relative", "Delete-By-Relative\Delete-By-Relative.csproj", "{9DFCA595-80AA-4E78-A9AF-5B4AB4D737C4}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Distance", "Distance\Distance.csproj", "{8D444B55-933C-40CD-B7FC-226136F16138}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drag-Drop-Explorer", "Drag-Drop-Explorer\Drag-Drop-Explorer.csproj", "{986B009B-2937-4624-AC9C-13806868DB8C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drag-Drop-Search", "Drag-Drop-Search\Drag-Drop-Search.csproj", "{87EB76BC-32A9-4FD0-922A-BD7E9B6E7D8B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicate-Search", "Duplicate-Search\Duplicate-Search.csproj", "{48E87D9B-B802-467A-BDC7-E86F7FD01D5C}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Face", "Face\Face.csproj", "{A12E19E5-59C0-40D4-B807-DF1334D4906D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FaceParts", "FaceParts\FaceParts.csproj", "{919525B1-60BA-40C6-BA66-6F7F4C526E01}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drag-Drop", "Drag-Drop\Drag-Drop.csproj", "{87EB76BC-32A9-4FD0-922A-BD7E9B6E7D8B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FaceRecognitionDotNet", "FaceRecognitionDotNet\FaceRecognitionDotNet.csproj", "{FAD03DA9-E8B1-4BBE-B8D0-2ADD2F2BC758}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duplicate-Search", "Duplicate-Search\Duplicate-Search.csproj", "{48E87D9B-B802-467A-BDC7-E86F7FD01D5C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Instance", "Instance\Instance.csproj", "{8085C1EE-C4DB-43DE-8888-1C956D69CF91}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Delete-By-Relative", "Delete-By-Relative\Delete-By-Relative.csproj", "{9DFCA595-80AA-4E78-A9AF-5B4AB4D737C4}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Map", "Map\Map.csproj", "{960BBED6-BF2C-4337-8330-F858606F4343}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Delete-By-Distinct", "Delete-By-Distinct\Delete-By-Distinct.csproj", "{3F00BDD5-75F8-470C-ACED-1A26FDC8D7B3}" +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}") = "Drag-Drop-Explorer", "Drag-Drop-Explorer\Drag-Drop-Explorer.csproj", "{986B009B-2937-4624-AC9C-13806868DB8C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrepareForOld", "PrepareForOld\PrepareForOld.csproj", "{F73F9468-0139-4B05-99CE-C6C0403D03E5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Property-Compare", "Property-Compare\Property-Compare.csproj", "{692AA058-F142-44B0-88BC-F22AB5BE5EDF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Property", "Property\Property.csproj", "{964B969A-719C-48AF-86C0-F97AF1397347}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rename", "Rename\Rename.csproj", "{83FD089F-8034-4597-B87F-87D343C0486B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Resize", "Resize\Resize.csproj", "{27D0D869-394D-4B07-83DF-2095B16026FC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{B4FB6B43-36EC-404D-B934-5C695C6E32CC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestsWithFaceRecognitionDotNet", "TestsWithFaceRecognitionDotNet\TestsWithFaceRecognitionDotNet.csproj", "{A67D73C7-A1A1-4443-B681-776339CFA08A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "View-by-Distance.Shared", "shared\View-by-Distance.Shared.csproj", "{1D231660-33B4-4763-9C9F-C6ACC8BA600D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -144,5 +146,9 @@ Global {986B009B-2937-4624-AC9C-13806868DB8C}.Debug|Any CPU.Build.0 = Debug|Any CPU {986B009B-2937-4624-AC9C-13806868DB8C}.Release|Any CPU.ActiveCfg = Release|Any CPU {986B009B-2937-4624-AC9C-13806868DB8C}.Release|Any CPU.Build.0 = Release|Any CPU + {83FD089F-8034-4597-B87F-87D343C0486B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {83FD089F-8034-4597-B87F-87D343C0486B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {83FD089F-8034-4597-B87F-87D343C0486B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {83FD089F-8034-4597-B87F-87D343C0486B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal