mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Patch Profiles that are missing GDI settings
This will ensure that existing display profiles will at least load. Anyone with refresh settings changes or BPC or other device context settings will need to recreate their display profiles.
This commit is contained in:
parent
b5e84cf6a8
commit
d98372bf39
@ -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.0.1.127")]
|
[assembly: AssemblyVersion("2.0.1.129")]
|
||||||
[assembly: AssemblyFileVersion("2.0.1.127")]
|
[assembly: AssemblyFileVersion("2.0.1.129")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
||||||
[assembly: CLSCompliant(true)]
|
[assembly: CLSCompliant(true)]
|
||||||
|
|
||||||
|
@ -818,6 +818,38 @@ namespace DisplayMagicianShared
|
|||||||
JObject NVIDIADisplayConfig = (JObject)profile.SelectToken("NVIDIADisplayConfig");
|
JObject NVIDIADisplayConfig = (JObject)profile.SelectToken("NVIDIADisplayConfig");
|
||||||
NVIDIADisplayConfig.Add("ColorConfig",defaultColorConfig);
|
NVIDIADisplayConfig.Add("ColorConfig",defaultColorConfig);
|
||||||
changedJson = true;
|
changedJson = true;
|
||||||
|
SharedLogger.logger.Trace($"ProfileRepository/MigrateJsonToLatestVersion: Patched missing NVIDIA Color Config in profile {profile.SelectToken("Name")} (index {i}).");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (JsonReaderException ex)
|
||||||
|
{
|
||||||
|
SharedLogger.logger.Error($"ProfileRepository/MigrateJsonToLatestVersion: JSONReaderException while trying to process the Profiles json data to migrate any older feature to the latest version.");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
SharedLogger.logger.Error($"ProfileRepository/MigrateJsonToLatestVersion: Exception while trying to process the Profiles json data to migrate any older feature to the latest version.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now we try and add a default Windows GDI Device Context if there isn't one
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SharedLogger.logger.Trace($"ProfileRepository/MigrateJsonToLatestVersion: Looking for missing Windows GDI Device Context.");
|
||||||
|
|
||||||
|
// Create a default object
|
||||||
|
Dictionary<string, GDI_DISPLAY_SETTING> GdiDisplaySettings = new Dictionary<string, GDI_DISPLAY_SETTING>();
|
||||||
|
JObject defaultGdiDisplaySettings = (JObject)JToken.FromObject(GdiDisplaySettings);
|
||||||
|
for (int i = 0; i < root.Count; i++)
|
||||||
|
{
|
||||||
|
JObject profile = (JObject)root[i];
|
||||||
|
JObject result = (JObject)profile.SelectToken("WindowsDisplayConfig.GdiDisplaySettings");
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
|
||||||
|
JObject WindowsDisplayConfig = (JObject)profile.SelectToken("WindowsDisplayConfig");
|
||||||
|
WindowsDisplayConfig.Add("GdiDisplaySettings", defaultGdiDisplaySettings);
|
||||||
|
changedJson = true;
|
||||||
|
SharedLogger.logger.Trace($"ProfileRepository/MigrateJsonToLatestVersion: Patched missing Windows GDI Device Context in profile {profile.SelectToken("Name")} (index {i}).");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user