AddUserSecrets, RenameByDateTaken and BlurHash
This commit is contained in:
@ -30,7 +30,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||
|
@ -39,7 +39,8 @@ public partial class DragDropMove : Form
|
||||
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables()
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile(isEnvironment.AppSettingsFileName, optional: false, reloadOnChange: true);
|
||||
.AddJsonFile(isEnvironment.AppSettingsFileName, optional: false, reloadOnChange: true)
|
||||
.AddUserSecrets<Program>();
|
||||
configurationRoot = configurationBuilder.Build();
|
||||
appSettings = Models.Binder.AppSettings.Get(configurationRoot);
|
||||
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
|
||||
@ -201,10 +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;
|
||||
string[] files = Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
{
|
||||
property = Property.Models.A_Property.GetImageProperty(file);
|
||||
property = Property.Models.A_Property.GetImageProperty(blurHasher, file);
|
||||
if (property.Id is null || property.DateTimeOriginal is null)
|
||||
continue;
|
||||
dateTime = property.DateTimeOriginal.Value.AddTicks(ticks);
|
||||
@ -238,6 +240,7 @@ public partial class DragDropMove : Form
|
||||
ticks++;
|
||||
|
||||
}
|
||||
Shared.Models.Methods.IBlurHasher? blurHasher = 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)
|
||||
@ -252,7 +255,7 @@ public partial class DragDropMove : Form
|
||||
bitmap.SetPropertyItem(propertyItem);
|
||||
bitmap.Save(checkFile);
|
||||
bitmap.Dispose();
|
||||
property = Property.Models.A_Property.GetImageProperty(checkFile);
|
||||
property = Property.Models.A_Property.GetImageProperty(blurHasher, checkFile);
|
||||
if (property.Id is null || property.Id.Value != id)
|
||||
throw new Exception();
|
||||
}
|
||||
@ -287,10 +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;
|
||||
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(badFiles.First());
|
||||
Shared.Models.Property targetProperty = Property.Models.A_Property.GetImageProperty(targetFiles.First());
|
||||
Shared.Models.Property badProperty = Property.Models.A_Property.GetImageProperty(blurHasher, badFiles.First());
|
||||
Shared.Models.Property targetProperty = Property.Models.A_Property.GetImageProperty(blurHasher, targetFiles.First());
|
||||
if (badProperty.DateTimeOriginal is null || targetProperty.DateTimeOriginal is null)
|
||||
_Logger.Error("Date is null!");
|
||||
else
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace View_by_Distance.Drag_Drop_Explorer;
|
||||
|
||||
static class Program
|
||||
public class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
|
Reference in New Issue
Block a user