mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Working profile comparisons
This commit is contained in:
parent
0b864f09ca
commit
90c13c7426
@ -111,69 +111,6 @@ namespace DisplayMagicianShared.AMD
|
||||
}
|
||||
}
|
||||
|
||||
/*[JsonRequired]
|
||||
public override List<ScreenPosition> Screens
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_screens.Count == 0)
|
||||
{
|
||||
_screens = GetScreenPositions();
|
||||
}
|
||||
return _screens;
|
||||
}
|
||||
set
|
||||
{
|
||||
_screens = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public override Bitmap ProfileBitmap
|
||||
{
|
||||
get
|
||||
{
|
||||
*//*if (!ProfileRepository.ProfilesLoaded)
|
||||
return null;*//*
|
||||
|
||||
if (_profileBitmap != null)
|
||||
return _profileBitmap;
|
||||
else
|
||||
{
|
||||
_profileBitmap = this.ProfileIcon.ToBitmap(256, 256);
|
||||
return _profileBitmap;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
_profileBitmap = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public override Bitmap ProfileTightestBitmap
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_profileShortcutBitmap != null)
|
||||
return _profileShortcutBitmap;
|
||||
else
|
||||
{
|
||||
_profileShortcutBitmap = this.ProfileIcon.ToTightestBitmap();
|
||||
return _profileShortcutBitmap;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
_profileShortcutBitmap = value;
|
||||
}
|
||||
|
||||
} */
|
||||
|
||||
#endregion
|
||||
|
||||
public override bool IsValid()
|
||||
|
@ -94,27 +94,6 @@ namespace DisplayMagicianShared.NVIDIA
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*[JsonIgnore]
|
||||
public override ProfileIcon ProfileIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_profileIcon != null)
|
||||
return _profileIcon;
|
||||
else
|
||||
{
|
||||
_profileIcon = new ProfileIcon(this);
|
||||
return _profileIcon;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
_profileIcon = value;
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
public override List<string> ProfileDisplayIdentifiers
|
||||
{
|
||||
get
|
||||
@ -132,64 +111,6 @@ namespace DisplayMagicianShared.NVIDIA
|
||||
}
|
||||
}
|
||||
|
||||
/*[JsonRequired]
|
||||
public override List<ScreenPosition> Screens
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_screens.Count == 0)
|
||||
{
|
||||
_screens = GetScreenPositions();
|
||||
}
|
||||
return _screens;
|
||||
}
|
||||
set
|
||||
{
|
||||
_screens = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public override Bitmap ProfileBitmap
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_profileBitmap != null)
|
||||
return _profileBitmap;
|
||||
else
|
||||
{
|
||||
_profileBitmap = this.ProfileIcon.ToBitmap(256, 256);
|
||||
return _profileBitmap;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
_profileBitmap = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public override Bitmap ProfileTightestBitmap
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_profileShortcutBitmap != null)
|
||||
return _profileShortcutBitmap;
|
||||
else
|
||||
{
|
||||
_profileShortcutBitmap = this.ProfileIcon.ToTightestBitmap();
|
||||
return _profileShortcutBitmap;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
_profileShortcutBitmap = value;
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
#endregion
|
||||
|
||||
public override bool IsValid()
|
||||
|
@ -368,7 +368,7 @@ namespace DisplayMagicianShared
|
||||
}
|
||||
|
||||
|
||||
// The public override for the Object.Equals
|
||||
/* // The public override for the Object.Equals
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return this.Equals(obj as ProfileItem);
|
||||
@ -432,7 +432,7 @@ namespace DisplayMagicianShared
|
||||
|
||||
int foundPathsCount = 0;
|
||||
int foundOtherPathsCount = 0;
|
||||
/*foreach (Topology.Path profilePath in Paths)
|
||||
*//*foreach (Topology.Path profilePath in Paths)
|
||||
{
|
||||
if (other.Paths.Contains(profilePath))
|
||||
{
|
||||
@ -448,14 +448,14 @@ namespace DisplayMagicianShared
|
||||
foundOtherPathsCount++;
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
}*//*
|
||||
|
||||
|
||||
if (foundPathsCount == foundOtherPathsCount)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
// If Equals() returns true for this object compared to another
|
||||
// then GetHashCode() must return the same value for these objects.
|
||||
@ -609,12 +609,12 @@ namespace DisplayMagicianShared
|
||||
}
|
||||
}
|
||||
|
||||
// Custom Equality comparer for the Profile class
|
||||
/*// Custom Equality comparer for the Profile class
|
||||
// Allows us to use 'Contains'
|
||||
class ProfileComparer : IEqualityComparer<ProfileItem>
|
||||
{
|
||||
// Products are equal if their names and product numbers are equal.
|
||||
/*public bool Equals(ProfileItem x, ProfileItem y)
|
||||
*//*public bool Equals(ProfileItem x, ProfileItem y)
|
||||
{
|
||||
|
||||
//Check whether the compared objects reference the same data.
|
||||
@ -632,7 +632,7 @@ namespace DisplayMagicianShared
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}*/
|
||||
}*//*
|
||||
|
||||
public bool Equals(ProfileItem x, ProfileItem y)
|
||||
{
|
||||
@ -681,7 +681,7 @@ namespace DisplayMagicianShared
|
||||
// Two profiles are equal only when they have the same viewport data
|
||||
int foundPathsCount = 0;
|
||||
int foundOtherPathsCount = 0;
|
||||
/*foreach (Topology.Path profilePath in x.Paths)
|
||||
*//*foreach (Topology.Path profilePath in x.Paths)
|
||||
{
|
||||
if (y.Paths.Contains(profilePath))
|
||||
{
|
||||
@ -697,7 +697,7 @@ namespace DisplayMagicianShared
|
||||
foundOtherPathsCount++;
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
}*//*
|
||||
|
||||
|
||||
if (foundPathsCount == foundOtherPathsCount)
|
||||
@ -708,7 +708,7 @@ namespace DisplayMagicianShared
|
||||
|
||||
// If Equals() returns true for a pair of objects
|
||||
// then GetHashCode() must return the same value for these objects.
|
||||
/*public int GetHashCode(ProfileItem profile)
|
||||
*//*public int GetHashCode(ProfileItem profile)
|
||||
{
|
||||
|
||||
// Check whether the object is null
|
||||
@ -720,7 +720,7 @@ namespace DisplayMagicianShared
|
||||
//Calculate the hash code for the product.
|
||||
return hashPaths;
|
||||
|
||||
}*/
|
||||
}*//*
|
||||
// Modified the GetHashCode to compare the displayidentifier
|
||||
public int GetHashCode(ProfileItem profile)
|
||||
{
|
||||
@ -739,5 +739,5 @@ namespace DisplayMagicianShared
|
||||
return (hashIds,hashPaths).GetHashCode();
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
@ -653,15 +653,27 @@ namespace DisplayMagicianShared
|
||||
|
||||
SharedLogger.logger.Debug($"ProfileRepository/IsActiveProfile: Checking whether the profile {profile.Name} is the currently active profile.");
|
||||
|
||||
if (profile.Equals(_currentProfile))
|
||||
if (profile is NVIDIAProfileItem && profile.Equals((NVIDIAProfileItem)_currentProfile))
|
||||
{
|
||||
SharedLogger.logger.Debug($"ProfileRepository/IsActiveProfile: The profile {profile.Name} is the currently active profile.");
|
||||
SharedLogger.logger.Debug($"ProfileRepository/IsActiveProfile: The NVIDIA profile {profile.Name} is the currently active profile.");
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (profile is AMDProfileItem && profile.Equals((AMDProfileItem)_currentProfile))
|
||||
{
|
||||
SharedLogger.logger.Debug($"ProfileRepository/IsActiveProfile: The AMD profile {profile.Name} is the currently active profile.");
|
||||
return true;
|
||||
}
|
||||
else if (profile is WinProfileItem && profile.Equals((WinProfileItem)_currentProfile))
|
||||
{
|
||||
SharedLogger.logger.Debug($"ProfileRepository/IsActiveProfile: The Windows CCD profile {profile.Name} is the currently active profile.");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SharedLogger.logger.Debug($"ProfileRepository/IsActiveProfile: The profile {profile.Name} is not the currently active profile.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static bool LoadProfiles()
|
||||
|
@ -96,68 +96,6 @@ namespace DisplayMagicianShared.Windows
|
||||
}
|
||||
}
|
||||
|
||||
/*[JsonRequired]
|
||||
public override List<ScreenPosition> Screens
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_screens.Count == 0)
|
||||
{
|
||||
_screens = GetScreenPositions();
|
||||
}
|
||||
return _screens;
|
||||
}
|
||||
set
|
||||
{
|
||||
_screens = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public override Bitmap ProfileBitmap
|
||||
{
|
||||
get
|
||||
{
|
||||
*//*if (!ProfileRepository.ProfilesLoaded)
|
||||
return null;*//*
|
||||
|
||||
if (_profileBitmap != null)
|
||||
return _profileBitmap;
|
||||
else
|
||||
{
|
||||
_profileBitmap = this.ProfileIcon.ToBitmap(256, 256);
|
||||
return _profileBitmap;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
_profileBitmap = value;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public override Bitmap ProfileTightestBitmap
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_profileShortcutBitmap != null)
|
||||
return _profileShortcutBitmap;
|
||||
else
|
||||
{
|
||||
_profileShortcutBitmap = this.ProfileIcon.ToTightestBitmap();
|
||||
return _profileShortcutBitmap;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
_profileShortcutBitmap = value;
|
||||
}
|
||||
|
||||
} */
|
||||
|
||||
#endregion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user