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")] [assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information // Version information
[assembly: AssemblyVersion("2.1.0.16")] [assembly: AssemblyVersion("2.1.0.17")]
[assembly: AssemblyFileVersion("2.1.0.16")] [assembly: AssemblyFileVersion("2.1.0.17")]
[assembly: NeutralResourcesLanguageAttribute( "en" )] [assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)] [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 override bool Equals(object obj) => obj is DEVICE_MODE other && this.Equals(other);
public bool Equals(DEVICE_MODE 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 && SpecificationVersion == other.SpecificationVersion &&
DriverVersion.Equals(other.DriverVersion) && //DriverVersion.Equals(other.DriverVersion) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
Size.Equals(other.Size) && //Size.Equals(other.Size) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
DriverExtra.Equals(other.DriverExtra) && //DriverExtra.Equals(other.DriverExtra) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
Fields.Equals(other.Fields) && //Fields.Equals(other.Fields) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
Position.Equals(other.Position) && //Position.Equals(other.Position) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
DisplayOrientation.Equals(other.DisplayOrientation) && DisplayOrientation.Equals(other.DisplayOrientation) &&
DisplayFixedOutput.Equals(other.DisplayFixedOutput) && DisplayFixedOutput.Equals(other.DisplayFixedOutput) &&
Color.Equals(other.Color) && //Color.Equals(other.Color) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
Duplex.Equals(other.Duplex) && //Duplex.Equals(other.Duplex) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
YResolution.Equals(other.YResolution) && //YResolution.Equals(other.YResolution) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
TrueTypeOption.Equals(other.TrueTypeOption) && //TrueTypeOption.Equals(other.TrueTypeOption) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
Collate.Equals(other.Collate) && //Collate.Equals(other.Collate) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
FormName.Equals(other.FormName) && //FormName.Equals(other.FormName) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
LogicalInchPixels.Equals(other.LogicalInchPixels) && //LogicalInchPixels.Equals(other.LogicalInchPixels) && // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
BitsPerPixel.Equals(other.BitsPerPixel) && BitsPerPixel.Equals(other.BitsPerPixel) &&
PixelsWidth.Equals(other.PixelsWidth) && PixelsWidth.Equals(other.PixelsWidth) &&
PixelsHeight.Equals(other.PixelsHeight) && PixelsHeight.Equals(other.PixelsHeight) &&
DisplayFlags.Equals(other.DisplayFlags) && DisplayFlags.Equals(other.DisplayFlags) &&
DisplayFrequency == other.DisplayFrequency; DisplayFrequency == other.DisplayFrequency;
public override int GetHashCode() public override int GetHashCode()
{ {
return (DeviceName, SpecificationVersion, DriverVersion, Size, DriverExtra, Fields, Position, DisplayOrientation, DisplayFixedOutput, Color, Duplex, // Removed specifically for DisplayMagician matching. Remove if you need true equality matching
YResolution, TrueTypeOption, Collate, FormName, LogicalInchPixels, BitsPerPixel, PixelsWidth, PixelsHeight, DisplayFlags, DisplayFrequency).GetHashCode(); //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); public static bool operator ==(DEVICE_MODE lhs, DEVICE_MODE rhs) => lhs.Equals(rhs);