Set-Created-Date
This commit is contained in:
@ -46,10 +46,10 @@ public interface IProperty
|
||||
static (bool?, string[]) IsWrongYear(Models.FileHolder fileHolder, DateTime? dateTimeOriginal, List<DateTime> dateTimes) =>
|
||||
Property.IsWrongYear(fileHolder, dateTimeOriginal, dateTimes);
|
||||
|
||||
(DateTime?, DateTime?[], int?, string?) TestStatic_Get(Models.FileHolder fileHolder, bool isIgnoreExtension, bool isValidImageFormatExtension) =>
|
||||
Get(fileHolder, isIgnoreExtension, isValidImageFormatExtension);
|
||||
static (DateTime?, DateTime?[], int?, string?) Get(Models.FileHolder fileHolder, bool isIgnoreExtension, bool isValidImageFormatExtension) =>
|
||||
Property.Get(fileHolder, isIgnoreExtension, isValidImageFormatExtension);
|
||||
(DateTime?, DateTime?[], int?, string?) TestStatic_Get(Models.FileHolder fileHolder, bool isIgnoreExtension, bool isValidImageFormatExtension, bool populateId) =>
|
||||
Get(fileHolder, isIgnoreExtension, isValidImageFormatExtension, populateId);
|
||||
static (DateTime?, DateTime?[], int?, string?) Get(Models.FileHolder fileHolder, bool isIgnoreExtension, bool isValidImageFormatExtension, bool populateId) =>
|
||||
Property.Get(fileHolder, isIgnoreExtension, isValidImageFormatExtension, populateId);
|
||||
|
||||
DateTime? TestStatic_GetDateTimeFromName(Models.FileHolder fileHolder) =>
|
||||
GetDateTimeFromName(fileHolder);
|
||||
|
@ -390,7 +390,7 @@ internal abstract class Property
|
||||
|
||||
#pragma warning disable CA1416
|
||||
|
||||
internal static (DateTime?, DateTime?[], int?, string?) Get(Models.FileHolder fileHolder, bool isIgnoreExtension, bool isValidImageFormatExtension)
|
||||
internal static (DateTime?, DateTime?[], int?, string?) Get(Models.FileHolder fileHolder, bool isIgnoreExtension, bool isValidImageFormatExtension, bool populateId)
|
||||
{
|
||||
int? id = null;
|
||||
string? message = null;
|
||||
@ -409,16 +409,21 @@ internal abstract class Property
|
||||
ASCIIEncoding asciiEncoding = new();
|
||||
string dateTimeFormat = IProperty.DateTimeFormat();
|
||||
using Image image = Image.FromFile(fileHolder.FullName);
|
||||
using Bitmap bitmap = new(image);
|
||||
Rectangle rectangle = new(0, 0, image.Width, image.Height);
|
||||
BitmapData bitmapData = bitmap.LockBits(rectangle, ImageLockMode.ReadOnly, bitmap.PixelFormat);
|
||||
IntPtr intPtr = bitmapData.Scan0;
|
||||
int length = bitmapData.Stride * bitmap.Height;
|
||||
bytes = new byte[length];
|
||||
Marshal.Copy(intPtr, bytes, 0, length);
|
||||
bitmap.UnlockBits(bitmapData);
|
||||
id = IProperty.GetDeterministicHashCode(bytes);
|
||||
bitmap.Dispose();
|
||||
if (!populateId)
|
||||
id = null;
|
||||
else
|
||||
{
|
||||
using Bitmap bitmap = new(image);
|
||||
Rectangle rectangle = new(0, 0, image.Width, image.Height);
|
||||
BitmapData bitmapData = bitmap.LockBits(rectangle, ImageLockMode.ReadOnly, bitmap.PixelFormat);
|
||||
IntPtr intPtr = bitmapData.Scan0;
|
||||
int length = bitmapData.Stride * bitmap.Height;
|
||||
bytes = new byte[length];
|
||||
Marshal.Copy(intPtr, bytes, 0, length);
|
||||
bitmap.UnlockBits(bitmapData);
|
||||
id = IProperty.GetDeterministicHashCode(bytes);
|
||||
bitmap.Dispose();
|
||||
}
|
||||
if (image.PropertyIdList.Contains((int)IExif.Tags.DateTime))
|
||||
{
|
||||
propertyItem = image.GetPropertyItem((int)IExif.Tags.DateTime);
|
||||
|
Reference in New Issue
Block a user