Skip to content

Commit

Permalink
Updated WinLibrary to latest version
Browse files Browse the repository at this point in the history
Also updated to v1.7.5
  • Loading branch information
terrymacdonald committed May 30, 2022
1 parent af13859 commit fc90131
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CCDInfo/Program.cs
Expand Up @@ -45,10 +45,10 @@ static void Main(string[] args)
NLog.LogManager.Configuration = config;

// Start the Log file
SharedLogger.logger.Info($"CCDInfo/Main: Starting CCDInfo v1.7.3");
SharedLogger.logger.Info($"CCDInfo/Main: Starting CCDInfo v1.7.5");


Console.WriteLine($"\nCCDInfo v1.7.3");
Console.WriteLine($"\nCCDInfo v1.7.5");
Console.WriteLine($"==============");
Console.WriteLine($"By Terry MacDonald 2022\n");

Expand Down
4 changes: 2 additions & 2 deletions CCDInfo/Properties/AssemblyInfo.cs
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.3.0")]
[assembly: AssemblyFileVersion("1.7.3.0")]
[assembly: AssemblyVersion("1.7.5.0")]
[assembly: AssemblyFileVersion("1.7.5.0")]
30 changes: 26 additions & 4 deletions CCDInfo/WinLibrary.cs
Expand Up @@ -52,11 +52,15 @@ public struct DISPLAY_SOURCE : IEquatable<DISPLAY_SOURCE>

public override bool Equals(object obj) => obj is DISPLAY_SOURCE other && this.Equals(other);
public bool Equals(DISPLAY_SOURCE other)
=> true;
=> SourceId.Equals(other.SourceId) &&
TargetId.Equals(other.TargetId) &&
DevicePath.Equals(other.DevicePath) &&
SourceDpiScalingRel.Equals(other.SourceDpiScalingRel);
//=> true;
public override int GetHashCode()
{
//return 300;
return (AdapterId, SourceId, TargetId, DevicePath, SourceDpiScalingRel).GetHashCode();
return (SourceId, TargetId, DevicePath, SourceDpiScalingRel).GetHashCode();
}

public static bool operator ==(DISPLAY_SOURCE lhs, DISPLAY_SOURCE rhs) => lhs.Equals(rhs);
Expand All @@ -83,15 +87,33 @@ public struct WINDOWS_DISPLAY_CONFIG : IEquatable<WINDOWS_DISPLAY_CONFIG>

public override bool Equals(object obj) => obj is WINDOWS_DISPLAY_CONFIG other && this.Equals(other);
public bool Equals(WINDOWS_DISPLAY_CONFIG other)
=> IsCloned == other.IsCloned &&
{
if (!(IsCloned == other.IsCloned &&
DisplayConfigPaths.SequenceEqual(other.DisplayConfigPaths) &&
DisplayConfigModes.SequenceEqual(other.DisplayConfigModes) &&
DisplayHDRStates.SequenceEqual(other.DisplayHDRStates) &&
// The dictionary keys sometimes change after returning from NVIDIA Surround, so we need to only focus on comparing the values of the GDISettings.
// Additionally, we had to disable the DEviceKey from the equality testing within the GDI library itself as that waould also change after changing back from NVIDIA surround
// This still allows us to detect when refresh rates change, which will allow DisplayMagician to detect profile differences.
GdiDisplaySettings.Values.SequenceEqual(other.GdiDisplaySettings.Values) &&
DisplayIdentifiers.SequenceEqual(other.DisplayIdentifiers);
DisplayIdentifiers.SequenceEqual(other.DisplayIdentifiers)))
{
return false;
}

// Now we need to go through the values to make sure they are the same, but ignore the keys (as they change after each reboot!)
for (int i = 0; i < DisplaySources.Count; i++)
{
if (!DisplaySources.ElementAt(i).Value.SequenceEqual(other.DisplaySources.ElementAt(i).Value))
{
return false;
}
}
return true;


}

// NOTE: I have disabled the TaskBar specific matching for now due to errors I cannot fix
// WinLibrary will still track the location of the taskbars, but won't actually set them as the setting of the taskbars doesnt work at the moment.
/*&&
Expand Down

0 comments on commit fc90131

Please sign in to comment.