Skip to content

Commit

Permalink
Merge pull request #8 from Virenbar/v2.6
Browse files Browse the repository at this point in the history
V2.6
  • Loading branch information
Virenbar authored Aug 8, 2024
2 parents 7a9d4d2 + f619182 commit 6874be1
Show file tree
Hide file tree
Showing 14 changed files with 535 additions and 411 deletions.
2 changes: 1 addition & 1 deletion GDPIControl/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal static class Constants
public static string BlacklistPath => Path.Combine(StartupPath, BlacklistName);
public static string BlacklistTempPath => Path.Combine(StartupPath, BlacklistTempName);
public static string ConfigPath => Path.Combine(StartupPath, ConfigName);
public static string GDPIPath => Path.Combine(Application.StartupPath, Environment.Is64BitOperatingSystem ? x86_64 : x86);
public static string GDPIPath => Path.Combine(StartupPath, Environment.Is64BitOperatingSystem ? x86_64 : x86);
public static string UserlistPath => Path.Combine(StartupPath, UserlistName);

#region StartupPath
Expand Down
46 changes: 46 additions & 0 deletions GDPIControl/Extensions/ModesetExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using GDPIControl.Model;

namespace GDPIControl.Extensions
{
public static class ModesetExtensions
{
public static string ToArgument(this Modeset modeset)
{
return modeset switch
{
Modeset.M1 => "-1",
Modeset.M2 => "-2",
Modeset.M3 => "-3",
Modeset.M4 => "-4",
Modeset.M5 => "-5",
Modeset.M6 => "-6",
Modeset.M7 => "-7",
Modeset.M8 => "-8",
Modeset.M9 => "-9",
Modeset.Custom1 => GetArguments(Config.Current.CustomSettings1),
Modeset.Custom2 => GetArguments(Config.Current.CustomSettings2),
Modeset.Custom3 => GetArguments(Config.Current.CustomSettings3),
_ => "-9",
};
}

public static GDPISettings ToSettings(this Modeset modeset)
{
return modeset switch
{
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 },
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 },
Modeset.M3 => new GDPISettings { P = true, R = true, S = true, E = true, E_V = 2 },
Modeset.M4 => new GDPISettings { P = true, R = true, S = true },
Modeset.M5 => new GDPISettings { F = true, F_V = 2, E = true, E_V = 2, ATTL = true, RFrag = true, MP = true, MP_V = 1200 },
Modeset.M6 => new GDPISettings { F = true, F_V = 2, E = true, E_V = 2, Seq = true, RFrag = true, MP = true, MP_V = 1200 },
Modeset.M7 => new GDPISettings { F = true, F_V = 2, E = true, E_V = 2, ChkSum = true, RFrag = true, MP = true, MP_V = 1200 },
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 },
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 },
_ => new GDPISettings(),
};
}

private static string GetArguments(GDPISettings settings) => settings.Arguments ?? settings.ToArguments();
}
}
133 changes: 75 additions & 58 deletions GDPIControl/FormMain.Designer.cs

Large diffs are not rendered by default.

15 changes: 5 additions & 10 deletions GDPIControl/FormMain.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using GDPIControl.Forms;
using GDPIControl.Extensions;
using GDPIControl.Forms;
using GDPIControl.Model;
using GDPIControl.Properties;
using System;
Expand Down Expand Up @@ -65,14 +66,7 @@ private void CloseGDPIControl()
private void RefreshArguments()
{
Settings.Modeset = RBModesets.First(X => X.Button.Checked).Modeset;
var Arguments = Settings.Modeset switch
{
Modeset.Custom1 => Settings.CustomSettings1.ToArguments(),
Modeset.Custom2 => Settings.CustomSettings2.ToArguments(),
Modeset.Custom3 => Settings.CustomSettings3.ToArguments(),
_ => GDPISettings.ModesetArgument(Settings.Modeset)
};

var Arguments = Settings.Modeset.ToArgument();
if (Settings.UseBlacklist) { Arguments += $@" --blacklist ""{Constants.BlacklistPath}"""; }
if (Settings.UseUserlist) { Arguments += $@" --blacklist ""{Constants.UserlistPath}"""; }
Settings.Arguments = Arguments;
Expand Down Expand Up @@ -100,6 +94,7 @@ private void StartGDPI()
Icon = Resources.icon_green;
RefreshArguments();
GDPIProcess.Start();
RefreshUI();
}

private void StopGDPI()
Expand All @@ -112,14 +107,14 @@ private void StopGDPI()
Icon = Resources.icon_red;
RefreshArguments();
GDPIProcess.Stop();
RefreshUI();
}

private void UIState(bool state)
{
B_Restart.Enabled = state;
B_Start.Enabled = state;
B_Close.Enabled = state;
if (state) { RefreshUI(); }
}

#region UIEvents
Expand Down
68 changes: 30 additions & 38 deletions GDPIControl/Forms/FormBlacklist.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6874be1

Please sign in to comment.