mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Save visuals in UI
This commit is contained in:
@@ -5,6 +5,14 @@ using System.Management;
|
|||||||
|
|
||||||
namespace GHelper.Display
|
namespace GHelper.Display
|
||||||
{
|
{
|
||||||
|
public enum SplendidGamut : int
|
||||||
|
{
|
||||||
|
Native = 50,
|
||||||
|
sRGB = 51,
|
||||||
|
DCIP3 = 53,
|
||||||
|
DisplayP3 = 54
|
||||||
|
}
|
||||||
|
|
||||||
public enum SplendidCommand: int
|
public enum SplendidCommand: int
|
||||||
{
|
{
|
||||||
Init = 10,
|
Init = 10,
|
||||||
@@ -41,21 +49,21 @@ namespace GHelper.Display
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Dictionary<int, string> GetGamutModes ()
|
public static Dictionary<SplendidGamut, string> GetGamutModes ()
|
||||||
{
|
{
|
||||||
Dictionary<int, string> _modes = new Dictionary<int, string>();
|
Dictionary<SplendidGamut, string> _modes = new Dictionary<SplendidGamut, string>();
|
||||||
|
|
||||||
DirectoryInfo d = new DirectoryInfo("C:\\ProgramData\\ASUS\\GameVisual");
|
DirectoryInfo d = new DirectoryInfo("C:\\ProgramData\\ASUS\\GameVisual");
|
||||||
FileInfo[] icms = d.GetFiles("*.icm");
|
FileInfo[] icms = d.GetFiles("*.icm");
|
||||||
|
|
||||||
if (icms.Length == 0) return _modes;
|
if (icms.Length == 0) return _modes;
|
||||||
|
|
||||||
_modes.Add(50, "Gamut - Native");
|
_modes.Add(SplendidGamut.Native, "Gamut - Native");
|
||||||
foreach (FileInfo icm in icms)
|
foreach (FileInfo icm in icms)
|
||||||
{
|
{
|
||||||
if (icm.Name.Contains("sRGB")) _modes.Add(51, "Gamut - sRGB");
|
if (icm.Name.Contains("sRGB")) _modes.Add(SplendidGamut.sRGB, "Gamut - sRGB");
|
||||||
if (icm.Name.Contains("DCIP3")) _modes.Add(53, "Gamut - DCIP3");
|
if (icm.Name.Contains("DCIP3")) _modes.Add(SplendidGamut.DCIP3, "Gamut - DCIP3");
|
||||||
if (icm.Name.Contains("DisplayP3")) _modes.Add(54, "Gamut - DisplayP3");
|
if (icm.Name.Contains("DisplayP3")) _modes.Add(SplendidGamut.DisplayP3, "Gamut - DisplayP3");
|
||||||
}
|
}
|
||||||
return _modes;
|
return _modes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,6 +288,8 @@ namespace GHelper
|
|||||||
comboVisual.DataSource = new BindingSource(ScreenControl.GetVisualModes(), null);
|
comboVisual.DataSource = new BindingSource(ScreenControl.GetVisualModes(), null);
|
||||||
comboVisual.DisplayMember = "Value";
|
comboVisual.DisplayMember = "Value";
|
||||||
comboVisual.ValueMember = "Key";
|
comboVisual.ValueMember = "Key";
|
||||||
|
comboVisual.SelectedValue = (SplendidCommand)AppConfig.Get("visual", (int)SplendidCommand.Default);
|
||||||
|
|
||||||
comboVisual.SelectedValueChanged += ComboVisual_SelectedValueChanged;
|
comboVisual.SelectedValueChanged += ComboVisual_SelectedValueChanged;
|
||||||
comboVisual.Visible = true;
|
comboVisual.Visible = true;
|
||||||
|
|
||||||
@@ -297,6 +299,8 @@ namespace GHelper
|
|||||||
comboGamut.DataSource = new BindingSource(gamuts, null);
|
comboGamut.DataSource = new BindingSource(gamuts, null);
|
||||||
comboGamut.DisplayMember = "Value";
|
comboGamut.DisplayMember = "Value";
|
||||||
comboGamut.ValueMember = "Key";
|
comboGamut.ValueMember = "Key";
|
||||||
|
comboGamut.SelectedValue = (SplendidGamut)AppConfig.Get("gamut", (int)SplendidGamut.Native);
|
||||||
|
|
||||||
comboGamut.SelectedValueChanged += ComboGamut_SelectedValueChanged;
|
comboGamut.SelectedValueChanged += ComboGamut_SelectedValueChanged;
|
||||||
comboGamut.Visible = true;
|
comboGamut.Visible = true;
|
||||||
|
|
||||||
@@ -304,11 +308,13 @@ namespace GHelper
|
|||||||
|
|
||||||
private void ComboGamut_SelectedValueChanged(object? sender, EventArgs e)
|
private void ComboGamut_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
AppConfig.Set("gamut", (int)comboGamut.SelectedValue);
|
||||||
ScreenControl.SetGamut((int)comboGamut.SelectedValue);
|
ScreenControl.SetGamut((int)comboGamut.SelectedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComboVisual_SelectedValueChanged(object? sender, EventArgs e)
|
private void ComboVisual_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
AppConfig.Set("visual", (int)comboVisual.SelectedValue);
|
||||||
ScreenControl.SetVisual((SplendidCommand)comboVisual.SelectedValue);
|
ScreenControl.SetVisual((SplendidCommand)comboVisual.SelectedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user