Loosened GDI matching for updated GDI usage

As we now only copy across some of the GDI display settings, we aren't able to have really tight matching on the GDI part of the Windows display profiles. For this reason, I loosened off the Equals test so that it would match on the functions that we change within DisplayMagician. The profile matching now works correctly.
This commit is contained in:
Terry MacDonald 2021-10-25 19:18:46 +13:00
parent ff83331f4d
commit d54328ceef
2 changed files with 21 additions and 19 deletions

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information
[assembly: AssemblyVersion("2.1.0.16")]
[assembly: AssemblyFileVersion("2.1.0.16")]
[assembly: AssemblyVersion("2.1.0.17")]
[assembly: AssemblyFileVersion("2.1.0.17")]
[assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)]

View File

@ -363,32 +363,34 @@ namespace DisplayMagicianShared.Windows
public override bool Equals(object obj) => obj is DEVICE_MODE other && this.Equals(other);
public bool Equals(DEVICE_MODE other)
=> DeviceName.Equals(other.DeviceName) &&
=> //DeviceName.Equals(other.DeviceName) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
SpecificationVersion == other.SpecificationVersion &&
DriverVersion.Equals(other.DriverVersion) &&
Size.Equals(other.Size) &&
DriverExtra.Equals(other.DriverExtra) &&
Fields.Equals(other.Fields) &&
Position.Equals(other.Position) &&
//DriverVersion.Equals(other.DriverVersion) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//Size.Equals(other.Size) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//DriverExtra.Equals(other.DriverExtra) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//Fields.Equals(other.Fields) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//Position.Equals(other.Position) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
DisplayOrientation.Equals(other.DisplayOrientation) &&
DisplayFixedOutput.Equals(other.DisplayFixedOutput) &&
Color.Equals(other.Color) &&
Duplex.Equals(other.Duplex) &&
YResolution.Equals(other.YResolution) &&
TrueTypeOption.Equals(other.TrueTypeOption) &&
Collate.Equals(other.Collate) &&
FormName.Equals(other.FormName) &&
LogicalInchPixels.Equals(other.LogicalInchPixels) &&
//Color.Equals(other.Color) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//Duplex.Equals(other.Duplex) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//YResolution.Equals(other.YResolution) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//TrueTypeOption.Equals(other.TrueTypeOption) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//Collate.Equals(other.Collate) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//FormName.Equals(other.FormName) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//LogicalInchPixels.Equals(other.LogicalInchPixels) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
BitsPerPixel.Equals(other.BitsPerPixel) &&
PixelsWidth.Equals(other.PixelsWidth) &&
PixelsHeight.Equals(other.PixelsHeight) &&
PixelsWidth.Equals(other.PixelsWidth) &&
PixelsHeight.Equals(other.PixelsHeight) &&
DisplayFlags.Equals(other.DisplayFlags) &&
DisplayFrequency == other.DisplayFrequency;
public override int GetHashCode()
{
return (DeviceName, SpecificationVersion, DriverVersion, Size, DriverExtra, Fields, Position, DisplayOrientation, DisplayFixedOutput, Color, Duplex,
YResolution, TrueTypeOption, Collate, FormName, LogicalInchPixels, BitsPerPixel, PixelsWidth, PixelsHeight, DisplayFlags, DisplayFrequency).GetHashCode();
// Removed specifically for DisplayMagician matching. Remove if you need true equality matching
//return (DeviceName, SpecificationVersion, DriverVersion, Size, DriverExtra, Fields, Position, DisplayOrientation, DisplayFixedOutput, Color, Duplex,
// YResolution, TrueTypeOption, Collate, FormName, LogicalInchPixels, BitsPerPixel, PixelsWidth, PixelsHeight, DisplayFlags, DisplayFrequency).GetHashCode();
return (SpecificationVersion, DisplayOrientation, DisplayFixedOutput, BitsPerPixel, PixelsWidth, PixelsHeight, DisplayFlags, DisplayFrequency).GetHashCode();
}
public static bool operator ==(DEVICE_MODE lhs, DEVICE_MODE rhs) => lhs.Equals(rhs);