Skip to content

Commit 6874be1

Browse files
authored
Merge pull request #8 from Virenbar/v2.6
V2.6
2 parents 7a9d4d2 + f619182 commit 6874be1

14 files changed

+535
-411
lines changed

GDPIControl/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal static class Constants
1515
public static string BlacklistPath => Path.Combine(StartupPath, BlacklistName);
1616
public static string BlacklistTempPath => Path.Combine(StartupPath, BlacklistTempName);
1717
public static string ConfigPath => Path.Combine(StartupPath, ConfigName);
18-
public static string GDPIPath => Path.Combine(Application.StartupPath, Environment.Is64BitOperatingSystem ? x86_64 : x86);
18+
public static string GDPIPath => Path.Combine(StartupPath, Environment.Is64BitOperatingSystem ? x86_64 : x86);
1919
public static string UserlistPath => Path.Combine(StartupPath, UserlistName);
2020

2121
#region StartupPath
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using GDPIControl.Model;
2+
3+
namespace GDPIControl.Extensions
4+
{
5+
public static class ModesetExtensions
6+
{
7+
public static string ToArgument(this Modeset modeset)
8+
{
9+
return modeset switch
10+
{
11+
Modeset.M1 => "-1",
12+
Modeset.M2 => "-2",
13+
Modeset.M3 => "-3",
14+
Modeset.M4 => "-4",
15+
Modeset.M5 => "-5",
16+
Modeset.M6 => "-6",
17+
Modeset.M7 => "-7",
18+
Modeset.M8 => "-8",
19+
Modeset.M9 => "-9",
20+
Modeset.Custom1 => GetArguments(Config.Current.CustomSettings1),
21+
Modeset.Custom2 => GetArguments(Config.Current.CustomSettings2),
22+
Modeset.Custom3 => GetArguments(Config.Current.CustomSettings3),
23+
_ => "-9",
24+
};
25+
}
26+
27+
public static GDPISettings ToSettings(this Modeset modeset)
28+
{
29+
return modeset switch
30+
{
31+
Modeset.M1 => new GDPISettings { P = true, R = true, S = true, F = true, F_V = 2, K = true, K_V = 2, N = true, E = true, E_V = 2 },
32+
Modeset.M2 => new GDPISettings { P = true, R = true, S = true, F = true, F_V = 2, K = true, K_V = 2, N = true, E = true, E_V = 40 },
33+
Modeset.M3 => new GDPISettings { P = true, R = true, S = true, E = true, E_V = 2 },
34+
Modeset.M4 => new GDPISettings { P = true, R = true, S = true },
35+
Modeset.M5 => new GDPISettings { F = true, F_V = 2, E = true, E_V = 2, ATTL = true, RFrag = true, MP = true, MP_V = 1200 },
36+
Modeset.M6 => new GDPISettings { F = true, F_V = 2, E = true, E_V = 2, Seq = true, RFrag = true, MP = true, MP_V = 1200 },
37+
Modeset.M7 => new GDPISettings { F = true, F_V = 2, E = true, E_V = 2, ChkSum = true, RFrag = true, MP = true, MP_V = 1200 },
38+
Modeset.M8 => new GDPISettings { F = true, F_V = 2, E = true, E_V = 2, Seq = true, ChkSum = true, RFrag = true, MP = true, MP_V = 1200 },
39+
Modeset.M9 => new GDPISettings { F = true, F_V = 2, E = true, E_V = 2, Seq = true, ChkSum = true, RFrag = true, MP = true, MP_V = 1200, Q = true },
40+
_ => new GDPISettings(),
41+
};
42+
}
43+
44+
private static string GetArguments(GDPISettings settings) => settings.Arguments ?? settings.ToArguments();
45+
}
46+
}

GDPIControl/FormMain.Designer.cs

Lines changed: 75 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GDPIControl/FormMain.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using GDPIControl.Forms;
1+
using GDPIControl.Extensions;
2+
using GDPIControl.Forms;
23
using GDPIControl.Model;
34
using GDPIControl.Properties;
45
using System;
@@ -65,14 +66,7 @@ private void CloseGDPIControl()
6566
private void RefreshArguments()
6667
{
6768
Settings.Modeset = RBModesets.First(X => X.Button.Checked).Modeset;
68-
var Arguments = Settings.Modeset switch
69-
{
70-
Modeset.Custom1 => Settings.CustomSettings1.ToArguments(),
71-
Modeset.Custom2 => Settings.CustomSettings2.ToArguments(),
72-
Modeset.Custom3 => Settings.CustomSettings3.ToArguments(),
73-
_ => GDPISettings.ModesetArgument(Settings.Modeset)
74-
};
75-
69+
var Arguments = Settings.Modeset.ToArgument();
7670
if (Settings.UseBlacklist) { Arguments += $@" --blacklist ""{Constants.BlacklistPath}"""; }
7771
if (Settings.UseUserlist) { Arguments += $@" --blacklist ""{Constants.UserlistPath}"""; }
7872
Settings.Arguments = Arguments;
@@ -100,6 +94,7 @@ private void StartGDPI()
10094
Icon = Resources.icon_green;
10195
RefreshArguments();
10296
GDPIProcess.Start();
97+
RefreshUI();
10398
}
10499

105100
private void StopGDPI()
@@ -112,14 +107,14 @@ private void StopGDPI()
112107
Icon = Resources.icon_red;
113108
RefreshArguments();
114109
GDPIProcess.Stop();
110+
RefreshUI();
115111
}
116112

117113
private void UIState(bool state)
118114
{
119115
B_Restart.Enabled = state;
120116
B_Start.Enabled = state;
121117
B_Close.Enabled = state;
122-
if (state) { RefreshUI(); }
123118
}
124119

125120
#region UIEvents

GDPIControl/Forms/FormBlacklist.Designer.cs

Lines changed: 30 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)