mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Integrated debloater
This commit is contained in:
139
app/Extra.Designer.cs
generated
139
app/Extra.Designer.cs
generated
@@ -93,6 +93,9 @@ namespace GHelper
|
||||
checkVariBright = new CheckBox();
|
||||
checkGpuApps = new CheckBox();
|
||||
checkFnLock = new CheckBox();
|
||||
panelServices = new Panel();
|
||||
labelServices = new Label();
|
||||
buttonServices = new RButton();
|
||||
groupBindings.SuspendLayout();
|
||||
tableKeys.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureHelp).BeginInit();
|
||||
@@ -104,6 +107,7 @@ namespace GHelper
|
||||
panelXMG.SuspendLayout();
|
||||
tableBacklight.SuspendLayout();
|
||||
groupOther.SuspendLayout();
|
||||
panelServices.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBindings
|
||||
@@ -380,7 +384,7 @@ namespace GHelper
|
||||
groupLight.Margin = new Padding(4, 2, 4, 2);
|
||||
groupLight.Name = "groupLight";
|
||||
groupLight.Padding = new Padding(4, 2, 4, 11);
|
||||
groupLight.Size = new Size(966, 554);
|
||||
groupLight.Size = new Size(966, 526);
|
||||
groupLight.TabIndex = 1;
|
||||
groupLight.TabStop = false;
|
||||
groupLight.Text = "Keyboard Backlight";
|
||||
@@ -398,15 +402,15 @@ namespace GHelper
|
||||
panelBacklightExtra.Controls.Add(labelSpeed);
|
||||
panelBacklightExtra.Controls.Add(comboKeyboardSpeed);
|
||||
panelBacklightExtra.Dock = DockStyle.Top;
|
||||
panelBacklightExtra.Location = new Point(4, 315);
|
||||
panelBacklightExtra.Location = new Point(4, 299);
|
||||
panelBacklightExtra.Margin = new Padding(4, 2, 4, 2);
|
||||
panelBacklightExtra.Name = "panelBacklightExtra";
|
||||
panelBacklightExtra.Size = new Size(958, 228);
|
||||
panelBacklightExtra.Size = new Size(958, 216);
|
||||
panelBacklightExtra.TabIndex = 43;
|
||||
//
|
||||
// numericBacklightPluggedTime
|
||||
//
|
||||
numericBacklightPluggedTime.Location = new Point(702, 181);
|
||||
numericBacklightPluggedTime.Location = new Point(702, 169);
|
||||
numericBacklightPluggedTime.Margin = new Padding(4, 2, 4, 2);
|
||||
numericBacklightPluggedTime.Maximum = new decimal(new int[] { 3600, 0, 0, 0 });
|
||||
numericBacklightPluggedTime.Name = "numericBacklightPluggedTime";
|
||||
@@ -415,7 +419,7 @@ namespace GHelper
|
||||
//
|
||||
// labelBacklightTimeoutPlugged
|
||||
//
|
||||
labelBacklightTimeoutPlugged.Location = new Point(13, 183);
|
||||
labelBacklightTimeoutPlugged.Location = new Point(13, 171);
|
||||
labelBacklightTimeoutPlugged.Margin = new Padding(4, 0, 4, 0);
|
||||
labelBacklightTimeoutPlugged.Name = "labelBacklightTimeoutPlugged";
|
||||
labelBacklightTimeoutPlugged.Size = new Size(683, 45);
|
||||
@@ -424,7 +428,7 @@ namespace GHelper
|
||||
//
|
||||
// numericBacklightTime
|
||||
//
|
||||
numericBacklightTime.Location = new Point(702, 132);
|
||||
numericBacklightTime.Location = new Point(702, 120);
|
||||
numericBacklightTime.Margin = new Padding(4, 2, 4, 2);
|
||||
numericBacklightTime.Maximum = new decimal(new int[] { 3600, 0, 0, 0 });
|
||||
numericBacklightTime.Name = "numericBacklightTime";
|
||||
@@ -433,7 +437,7 @@ namespace GHelper
|
||||
//
|
||||
// labelBacklightTimeout
|
||||
//
|
||||
labelBacklightTimeout.Location = new Point(13, 134);
|
||||
labelBacklightTimeout.Location = new Point(13, 122);
|
||||
labelBacklightTimeout.Margin = new Padding(4, 0, 4, 0);
|
||||
labelBacklightTimeout.Name = "labelBacklightTimeout";
|
||||
labelBacklightTimeout.Size = new Size(683, 45);
|
||||
@@ -452,7 +456,7 @@ namespace GHelper
|
||||
// trackBrightness
|
||||
//
|
||||
trackBrightness.LargeChange = 1;
|
||||
trackBrightness.Location = new Point(355, 60);
|
||||
trackBrightness.Location = new Point(355, 59);
|
||||
trackBrightness.Margin = new Padding(4, 2, 4, 2);
|
||||
trackBrightness.Maximum = 3;
|
||||
trackBrightness.Name = "trackBrightness";
|
||||
@@ -462,7 +466,7 @@ namespace GHelper
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
labelSpeed.Location = new Point(13, 15);
|
||||
labelSpeed.Location = new Point(13, 18);
|
||||
labelSpeed.Margin = new Padding(4, 0, 4, 0);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(539, 41);
|
||||
@@ -478,7 +482,7 @@ namespace GHelper
|
||||
comboKeyboardSpeed.FormattingEnabled = true;
|
||||
comboKeyboardSpeed.ItemHeight = 32;
|
||||
comboKeyboardSpeed.Items.AddRange(new object[] { "Slow", "Normal", "Fast" });
|
||||
comboKeyboardSpeed.Location = new Point(607, 15);
|
||||
comboKeyboardSpeed.Location = new Point(607, 16);
|
||||
comboKeyboardSpeed.Margin = new Padding(4, 11, 4, 9);
|
||||
comboKeyboardSpeed.Name = "comboKeyboardSpeed";
|
||||
comboKeyboardSpeed.Size = new Size(292, 40);
|
||||
@@ -489,7 +493,7 @@ namespace GHelper
|
||||
//
|
||||
panelXMG.Controls.Add(checkXMG);
|
||||
panelXMG.Dock = DockStyle.Top;
|
||||
panelXMG.Location = new Point(4, 257);
|
||||
panelXMG.Location = new Point(4, 241);
|
||||
panelXMG.Margin = new Padding(4, 2, 4, 2);
|
||||
panelXMG.Name = "panelXMG";
|
||||
panelXMG.Size = new Size(958, 58);
|
||||
@@ -545,7 +549,7 @@ namespace GHelper
|
||||
tableBacklight.RowStyles.Add(new RowStyle());
|
||||
tableBacklight.RowStyles.Add(new RowStyle());
|
||||
tableBacklight.RowStyles.Add(new RowStyle());
|
||||
tableBacklight.Size = new Size(958, 223);
|
||||
tableBacklight.Size = new Size(958, 207);
|
||||
tableBacklight.TabIndex = 41;
|
||||
//
|
||||
// labelBacklight
|
||||
@@ -563,8 +567,8 @@ namespace GHelper
|
||||
// checkAwake
|
||||
//
|
||||
checkAwake.Dock = DockStyle.Fill;
|
||||
checkAwake.Location = new Point(4, 45);
|
||||
checkAwake.Margin = new Padding(4, 2, 4, 2);
|
||||
checkAwake.Location = new Point(4, 43);
|
||||
checkAwake.Margin = new Padding(4, 0, 4, 0);
|
||||
checkAwake.Name = "checkAwake";
|
||||
checkAwake.Padding = new Padding(15, 2, 6, 2);
|
||||
checkAwake.Size = new Size(231, 41);
|
||||
@@ -575,8 +579,8 @@ namespace GHelper
|
||||
// checkBoot
|
||||
//
|
||||
checkBoot.Dock = DockStyle.Fill;
|
||||
checkBoot.Location = new Point(4, 90);
|
||||
checkBoot.Margin = new Padding(4, 2, 4, 2);
|
||||
checkBoot.Location = new Point(4, 84);
|
||||
checkBoot.Margin = new Padding(4, 0, 4, 0);
|
||||
checkBoot.Name = "checkBoot";
|
||||
checkBoot.Padding = new Padding(15, 2, 6, 2);
|
||||
checkBoot.Size = new Size(231, 41);
|
||||
@@ -587,8 +591,8 @@ namespace GHelper
|
||||
// checkSleep
|
||||
//
|
||||
checkSleep.Dock = DockStyle.Fill;
|
||||
checkSleep.Location = new Point(4, 135);
|
||||
checkSleep.Margin = new Padding(4, 2, 4, 2);
|
||||
checkSleep.Location = new Point(4, 125);
|
||||
checkSleep.Margin = new Padding(4, 0, 4, 0);
|
||||
checkSleep.Name = "checkSleep";
|
||||
checkSleep.Padding = new Padding(15, 2, 6, 2);
|
||||
checkSleep.Size = new Size(231, 41);
|
||||
@@ -599,8 +603,8 @@ namespace GHelper
|
||||
// checkShutdown
|
||||
//
|
||||
checkShutdown.Dock = DockStyle.Fill;
|
||||
checkShutdown.Location = new Point(4, 180);
|
||||
checkShutdown.Margin = new Padding(4, 2, 4, 2);
|
||||
checkShutdown.Location = new Point(4, 166);
|
||||
checkShutdown.Margin = new Padding(4, 0, 4, 0);
|
||||
checkShutdown.Name = "checkShutdown";
|
||||
checkShutdown.Padding = new Padding(15, 2, 6, 2);
|
||||
checkShutdown.Size = new Size(231, 41);
|
||||
@@ -623,8 +627,8 @@ namespace GHelper
|
||||
// checkAwakeLogo
|
||||
//
|
||||
checkAwakeLogo.Dock = DockStyle.Fill;
|
||||
checkAwakeLogo.Location = new Point(243, 45);
|
||||
checkAwakeLogo.Margin = new Padding(4, 2, 4, 2);
|
||||
checkAwakeLogo.Location = new Point(243, 43);
|
||||
checkAwakeLogo.Margin = new Padding(4, 0, 4, 0);
|
||||
checkAwakeLogo.Name = "checkAwakeLogo";
|
||||
checkAwakeLogo.Padding = new Padding(15, 2, 6, 2);
|
||||
checkAwakeLogo.Size = new Size(231, 41);
|
||||
@@ -635,8 +639,8 @@ namespace GHelper
|
||||
// checkBootLogo
|
||||
//
|
||||
checkBootLogo.Dock = DockStyle.Fill;
|
||||
checkBootLogo.Location = new Point(243, 90);
|
||||
checkBootLogo.Margin = new Padding(4, 2, 4, 2);
|
||||
checkBootLogo.Location = new Point(243, 84);
|
||||
checkBootLogo.Margin = new Padding(4, 0, 4, 0);
|
||||
checkBootLogo.Name = "checkBootLogo";
|
||||
checkBootLogo.Padding = new Padding(15, 2, 6, 2);
|
||||
checkBootLogo.Size = new Size(231, 41);
|
||||
@@ -647,8 +651,8 @@ namespace GHelper
|
||||
// checkSleepLogo
|
||||
//
|
||||
checkSleepLogo.Dock = DockStyle.Fill;
|
||||
checkSleepLogo.Location = new Point(243, 135);
|
||||
checkSleepLogo.Margin = new Padding(4, 2, 4, 2);
|
||||
checkSleepLogo.Location = new Point(243, 125);
|
||||
checkSleepLogo.Margin = new Padding(4, 0, 4, 0);
|
||||
checkSleepLogo.Name = "checkSleepLogo";
|
||||
checkSleepLogo.Padding = new Padding(15, 2, 6, 2);
|
||||
checkSleepLogo.Size = new Size(231, 41);
|
||||
@@ -659,8 +663,8 @@ namespace GHelper
|
||||
// checkShutdownLogo
|
||||
//
|
||||
checkShutdownLogo.Dock = DockStyle.Fill;
|
||||
checkShutdownLogo.Location = new Point(243, 180);
|
||||
checkShutdownLogo.Margin = new Padding(4, 2, 4, 2);
|
||||
checkShutdownLogo.Location = new Point(243, 166);
|
||||
checkShutdownLogo.Margin = new Padding(4, 0, 4, 0);
|
||||
checkShutdownLogo.Name = "checkShutdownLogo";
|
||||
checkShutdownLogo.Padding = new Padding(15, 2, 6, 2);
|
||||
checkShutdownLogo.Size = new Size(231, 41);
|
||||
@@ -683,8 +687,8 @@ namespace GHelper
|
||||
// checkAwakeBar
|
||||
//
|
||||
checkAwakeBar.Dock = DockStyle.Fill;
|
||||
checkAwakeBar.Location = new Point(482, 45);
|
||||
checkAwakeBar.Margin = new Padding(4, 2, 4, 2);
|
||||
checkAwakeBar.Location = new Point(482, 43);
|
||||
checkAwakeBar.Margin = new Padding(4, 0, 4, 0);
|
||||
checkAwakeBar.Name = "checkAwakeBar";
|
||||
checkAwakeBar.Padding = new Padding(15, 2, 6, 2);
|
||||
checkAwakeBar.Size = new Size(231, 41);
|
||||
@@ -695,8 +699,8 @@ namespace GHelper
|
||||
// checkBootBar
|
||||
//
|
||||
checkBootBar.Dock = DockStyle.Fill;
|
||||
checkBootBar.Location = new Point(482, 90);
|
||||
checkBootBar.Margin = new Padding(4, 2, 4, 2);
|
||||
checkBootBar.Location = new Point(482, 84);
|
||||
checkBootBar.Margin = new Padding(4, 0, 4, 0);
|
||||
checkBootBar.Name = "checkBootBar";
|
||||
checkBootBar.Padding = new Padding(15, 2, 6, 2);
|
||||
checkBootBar.Size = new Size(231, 41);
|
||||
@@ -707,8 +711,8 @@ namespace GHelper
|
||||
// checkSleepBar
|
||||
//
|
||||
checkSleepBar.Dock = DockStyle.Fill;
|
||||
checkSleepBar.Location = new Point(482, 135);
|
||||
checkSleepBar.Margin = new Padding(4, 2, 4, 2);
|
||||
checkSleepBar.Location = new Point(482, 125);
|
||||
checkSleepBar.Margin = new Padding(4, 0, 4, 0);
|
||||
checkSleepBar.Name = "checkSleepBar";
|
||||
checkSleepBar.Padding = new Padding(15, 2, 6, 2);
|
||||
checkSleepBar.Size = new Size(231, 41);
|
||||
@@ -719,8 +723,8 @@ namespace GHelper
|
||||
// checkShutdownBar
|
||||
//
|
||||
checkShutdownBar.Dock = DockStyle.Fill;
|
||||
checkShutdownBar.Location = new Point(482, 180);
|
||||
checkShutdownBar.Margin = new Padding(4, 2, 4, 2);
|
||||
checkShutdownBar.Location = new Point(482, 166);
|
||||
checkShutdownBar.Margin = new Padding(4, 0, 4, 0);
|
||||
checkShutdownBar.Name = "checkShutdownBar";
|
||||
checkShutdownBar.Padding = new Padding(15, 2, 6, 2);
|
||||
checkShutdownBar.Size = new Size(231, 41);
|
||||
@@ -743,8 +747,8 @@ namespace GHelper
|
||||
// checkAwakeLid
|
||||
//
|
||||
checkAwakeLid.Dock = DockStyle.Fill;
|
||||
checkAwakeLid.Location = new Point(721, 45);
|
||||
checkAwakeLid.Margin = new Padding(4, 2, 4, 2);
|
||||
checkAwakeLid.Location = new Point(721, 43);
|
||||
checkAwakeLid.Margin = new Padding(4, 0, 4, 0);
|
||||
checkAwakeLid.Name = "checkAwakeLid";
|
||||
checkAwakeLid.Padding = new Padding(15, 2, 6, 2);
|
||||
checkAwakeLid.Size = new Size(233, 41);
|
||||
@@ -755,8 +759,8 @@ namespace GHelper
|
||||
// checkBootLid
|
||||
//
|
||||
checkBootLid.Dock = DockStyle.Fill;
|
||||
checkBootLid.Location = new Point(721, 90);
|
||||
checkBootLid.Margin = new Padding(4, 2, 4, 2);
|
||||
checkBootLid.Location = new Point(721, 84);
|
||||
checkBootLid.Margin = new Padding(4, 0, 4, 0);
|
||||
checkBootLid.Name = "checkBootLid";
|
||||
checkBootLid.Padding = new Padding(15, 2, 6, 2);
|
||||
checkBootLid.Size = new Size(233, 41);
|
||||
@@ -767,8 +771,8 @@ namespace GHelper
|
||||
// checkSleepLid
|
||||
//
|
||||
checkSleepLid.Dock = DockStyle.Fill;
|
||||
checkSleepLid.Location = new Point(721, 135);
|
||||
checkSleepLid.Margin = new Padding(4, 2, 4, 2);
|
||||
checkSleepLid.Location = new Point(721, 125);
|
||||
checkSleepLid.Margin = new Padding(4, 0, 4, 0);
|
||||
checkSleepLid.Name = "checkSleepLid";
|
||||
checkSleepLid.Padding = new Padding(15, 2, 6, 2);
|
||||
checkSleepLid.Size = new Size(233, 41);
|
||||
@@ -779,8 +783,8 @@ namespace GHelper
|
||||
// checkShutdownLid
|
||||
//
|
||||
checkShutdownLid.Dock = DockStyle.Fill;
|
||||
checkShutdownLid.Location = new Point(721, 180);
|
||||
checkShutdownLid.Margin = new Padding(4, 2, 4, 2);
|
||||
checkShutdownLid.Location = new Point(721, 166);
|
||||
checkShutdownLid.Margin = new Padding(4, 0, 4, 0);
|
||||
checkShutdownLid.Name = "checkShutdownLid";
|
||||
checkShutdownLid.Padding = new Padding(15, 2, 6, 2);
|
||||
checkShutdownLid.Size = new Size(233, 41);
|
||||
@@ -800,7 +804,7 @@ namespace GHelper
|
||||
groupOther.Controls.Add(checkGpuApps);
|
||||
groupOther.Controls.Add(checkFnLock);
|
||||
groupOther.Dock = DockStyle.Top;
|
||||
groupOther.Location = new Point(9, 908);
|
||||
groupOther.Location = new Point(9, 880);
|
||||
groupOther.Margin = new Padding(4, 2, 4, 2);
|
||||
groupOther.Name = "groupOther";
|
||||
groupOther.Padding = new Padding(20, 2, 4, 10);
|
||||
@@ -894,13 +898,51 @@ namespace GHelper
|
||||
checkFnLock.Text = "Process Fn+F hotkeys without Fn";
|
||||
checkFnLock.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// panelServices
|
||||
//
|
||||
panelServices.Controls.Add(labelServices);
|
||||
panelServices.Controls.Add(buttonServices);
|
||||
panelServices.Dock = DockStyle.Top;
|
||||
panelServices.Location = new Point(9, 1176);
|
||||
panelServices.Name = "panelServices";
|
||||
panelServices.Size = new Size(966, 72);
|
||||
panelServices.TabIndex = 3;
|
||||
//
|
||||
// labelServices
|
||||
//
|
||||
labelServices.AutoSize = true;
|
||||
labelServices.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelServices.Location = new Point(23, 19);
|
||||
labelServices.Name = "labelServices";
|
||||
labelServices.Size = new Size(273, 32);
|
||||
labelServices.TabIndex = 20;
|
||||
labelServices.Text = "Asus Services Running";
|
||||
//
|
||||
// buttonServices
|
||||
//
|
||||
buttonServices.Activated = false;
|
||||
buttonServices.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonServices.BackColor = SystemColors.ControlLight;
|
||||
buttonServices.BorderColor = Color.Transparent;
|
||||
buttonServices.BorderRadius = 2;
|
||||
buttonServices.FlatStyle = FlatStyle.Flat;
|
||||
buttonServices.Location = new Point(695, 14);
|
||||
buttonServices.Margin = new Padding(4, 2, 4, 2);
|
||||
buttonServices.Name = "buttonServices";
|
||||
buttonServices.Secondary = true;
|
||||
buttonServices.Size = new Size(250, 44);
|
||||
buttonServices.TabIndex = 19;
|
||||
buttonServices.Text = "Start Services";
|
||||
buttonServices.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// Extra
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
AutoSize = true;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ClientSize = new Size(984, 1244);
|
||||
ClientSize = new Size(984, 1262);
|
||||
Controls.Add(panelServices);
|
||||
Controls.Add(groupOther);
|
||||
Controls.Add(groupLight);
|
||||
Controls.Add(groupBindings);
|
||||
@@ -931,6 +973,8 @@ namespace GHelper
|
||||
tableBacklight.ResumeLayout(false);
|
||||
groupOther.ResumeLayout(false);
|
||||
groupOther.PerformLayout();
|
||||
panelServices.ResumeLayout(false);
|
||||
panelServices.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@@ -999,5 +1043,8 @@ namespace GHelper
|
||||
private RComboBox comboFNC;
|
||||
private TextBox textFNC;
|
||||
private CheckBox checkVariBright;
|
||||
private Panel panelServices;
|
||||
private RButton buttonServices;
|
||||
private Label labelServices;
|
||||
}
|
||||
}
|
||||
55
app/Extra.cs
55
app/Extra.cs
@@ -1,6 +1,5 @@
|
||||
using CustomControls;
|
||||
using GHelper.Gpu;
|
||||
using Microsoft.VisualBasic.Devices;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace GHelper
|
||||
@@ -231,7 +230,61 @@ namespace GHelper
|
||||
|
||||
pictureHelp.Click += PictureHelp_Click;
|
||||
|
||||
buttonServices.Click += ButtonServices_Click;
|
||||
|
||||
InitVariBright();
|
||||
InitServices();
|
||||
}
|
||||
|
||||
|
||||
private void InitServices()
|
||||
{
|
||||
if (OptimizationService.IsRunning()) buttonServices.Text = Properties.Strings.Stop;
|
||||
else buttonServices.Text = Properties.Strings.Start;
|
||||
|
||||
labelServices.Text = Properties.Strings.AsusServicesRunning + ": " + OptimizationService.GetRunningCount();
|
||||
buttonServices.Enabled = true;
|
||||
|
||||
Program.inputDispatcher.Init();
|
||||
|
||||
}
|
||||
|
||||
public void ServiesToggle()
|
||||
{
|
||||
buttonServices.Enabled = false;
|
||||
|
||||
if (OptimizationService.IsRunning())
|
||||
{
|
||||
labelServices.Text = Properties.Strings.StoppingServices + " ...";
|
||||
Task.Run(() =>
|
||||
{
|
||||
OptimizationService.StopAsusServices();
|
||||
BeginInvoke(delegate
|
||||
{
|
||||
InitServices();
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
labelServices.Text = Properties.Strings.StartingServices + " ...";
|
||||
Task.Run(() =>
|
||||
{
|
||||
OptimizationService.StartAsusServices();
|
||||
BeginInvoke(delegate
|
||||
{
|
||||
InitServices();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonServices_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ProcessHelper.IsUserAdministrator())
|
||||
ServiesToggle();
|
||||
else
|
||||
ProcessHelper.RunAsAdmin("services");
|
||||
}
|
||||
|
||||
private void InitVariBright()
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.80</AssemblyVersion>
|
||||
<AssemblyVersion>0.81</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
@@ -91,43 +91,6 @@ public class NvidiaGpuControl : IGpuControl
|
||||
|
||||
}
|
||||
|
||||
private static void RunCMD(string name, string args)
|
||||
{
|
||||
var cmd = new Process();
|
||||
cmd.StartInfo.UseShellExecute = false;
|
||||
cmd.StartInfo.CreateNoWindow = true;
|
||||
cmd.StartInfo.RedirectStandardOutput = true;
|
||||
cmd.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
cmd.StartInfo.FileName = name;
|
||||
cmd.StartInfo.Arguments = args;
|
||||
cmd.Start();
|
||||
Logger.WriteLine(cmd.StandardOutput.ReadToEnd());
|
||||
cmd.WaitForExit();
|
||||
}
|
||||
|
||||
|
||||
public bool RestartGPUPnP()
|
||||
{
|
||||
|
||||
if (!IsValid) return false;
|
||||
|
||||
try
|
||||
{
|
||||
PhysicalGPU internalGpu = _internalGpu!;
|
||||
var pnpDeviceId = internalGpu.BusInformation.PCIIdentifiers.ToString();
|
||||
Logger.WriteLine("Device ID:" + pnpDeviceId);
|
||||
RunCMD("pnputil", $"/disable-device /deviceid \"{pnpDeviceId}\"");
|
||||
Thread.Sleep(3000);
|
||||
RunCMD("pnputil", $"/enable-device /deviceid \"{pnpDeviceId}\"");
|
||||
Thread.Sleep(2000);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool RestartGPU()
|
||||
{
|
||||
@@ -135,7 +98,7 @@ public class NvidiaGpuControl : IGpuControl
|
||||
{
|
||||
string script = @"$device = Get-PnpDevice | Where-Object { $_.FriendlyName -imatch 'NVIDIA' -and $_.Class -eq 'Display' }; Disable-PnpDevice $device.InstanceId -Confirm:$false; Start-Sleep -Seconds 3; Enable-PnpDevice $device.InstanceId -Confirm:$false";
|
||||
Logger.WriteLine(script);
|
||||
RunCMD("powershell", script);
|
||||
ProcessHelper.RunCMD("powershell", script);
|
||||
//Thread.Sleep(2000);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,27 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Win32;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
public static class OptimizationService
|
||||
{
|
||||
public static void SetChargeLimit (int newValue)
|
||||
|
||||
static List<string> services = new() {
|
||||
"AsusAppService",
|
||||
"ASUSLinkNear",
|
||||
"ASUSLinkRemote",
|
||||
"ASUSSoftwareManager",
|
||||
"ASUSSwitch",
|
||||
"ASUSSystemAnalysis",
|
||||
"ASUSSystemDiagnosis",
|
||||
"ArmouryCrateControlInterface",
|
||||
"AsusCertService",
|
||||
"ASUSOptimization"
|
||||
};
|
||||
|
||||
public static void SetChargeLimit(int newValue)
|
||||
{
|
||||
// Set the path to the .ini file
|
||||
string path = @"C:\ProgramData\ASUS\ASUS System Control Interface\ASUSOptimization\Customization.ini";
|
||||
@@ -41,6 +55,16 @@ namespace GHelper
|
||||
return (Process.GetProcessesByName("AsusOptimization").Count() > 0);
|
||||
}
|
||||
|
||||
public static int GetRunningCount()
|
||||
{
|
||||
int count = 0;
|
||||
foreach (string service in services)
|
||||
{
|
||||
if (Process.GetProcessesByName(service).Count() > 0) count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
public static void SetBacklightOffDelay(int value = 60)
|
||||
{
|
||||
@@ -60,6 +84,23 @@ namespace GHelper
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void StopAsusServices()
|
||||
{
|
||||
foreach (string service in services)
|
||||
{
|
||||
ProcessHelper.StopDisableService(service);
|
||||
}
|
||||
}
|
||||
|
||||
public static void StartAsusServices()
|
||||
{
|
||||
foreach (string service in services)
|
||||
{
|
||||
ProcessHelper.StartEnableService(service);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -92,6 +92,48 @@ namespace GHelper
|
||||
}
|
||||
}
|
||||
|
||||
public static void StopDisableService(string serviceName)
|
||||
{
|
||||
try
|
||||
{
|
||||
string script = $"Set-Service -Name \"{serviceName}\" -Status stopped -StartupType disabled";
|
||||
Logger.WriteLine(script);
|
||||
RunCMD("powershell", script);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void StartEnableService(string serviceName)
|
||||
{
|
||||
try
|
||||
{
|
||||
string script = $"Set-Service -Name \"{serviceName}\" -Status running -StartupType Automatic";
|
||||
Logger.WriteLine(script);
|
||||
RunCMD("powershell", script);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void RunCMD(string name, string args)
|
||||
{
|
||||
var cmd = new Process();
|
||||
cmd.StartInfo.UseShellExecute = false;
|
||||
cmd.StartInfo.CreateNoWindow = true;
|
||||
cmd.StartInfo.RedirectStandardOutput = true;
|
||||
cmd.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
cmd.StartInfo.FileName = name;
|
||||
cmd.StartInfo.Arguments = args;
|
||||
cmd.Start();
|
||||
Logger.WriteLine(cmd.StandardOutput.ReadToEnd());
|
||||
cmd.WaitForExit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Security.Principal;
|
||||
using System.Windows.Forms;
|
||||
using static NativeMethods;
|
||||
|
||||
namespace GHelper
|
||||
@@ -188,6 +189,11 @@ namespace GHelper
|
||||
case "gpurestart":
|
||||
settingsForm.RestartGPU(false);
|
||||
break;
|
||||
case "services":
|
||||
settingsForm.keyb = new Extra();
|
||||
settingsForm.keyb.Show();
|
||||
settingsForm.keyb.ServiesToggle();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
45
app/Properties/Strings.Designer.cs
generated
45
app/Properties/Strings.Designer.cs
generated
@@ -177,6 +177,15 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Asus Services Running.
|
||||
/// </summary>
|
||||
internal static string AsusServicesRunning {
|
||||
get {
|
||||
return ResourceManager.GetString("AsusServicesRunning", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Breathe.
|
||||
/// </summary>
|
||||
@@ -1041,6 +1050,24 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Start.
|
||||
/// </summary>
|
||||
internal static string Start {
|
||||
get {
|
||||
return ResourceManager.GetString("Start", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Starting Services.
|
||||
/// </summary>
|
||||
internal static string StartingServices {
|
||||
get {
|
||||
return ResourceManager.GetString("StartingServices", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Startup Error.
|
||||
/// </summary>
|
||||
@@ -1050,6 +1077,24 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Stop.
|
||||
/// </summary>
|
||||
internal static string Stop {
|
||||
get {
|
||||
return ResourceManager.GetString("Stop", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Stopping Services.
|
||||
/// </summary>
|
||||
internal static string StoppingServices {
|
||||
get {
|
||||
return ResourceManager.GetString("StoppingServices", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Toggle Aura.
|
||||
/// </summary>
|
||||
|
||||
@@ -156,6 +156,9 @@
|
||||
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
|
||||
<value>Auto adjust Windows Power Modes</value>
|
||||
</data>
|
||||
<data name="AsusServicesRunning" xml:space="preserve">
|
||||
<value>Asus Services Running</value>
|
||||
</data>
|
||||
<data name="AuraBreathe" xml:space="preserve">
|
||||
<value>Breathe</value>
|
||||
</data>
|
||||
@@ -444,9 +447,21 @@
|
||||
<data name="StandardMode" xml:space="preserve">
|
||||
<value>Standard</value>
|
||||
</data>
|
||||
<data name="Start" xml:space="preserve">
|
||||
<value>Start</value>
|
||||
</data>
|
||||
<data name="StartingServices" xml:space="preserve">
|
||||
<value>Starting Services</value>
|
||||
</data>
|
||||
<data name="StartupError" xml:space="preserve">
|
||||
<value>Startup Error</value>
|
||||
</data>
|
||||
<data name="Stop" xml:space="preserve">
|
||||
<value>Stop</value>
|
||||
</data>
|
||||
<data name="StoppingServices" xml:space="preserve">
|
||||
<value>Stopping Services</value>
|
||||
</data>
|
||||
<data name="ToggleAura" xml:space="preserve">
|
||||
<value>Toggle Aura</value>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user