From 2a4dbd8fe56e9c0bf4a408f02192c6eea48202af Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Mon, 2 May 2022 22:21:10 +0200 Subject: [PATCH] Fixed ambiguous equals in Display --- ScreenCapture.NET/Model/Display.cs | 10 ++++++---- ScreenCapture.NET/ScreenCapture.NET.csproj | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ScreenCapture.NET/Model/Display.cs b/ScreenCapture.NET/Model/Display.cs index 7c749aa..bbf67a0 100644 --- a/ScreenCapture.NET/Model/Display.cs +++ b/ScreenCapture.NET/Model/Display.cs @@ -1,5 +1,7 @@ // ReSharper disable MemberCanBePrivate.Global +using System; + namespace ScreenCapture.NET; /// @@ -58,20 +60,20 @@ public readonly struct Display #endregion #region Methods - + /// /// Determines whether this equals the given one. /// /// The to compare. /// true if the specified object is equal to the current object; otherwise, false. - public bool Equals(Display other) => Index == other.Index; + public bool Equals(Display other) => (Index == other.Index) && GraphicsCard.Equals(other.GraphicsCard); /// public override bool Equals(object? obj) => obj is Display other && Equals(other); /// - public override int GetHashCode() => Index; - + public override int GetHashCode() => HashCode.Combine(Index, GraphicsCard); + /// /// Determines whether two are equal. /// diff --git a/ScreenCapture.NET/ScreenCapture.NET.csproj b/ScreenCapture.NET/ScreenCapture.NET.csproj index 2baac8f..6923e83 100644 --- a/ScreenCapture.NET/ScreenCapture.NET.csproj +++ b/ScreenCapture.NET/ScreenCapture.NET.csproj @@ -26,8 +26,9 @@ True - - Added IScreenCapture.UpdateCaptureZone to modify existing CaptureZones without having to remove and add them again. + - Added IScreenCapture.UpdateCaptureZone to modify existing CaptureZones without having to remove and add them again. (This has performance benefits when only X and/or Y is changed, changes to width, height and downscale are internally still reinitializing the zone.) + - Fixed ambiguous equals in Display 1.2.0