mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Changed profile detection
Changed Profiles to use new methods for profiles detection provided by the new video card library updates for NVIDIALibrary, AMDLibrary and WinLibrary. This should make DisplayMagician faster as there is less repetition.
This commit is contained in:
parent
e321893876
commit
419969ad5f
@ -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.9")]
|
[assembly: AssemblyVersion("2.1.0.10")]
|
||||||
[assembly: AssemblyFileVersion("2.1.0.9")]
|
[assembly: AssemblyFileVersion("2.1.0.10")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
||||||
[assembly: CLSCompliant(true)]
|
[assembly: CLSCompliant(true)]
|
||||||
|
|
||||||
|
@ -466,72 +466,31 @@ namespace DisplayMagicianShared
|
|||||||
|
|
||||||
public bool CreateProfileFromCurrentDisplaySettings()
|
public bool CreateProfileFromCurrentDisplaySettings()
|
||||||
{
|
{
|
||||||
// Create defaults for NVIDIA and AMD so that the JSON file can save properly
|
// Calling the 3 different libraries automatically gets the different configs from each of the 3 video libraries.
|
||||||
|
// If the video library isn't in use then it also fills in the defaults so that the JSON file can save properly
|
||||||
// (C# Structs populate with default values which mean that arrays start with null)
|
// (C# Structs populate with default values which mean that arrays start with null)
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
NVIDIALibrary nvidiaLibrary = NVIDIALibrary.GetLibrary();
|
NVIDIALibrary nvidiaLibrary = NVIDIALibrary.GetLibrary();
|
||||||
AMDLibrary amdLibrary = AMDLibrary.GetLibrary();
|
AMDLibrary amdLibrary = AMDLibrary.GetLibrary();
|
||||||
WinLibrary winLibrary = WinLibrary.GetLibrary();
|
WinLibrary winLibrary = WinLibrary.GetLibrary();
|
||||||
|
|
||||||
if (VideoMode == VIDEO_MODE.NVIDIA && nvidiaLibrary.IsInstalled)
|
|
||||||
{
|
|
||||||
if (nvidiaLibrary.IsInstalled)
|
|
||||||
{
|
|
||||||
// Create the profile data from the current config
|
// Create the profile data from the current config
|
||||||
_nvidiaDisplayConfig = nvidiaLibrary.GetActiveConfig();
|
_nvidiaDisplayConfig = nvidiaLibrary.ActiveDisplayConfig;
|
||||||
_windowsDisplayConfig = winLibrary.GetActiveConfig();
|
_amdDisplayConfig = amdLibrary.ActiveDisplayConfig;
|
||||||
_profileDisplayIdentifiers = nvidiaLibrary.GetCurrentDisplayIdentifiers();
|
_windowsDisplayConfig = winLibrary.ActiveDisplayConfig;
|
||||||
|
_profileDisplayIdentifiers = nvidiaLibrary.CurrentDisplayIdentifiers;
|
||||||
|
|
||||||
// Now, since the ActiveProfile has changed, we need to regenerate screen positions
|
// Now, since the ActiveProfile has changed, we need to regenerate screen positions
|
||||||
_screens = GetScreenPositions();
|
_screens = GetScreenPositions();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(VideoMode == VIDEO_MODE.AMD && AMDLibrary.GetLibrary().IsInstalled)
|
|
||||||
{
|
|
||||||
if (amdLibrary.IsInstalled)
|
|
||||||
{
|
|
||||||
// Create the profile data from the current config
|
|
||||||
_amdDisplayConfig = amdLibrary.GetActiveConfig();
|
|
||||||
_windowsDisplayConfig = winLibrary.GetActiveConfig();
|
|
||||||
_profileDisplayIdentifiers = amdLibrary.GetCurrentDisplayIdentifiers();
|
|
||||||
|
|
||||||
// Now, since the ActiveProfile has changed, we need to regenerate screen positions
|
|
||||||
_screens = GetScreenPositions();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return false;
|
SharedLogger.logger.Error(ex, $"ProfileRepository/CreateProfileFromCurrentDisplaySettings: Exception getting the config settings!");
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (VideoMode == VIDEO_MODE.WINDOWS)
|
|
||||||
{
|
|
||||||
if (winLibrary.IsInstalled)
|
|
||||||
{
|
|
||||||
// Create the profile data from the current config
|
|
||||||
_windowsDisplayConfig = winLibrary.GetActiveConfig();
|
|
||||||
_profileDisplayIdentifiers = winLibrary.GetCurrentDisplayIdentifiers();
|
|
||||||
|
|
||||||
// Now, since the ActiveProfile has changed, we need to regenerate screen positions
|
|
||||||
_screens = GetScreenPositions();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SharedLogger.logger.Error($"ProfileRepository/CreateProfileFromCurrentDisplaySettings: Tried to use an unknown video mode!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -676,7 +635,7 @@ namespace DisplayMagicianShared
|
|||||||
WinLibrary winLibrary = WinLibrary.GetLibrary();
|
WinLibrary winLibrary = WinLibrary.GetLibrary();
|
||||||
if (nvidiaLibrary.IsInstalled)
|
if (nvidiaLibrary.IsInstalled)
|
||||||
{
|
{
|
||||||
if (!(nvidiaLibrary.IsActiveConfig(_nvidiaDisplayConfig) && winLibrary.IsActiveConfig(_windowsDisplayConfig)))
|
if (!winLibrary.IsActiveConfig(_windowsDisplayConfig) || !nvidiaLibrary.IsActiveConfig(_nvidiaDisplayConfig))
|
||||||
{
|
{
|
||||||
if (nvidiaLibrary.IsPossibleConfig(_nvidiaDisplayConfig))
|
if (nvidiaLibrary.IsPossibleConfig(_nvidiaDisplayConfig))
|
||||||
{
|
{
|
||||||
@ -737,7 +696,7 @@ namespace DisplayMagicianShared
|
|||||||
WinLibrary winLibrary = WinLibrary.GetLibrary();
|
WinLibrary winLibrary = WinLibrary.GetLibrary();
|
||||||
if (amdLibrary.IsInstalled)
|
if (amdLibrary.IsInstalled)
|
||||||
{
|
{
|
||||||
if (!(amdLibrary.IsActiveConfig(_amdDisplayConfig) && winLibrary.IsActiveConfig(_windowsDisplayConfig)))
|
if (!winLibrary.IsActiveConfig(_windowsDisplayConfig) || !amdLibrary.IsActiveConfig(_amdDisplayConfig))
|
||||||
{
|
{
|
||||||
if (amdLibrary.IsPossibleConfig(_amdDisplayConfig))
|
if (amdLibrary.IsPossibleConfig(_amdDisplayConfig))
|
||||||
{
|
{
|
||||||
|
@ -587,9 +587,6 @@ namespace DisplayMagicianShared
|
|||||||
public static void UpdateActiveProfile()
|
public static void UpdateActiveProfile()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//ProfileItem activeProfile;
|
|
||||||
|
|
||||||
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 profile;
|
ProfileItem profile;
|
||||||
|
Loading…
Reference in New Issue
Block a user