Equality overrides
This commit is contained in:
parent
2352e868bc
commit
c445cbb6af
@ -28,4 +28,19 @@ public struct Point
|
|||||||
{
|
{
|
||||||
return $"{{X={X,-7:####0}, Y={Y,-7:####0}}}";
|
return $"{{X={X,-7:####0}, Y={Y,-7:####0}}}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object? obj)
|
||||||
|
{
|
||||||
|
return obj is Point other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(Point other)
|
||||||
|
{
|
||||||
|
return X == other.X && Y == other.Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(X, Y);
|
||||||
|
}
|
||||||
}
|
}
|
@ -17,6 +17,24 @@ public struct WindowInfo
|
|||||||
this.WindowTitle = windowTitle;
|
this.WindowTitle = windowTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object? obj)
|
||||||
|
{
|
||||||
|
return obj is WindowInfo other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(WindowInfo other)
|
||||||
|
{
|
||||||
|
return WindowHandle == other.WindowHandle &&
|
||||||
|
WindowPlacement.Equals(other.WindowPlacement) &&
|
||||||
|
WindowTitle == other.WindowTitle &&
|
||||||
|
ProcessInfo.Equals(other.ProcessInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(WindowHandle, WindowPlacement, WindowTitle, ProcessInfo);
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
const int cutoffStr = 17;
|
const int cutoffStr = 17;
|
||||||
|
@ -59,4 +59,22 @@ public struct WINDOWPLACEMENT
|
|||||||
{
|
{
|
||||||
return $"CMD: {ShowCmd,13} Min: {MinPosition} Max: {MaxPosition} Normal: {NormalPosition}";
|
return $"CMD: {ShowCmd,13} Min: {MinPosition} Max: {MaxPosition} Normal: {NormalPosition}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object? obj)
|
||||||
|
{
|
||||||
|
return obj is WindowPlacement other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(WindowPlacement other)
|
||||||
|
{
|
||||||
|
return ShowCmd == other.ShowCmd &&
|
||||||
|
MinPosition.Equals(other.MinPosition) &&
|
||||||
|
MaxPosition.Equals(other.MaxPosition) &&
|
||||||
|
NormalPosition.Equals(other.NormalPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine((int)ShowCmd, MinPosition, MaxPosition, NormalPosition);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user