Remove ThumbHasher from Property

This commit is contained in:
2023-05-22 20:36:02 -07:00
parent a0c880c7ba
commit 82143850ac
7 changed files with 26 additions and 90 deletions

View File

@ -202,11 +202,10 @@ public partial class DragDropMove : Form
List<(string, int, DateTime)> results = new();
DateTime dateTime;
Shared.Models.Property property;
Shared.Models.Methods.IThumbHasher? thumbHasher = null;
string[] files = Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string file in files)
{
property = Property.Models.A_Property.GetImageProperty(thumbHasher, file);
property = Property.Models.A_Property.GetImageProperty(file);
if (property.Id is null || property.DateTimeOriginal is null)
continue;
dateTime = property.DateTimeOriginal.Value.AddTicks(ticks);
@ -240,7 +239,6 @@ public partial class DragDropMove : Form
ticks++;
}
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 +253,7 @@ public partial class DragDropMove : Form
bitmap.SetPropertyItem(propertyItem);
bitmap.Save(checkFile);
bitmap.Dispose();
property = Property.Models.A_Property.GetImageProperty(thumbHasher, checkFile);
property = Property.Models.A_Property.GetImageProperty(checkFile);
if (property.Id is null || property.Id.Value != id)
throw new Exception();
}
@ -290,11 +288,10 @@ 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.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(thumbHasher, badFiles.First());
Shared.Models.Property targetProperty = Property.Models.A_Property.GetImageProperty(thumbHasher, targetFiles.First());
Shared.Models.Property badProperty = Property.Models.A_Property.GetImageProperty(badFiles.First());
Shared.Models.Property targetProperty = Property.Models.A_Property.GetImageProperty(targetFiles.First());
if (badProperty.DateTimeOriginal is null || targetProperty.DateTimeOriginal is null)
_Logger.Error("Date is null!");
else