Exif Helper
This commit is contained in:
@ -9,6 +9,7 @@ public record AppSettings(string Company,
|
||||
string[] ExcludeSchemes,
|
||||
string PersonBirthdayFormat,
|
||||
char[] PersonTitleFilters,
|
||||
string[] ValidImageFormatExtensions,
|
||||
string WorkingDirectoryName)
|
||||
{
|
||||
|
||||
|
@ -13,6 +13,7 @@ public class AppSettings
|
||||
public string[]? ExcludeSchemes { get; set; }
|
||||
public string? PersonBirthdayFormat { get; set; }
|
||||
public string? PersonTitleFilters { get; set; }
|
||||
public string[]? ValidImageFormatExtensions { get; set; }
|
||||
public string? WorkingDirectoryName { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
@ -47,20 +48,20 @@ public class AppSettings
|
||||
if (appSettings?.ExcludeSchemes is null) throw new NullReferenceException(nameof(appSettings.ExcludeSchemes));
|
||||
if (appSettings?.PersonBirthdayFormat is null) throw new NullReferenceException(nameof(appSettings.PersonBirthdayFormat));
|
||||
if (appSettings?.PersonTitleFilters is null) throw new NullReferenceException(nameof(appSettings.PersonTitleFilters));
|
||||
if (appSettings?.ValidImageFormatExtensions is null) throw new NullReferenceException(nameof(appSettings.ValidImageFormatExtensions));
|
||||
if (appSettings?.WorkingDirectoryName is null) throw new NullReferenceException(nameof(appSettings.WorkingDirectoryName));
|
||||
result = new(
|
||||
appSettings.Company,
|
||||
appSettings.DefaultNoteType,
|
||||
appSettings.ExcludeDirectoryNames,
|
||||
appSettings.ExcludeSchemes,
|
||||
appSettings.PersonBirthdayFormat,
|
||||
appSettings.PersonTitleFilters.ToArray(),
|
||||
appSettings.WorkingDirectoryName
|
||||
);
|
||||
result = new(appSettings.Company,
|
||||
appSettings.DefaultNoteType,
|
||||
appSettings.ExcludeDirectoryNames,
|
||||
appSettings.ExcludeSchemes,
|
||||
appSettings.PersonBirthdayFormat,
|
||||
appSettings.PersonTitleFilters.ToArray(),
|
||||
appSettings.ValidImageFormatExtensions,
|
||||
appSettings.WorkingDirectoryName);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||
{
|
||||
Models.AppSettings result;
|
||||
#pragma warning disable IL3050, IL2026
|
||||
|
24
Models/Exif/AviDirectory.cs
Normal file
24
Models/Exif/AviDirectory.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record AviDirectory(DateTime? DateTimeOriginal,
|
||||
string? Duration,
|
||||
string? Height,
|
||||
string? Width)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, AviDirectorySourceGenerationContext.Default.AviDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(AviDirectory))]
|
||||
public partial class AviDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
36
Models/Exif/ExifDirectory.cs
Normal file
36
Models/Exif/ExifDirectory.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record ExifDirectory(AviDirectory[] AviDirectories,
|
||||
ExifDirectoryBase[] ExifBaseDirectories,
|
||||
FileMetadataDirectory[] FileMetadataDirectories,
|
||||
GifHeaderDirectory[] GifHeaderDirectories,
|
||||
GpsDirectory[] GpsDirectories,
|
||||
int? Height,
|
||||
int? Id,
|
||||
JpegDirectory[] JpegDirectories,
|
||||
MakernoteDirectory[] MakernoteDirectories,
|
||||
string OriginalFileName,
|
||||
PhotoshopDirectory[] PhotoshopDirectories,
|
||||
PngDirectory[] PngDirectories,
|
||||
QuickTimeMovieHeaderDirectory[] QuickTimeMovieHeaderDirectories,
|
||||
QuickTimeTrackHeaderDirectory[] QuickTimeTrackHeaderDirectories,
|
||||
WebPDirectory[] WebPDirectories,
|
||||
int? Width)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, ExifDirectorySourceGenerationContext.Default.ExifDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
[JsonSerializable(typeof(ExifDirectory))]
|
||||
public partial class ExifDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
66
Models/Exif/ExifDirectoryBase.cs
Normal file
66
Models/Exif/ExifDirectoryBase.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record ExifDirectoryBase(string? Aperture,
|
||||
string? ApplicationNotes,
|
||||
string? Artist,
|
||||
string? BitsPerSample,
|
||||
string? BodySerialNumber,
|
||||
string? CameraOwnerName,
|
||||
string? CompressedAverageBitsPerPixel,
|
||||
string? Compression,
|
||||
string? Copyright,
|
||||
DateTime? DateTime,
|
||||
DateTime? DateTimeDigitized,
|
||||
DateTime? DateTimeOriginal,
|
||||
string? DocumentName,
|
||||
string? ExifVersion,
|
||||
string? ExposureTime,
|
||||
string? FileSource,
|
||||
string? ImageDescription,
|
||||
string? ImageHeight,
|
||||
string? ImageNumber,
|
||||
string? ImageUniqueId,
|
||||
string? ImageWidth,
|
||||
string? IsoSpeed,
|
||||
string? LensMake,
|
||||
string? LensModel,
|
||||
string? LensSerialNumber,
|
||||
string? Make,
|
||||
string? MakerNote,
|
||||
string? Model,
|
||||
string? Orientation,
|
||||
int? OrientationValue,
|
||||
string? Rating,
|
||||
string? RatingPercent,
|
||||
string? SecurityClassification,
|
||||
string? ShutterSpeed,
|
||||
string? Software,
|
||||
string? TimeZone,
|
||||
string? TimeZoneDigitized,
|
||||
string? TimeZoneOriginal,
|
||||
string? UserComment,
|
||||
string? WinAuthor,
|
||||
string? WinComment,
|
||||
string? WinKeywords,
|
||||
string? WinSubject,
|
||||
string? WinTitle,
|
||||
string? XResolution,
|
||||
string? YResolution)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, ExifDirectoryBaseSourceGenerationContext.Default.ExifDirectoryBase);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(ExifDirectoryBase))]
|
||||
public partial class ExifDirectoryBaseSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
23
Models/Exif/FileMetadataDirectory.cs
Normal file
23
Models/Exif/FileMetadataDirectory.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record FileMetadataDirectory(DateTime? FileModifiedDate,
|
||||
string? FileName,
|
||||
string? FileSize)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, FileMetadataDirectorySourceGenerationContext.Default.FileMetadataDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(FileMetadataDirectory))]
|
||||
public partial class FileMetadataDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
22
Models/Exif/GifHeaderDirectory.cs
Normal file
22
Models/Exif/GifHeaderDirectory.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record GifHeaderDirectory(string? ImageHeight,
|
||||
string? ImageWidth)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, GifHeaderDirectorySourceGenerationContext.Default.GifHeaderDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(GifHeaderDirectory))]
|
||||
public partial class GifHeaderDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
26
Models/Exif/GpsDirectory.cs
Normal file
26
Models/Exif/GpsDirectory.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record GpsDirectory(string? Altitude,
|
||||
string? Latitude,
|
||||
string? LatitudeRef,
|
||||
string? Longitude,
|
||||
string? LongitudeRef,
|
||||
DateTime? TimeStamp)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, GpsDirectorySourceGenerationContext.Default.GpsDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(GpsDirectory))]
|
||||
public partial class GpsDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
22
Models/Exif/JpegDirectory.cs
Normal file
22
Models/Exif/JpegDirectory.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record JpegDirectory(string? ImageHeight,
|
||||
string? ImageWidth)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, JpegDirectorySourceGenerationContext.Default.JpegDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(JpegDirectory))]
|
||||
public partial class JpegDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
23
Models/Exif/MakernoteDirectory.cs
Normal file
23
Models/Exif/MakernoteDirectory.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record MakernoteDirectory(string? CameraSerialNumber,
|
||||
string? FirmwareVersion,
|
||||
string? QualityAndFileFormat)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, MakernoteDirectorySourceGenerationContext.Default.MakernoteDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(MakernoteDirectory))]
|
||||
public partial class MakernoteDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
22
Models/Exif/PhotoshopDirectory.cs
Normal file
22
Models/Exif/PhotoshopDirectory.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record PhotoshopDirectory(string? JpegQuality,
|
||||
string? Url)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, PhotoshopDirectorySourceGenerationContext.Default.PhotoshopDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(PhotoshopDirectory))]
|
||||
public partial class PhotoshopDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
23
Models/Exif/PngDirectory.cs
Normal file
23
Models/Exif/PngDirectory.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record PngDirectory(string? ImageHeight,
|
||||
string? ImageWidth,
|
||||
string? TextualData)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, PngDirectorySourceGenerationContext.Default.PngDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(PngDirectory))]
|
||||
public partial class PngDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
21
Models/Exif/QuickTimeMovieHeaderDirectory.cs
Normal file
21
Models/Exif/QuickTimeMovieHeaderDirectory.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record QuickTimeMovieHeaderDirectory(DateTime? Created)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, QuickTimeMovieHeaderDirectorySourceGenerationContext.Default.QuickTimeMovieHeaderDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(QuickTimeMovieHeaderDirectory))]
|
||||
public partial class QuickTimeMovieHeaderDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
21
Models/Exif/QuickTimeTrackHeaderDirectory.cs
Normal file
21
Models/Exif/QuickTimeTrackHeaderDirectory.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record QuickTimeTrackHeaderDirectory(DateTime? Created)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, QuickTimeTrackHeaderDirectorySourceGenerationContext.Default.QuickTimeTrackHeaderDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(QuickTimeTrackHeaderDirectory))]
|
||||
public partial class QuickTimeTrackHeaderDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
22
Models/Exif/WebPDirectory.cs
Normal file
22
Models/Exif/WebPDirectory.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Exif;
|
||||
|
||||
public record WebPDirectory(string? ImageHeight,
|
||||
string? ImageWidth)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, WebPDirectorySourceGenerationContext.Default.WebPDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(WebPDirectory))]
|
||||
public partial class WebPDirectorySourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
11
Models/Face/FaceEncoding.cs
Normal file
11
Models/Face/FaceEncoding.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Face;
|
||||
|
||||
public record FaceEncoding(double[] RawEncoding, int Size);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = false)]
|
||||
[JsonSerializable(typeof(FaceEncoding))]
|
||||
public partial class FaceEncodingGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
33
Models/Face/FaceFile.cs
Normal file
33
Models/Face/FaceFile.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Face;
|
||||
|
||||
public record FaceFile(int? AreaPermyriad,
|
||||
int? ConfidencePercent,
|
||||
string? DMS,
|
||||
DateTime DateTime,
|
||||
FaceEncoding? FaceEncoding,
|
||||
Dictionary<FacePart, FacePoint[]>? FaceParts,
|
||||
Location? Location,
|
||||
string? Maker,
|
||||
MappingFromPerson? MappingFromPerson,
|
||||
string? Model,
|
||||
OutputResolution? OutputResolution);
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = false)]
|
||||
[JsonSerializable(typeof(FaceFile))]
|
||||
public partial class FaceFileGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = false, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
[JsonSerializable(typeof(FaceFile[]))]
|
||||
public partial class FaceFileCollectionGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
[JsonSerializable(typeof(FaceFile[]))]
|
||||
public partial class FaceFileCollectionWriteIndentedGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
54
Models/Face/FacePart.cs
Normal file
54
Models/Face/FacePart.cs
Normal file
@ -0,0 +1,54 @@
|
||||
namespace File_Folder_Helper.Models.Face;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the part of face.
|
||||
/// </summary>
|
||||
public enum FacePart
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the chin.
|
||||
/// </summary>
|
||||
Chin = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the left eyebrow.
|
||||
/// </summary>
|
||||
LeftEyebrow = 17,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the right eyebrow.
|
||||
/// </summary>
|
||||
RightEyebrow = 22,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the nose bridge.
|
||||
/// </summary>
|
||||
NoseBridge = 27,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the nose tip.
|
||||
/// </summary>
|
||||
NoseTip = 31,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the left eye.
|
||||
/// </summary>
|
||||
LeftEye = 36,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the right eye.
|
||||
/// </summary>
|
||||
RightEye = 42,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the top lip.
|
||||
/// </summary>
|
||||
TopLip = 48,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the bottom lip.
|
||||
/// </summary>
|
||||
BottomLip = 55
|
||||
|
||||
}
|
39
Models/Face/FacePoint.cs
Normal file
39
Models/Face/FacePoint.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System.Drawing;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Face;
|
||||
|
||||
[method: JsonConstructor]
|
||||
public class FacePoint(int index, int x, int y)
|
||||
{
|
||||
public int Index { get; } = index;
|
||||
public int X { get; } = x;
|
||||
public int Y { get; } = y;
|
||||
|
||||
private readonly Point _Point = new(x, y);
|
||||
|
||||
public override bool Equals(object? obj) => obj is FacePoint point && Equals(point);
|
||||
|
||||
#pragma warning disable IDE0070
|
||||
public override int GetHashCode()
|
||||
#pragma warning restore IDE0070
|
||||
{
|
||||
int hashCode = 1861411795;
|
||||
hashCode = (hashCode * -1521134295) + _Point.GetHashCode();
|
||||
hashCode = (hashCode * -1521134295) + Index.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public bool Equals(FacePoint? facePoint)
|
||||
{
|
||||
return facePoint is not null
|
||||
&& X == facePoint.X
|
||||
&& Y == facePoint.Y
|
||||
&& Index == facePoint.Index;
|
||||
}
|
||||
|
||||
public static bool operator ==(FacePoint point1, FacePoint point2) => point1.Equals(point2);
|
||||
|
||||
public static bool operator !=(FacePoint point1, FacePoint point2) => !(point1 == point2);
|
||||
|
||||
}
|
42
Models/Face/Location.cs
Normal file
42
Models/Face/Location.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Face;
|
||||
|
||||
[method: JsonConstructor]
|
||||
public class Location(int bottom, double confidence, int left, int right, int top) : IEquatable<Location>
|
||||
{
|
||||
|
||||
public int Bottom { init; get; } = bottom;
|
||||
public double Confidence { init; get; } = confidence;
|
||||
public int Left { init; get; } = left;
|
||||
public int Right { init; get; } = right;
|
||||
public int Top { init; get; } = top;
|
||||
|
||||
public override bool Equals(object? obj) => Equals(obj as Location);
|
||||
|
||||
#pragma warning disable IDE0070
|
||||
public override int GetHashCode()
|
||||
#pragma warning restore IDE0070
|
||||
{
|
||||
int hashCode = -773114317;
|
||||
hashCode = (hashCode * -1521134295) + Bottom.GetHashCode();
|
||||
hashCode = (hashCode * -1521134295) + Left.GetHashCode();
|
||||
hashCode = (hashCode * -1521134295) + Right.GetHashCode();
|
||||
hashCode = (hashCode * -1521134295) + Top.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public bool Equals(Location? location)
|
||||
{
|
||||
return location is not null
|
||||
&& Bottom == location.Bottom
|
||||
&& Left == location.Left
|
||||
&& Right == location.Right
|
||||
&& Top == location.Top;
|
||||
}
|
||||
|
||||
public static bool operator ==(Location location1, Location location2) => EqualityComparer<Location>.Default.Equals(location1, location2);
|
||||
|
||||
public static bool operator !=(Location location1, Location location2) => !(location1 == location2);
|
||||
|
||||
}
|
24
Models/Face/MappingFromPerson.cs
Normal file
24
Models/Face/MappingFromPerson.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace File_Folder_Helper.Models.Face;
|
||||
|
||||
public record MappingFromPerson(int? ApproximateYears,
|
||||
string DisplayDirectoryName,
|
||||
long PersonKey,
|
||||
string SegmentB)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, MappingFromPersonGenerationContext.Default.MappingFromPerson);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(MappingFromPerson))]
|
||||
public partial class MappingFromPersonGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
5
Models/Face/OutputResolution.cs
Normal file
5
Models/Face/OutputResolution.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace File_Folder_Helper.Models.Face;
|
||||
|
||||
public record OutputResolution(int Height,
|
||||
int Orientation,
|
||||
int Width);
|
Reference in New Issue
Block a user