FaceFile for D2
This commit is contained in:
39
Shared/Models/FacePoint.cs
Normal file
39
Shared/Models/FacePoint.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System.Drawing;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
[method: JsonConstructor]
|
||||
public class FacePoint(int index, int x, int y) : Properties.IFacePoint
|
||||
{
|
||||
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);
|
||||
|
||||
}
|
Reference in New Issue
Block a user