Skip to content

Commit

Permalink
Fixed case when directory doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Mar 7, 2024
1 parent 84f03d7 commit f749bfc
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions app/Display/ScreenControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,27 @@ public static Dictionary<SplendidGamut, string> GetGamutModes ()
{
Dictionary<SplendidGamut, string> _modes = new Dictionary<SplendidGamut, string>();

DirectoryInfo d = new DirectoryInfo("C:\\ProgramData\\ASUS\\GameVisual");
FileInfo[] icms = d.GetFiles("*.icm");
if (!Directory.Exists("C:\\ProgramData\\ASUS\\GameVisual")) return _modes;

if (icms.Length == 0) return _modes;

_modes.Add(SplendidGamut.Native, "Gamut - Native");
foreach (FileInfo icm in icms)
try
{
if (icm.Name.Contains("sRGB")) _modes.Add(SplendidGamut.sRGB, "Gamut - sRGB");
if (icm.Name.Contains("DCIP3")) _modes.Add(SplendidGamut.DCIP3, "Gamut - DCIP3");
if (icm.Name.Contains("DisplayP3")) _modes.Add(SplendidGamut.DisplayP3, "Gamut - DisplayP3");
DirectoryInfo d = new DirectoryInfo("C:\\ProgramData\\ASUS\\GameVisual");
FileInfo[] icms = d.GetFiles("*.icm");
if (icms.Length == 0) return _modes;

_modes.Add(SplendidGamut.Native, "Gamut - Native");
foreach (FileInfo icm in icms)
{
if (icm.Name.Contains("sRGB")) _modes.Add(SplendidGamut.sRGB, "Gamut - sRGB");
if (icm.Name.Contains("DCIP3")) _modes.Add(SplendidGamut.DCIP3, "Gamut - DCIP3");
if (icm.Name.Contains("DisplayP3")) _modes.Add(SplendidGamut.DisplayP3, "Gamut - DisplayP3");
}
return _modes;
}
catch {
return _modes;
}
return _modes;

}

public static Dictionary<SplendidCommand, string> GetVisualModes()
Expand Down

0 comments on commit f749bfc

Please sign in to comment.