mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
10 Commits
gamma
...
slash_ligh
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f326fa99cc | ||
|
|
ab44dbf2b4 | ||
|
|
6e88cd2304 | ||
|
|
7639950843 | ||
|
|
c4cd7748f6 | ||
|
|
1adec8b6c9 | ||
|
|
ae298873ca | ||
|
|
773a5899d1 | ||
|
|
72888401b9 | ||
|
|
6a44c42cbf |
@@ -389,11 +389,6 @@ public static class AppConfig
|
||||
return ContainsModel("GA503") || IsSlash();
|
||||
}
|
||||
|
||||
public static bool IsOLED()
|
||||
{
|
||||
return ContainsModel("OLED") || IsSlash() || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("K360") || ContainsModel("X150");
|
||||
}
|
||||
|
||||
public static bool IsStrix()
|
||||
{
|
||||
return ContainsModel("Strix") || ContainsModel("Scar") || ContainsModel("G703G");
|
||||
|
||||
@@ -46,6 +46,7 @@ public class AsusACPI
|
||||
public const int KB_DUO_PgUpDn = 0x4B;
|
||||
public const int KB_DUO_SecondDisplay = 0x6A;
|
||||
|
||||
|
||||
public const int Touchpad_Toggle = 0x6B;
|
||||
|
||||
public const int ChargerMode = 0x0012006C;
|
||||
@@ -105,7 +106,7 @@ public class AsusACPI
|
||||
public const int TUF_KB2 = 0x0010005a;
|
||||
public const int TUF_KB_STATE = 0x00100057;
|
||||
|
||||
public const int MicMuteLed = 0x00040017;
|
||||
public const int MICMUTE_LED = 0x00040017;
|
||||
|
||||
public const int TabletState = 0x00060077;
|
||||
public const int FnLock = 0x00100023;
|
||||
@@ -113,8 +114,6 @@ public class AsusACPI
|
||||
public const int ScreenPadToggle = 0x00050031;
|
||||
public const int ScreenPadBrightness = 0x00050032;
|
||||
|
||||
public const int CameraLed = 0x00060079;
|
||||
|
||||
public const int BootSound = 0x00130022;
|
||||
|
||||
public const int Tablet_Notebook = 0;
|
||||
@@ -514,25 +513,16 @@ public class AsusACPI
|
||||
default: fan_mode = 0; break;
|
||||
}
|
||||
|
||||
byte[] result;
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case AsusFan.GPU:
|
||||
result = DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
|
||||
break;
|
||||
return DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
|
||||
case AsusFan.Mid:
|
||||
result = DeviceGetBuffer(DevsMidFanCurve, fan_mode);
|
||||
break;
|
||||
return DeviceGetBuffer(DevsMidFanCurve, fan_mode);
|
||||
default:
|
||||
result = DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
|
||||
break;
|
||||
return DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
|
||||
}
|
||||
|
||||
Logger.WriteLine($"GetFan {device} :" + BitConverter.ToString(result));
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public static bool IsInvalidCurve(byte[] curve)
|
||||
@@ -674,32 +664,22 @@ public class AsusACPI
|
||||
}
|
||||
}
|
||||
|
||||
public string ScanRange()
|
||||
public void ScanRange()
|
||||
{
|
||||
int value;
|
||||
string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
|
||||
string logFile = appPath + "\\scan.txt";
|
||||
using (StreamWriter w = File.AppendText(logFile))
|
||||
for (uint i = 0x00000000; i <= 0x00160000; i++)
|
||||
{
|
||||
w.WriteLine($"Scan started {DateTime.Now}");
|
||||
for (uint i = 0x00000000; i <= 0x00160000; i += 0x10000)
|
||||
{
|
||||
for (uint j = 0x00; j <= 0xFF; j++)
|
||||
value = DeviceGet(i);
|
||||
if (value >= 0)
|
||||
using (StreamWriter w = File.AppendText(logFile))
|
||||
{
|
||||
uint id = i + j;
|
||||
value = DeviceGet(id);
|
||||
if (value >= 0)
|
||||
{
|
||||
w.WriteLine(id.ToString("X8") + ": " + value.ToString("X4") + " (" + value + ")");
|
||||
}
|
||||
w.WriteLine(i.ToString("X8") + ": " + value.ToString("X4") + " (" + value + ")");
|
||||
w.Close();
|
||||
}
|
||||
}
|
||||
w.WriteLine($"---------------------");
|
||||
w.Close();
|
||||
}
|
||||
|
||||
return logFile;
|
||||
|
||||
}
|
||||
|
||||
public void TUFKeyboardBrightness(int brightness)
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
namespace GHelper.Display
|
||||
{
|
||||
|
||||
public class DisplayGammaRamp
|
||||
{
|
||||
|
||||
public DisplayGammaRamp(ushort[] red, ushort[] green, ushort[] blue)
|
||||
{
|
||||
if (red?.Length != GammaRamp.DataPoints)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(red));
|
||||
}
|
||||
|
||||
if (green?.Length != GammaRamp.DataPoints)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(green));
|
||||
}
|
||||
|
||||
if (blue?.Length != GammaRamp.DataPoints)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(blue));
|
||||
}
|
||||
|
||||
Red = red;
|
||||
Green = green;
|
||||
Blue = blue;
|
||||
}
|
||||
|
||||
public DisplayGammaRamp(double brightness = 1, double contrast = 1, double gamma = 1)
|
||||
: this(
|
||||
CalculateLUT(brightness, contrast, gamma),
|
||||
CalculateLUT(brightness, contrast, gamma),
|
||||
CalculateLUT(brightness, contrast, gamma)
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public DisplayGammaRamp(
|
||||
double redBrightness,
|
||||
double redContrast,
|
||||
double redGamma,
|
||||
double greenBrightness,
|
||||
double greenContrast,
|
||||
double greenGamma,
|
||||
double blueBrightness,
|
||||
double blueContrast,
|
||||
double blueGamma
|
||||
)
|
||||
: this(
|
||||
CalculateLUT(redBrightness, redContrast, redGamma),
|
||||
CalculateLUT(greenBrightness, greenContrast, greenGamma),
|
||||
CalculateLUT(blueBrightness, blueContrast, blueGamma)
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
internal DisplayGammaRamp(GammaRamp ramp) :
|
||||
this(ramp.Red, ramp.Green, ramp.Blue)
|
||||
{
|
||||
}
|
||||
public ushort[] Blue { get; }
|
||||
public ushort[] Green { get; }
|
||||
public ushort[] Red { get; }
|
||||
private static ushort[] CalculateLUT(double brightness, double contrast, double gamma)
|
||||
{
|
||||
brightness = 0.5 + brightness / 2;
|
||||
var result = new ushort[GammaRamp.DataPoints];
|
||||
for (var i = 0; i < result.Length; i++)
|
||||
{
|
||||
result[i] = (ushort)(brightness * ushort.MaxValue * i / (float)(result.Length - 1));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool IsOriginal()
|
||||
{
|
||||
int MaxRed = Red[Red.Length - 1];
|
||||
int MaxGreen = Green[Green.Length - 1];
|
||||
int MaxBlue = Blue[Blue.Length - 1];
|
||||
return (Math.Abs((MaxRed + MaxGreen + MaxBlue) / 3 - ushort.MaxValue) < 256);
|
||||
}
|
||||
|
||||
private static ushort[] Brightness(ushort[] data, double brightness)
|
||||
{
|
||||
var result = new ushort[GammaRamp.DataPoints];
|
||||
for (var i = 0; i < result.Length; i++)
|
||||
{
|
||||
if (brightness < 0.5)
|
||||
result[i] = (ushort)(0.5 * ushort.MaxValue * Math.Pow((float)i/(result.Length - 1), 2 - brightness*2));
|
||||
else
|
||||
result[i] = (ushort)(data[i] * brightness);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal GammaRamp AsBrightnessRamp(double brightness)
|
||||
{
|
||||
return new GammaRamp(
|
||||
Brightness(Red, brightness),
|
||||
Brightness(Green, brightness),
|
||||
Brightness(Blue, brightness)
|
||||
);
|
||||
}
|
||||
|
||||
internal GammaRamp AsRamp()
|
||||
{
|
||||
return new GammaRamp(Red, Green, Blue);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace GHelper.Display
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct GammaRamp
|
||||
{
|
||||
public const int DataPoints = 256;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DataPoints)]
|
||||
public readonly ushort[] Red;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DataPoints)]
|
||||
public readonly ushort[] Green;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DataPoints)]
|
||||
public readonly ushort[] Blue;
|
||||
|
||||
public GammaRamp(ushort[] red, ushort[] green, ushort[] blue)
|
||||
{
|
||||
if (red == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(red));
|
||||
}
|
||||
|
||||
if (green == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(green));
|
||||
}
|
||||
|
||||
if (blue == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(blue));
|
||||
}
|
||||
|
||||
if (red.Length != DataPoints)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(red));
|
||||
}
|
||||
|
||||
if (green.Length != DataPoints)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(green));
|
||||
}
|
||||
|
||||
if (blue.Length != DataPoints)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(blue));
|
||||
}
|
||||
|
||||
Red = red;
|
||||
Green = green;
|
||||
Blue = blue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace GHelper.Display
|
||||
{
|
||||
@@ -7,8 +7,6 @@ namespace GHelper.Display
|
||||
|
||||
public const int MAX_REFRESH = 1000;
|
||||
|
||||
public static DisplayGammaRamp? gammaRamp;
|
||||
|
||||
public void AutoScreen(bool force = false)
|
||||
{
|
||||
if (force || AppConfig.Is("screen_auto"))
|
||||
@@ -24,70 +22,6 @@ namespace GHelper.Display
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveGamma()
|
||||
{
|
||||
var screenName = ScreenNative.FindLaptopScreen();
|
||||
if (screenName is null) return;
|
||||
|
||||
try
|
||||
{
|
||||
var handle = ScreenNative.CreateDC(screenName, screenName, null, IntPtr.Zero);
|
||||
var gammaRamp = new GammaRamp();
|
||||
if (ScreenNative.GetDeviceGammaRamp(handle, ref gammaRamp))
|
||||
{
|
||||
var gamma = new DisplayGammaRamp(gammaRamp);
|
||||
Logger.WriteLine("Gamma R: " + string.Join("-", gamma.Red));
|
||||
Logger.WriteLine("Gamma G: " + string.Join("-", gamma.Green));
|
||||
Logger.WriteLine("Gamma B: " + string.Join("-", gamma.Blue));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGamma(int brightness = 100)
|
||||
{
|
||||
var bright = Math.Round((float)brightness / 200 + 0.5, 2);
|
||||
|
||||
var screenName = ScreenNative.FindLaptopScreen();
|
||||
if (screenName is null) return;
|
||||
|
||||
try
|
||||
{
|
||||
var handle = ScreenNative.CreateDC(screenName, screenName, null, IntPtr.Zero);
|
||||
if (gammaRamp is null)
|
||||
{
|
||||
var gammaDump = new GammaRamp();
|
||||
if (ScreenNative.GetDeviceGammaRamp(handle, ref gammaDump))
|
||||
{
|
||||
gammaRamp = new DisplayGammaRamp(gammaDump);
|
||||
Logger.WriteLine("Gamma R: " + string.Join("-", gammaRamp.Red));
|
||||
Logger.WriteLine("Gamma G: " + string.Join("-", gammaRamp.Green));
|
||||
Logger.WriteLine("Gamma B: " + string.Join("-", gammaRamp.Blue));
|
||||
}
|
||||
}
|
||||
|
||||
if (gammaRamp is null || !gammaRamp.IsOriginal())
|
||||
{
|
||||
Logger.WriteLine("Default Gamma");
|
||||
gammaRamp = new DisplayGammaRamp();
|
||||
}
|
||||
|
||||
var ramp = gammaRamp.AsBrightnessRamp(bright);
|
||||
bool result = ScreenNative.SetDeviceGammaRamp(handle, ref ramp);
|
||||
|
||||
Logger.WriteLine("Brightness " + bright.ToString() + ": " + result);
|
||||
|
||||
} catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
//ScreenBrightness.Set(60 + (int)(40 * bright));
|
||||
}
|
||||
|
||||
public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
|
||||
{
|
||||
var laptopScreen = ScreenNative.FindLaptopScreen(true);
|
||||
@@ -137,8 +71,7 @@ namespace GHelper.Display
|
||||
if (miniled1 >= 0)
|
||||
{
|
||||
miniled = (miniled1 == 1) ? 0 : 1;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
switch (miniled2)
|
||||
{
|
||||
|
||||
@@ -32,16 +32,6 @@ namespace GHelper.Display
|
||||
}
|
||||
internal class ScreenNative
|
||||
{
|
||||
|
||||
[DllImport("gdi32", CharSet = CharSet.Unicode)]
|
||||
internal static extern IntPtr CreateDC(string driver, string device, string port, IntPtr deviceMode);
|
||||
|
||||
[DllImport("gdi32")]
|
||||
internal static extern bool SetDeviceGammaRamp(IntPtr dcHandle, ref GammaRamp ramp);
|
||||
|
||||
[DllImport("gdi32")]
|
||||
internal static extern bool GetDeviceGammaRamp(IntPtr dcHandle, ref GammaRamp ramp);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct DEVMODE
|
||||
{
|
||||
@@ -156,7 +146,7 @@ namespace GHelper.Display
|
||||
public const string defaultDevice = @"\\.\DISPLAY1";
|
||||
|
||||
|
||||
public static string? FindInternalName(bool log = false)
|
||||
private static string? FindInternalName(bool log = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
19
app/Extra.Designer.cs
generated
19
app/Extra.Designer.cs
generated
@@ -120,7 +120,6 @@ namespace GHelper
|
||||
comboAPU = new RComboBox();
|
||||
pictureAPUMem = new PictureBox();
|
||||
labelAPUMem = new Label();
|
||||
pictureScan = new PictureBox();
|
||||
panelServices.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureService).BeginInit();
|
||||
panelBindingsHeader.SuspendLayout();
|
||||
@@ -145,7 +144,6 @@ namespace GHelper
|
||||
((System.ComponentModel.ISupportInitialize)pictureHibernate).BeginInit();
|
||||
panelAPU.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureAPUMem).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureScan).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panelServices
|
||||
@@ -1005,7 +1003,6 @@ namespace GHelper
|
||||
//
|
||||
panelSettingsHeader.AutoSize = true;
|
||||
panelSettingsHeader.BackColor = SystemColors.ControlLight;
|
||||
panelSettingsHeader.Controls.Add(pictureScan);
|
||||
panelSettingsHeader.Controls.Add(pictureLog);
|
||||
panelSettingsHeader.Controls.Add(pictureSettings);
|
||||
panelSettingsHeader.Controls.Add(labelSettings);
|
||||
@@ -1266,20 +1263,6 @@ namespace GHelper
|
||||
labelAPUMem.TabIndex = 0;
|
||||
labelAPUMem.Text = "Memory Assigned to GPU";
|
||||
//
|
||||
// pictureScan
|
||||
//
|
||||
pictureScan.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
pictureScan.BackgroundImage = Resources.icons8_heartbeat_32;
|
||||
pictureScan.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureScan.Cursor = Cursors.Hand;
|
||||
pictureScan.Location = new Point(891, 11);
|
||||
pictureScan.Margin = new Padding(4, 3, 4, 3);
|
||||
pictureScan.Name = "pictureScan";
|
||||
pictureScan.Size = new Size(32, 32);
|
||||
pictureScan.TabIndex = 13;
|
||||
pictureScan.TabStop = false;
|
||||
pictureScan.Visible = false;
|
||||
//
|
||||
// Extra
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||
@@ -1343,7 +1326,6 @@ namespace GHelper
|
||||
panelAPU.ResumeLayout(false);
|
||||
panelAPU.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureAPUMem).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureScan).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@@ -1438,6 +1420,5 @@ namespace GHelper
|
||||
private PictureBox pictureAPUMem;
|
||||
private Label labelAPUMem;
|
||||
private RComboBox comboAPU;
|
||||
private PictureBox pictureScan;
|
||||
}
|
||||
}
|
||||
13
app/Extra.cs
13
app/Extra.cs
@@ -386,7 +386,6 @@ namespace GHelper
|
||||
buttonServices.Click += ButtonServices_Click;
|
||||
|
||||
pictureLog.Click += PictureLog_Click;
|
||||
pictureScan.Click += PictureScan_Click;
|
||||
|
||||
checkGPUFix.Visible = Program.acpi.IsNVidiaGPU();
|
||||
checkGPUFix.Checked = AppConfig.IsGPUFix();
|
||||
@@ -399,18 +398,6 @@ namespace GHelper
|
||||
InitHibernate();
|
||||
}
|
||||
|
||||
private void PictureScan_Click(object? sender, EventArgs e)
|
||||
{
|
||||
string logFile = Program.acpi.ScanRange();
|
||||
new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo(logFile)
|
||||
{
|
||||
UseShellExecute = true
|
||||
}
|
||||
}.Start();
|
||||
}
|
||||
|
||||
private void ComboAPU_SelectedIndexChanged(object? sender, EventArgs e)
|
||||
{
|
||||
int mem = comboAPU.SelectedIndex;
|
||||
|
||||
@@ -953,7 +953,7 @@ namespace GHelper
|
||||
int chartCount = 2;
|
||||
|
||||
// Middle / system fan check
|
||||
if (!AsusACPI.IsEmptyCurve(Program.acpi.GetFanCurve(AsusFan.Mid)) || Program.acpi.GetFan(AsusFan.Mid) >= 0)
|
||||
if (!AsusACPI.IsEmptyCurve(Program.acpi.GetFanCurve(AsusFan.Mid)))
|
||||
{
|
||||
AppConfig.Set("mid_fan", 1);
|
||||
chartCount++;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.154</AssemblyVersion>
|
||||
<AssemblyVersion>0.153</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
@@ -30,7 +30,7 @@ public static class Logger
|
||||
try
|
||||
{
|
||||
var file = File.ReadAllLines(logFile);
|
||||
int skip = Math.Max(0, file.Count() - 2000);
|
||||
int skip = Math.Max(0, file.Count() - 1000);
|
||||
File.WriteAllLines(logFile, file.Skip(skip).ToArray());
|
||||
}
|
||||
catch { }
|
||||
|
||||
@@ -500,7 +500,7 @@ namespace GHelper.Input
|
||||
case "micmute":
|
||||
bool muteStatus = Audio.ToggleMute();
|
||||
Program.toast.RunToast(muteStatus ? "Muted" : "Unmuted", muteStatus ? ToastIcon.MicrophoneMute : ToastIcon.Microphone);
|
||||
if (AppConfig.IsVivobook()) Program.acpi.DeviceSet(AsusACPI.MicMuteLed, muteStatus ? 1 : 0, "MicmuteLed");
|
||||
if (AppConfig.IsVivobook()) Program.acpi.DeviceSet(AsusACPI.MICMUTE_LED, muteStatus ? 1 : 0, "MicmuteLed");
|
||||
break;
|
||||
case "brightness_up":
|
||||
SetBrightness(+10);
|
||||
@@ -628,9 +628,6 @@ namespace GHelper.Input
|
||||
{
|
||||
switch (EventID)
|
||||
{
|
||||
case 134: // FN + F12 ON OLD DEVICES
|
||||
KeyProcess("m4");
|
||||
return;
|
||||
case 124: // M3
|
||||
KeyProcess("m3");
|
||||
return;
|
||||
@@ -709,9 +706,6 @@ namespace GHelper.Input
|
||||
else
|
||||
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness");
|
||||
break;
|
||||
case 133: // Camera Toggle
|
||||
ToggleCamera();
|
||||
break;
|
||||
case 107: // FN+F10
|
||||
ToggleTouchpadEvent();
|
||||
break;
|
||||
@@ -790,36 +784,6 @@ namespace GHelper.Input
|
||||
Program.toast.RunToast($"Screen Pad " + (toggle == 1 ? "On" : "Off"), toggle > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
|
||||
}
|
||||
|
||||
public static void ToggleCamera()
|
||||
{
|
||||
if (!ProcessHelper.IsUserAdministrator()) return;
|
||||
|
||||
string CameraRegistryKeyPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam";
|
||||
string CameraRegistryValueName = "Value";
|
||||
|
||||
try
|
||||
{
|
||||
var status = (string?)Registry.GetValue(CameraRegistryKeyPath, CameraRegistryValueName, "");
|
||||
|
||||
if (status == "Allow") status = "Deny";
|
||||
else if (status == "Deny") status = "Allow";
|
||||
else
|
||||
{
|
||||
Logger.WriteLine("Unknown camera status");
|
||||
return;
|
||||
}
|
||||
|
||||
Registry.SetValue(CameraRegistryKeyPath, CameraRegistryValueName, status, RegistryValueKind.String);
|
||||
Program.acpi.DeviceSet(AsusACPI.CameraLed, (status == "Deny" ? 1 : 0), "Camera");
|
||||
Program.toast.RunToast($"Camera " + (status == "Deny" ? "Off" : "On"));
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void SetScreenpad(int delta)
|
||||
{
|
||||
|
||||
@@ -24,30 +24,26 @@ public sealed class KeyboardHook : IDisposable
|
||||
public static void KeyPress(Keys key)
|
||||
{
|
||||
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
||||
|
||||
Thread.Sleep(1);
|
||||
|
||||
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
|
||||
}
|
||||
|
||||
public static void KeyKeyPress(Keys key, Keys key2)
|
||||
{
|
||||
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
||||
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
||||
|
||||
Thread.Sleep(1);
|
||||
|
||||
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
|
||||
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
|
||||
}
|
||||
|
||||
public static void KeyKeyKeyPress(Keys key, Keys key2, Keys key3, int sleep = 1)
|
||||
public static void KeyKeyKeyPress(Keys key, Keys key2, Keys key3, int sleep = 0)
|
||||
{
|
||||
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
||||
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
||||
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
||||
|
||||
Thread.Sleep(sleep);
|
||||
if (sleep > 0)
|
||||
{
|
||||
Thread.Sleep(sleep);
|
||||
}
|
||||
|
||||
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
|
||||
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace GHelper.Input
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine($"Listener exited: {ex.Message}");
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
10
app/Properties/Resources.Designer.cs
generated
10
app/Properties/Resources.Designer.cs
generated
@@ -210,16 +210,6 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap icons8_brightness_32 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("icons8-brightness-32", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
||||
@@ -136,9 +136,6 @@
|
||||
<data name="icons8-bicycle-48 (1)" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-bicycle-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="standard" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -166,15 +163,9 @@
|
||||
<data name="icons8-automation-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-automation-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-settings-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-settings-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="brightness_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\brightness-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="brightness_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\brightness-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_processor_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-processor-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -196,9 +187,15 @@
|
||||
<data name="icons8-laptop-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-laptop-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ally" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ally.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_remove_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-remove-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_share_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_function" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
@@ -232,11 +229,14 @@
|
||||
<data name="icons8-xbox-rt-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-xbox-rt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_controller_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-fan-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-fan-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_controller_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="icons8-settings-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-settings-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_maus_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-maus-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
@@ -250,11 +250,8 @@
|
||||
<data name="dot_ultimate" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\dot-ultimate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-heartbeat-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-heartbeat-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ally" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ally.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="brightness_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\brightness-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="backlight_up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\backlight-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
@@ -322,8 +319,8 @@
|
||||
<data name="icons8_software_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-software-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8_share_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="standard" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-soonvibes-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-soonvibes-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
@@ -334,7 +331,7 @@
|
||||
<data name="icons8-charging-battery-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="icons8-brightness-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-brightness-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="icons8-heartbeat-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icons8-heartbeat-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 420 B |
137
app/Settings.Designer.cs
generated
137
app/Settings.Designer.cs
generated
@@ -34,7 +34,6 @@ namespace GHelper
|
||||
tableLayoutMatrix = new TableLayoutPanel();
|
||||
comboMatrix = new RComboBox();
|
||||
comboMatrixRunning = new RComboBox();
|
||||
comboInterval = new RComboBox();
|
||||
buttonMatrix = new RButton();
|
||||
panelMatrixTitle = new Panel();
|
||||
pictureMatrix = new PictureBox();
|
||||
@@ -120,12 +119,7 @@ namespace GHelper
|
||||
panelAllyTitle = new Panel();
|
||||
pictureAlly = new PictureBox();
|
||||
labelAlly = new Label();
|
||||
panelGamma = new Panel();
|
||||
sliderGamma = new Slider();
|
||||
panelGammaTitle = new Panel();
|
||||
labelGamma = new Label();
|
||||
pictureGamma = new PictureBox();
|
||||
labelGammaTitle = new Label();
|
||||
comboInterval = new RComboBox();
|
||||
panelMatrix.SuspendLayout();
|
||||
tableLayoutMatrix.SuspendLayout();
|
||||
panelMatrixTitle.SuspendLayout();
|
||||
@@ -164,9 +158,6 @@ namespace GHelper
|
||||
tableLayoutAlly.SuspendLayout();
|
||||
panelAllyTitle.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureAlly).BeginInit();
|
||||
panelGamma.SuspendLayout();
|
||||
panelGammaTitle.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureGamma).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panelMatrix
|
||||
@@ -178,7 +169,7 @@ namespace GHelper
|
||||
panelMatrix.Controls.Add(panelMatrixTitle);
|
||||
panelMatrix.Controls.Add(checkMatrix);
|
||||
panelMatrix.Dock = DockStyle.Top;
|
||||
panelMatrix.Location = new Point(11, 950);
|
||||
panelMatrix.Location = new Point(11, 827);
|
||||
panelMatrix.Margin = new Padding(0);
|
||||
panelMatrix.Name = "panelMatrix";
|
||||
panelMatrix.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -239,21 +230,6 @@ namespace GHelper
|
||||
comboMatrixRunning.Size = new Size(248, 40);
|
||||
comboMatrixRunning.TabIndex = 17;
|
||||
//
|
||||
// comboInterval
|
||||
//
|
||||
comboInterval.BorderColor = Color.White;
|
||||
comboInterval.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboInterval.Dock = DockStyle.Top;
|
||||
comboInterval.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboInterval.FormattingEnabled = true;
|
||||
comboInterval.ItemHeight = 32;
|
||||
comboInterval.Location = new Point(7, 75);
|
||||
comboInterval.Margin = new Padding(7, 11, 7, 8);
|
||||
comboInterval.Name = "comboInterval";
|
||||
comboInterval.Size = new Size(248, 40);
|
||||
comboInterval.TabIndex = 19;
|
||||
comboInterval.Visible = false;
|
||||
//
|
||||
// buttonMatrix
|
||||
//
|
||||
buttonMatrix.Activated = false;
|
||||
@@ -325,7 +301,7 @@ namespace GHelper
|
||||
panelBattery.Controls.Add(sliderBattery);
|
||||
panelBattery.Controls.Add(panelBatteryTitle);
|
||||
panelBattery.Dock = DockStyle.Top;
|
||||
panelBattery.Location = new Point(11, 1608);
|
||||
panelBattery.Location = new Point(11, 1485);
|
||||
panelBattery.Margin = new Padding(0);
|
||||
panelBattery.Name = "panelBattery";
|
||||
panelBattery.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -417,7 +393,7 @@ namespace GHelper
|
||||
panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelFooter.Controls.Add(tableButtons);
|
||||
panelFooter.Dock = DockStyle.Top;
|
||||
panelFooter.Location = new Point(11, 1783);
|
||||
panelFooter.Location = new Point(11, 1660);
|
||||
panelFooter.Margin = new Padding(0);
|
||||
panelFooter.Name = "panelFooter";
|
||||
panelFooter.Padding = new Padding(20);
|
||||
@@ -1164,7 +1140,7 @@ namespace GHelper
|
||||
panelKeyboard.Controls.Add(tableLayoutKeyboard);
|
||||
panelKeyboard.Controls.Add(panelKeyboardTitle);
|
||||
panelKeyboard.Dock = DockStyle.Top;
|
||||
panelKeyboard.Location = new Point(11, 1266);
|
||||
panelKeyboard.Location = new Point(11, 1143);
|
||||
panelKeyboard.Margin = new Padding(0);
|
||||
panelKeyboard.Name = "panelKeyboard";
|
||||
panelKeyboard.Padding = new Padding(20);
|
||||
@@ -1340,7 +1316,7 @@ namespace GHelper
|
||||
panelVersion.Controls.Add(labelCharge);
|
||||
panelVersion.Controls.Add(checkStartup);
|
||||
panelVersion.Dock = DockStyle.Top;
|
||||
panelVersion.Location = new Point(11, 1727);
|
||||
panelVersion.Location = new Point(11, 1604);
|
||||
panelVersion.Margin = new Padding(4);
|
||||
panelVersion.Name = "panelVersion";
|
||||
panelVersion.Size = new Size(827, 56);
|
||||
@@ -1365,7 +1341,7 @@ namespace GHelper
|
||||
panelPeripherals.Controls.Add(tableLayoutPeripherals);
|
||||
panelPeripherals.Controls.Add(panelPeripheralsTile);
|
||||
panelPeripherals.Dock = DockStyle.Top;
|
||||
panelPeripherals.Location = new Point(11, 1410);
|
||||
panelPeripherals.Location = new Point(11, 1287);
|
||||
panelPeripherals.Margin = new Padding(0);
|
||||
panelPeripherals.Name = "panelPeripherals";
|
||||
panelPeripherals.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -1507,7 +1483,7 @@ namespace GHelper
|
||||
panelAlly.Controls.Add(tableLayoutAlly);
|
||||
panelAlly.Controls.Add(panelAllyTitle);
|
||||
panelAlly.Dock = DockStyle.Top;
|
||||
panelAlly.Location = new Point(11, 1126);
|
||||
panelAlly.Location = new Point(11, 1003);
|
||||
panelAlly.Margin = new Padding(0);
|
||||
panelAlly.Name = "panelAlly";
|
||||
panelAlly.Padding = new Padding(20, 20, 20, 0);
|
||||
@@ -1635,79 +1611,20 @@ namespace GHelper
|
||||
labelAlly.TabIndex = 26;
|
||||
labelAlly.Text = "Ally Controller";
|
||||
//
|
||||
// panelGamma
|
||||
// comboInterval
|
||||
//
|
||||
panelGamma.AutoSize = true;
|
||||
panelGamma.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelGamma.Controls.Add(sliderGamma);
|
||||
panelGamma.Controls.Add(panelGammaTitle);
|
||||
panelGamma.Dock = DockStyle.Top;
|
||||
panelGamma.Location = new Point(11, 827);
|
||||
panelGamma.Margin = new Padding(0);
|
||||
panelGamma.Name = "panelGamma";
|
||||
panelGamma.Padding = new Padding(20, 20, 20, 10);
|
||||
panelGamma.Size = new Size(827, 123);
|
||||
panelGamma.TabIndex = 9;
|
||||
panelGamma.Visible = false;
|
||||
//
|
||||
// sliderGamma
|
||||
//
|
||||
sliderGamma.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
sliderGamma.Location = new Point(40, 69);
|
||||
sliderGamma.Margin = new Padding(4);
|
||||
sliderGamma.Max = 100;
|
||||
sliderGamma.Min = 0;
|
||||
sliderGamma.Name = "sliderGamma";
|
||||
sliderGamma.Size = new Size(752, 40);
|
||||
sliderGamma.Step = 10;
|
||||
sliderGamma.TabIndex = 20;
|
||||
sliderGamma.Text = "sliderGamma";
|
||||
sliderGamma.Value = 100;
|
||||
//
|
||||
// panelGammaTitle
|
||||
//
|
||||
panelGammaTitle.Controls.Add(labelGamma);
|
||||
panelGammaTitle.Controls.Add(pictureGamma);
|
||||
panelGammaTitle.Controls.Add(labelGammaTitle);
|
||||
panelGammaTitle.Dock = DockStyle.Top;
|
||||
panelGammaTitle.Location = new Point(20, 20);
|
||||
panelGammaTitle.Margin = new Padding(4);
|
||||
panelGammaTitle.Name = "panelGammaTitle";
|
||||
panelGammaTitle.Padding = new Padding(0, 0, 0, 4);
|
||||
panelGammaTitle.Size = new Size(787, 44);
|
||||
panelGammaTitle.TabIndex = 40;
|
||||
//
|
||||
// labelGamma
|
||||
//
|
||||
labelGamma.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelGamma.Location = new Point(675, 4);
|
||||
labelGamma.Margin = new Padding(8, 0, 8, 0);
|
||||
labelGamma.Name = "labelGamma";
|
||||
labelGamma.Size = new Size(107, 36);
|
||||
labelGamma.TabIndex = 39;
|
||||
labelGamma.Text = " ";
|
||||
labelGamma.TextAlign = ContentAlignment.TopRight;
|
||||
//
|
||||
// pictureGamma
|
||||
//
|
||||
pictureGamma.BackgroundImage = Properties.Resources.icons8_brightness_32;
|
||||
pictureGamma.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureGamma.Location = new Point(4, 2);
|
||||
pictureGamma.Margin = new Padding(4);
|
||||
pictureGamma.Name = "pictureGamma";
|
||||
pictureGamma.Size = new Size(32, 32);
|
||||
pictureGamma.TabIndex = 38;
|
||||
pictureGamma.TabStop = false;
|
||||
//
|
||||
// labelGammaTitle
|
||||
//
|
||||
labelGammaTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelGammaTitle.Location = new Point(43, 0);
|
||||
labelGammaTitle.Margin = new Padding(8, 0, 8, 0);
|
||||
labelGammaTitle.Name = "labelGammaTitle";
|
||||
labelGammaTitle.Size = new Size(307, 32);
|
||||
labelGammaTitle.TabIndex = 37;
|
||||
labelGammaTitle.Text = "Flicker-free Dimming";
|
||||
comboInterval.BorderColor = Color.White;
|
||||
comboInterval.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboInterval.Dock = DockStyle.Top;
|
||||
comboInterval.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboInterval.FormattingEnabled = true;
|
||||
comboInterval.ItemHeight = 32;
|
||||
comboInterval.Location = new Point(7, 75);
|
||||
comboInterval.Margin = new Padding(7, 11, 7, 8);
|
||||
comboInterval.Name = "comboInterval";
|
||||
comboInterval.Size = new Size(248, 40);
|
||||
comboInterval.TabIndex = 19;
|
||||
comboInterval.Visible = false;
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
@@ -1715,7 +1632,7 @@ namespace GHelper
|
||||
AutoScaleMode = AutoScaleMode.Dpi;
|
||||
AutoSize = true;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ClientSize = new Size(849, 2119);
|
||||
ClientSize = new Size(849, 1717);
|
||||
Controls.Add(panelFooter);
|
||||
Controls.Add(panelVersion);
|
||||
Controls.Add(panelBattery);
|
||||
@@ -1723,7 +1640,6 @@ namespace GHelper
|
||||
Controls.Add(panelKeyboard);
|
||||
Controls.Add(panelAlly);
|
||||
Controls.Add(panelMatrix);
|
||||
Controls.Add(panelGamma);
|
||||
Controls.Add(panelScreen);
|
||||
Controls.Add(panelGPU);
|
||||
Controls.Add(panelPerformance);
|
||||
@@ -1792,9 +1708,6 @@ namespace GHelper
|
||||
panelAllyTitle.ResumeLayout(false);
|
||||
panelAllyTitle.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureAlly).EndInit();
|
||||
panelGamma.ResumeLayout(false);
|
||||
panelGammaTitle.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)pictureGamma).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@@ -1890,11 +1803,5 @@ namespace GHelper
|
||||
private RButton buttonController;
|
||||
private RButton buttonOverlay;
|
||||
private RComboBox comboInterval;
|
||||
private Panel panelGamma;
|
||||
private Slider sliderGamma;
|
||||
private Panel panelGammaTitle;
|
||||
private Label labelGamma;
|
||||
private PictureBox pictureGamma;
|
||||
private Label labelGammaTitle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,19 +253,9 @@ namespace GHelper
|
||||
VisualiseFnLock();
|
||||
buttonFnLock.Click += ButtonFnLock_Click;
|
||||
|
||||
panelGamma.Visible = AppConfig.IsOLED();
|
||||
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
|
||||
labelGamma.Text = "100%";
|
||||
|
||||
panelPerformance.Focus();
|
||||
}
|
||||
|
||||
private void SliderGamma_ValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
screenControl.SetGamma(sliderGamma.Value);
|
||||
labelGamma.Text = sliderGamma.Value + "%";
|
||||
}
|
||||
|
||||
private void ButtonOverlay_Click(object? sender, EventArgs e)
|
||||
{
|
||||
KeyboardHook.KeyKeyKeyPress(Keys.LControlKey, Keys.LShiftKey, Keys.O);
|
||||
|
||||
@@ -90,24 +90,18 @@ public static class AsusHid
|
||||
if (devices is null) return;
|
||||
|
||||
foreach (var device in devices)
|
||||
try
|
||||
{
|
||||
using (var stream = device.Open())
|
||||
foreach (var data in dataList)
|
||||
try
|
||||
{
|
||||
stream.Write(data);
|
||||
Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine($"Error writing {log} {device.ProductID.ToString("X")}: {ex.Message} {BitConverter.ToString(data)} ");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine($"Error opening {log} {device.ProductID.ToString("X")}: {ex.Message}");
|
||||
}
|
||||
using (var stream = device.Open())
|
||||
foreach (var data in dataList)
|
||||
try
|
||||
{
|
||||
stream.Write(data);
|
||||
Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine($"Error writing {log} {device.ProductID.ToString("X")}: {ex.Message} {BitConverter.ToString(data)} ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void WriteAura(byte[] data)
|
||||
|
||||
@@ -73,9 +73,6 @@ namespace GHelper.USB
|
||||
private static AuraMode mode = AuraMode.AuraStatic;
|
||||
private static AuraSpeed speed = AuraSpeed.Normal;
|
||||
|
||||
private static bool backlight = false;
|
||||
private static bool initDirect = false;
|
||||
|
||||
public static Color Color1 = Color.White;
|
||||
public static Color Color2 = Color.Black;
|
||||
|
||||
@@ -292,8 +289,6 @@ namespace GHelper.USB
|
||||
|
||||
public static void ApplyBrightness(int brightness, string log = "Backlight", bool delay = false)
|
||||
{
|
||||
if (brightness == 0) backlight = false;
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
if (delay) await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
@@ -306,13 +301,6 @@ namespace GHelper.USB
|
||||
|
||||
if (AppConfig.IsAlly()) ApplyAura();
|
||||
|
||||
if (brightness > 0)
|
||||
{
|
||||
if (!backlight) initDirect = true;
|
||||
backlight = true;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -506,8 +494,6 @@ namespace GHelper.USB
|
||||
|
||||
public static void ApplyDirect(Color[] color, bool init = false)
|
||||
{
|
||||
if (!backlight) return;
|
||||
|
||||
const byte keySet = 167;
|
||||
const byte ledCount = 178;
|
||||
const ushort mapSize = 3 * ledCount;
|
||||
@@ -525,9 +511,9 @@ namespace GHelper.USB
|
||||
buffer[6] = 0;
|
||||
buffer[7] = 0x10;
|
||||
|
||||
if (init || initDirect)
|
||||
if (init)
|
||||
{
|
||||
initDirect = false;
|
||||
Init();
|
||||
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xBC });
|
||||
}
|
||||
|
||||
@@ -588,8 +574,6 @@ namespace GHelper.USB
|
||||
public static void ApplyDirect(Color color, bool init = false)
|
||||
{
|
||||
|
||||
if (!backlight) return;
|
||||
|
||||
if (isACPI)
|
||||
{
|
||||
Program.acpi.TUFKeyboardRGB(0, color, 0, null);
|
||||
@@ -608,9 +592,9 @@ namespace GHelper.USB
|
||||
return;
|
||||
}
|
||||
|
||||
if (init || initDirect)
|
||||
if (init)
|
||||
{
|
||||
initDirect = false;
|
||||
//Init();
|
||||
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc, 1 });
|
||||
}
|
||||
|
||||
@@ -737,8 +721,6 @@ namespace GHelper.USB
|
||||
|
||||
public static void ApplyAmbient(bool init = false)
|
||||
{
|
||||
if (!backlight) return;
|
||||
|
||||
var bound = Screen.GetBounds(Point.Empty);
|
||||
bound.Y += bound.Height / 3;
|
||||
bound.Height -= (int)Math.Round(bound.Height * (0.33f + 0.022f)); // cut 1/3 of the top screen + windows panel
|
||||
|
||||
@@ -107,12 +107,13 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio
|
||||
### ⌨️ Keybindings
|
||||
|
||||
- ``Fn + F5 / Fn + Shift + F5`` - Toggle Performance Modes forwards / backwards
|
||||
- ``Shift + Fn + F7 / F8`` - Set Anime Matrix / Slash Lightning brightness Down / Up
|
||||
- ``Ctrl + Shift + F5 / Ctrl + Shift + Alt + F5`` - Toggle Performance Modes forwards / backwards
|
||||
- ``Ctrl + Shift + F12`` - Open G-Helper window
|
||||
- ``Ctrl + M1 / M2`` - Screen brightness Down / Up
|
||||
- ``Shift + M1 / M2`` - Backlight brightness Down / Up
|
||||
- ``Fn + C`` - Fn-Lock
|
||||
- ``Fn + Shift + F7 / F8`` - Matrix / Slash Lightning brightness Down / Up
|
||||
- ``Fn + Shift + F7 / F8`` - Matrix brightness Down / Up
|
||||
- ``Fn + Shift + F7 / F8`` - Screenpad brightness Down / Up
|
||||
- ``Ctrl + Shift + F20`` - Mute Microphone
|
||||
- ``Ctrl + Shift + Alt + F14`` - Eco GPU Mode
|
||||
|
||||
Reference in New Issue
Block a user