Body Changes Only
This commit is contained in:
parent
3b63279545
commit
f458af776a
@ -59,7 +59,7 @@ public partial class DragDropExplorer : Form
|
|||||||
Controls.Add(_FirstTextBox);
|
Controls.Add(_FirstTextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Form1_Load(object? sender, EventArgs e)
|
private void Form1_Load(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -81,7 +81,7 @@ public partial class DragDropExplorer : Form
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBox_LostFocus(object? sender, EventArgs e)
|
private void TextBox_LostFocus(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ public partial class DragDropExplorer : Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Form1_DragEnter(object? sender, DragEventArgs e)
|
private void Form1_DragEnter(object? sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -112,7 +112,7 @@ public partial class DragDropExplorer : Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Form1_DragDrop(object? sender, DragEventArgs e)
|
private void Form1_DragDrop(object? sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ public partial class DragDropSearch : Form
|
|||||||
Controls.Add(_TextBox);
|
Controls.Add(_TextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Form1_Load(object? sender, EventArgs e)
|
private void Form1_Load(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -79,7 +79,7 @@ public partial class DragDropSearch : Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBox_LostFocus(object? sender, EventArgs e)
|
private void TextBox_LostFocus(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -92,7 +92,7 @@ public partial class DragDropSearch : Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Form1_DragEnter(object? sender, DragEventArgs e)
|
private void Form1_DragEnter(object? sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -105,7 +105,7 @@ public partial class DragDropSearch : Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
Container[] containers;
|
Container[] containers;
|
||||||
string aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(A_Property), "{}");
|
string aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_Configuration.PropertyConfiguration, nameof(A_Property), "{}");
|
||||||
@ -168,7 +168,7 @@ public partial class DragDropSearch : Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Form1_DragDrop(object? sender, DragEventArgs e)
|
private void Form1_DragDrop(object? sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -26,16 +26,15 @@ public abstract class DisposableObject : IDisposable
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// If this object is disposed, then <see cref="ObjectDisposedException"/> is thrown.
|
/// If this object is disposed, then <see cref="ObjectDisposedException"/> is thrown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ThrowIfDisposed()
|
public void ThrowIfDisposed() =>
|
||||||
{
|
ObjectDisposedException.ThrowIf(IsDisposed, this);
|
||||||
if (IsDisposed)
|
|
||||||
throw new ObjectDisposedException(GetType().FullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void ThrowIfDisposed(string objectName)
|
internal void ThrowIfDisposed(string objectName)
|
||||||
{
|
{
|
||||||
|
#pragma warning disable CA1513
|
||||||
if (IsDisposed)
|
if (IsDisposed)
|
||||||
throw new ObjectDisposedException(objectName);
|
throw new ObjectDisposedException(objectName);
|
||||||
|
#pragma warning restore CA1513
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Overrides
|
#region Overrides
|
||||||
|
@ -519,8 +519,12 @@ internal abstract class Exif
|
|||||||
|
|
||||||
internal static Shared.Models.ExifDirectory GetExifDirectory(Shared.Models.FilePath filePath)
|
internal static Shared.Models.ExifDirectory GetExifDirectory(Shared.Models.FilePath filePath)
|
||||||
{
|
{
|
||||||
Shared.Models.ExifDirectory? result;
|
Shared.Models.ExifDirectory result;
|
||||||
System.Drawing.Size? size = Dimensions.GetDimensions(filePath.FullName);
|
System.Drawing.Size? size;
|
||||||
|
try
|
||||||
|
{ size = Dimensions.GetDimensions(filePath.FullName); }
|
||||||
|
catch (Exception)
|
||||||
|
{ size = null; }
|
||||||
IReadOnlyList<MetadataExtractor.Directory> directories = ImageMetadataReader.ReadMetadata(filePath.FullName);
|
IReadOnlyList<MetadataExtractor.Directory> directories = ImageMetadataReader.ReadMetadata(filePath.FullName);
|
||||||
result = Covert(filePath, size, directories);
|
result = Covert(filePath, size, directories);
|
||||||
return result;
|
return result;
|
||||||
|
@ -35,6 +35,17 @@ internal static class Face
|
|||||||
result = pngDirectory.TextualData[artist.Length..];
|
result = pngDirectory.TextualData[artist.Length..];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (result is null)
|
||||||
|
{
|
||||||
|
const string author = "Author:";
|
||||||
|
foreach (PngDirectory pngDirectory in pngDirectories)
|
||||||
|
{
|
||||||
|
if (pngDirectory.TextualData is null || !pngDirectory.TextualData.StartsWith(author))
|
||||||
|
continue;
|
||||||
|
result = pngDirectory.TextualData[author.Length..];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public class OffsetDateTimeOriginal
|
|||||||
string checkFile;
|
string checkFile;
|
||||||
PropertyItem? propertyItem;
|
PropertyItem? propertyItem;
|
||||||
string? ticksDirectory = null;
|
string? ticksDirectory = null;
|
||||||
int dateTimeOriginal = MetadataExtractor.Formats.Exif.ExifDirectoryBase.TagDateTimeOriginal;
|
const int dateTimeOriginal = MetadataExtractor.Formats.Exif.ExifDirectoryBase.TagDateTimeOriginal; // 36867
|
||||||
for (int i = 0; i < int.MaxValue; i++)
|
for (int i = 0; i < int.MaxValue; i++)
|
||||||
{
|
{
|
||||||
ticksDirectory = Path.Combine(sourceDirectory, ticks.ToString());
|
ticksDirectory = Path.Combine(sourceDirectory, ticks.ToString());
|
||||||
|
@ -312,10 +312,12 @@ public class C_Resize
|
|||||||
{
|
{
|
||||||
if (mappingFromItem.ResizedFileHolder is null)
|
if (mappingFromItem.ResizedFileHolder is null)
|
||||||
throw new NullReferenceException(nameof(mappingFromItem.ResizedFileHolder));
|
throw new NullReferenceException(nameof(mappingFromItem.ResizedFileHolder));
|
||||||
|
#pragma warning disable CA1854
|
||||||
if (!outputResolutionToResize.ContainsKey(_Original))
|
if (!outputResolutionToResize.ContainsKey(_Original))
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
if (!outputResolutionToResize.ContainsKey(outputResolution))
|
if (!outputResolutionToResize.ContainsKey(outputResolution))
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
|
#pragma warning restore CA1854
|
||||||
FileInfo fileInfo = new(mappingFromItem.ResizedFileHolder.FullName);
|
FileInfo fileInfo = new(mappingFromItem.ResizedFileHolder.FullName);
|
||||||
bool check = false;
|
bool check = false;
|
||||||
int[] resize = outputResolutionToResize[outputResolution];
|
int[] resize = outputResolutionToResize[outputResolution];
|
||||||
|
@ -81,6 +81,7 @@ internal abstract class ImageHelper
|
|||||||
internal static Size GetDimensions(BinaryReader binaryReader, int? faceRight, int? faceBottom)
|
internal static Size GetDimensions(BinaryReader binaryReader, int? faceRight, int? faceBottom)
|
||||||
{
|
{
|
||||||
Size? result = null;
|
Size? result = null;
|
||||||
|
#pragma warning disable IDE0230
|
||||||
Dictionary<byte[], Func<BinaryReader, Size>> _ImageFormatDecoders = new()
|
Dictionary<byte[], Func<BinaryReader, Size>> _ImageFormatDecoders = new()
|
||||||
{
|
{
|
||||||
{ new byte[] { 0x42, 0x4D }, DecodeBitmap },
|
{ new byte[] { 0x42, 0x4D }, DecodeBitmap },
|
||||||
@ -89,6 +90,7 @@ internal abstract class ImageHelper
|
|||||||
{ new byte[] { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }, DecodePng },
|
{ new byte[] { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }, DecodePng },
|
||||||
{ new byte[] { 0xff, 0xd8 }, DecodeJfif },
|
{ new byte[] { 0xff, 0xd8 }, DecodeJfif },
|
||||||
};
|
};
|
||||||
|
#pragma warning restore IDE0230
|
||||||
int maxMagicBytesLength = _ImageFormatDecoders.Keys.OrderByDescending(x => x.Length).First().Length;
|
int maxMagicBytesLength = _ImageFormatDecoders.Keys.OrderByDescending(x => x.Length).First().Length;
|
||||||
byte[] magicBytes = new byte[maxMagicBytesLength];
|
byte[] magicBytes = new byte[maxMagicBytesLength];
|
||||||
for (int i = 0; i < maxMagicBytesLength; i += 1)
|
for (int i = 0; i < maxMagicBytesLength; i += 1)
|
||||||
|
@ -9,25 +9,28 @@ namespace Phares.Shared;
|
|||||||
|
|
||||||
public static class RijndaelEncryption
|
public static class RijndaelEncryption
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change the Inputkey GUID when you use this code in your own program.
|
/// Change the input key GUID when you use this code in your own program.
|
||||||
/// Keep this inputkey very safe and prevent someone from decoding it some way!!
|
/// Keep this input key very safe and prevent someone from decoding it some way!!
|
||||||
/// Generated 2021-08-10
|
/// Generated 2021-08-10
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal const string _Inputkey = "970CCEF6-4307-4F6A-9AC8-377DADB889BD";
|
internal const string _InputKey = "970CCEF6-4307-4F6A-9AC8-377DADB889BD";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Encrypt the given text and give the byte array back as a BASE64 string
|
/// Encrypt the given text and give the byte array back as a BASE64 string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">The text to encrypt</param>
|
/// <param name="text">The text to encrypt</param>
|
||||||
/// <param name="salt">The pasword salt</param>
|
/// <param name="salt">The password salt</param>
|
||||||
/// <returns>The encrypted text</returns>
|
/// <returns>The encrypted text</returns>
|
||||||
public static string Encrypt(string text, string salt)
|
public static string Encrypt(string text, string salt)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
if (string.IsNullOrEmpty(text))
|
if (string.IsNullOrEmpty(text))
|
||||||
throw new NullReferenceException(nameof(text));
|
throw new ArgumentNullException(nameof(text));
|
||||||
|
#pragma warning disable
|
||||||
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
|
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
|
||||||
|
#pragma warning restore
|
||||||
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
|
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
|
||||||
MemoryStream msEncrypt = new();
|
MemoryStream msEncrypt = new();
|
||||||
using (CryptoStream csEncrypt = new(msEncrypt, encryptor, CryptoStreamMode.Write))
|
using (CryptoStream csEncrypt = new(msEncrypt, encryptor, CryptoStreamMode.Write))
|
||||||
@ -46,7 +49,9 @@ public static class RijndaelEncryption
|
|||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
base64String = base64String.Trim();
|
base64String = base64String.Trim();
|
||||||
|
#pragma warning disable
|
||||||
result = (base64String.Length % 4 == 0) && Regex.IsMatch(base64String, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None);
|
result = (base64String.Length % 4 == 0) && Regex.IsMatch(base64String, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None);
|
||||||
|
#pragma warning restore
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,16 +59,18 @@ public static class RijndaelEncryption
|
|||||||
/// Decrypts the given text
|
/// Decrypts the given text
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cipherText">The encrypted BASE64 text</param>
|
/// <param name="cipherText">The encrypted BASE64 text</param>
|
||||||
/// <param name="salt">The pasword salt</param>
|
/// <param name="salt">The password salt</param>
|
||||||
/// <returns>De gedecrypte text</returns>
|
/// <returns>De gedecrypte text</returns>
|
||||||
public static string Decrypt(string cipherText, string salt)
|
public static string Decrypt(string cipherText, string salt)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(cipherText))
|
if (string.IsNullOrEmpty(cipherText))
|
||||||
throw new NullReferenceException(nameof(cipherText));
|
throw new ArgumentNullException(nameof(cipherText));
|
||||||
if (!IsBase64String(cipherText))
|
if (!IsBase64String(cipherText))
|
||||||
throw new Exception("The cipherText input parameter is not base64 encoded");
|
throw new Exception("The cipherText input parameter is not base64 encoded");
|
||||||
string text;
|
string text;
|
||||||
|
#pragma warning disable
|
||||||
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
|
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
|
||||||
|
#pragma warning restore
|
||||||
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
|
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
|
||||||
byte[] cipher = Convert.FromBase64String(cipherText);
|
byte[] cipher = Convert.FromBase64String(cipherText);
|
||||||
using (MemoryStream msDecrypt = new(cipher))
|
using (MemoryStream msDecrypt = new(cipher))
|
||||||
@ -76,19 +83,22 @@ public static class RijndaelEncryption
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GetPersonName a new RijndaelManaged class and initialize it
|
/// Create a new RijndaelManaged class and initialize it
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="salt">The pasword salt</param>
|
/// <param name="salt">The password salt</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
#pragma warning disable
|
||||||
private static RijndaelManaged NewRijndaelManaged(string salt)
|
private static RijndaelManaged NewRijndaelManaged(string salt)
|
||||||
{
|
{
|
||||||
if (salt == null)
|
if (salt == null)
|
||||||
throw new NullReferenceException(nameof(salt));
|
throw new ArgumentNullException(nameof(salt));
|
||||||
byte[] saltBytes = Encoding.ASCII.GetBytes(salt);
|
byte[] saltBytes = Encoding.ASCII.GetBytes(salt);
|
||||||
Rfc2898DeriveBytes key = new(_Inputkey, saltBytes);
|
Rfc2898DeriveBytes key = new(_InputKey, saltBytes);
|
||||||
RijndaelManaged aesAlg = new();
|
RijndaelManaged aesAlg = new();
|
||||||
|
#pragma warning restore
|
||||||
aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8);
|
aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8);
|
||||||
aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8);
|
aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8);
|
||||||
return aesAlg;
|
return aesAlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ using Phares.Shared;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.Json;
|
||||||
using View_by_Distance.Shared.Models;
|
using View_by_Distance.Shared.Models;
|
||||||
using View_by_Distance.Shared.Models.Stateless.Methods;
|
using View_by_Distance.Shared.Models.Stateless.Methods;
|
||||||
using View_by_Distance.Tests.Models;
|
using View_by_Distance.Tests.Models;
|
||||||
@ -14,6 +15,7 @@ namespace View_by_Distance.Tests;
|
|||||||
public partial class UnitTestHardCoded
|
public partial class UnitTestHardCoded
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private readonly string _Git;
|
||||||
private readonly AppSettings _AppSettings;
|
private readonly AppSettings _AppSettings;
|
||||||
private readonly string _WorkingDirectory;
|
private readonly string _WorkingDirectory;
|
||||||
private readonly Configuration _Configuration;
|
private readonly Configuration _Configuration;
|
||||||
@ -43,6 +45,7 @@ public partial class UnitTestHardCoded
|
|||||||
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
||||||
propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
|
propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
|
||||||
configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration);
|
configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration);
|
||||||
|
_Git = "c9dbce3b";
|
||||||
_AppSettings = appSettings;
|
_AppSettings = appSettings;
|
||||||
_Configuration = configuration;
|
_Configuration = configuration;
|
||||||
_IsEnvironment = isEnvironment;
|
_IsEnvironment = isEnvironment;
|
||||||
@ -86,7 +89,7 @@ public partial class UnitTestHardCoded
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestMethodGetApproximateYears()
|
public void TestMethodGetApproximateYears()
|
||||||
{
|
{
|
||||||
string personDisplayDirectory = "D:/1-Images-A/Images-7007a9df-Results/A2)People/7007a9df/{}/^/Sydney Dupray^9";
|
string personDisplayDirectory = string.Concat($"D:/1-Images-A/Images-{_Git}-Results/A2)People/{_Git}", "/{}/^/Sydney Dupray^9");
|
||||||
if (Directory.Exists(Directory.GetDirectoryRoot(personDisplayDirectory)) && Directory.Exists(personDisplayDirectory))
|
if (Directory.Exists(Directory.GetDirectoryRoot(personDisplayDirectory)) && Directory.Exists(personDisplayDirectory))
|
||||||
{
|
{
|
||||||
char numberSign = '#';
|
char numberSign = '#';
|
||||||
@ -189,7 +192,7 @@ public partial class UnitTestHardCoded
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestMethodRenameAbandoned()
|
public void TestMethodRenameAbandoned()
|
||||||
{
|
{
|
||||||
string directory = "D:/1-Images-A/Images-7007a9df-Results/A2)People/7007a9df/{}/!/Abandoned";
|
string directory = string.Concat($"D:/1-Images-A/Images-{_Git}-Results/A2)People/{_Git}", "/{}/!/Abandoned");
|
||||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||||
{
|
{
|
||||||
string checkFile;
|
string checkFile;
|
||||||
@ -209,7 +212,7 @@ public partial class UnitTestHardCoded
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestMethodRenameDelete()
|
public void TestMethodRenameDelete()
|
||||||
{
|
{
|
||||||
string directory = "D:/1-Images-A/Images-7007a9df-Results/A)Property/7007a9df/{}";
|
string directory = string.Concat($"D:/1-Images-A/Images-{_Git}-Results/A)Property/{_Git}", "/{}");
|
||||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||||
{
|
{
|
||||||
string checkFile;
|
string checkFile;
|
||||||
@ -229,7 +232,7 @@ public partial class UnitTestHardCoded
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestMethodRenameOld()
|
public void TestMethodRenameOld()
|
||||||
{
|
{
|
||||||
string directory = "D:/1-Images-A/Images-7007a9df-Results/E)Distance/7007a9df/()";
|
string directory = $"D:/1-Images-A/Images-{_Git}-Results/E)Distance/{_Git}/()";
|
||||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||||
{
|
{
|
||||||
string checkFile;
|
string checkFile;
|
||||||
@ -250,7 +253,7 @@ public partial class UnitTestHardCoded
|
|||||||
public void TestMethodRenameDup()
|
public void TestMethodRenameDup()
|
||||||
{
|
{
|
||||||
string directory;
|
string directory;
|
||||||
directory = "D:/1-Images-A/Images-7007a9df-Results/E)Distance/7007a9df/()";
|
directory = $"D:/1-Images-A/Images-{_Git}-Results/E)Distance/{_Git}/()";
|
||||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||||
{
|
{
|
||||||
string checkFile;
|
string checkFile;
|
||||||
@ -264,7 +267,7 @@ public partial class UnitTestHardCoded
|
|||||||
}
|
}
|
||||||
Assert.IsTrue(true);
|
Assert.IsTrue(true);
|
||||||
}
|
}
|
||||||
directory = "D:/1-Images-A/Images-7007a9df-Results/A2)People/7007a9df/{}/!";
|
directory = string.Concat($"D:/1-Images-A/Images-{_Git}-Results/A2)People/{_Git}", "/{}/!");
|
||||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||||
{
|
{
|
||||||
string checkFile;
|
string checkFile;
|
||||||
@ -284,9 +287,9 @@ public partial class UnitTestHardCoded
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestMethodRename()
|
public void TestMethodRename()
|
||||||
{
|
{
|
||||||
// string directory = "D:/2-Images-B/Not-Copy-Copy-7007a9df";
|
// string $directory = "D:/2-Images-B/Not-Copy-Copy-{_Git}";
|
||||||
string directory = "D:/1-Images-A/Images-7007a9df";
|
string directory = $"D:/1-Images-A/Images-{_Git}";
|
||||||
// string directory = "D:/2-Images-B/Not-Copy-Copy-7007a9df";
|
// string $directory = "D:/2-Images-B/Not-Copy-Copy-{_Git}";
|
||||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||||
{
|
{
|
||||||
string[] directories = Directory.GetDirectories(directory, "*;*", SearchOption.AllDirectories);
|
string[] directories = Directory.GetDirectories(directory, "*;*", SearchOption.AllDirectories);
|
||||||
@ -301,9 +304,9 @@ public partial class UnitTestHardCoded
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestMethodRenameForUnkown()
|
public void TestMethodRenameForUnknown()
|
||||||
{
|
{
|
||||||
string directory = "D:/1-Images-A/Images-7007a9df-Results/E)Distance/7007a9df/(RectInt-2023-06-19-less-0.99)";
|
string directory = $"D:/1-Images-A/Images-{_Git}-Results/E)Distance/{_Git}/(RectInt-2023-06-19-less-0.99)";
|
||||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||||
{
|
{
|
||||||
string[] files = Directory.GetFiles(directory, "*.unk", SearchOption.AllDirectories);
|
string[] files = Directory.GetFiles(directory, "*.unk", SearchOption.AllDirectories);
|
||||||
@ -316,13 +319,13 @@ public partial class UnitTestHardCoded
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestMethodRenameForTicks()
|
public void TestMethodRenameForTicks()
|
||||||
{
|
{
|
||||||
string directory = "D:/1-Images-A/Images-7007a9df-Results/A2)People/7007a9df/([])/ged";
|
string directory = $"D:/1-Images-A/Images-{_Git}-Results/A2)People/{_Git}/([])/ged";
|
||||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||||
{
|
{
|
||||||
string checkName;
|
string checkName;
|
||||||
DateTime dateTime;
|
DateTime dateTime;
|
||||||
string weekOfYear;
|
string weekOfYear;
|
||||||
string checkDirectoy;
|
string checkDirectory;
|
||||||
Calendar calendar = new CultureInfo("en-US").Calendar;
|
Calendar calendar = new CultureInfo("en-US").Calendar;
|
||||||
string[] files = Directory.GetFiles(directory, "*.ged", SearchOption.TopDirectoryOnly);
|
string[] files = Directory.GetFiles(directory, "*.ged", SearchOption.TopDirectoryOnly);
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
@ -331,10 +334,10 @@ public partial class UnitTestHardCoded
|
|||||||
continue;
|
continue;
|
||||||
dateTime = new(ticks);
|
dateTime = new(ticks);
|
||||||
weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||||
checkDirectoy = Path.Combine(directory, dateTime.Year.ToString(), $"{dateTime.Year}-Week-{weekOfYear}");
|
checkDirectory = Path.Combine(directory, dateTime.Year.ToString(), $"{dateTime.Year}-Week-{weekOfYear}");
|
||||||
checkName = Path.Combine(checkDirectoy, Path.GetFileName(file));
|
checkName = Path.Combine(checkDirectory, Path.GetFileName(file));
|
||||||
if (!Directory.Exists(checkDirectoy))
|
if (!Directory.Exists(checkDirectory))
|
||||||
_ = Directory.CreateDirectory(checkDirectoy);
|
_ = Directory.CreateDirectory(checkDirectory);
|
||||||
if (File.Exists(checkName))
|
if (File.Exists(checkName))
|
||||||
continue;
|
continue;
|
||||||
File.Move(file, checkName);
|
File.Move(file, checkName);
|
||||||
@ -343,4 +346,22 @@ public partial class UnitTestHardCoded
|
|||||||
NonThrowTryCatch();
|
NonThrowTryCatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestMethodImmichAsset()
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(_Configuration.ImmichAssetsFile) && File.Exists(_Configuration.ImmichAssetsFile))
|
||||||
|
{
|
||||||
|
Dictionary<string, ImmichAsset> keyValuePairs = [];
|
||||||
|
string json = File.ReadAllText(_Configuration.ImmichAssetsFile);
|
||||||
|
ImmichAsset[]? immichAssets = JsonSerializer.Deserialize(json, ImmichAssetCollectionSourceGenerationContext.Default.ImmichAssetArray);
|
||||||
|
if (immichAssets is not null)
|
||||||
|
{
|
||||||
|
foreach (ImmichAsset immichAsset in immichAssets)
|
||||||
|
keyValuePairs.Add(immichAsset.OriginalPath, immichAsset);
|
||||||
|
}
|
||||||
|
Assert.IsTrue(keyValuePairs.Count > 0);
|
||||||
|
}
|
||||||
|
NonThrowTryCatch();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -11,13 +11,13 @@ public static partial class ThumbHash
|
|||||||
private const int _MinHash = 5;
|
private const int _MinHash = 5;
|
||||||
|
|
||||||
[DoesNotReturn]
|
[DoesNotReturn]
|
||||||
static void ThrowIfLessThan<T>(T value, T other, [CallerArgumentExpression(nameof(value))] string? paramName = null) => throw new ArgumentOutOfRangeException(paramName, value, $"'{value}' must be greater than or equal to '{other}'.");
|
private static void ThrowIfLessThan<T>(T value, T other, [CallerArgumentExpression(nameof(value))] string? paramName = null) => throw new ArgumentOutOfRangeException(paramName, value, $"'{value}' must be greater than or equal to '{other}'.");
|
||||||
|
|
||||||
[DoesNotReturn]
|
[DoesNotReturn]
|
||||||
static void ThrowIfGreaterThan<T>(T value, T other, [CallerArgumentExpression(nameof(value))] string? paramName = null) => throw new ArgumentOutOfRangeException(paramName, value, $"'{paramName}' must be less than or equal to '{other}'.");
|
private static void ThrowIfGreaterThan<T>(T value, T other, [CallerArgumentExpression(nameof(value))] string? paramName = null) => throw new ArgumentOutOfRangeException(paramName, value, $"'{paramName}' must be less than or equal to '{other}'.");
|
||||||
|
|
||||||
[DoesNotReturn]
|
[DoesNotReturn]
|
||||||
static void ThrowNotEqual<T>(T value, T other, [CallerArgumentExpression(nameof(value))] string? paramName = null, [CallerArgumentExpression(nameof(other))] string? otherName = null) => throw new ArgumentOutOfRangeException(paramName, value, $"'{paramName}' must be equal to '{other}' ('{otherName}').");
|
private static void ThrowNotEqual<T>(T value, T other, [CallerArgumentExpression(nameof(value))] string? paramName = null, [CallerArgumentExpression(nameof(other))] string? otherName = null) => throw new ArgumentOutOfRangeException(paramName, value, $"'{paramName}' must be equal to '{other}' ('{otherName}').");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Encodes an RGBA image to a ThumbHash.
|
/// Encodes an RGBA image to a ThumbHash.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user