Testing
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
@ -80,4 +81,55 @@ internal static class MetaBase
|
||||
return results.AsReadOnly();
|
||||
}
|
||||
|
||||
internal static int? GetWidth(ExifDirectoryBase[]? exifBaseDirectories)
|
||||
{
|
||||
int? result = null;
|
||||
// public const int TagImageWidth = 256;
|
||||
if (exifBaseDirectories is not null)
|
||||
{
|
||||
foreach (ExifDirectoryBase exifDirectoryBase in exifBaseDirectories)
|
||||
{
|
||||
result = exifDirectoryBase?.ImageWidthValue;
|
||||
if (result is not null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static int? GetHeight(ExifDirectoryBase[]? exifBaseDirectories)
|
||||
{
|
||||
int? result = null;
|
||||
// public const int TagImageHeight = 257;
|
||||
if (exifBaseDirectories is not null)
|
||||
{
|
||||
foreach (ExifDirectoryBase exifDirectoryBase in exifBaseDirectories)
|
||||
{
|
||||
result = exifDirectoryBase?.ImageHeightValue;
|
||||
if (result is not null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma warning disable CA1416
|
||||
|
||||
internal static DateTime? GetDateTime(string dateTimeFormat, string? value)
|
||||
{
|
||||
DateTime? result;
|
||||
string alternateFormat = "ddd MMM dd HH:mm:ss yyyy";
|
||||
if (value is not null && DateTime.TryParse(value, out DateTime dateTime))
|
||||
result = dateTime;
|
||||
else if (value is not null && value.Length == dateTimeFormat.Length && DateTime.TryParseExact(value, dateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
|
||||
result = dateTime;
|
||||
else if (value is not null && value.Length == alternateFormat.Length && DateTime.TryParseExact(value, alternateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
|
||||
result = dateTime;
|
||||
else
|
||||
result = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma warning restore CA1416
|
||||
|
||||
}
|
Reference in New Issue
Block a user