Renamed ADLWrapper to AMDLibrary

It better reflects the purpose of the class.
This commit is contained in:
Terry MacDonald 2021-06-20 10:45:45 +12:00
parent d2c8c67d44
commit 484b6d86b4
4 changed files with 316 additions and 324 deletions

View File

@ -52,7 +52,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AMD\ADL.cs" /> <Compile Include="AMD\ADL.cs" />
<Compile Include="AMD\ADLWrapper.cs" /> <Compile Include="AMD\AMDLibrary.cs" />
<Compile Include="SharedLogger.cs" /> <Compile Include="SharedLogger.cs" />
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>

View File

@ -30,7 +30,7 @@ namespace DisplayMagicianShared
private static ProfileItem _currentProfile; private static ProfileItem _currentProfile;
private static List<string> _connectedDisplayIdentifiers = new List<string>(); private static List<string> _connectedDisplayIdentifiers = new List<string>();
private static bool notifiedEDIDErrorToUser = false; private static bool notifiedEDIDErrorToUser = false;
private static ADLWrapper AMDLibrary; private static AMDLibrary AMDLibrary;
// Other constants that are useful // Other constants that are useful
public static string AppDataPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DisplayMagician"); public static string AppDataPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DisplayMagician");
@ -61,7 +61,7 @@ namespace DisplayMagicianShared
try try
{ {
SharedLogger.logger.Debug($"ProfileRepository/ProfileRepository: Initialising the AMD ADL library."); SharedLogger.logger.Debug($"ProfileRepository/ProfileRepository: Initialising the AMD ADL library.");
AMDLibrary = new ADLWrapper(); AMDLibrary = new AMDLibrary();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -556,6 +556,13 @@ namespace DisplayMagicianShared
public static void UpdateActiveProfile() public static void UpdateActiveProfile()
{ {
AMDLibrary amdLibrary = AMDLibrary.GetLibrary();
if (amdLibrary.IsInstalled)
{
amdLibrary.GetActiveProfile();
}
SharedLogger.logger.Debug($"ProfileRepository/UpdateActiveProfile: Updating the profile currently active (in use now)."); SharedLogger.logger.Debug($"ProfileRepository/UpdateActiveProfile: Updating the profile currently active (in use now).");
ProfileItem activeProfile = new ProfileItem ProfileItem activeProfile = new ProfileItem
@ -1156,7 +1163,7 @@ namespace DisplayMagicianShared
} }
// If the Video Card is an AMD, then we should generate specific AMD displayIdentifiers // If the Video Card is an AMD, then we should generate specific AMD displayIdentifiers
AMD.ADLWrapper thingy = new AMD.ADLWrapper(); AMD.AMDLibrary thingy = new AMD.AMDLibrary();
if (isNvidia && myPhysicalGPUs != null && myPhysicalGPUs.Length > 0) if (isNvidia && myPhysicalGPUs != null && myPhysicalGPUs.Length > 0)
//if (false) //if (false)

View File

@ -77,32 +77,17 @@ namespace DisplayMagicianShared.Topology
// Check whether the Profile Viewport properties are equal // Check whether the Profile Viewport properties are equal
// Two profiles are equal only when they have the same viewport data exactly // Two profiles are equal only when they have the same viewport data exactly
/*if (PixelFormat == other.PixelFormat &&
Position.Equals(other.Position) &&
Resolution.Equals(other.Resolution) &&
SourceId == other.SourceId)*/
// Note: Removed the source ID as it changes on boot sometimes!
// It can change and the profiles can still be the same
if (PixelFormat == other.PixelFormat && if (PixelFormat == other.PixelFormat &&
Position.Equals(other.Position) && Position.Equals(other.Position) &&
Resolution.Equals(other.Resolution) && Resolution.Equals(other.Resolution) &&
SourceId == other.SourceId) SourceId == other.SourceId)
{ {
/*// If the above all match, then we need to check the DisplayTargets // If the above all match, then we need to check the DisplayTargets
if (other.TargetDisplays.SequenceEqual(TargetDisplays))
return true;
else
return false;*/
foreach (PathTarget myTargetDisplay in TargetDisplays) foreach (PathTarget myTargetDisplay in TargetDisplays)
{ {
if (!other.TargetDisplays.Contains(myTargetDisplay)) if (!other.TargetDisplays.Contains(myTargetDisplay))
return false; return false;
} }
/*foreach (PathTarget theirTargetDisplay in other.TargetDisplays)
{
if (!TargetDisplays.Contains(theirTargetDisplay))
return false;
}*/
return true; return true;
} }
else else