Switched to ThumbHasher over BlurHasher

This commit is contained in:
2023-05-21 23:56:10 -07:00
parent 514637b9c6
commit a0c880c7ba
26 changed files with 803 additions and 121 deletions

View File

@ -202,11 +202,11 @@ public partial class DragDropMove : Form
List<(string, int, DateTime)> results = new();
DateTime dateTime;
Shared.Models.Property property;
Shared.Models.Methods.IBlurHasher? blurHasher = null;
Shared.Models.Methods.IThumbHasher? thumbHasher = null;
string[] files = Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string file in files)
{
property = Property.Models.A_Property.GetImageProperty(blurHasher, file);
property = Property.Models.A_Property.GetImageProperty(thumbHasher, file);
if (property.Id is null || property.DateTimeOriginal is null)
continue;
dateTime = property.DateTimeOriginal.Value.AddTicks(ticks);
@ -240,7 +240,7 @@ public partial class DragDropMove : Form
ticks++;
}
Shared.Models.Methods.IBlurHasher? blurHasher = null;
Shared.Models.Methods.IThumbHasher? thumbHasher = null;
List<(string, int, DateTime)> collection = GetCollection(checkDirectory, minimumDateTime, maximumDateTime, ticks);
ConstructorInfo? constructorInfo = typeof(PropertyItem).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public, null, Array.Empty<Type>(), null) ?? throw new Exception();
foreach ((string file, int id, DateTime dateTime) in collection)
@ -255,7 +255,7 @@ public partial class DragDropMove : Form
bitmap.SetPropertyItem(propertyItem);
bitmap.Save(checkFile);
bitmap.Dispose();
property = Property.Models.A_Property.GetImageProperty(blurHasher, checkFile);
property = Property.Models.A_Property.GetImageProperty(thumbHasher, checkFile);
if (property.Id is null || property.Id.Value != id)
throw new Exception();
}
@ -290,11 +290,11 @@ public partial class DragDropMove : Form
_Logger.Error("bad file(s) or target file(s) or maximum directory doesn't equal 1!");
else
{
Shared.Models.Methods.IBlurHasher? blurHasher = null;
Shared.Models.Methods.IThumbHasher? thumbHasher = null;
DateTime minimumDateTime = DateTime.ParseExact(Path.GetFileName(minimumDirectory.First()), format, null, System.Globalization.DateTimeStyles.None);
DateTime maximumDateTime = DateTime.ParseExact(Path.GetFileName(maximumDirectory.First()), format, null, System.Globalization.DateTimeStyles.None).AddHours(23);
Shared.Models.Property badProperty = Property.Models.A_Property.GetImageProperty(blurHasher, badFiles.First());
Shared.Models.Property targetProperty = Property.Models.A_Property.GetImageProperty(blurHasher, targetFiles.First());
Shared.Models.Property badProperty = Property.Models.A_Property.GetImageProperty(thumbHasher, badFiles.First());
Shared.Models.Property targetProperty = Property.Models.A_Property.GetImageProperty(thumbHasher, targetFiles.First());
if (badProperty.DateTimeOriginal is null || targetProperty.DateTimeOriginal is null)
_Logger.Error("Date is null!");
else