mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
12 Commits
slash_ligh
...
v0.154
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03bff51850 | ||
|
|
42a598f177 | ||
|
|
ebfb9b3875 | ||
|
|
60c4e08347 | ||
|
|
e98cd2f5c1 | ||
|
|
697b5f0d2f | ||
|
|
b638382799 | ||
|
|
5f6afc0c6e | ||
|
|
8de06ce5ad | ||
|
|
85725fb782 | ||
|
|
d2cb6965e0 | ||
|
|
3f8083be50 |
@@ -46,7 +46,6 @@ public class AsusACPI
|
|||||||
public const int KB_DUO_PgUpDn = 0x4B;
|
public const int KB_DUO_PgUpDn = 0x4B;
|
||||||
public const int KB_DUO_SecondDisplay = 0x6A;
|
public const int KB_DUO_SecondDisplay = 0x6A;
|
||||||
|
|
||||||
|
|
||||||
public const int Touchpad_Toggle = 0x6B;
|
public const int Touchpad_Toggle = 0x6B;
|
||||||
|
|
||||||
public const int ChargerMode = 0x0012006C;
|
public const int ChargerMode = 0x0012006C;
|
||||||
@@ -106,7 +105,7 @@ public class AsusACPI
|
|||||||
public const int TUF_KB2 = 0x0010005a;
|
public const int TUF_KB2 = 0x0010005a;
|
||||||
public const int TUF_KB_STATE = 0x00100057;
|
public const int TUF_KB_STATE = 0x00100057;
|
||||||
|
|
||||||
public const int MICMUTE_LED = 0x00040017;
|
public const int MicMuteLed = 0x00040017;
|
||||||
|
|
||||||
public const int TabletState = 0x00060077;
|
public const int TabletState = 0x00060077;
|
||||||
public const int FnLock = 0x00100023;
|
public const int FnLock = 0x00100023;
|
||||||
@@ -114,6 +113,8 @@ public class AsusACPI
|
|||||||
public const int ScreenPadToggle = 0x00050031;
|
public const int ScreenPadToggle = 0x00050031;
|
||||||
public const int ScreenPadBrightness = 0x00050032;
|
public const int ScreenPadBrightness = 0x00050032;
|
||||||
|
|
||||||
|
public const int CameraLed = 0x00060079;
|
||||||
|
|
||||||
public const int BootSound = 0x00130022;
|
public const int BootSound = 0x00130022;
|
||||||
|
|
||||||
public const int Tablet_Notebook = 0;
|
public const int Tablet_Notebook = 0;
|
||||||
@@ -513,16 +514,25 @@ public class AsusACPI
|
|||||||
default: fan_mode = 0; break;
|
default: fan_mode = 0; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte[] result;
|
||||||
|
|
||||||
switch (device)
|
switch (device)
|
||||||
{
|
{
|
||||||
case AsusFan.GPU:
|
case AsusFan.GPU:
|
||||||
return DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
|
result = DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
|
||||||
|
break;
|
||||||
case AsusFan.Mid:
|
case AsusFan.Mid:
|
||||||
return DeviceGetBuffer(DevsMidFanCurve, fan_mode);
|
result = DeviceGetBuffer(DevsMidFanCurve, fan_mode);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
|
result = DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger.WriteLine($"GetFan {device} :" + BitConverter.ToString(result));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsInvalidCurve(byte[] curve)
|
public static bool IsInvalidCurve(byte[] curve)
|
||||||
@@ -664,22 +674,32 @@ public class AsusACPI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScanRange()
|
public string ScanRange()
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
|
string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
|
||||||
string logFile = appPath + "\\scan.txt";
|
string logFile = appPath + "\\scan.txt";
|
||||||
for (uint i = 0x00000000; i <= 0x00160000; i++)
|
using (StreamWriter w = File.AppendText(logFile))
|
||||||
{
|
{
|
||||||
value = DeviceGet(i);
|
w.WriteLine($"Scan started {DateTime.Now}");
|
||||||
if (value >= 0)
|
for (uint i = 0x00000000; i <= 0x00160000; i += 0x10000)
|
||||||
using (StreamWriter w = File.AppendText(logFile))
|
{
|
||||||
|
for (uint j = 0x00; j <= 0xFF; j++)
|
||||||
{
|
{
|
||||||
w.WriteLine(i.ToString("X8") + ": " + value.ToString("X4") + " (" + value + ")");
|
uint id = i + j;
|
||||||
w.Close();
|
value = DeviceGet(id);
|
||||||
|
if (value >= 0)
|
||||||
|
{
|
||||||
|
w.WriteLine(id.ToString("X8") + ": " + value.ToString("X4") + " (" + value + ")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
w.WriteLine($"---------------------");
|
||||||
|
w.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return logFile;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TUFKeyboardBrightness(int brightness)
|
public void TUFKeyboardBrightness(int brightness)
|
||||||
|
|||||||
19
app/Extra.Designer.cs
generated
19
app/Extra.Designer.cs
generated
@@ -120,6 +120,7 @@ namespace GHelper
|
|||||||
comboAPU = new RComboBox();
|
comboAPU = new RComboBox();
|
||||||
pictureAPUMem = new PictureBox();
|
pictureAPUMem = new PictureBox();
|
||||||
labelAPUMem = new Label();
|
labelAPUMem = new Label();
|
||||||
|
pictureScan = new PictureBox();
|
||||||
panelServices.SuspendLayout();
|
panelServices.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureService).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureService).BeginInit();
|
||||||
panelBindingsHeader.SuspendLayout();
|
panelBindingsHeader.SuspendLayout();
|
||||||
@@ -144,6 +145,7 @@ namespace GHelper
|
|||||||
((System.ComponentModel.ISupportInitialize)pictureHibernate).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureHibernate).BeginInit();
|
||||||
panelAPU.SuspendLayout();
|
panelAPU.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureAPUMem).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureAPUMem).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureScan).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// panelServices
|
// panelServices
|
||||||
@@ -1003,6 +1005,7 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
panelSettingsHeader.AutoSize = true;
|
panelSettingsHeader.AutoSize = true;
|
||||||
panelSettingsHeader.BackColor = SystemColors.ControlLight;
|
panelSettingsHeader.BackColor = SystemColors.ControlLight;
|
||||||
|
panelSettingsHeader.Controls.Add(pictureScan);
|
||||||
panelSettingsHeader.Controls.Add(pictureLog);
|
panelSettingsHeader.Controls.Add(pictureLog);
|
||||||
panelSettingsHeader.Controls.Add(pictureSettings);
|
panelSettingsHeader.Controls.Add(pictureSettings);
|
||||||
panelSettingsHeader.Controls.Add(labelSettings);
|
panelSettingsHeader.Controls.Add(labelSettings);
|
||||||
@@ -1263,6 +1266,20 @@ namespace GHelper
|
|||||||
labelAPUMem.TabIndex = 0;
|
labelAPUMem.TabIndex = 0;
|
||||||
labelAPUMem.Text = "Memory Assigned to GPU";
|
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
|
// Extra
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(192F, 192F);
|
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||||
@@ -1326,6 +1343,7 @@ namespace GHelper
|
|||||||
panelAPU.ResumeLayout(false);
|
panelAPU.ResumeLayout(false);
|
||||||
panelAPU.PerformLayout();
|
panelAPU.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureAPUMem).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureAPUMem).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureScan).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@@ -1420,5 +1438,6 @@ namespace GHelper
|
|||||||
private PictureBox pictureAPUMem;
|
private PictureBox pictureAPUMem;
|
||||||
private Label labelAPUMem;
|
private Label labelAPUMem;
|
||||||
private RComboBox comboAPU;
|
private RComboBox comboAPU;
|
||||||
|
private PictureBox pictureScan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
13
app/Extra.cs
13
app/Extra.cs
@@ -386,6 +386,7 @@ namespace GHelper
|
|||||||
buttonServices.Click += ButtonServices_Click;
|
buttonServices.Click += ButtonServices_Click;
|
||||||
|
|
||||||
pictureLog.Click += PictureLog_Click;
|
pictureLog.Click += PictureLog_Click;
|
||||||
|
pictureScan.Click += PictureScan_Click;
|
||||||
|
|
||||||
checkGPUFix.Visible = Program.acpi.IsNVidiaGPU();
|
checkGPUFix.Visible = Program.acpi.IsNVidiaGPU();
|
||||||
checkGPUFix.Checked = AppConfig.IsGPUFix();
|
checkGPUFix.Checked = AppConfig.IsGPUFix();
|
||||||
@@ -398,6 +399,18 @@ namespace GHelper
|
|||||||
InitHibernate();
|
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)
|
private void ComboAPU_SelectedIndexChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
int mem = comboAPU.SelectedIndex;
|
int mem = comboAPU.SelectedIndex;
|
||||||
|
|||||||
@@ -953,7 +953,7 @@ namespace GHelper
|
|||||||
int chartCount = 2;
|
int chartCount = 2;
|
||||||
|
|
||||||
// Middle / system fan check
|
// Middle / system fan check
|
||||||
if (!AsusACPI.IsEmptyCurve(Program.acpi.GetFanCurve(AsusFan.Mid)))
|
if (!AsusACPI.IsEmptyCurve(Program.acpi.GetFanCurve(AsusFan.Mid)) || Program.acpi.GetFan(AsusFan.Mid) >= 0)
|
||||||
{
|
{
|
||||||
AppConfig.Set("mid_fan", 1);
|
AppConfig.Set("mid_fan", 1);
|
||||||
chartCount++;
|
chartCount++;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.153</AssemblyVersion>
|
<AssemblyVersion>0.154</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public static class Logger
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var file = File.ReadAllLines(logFile);
|
var file = File.ReadAllLines(logFile);
|
||||||
int skip = Math.Max(0, file.Count() - 1000);
|
int skip = Math.Max(0, file.Count() - 2000);
|
||||||
File.WriteAllLines(logFile, file.Skip(skip).ToArray());
|
File.WriteAllLines(logFile, file.Skip(skip).ToArray());
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|||||||
@@ -500,7 +500,7 @@ namespace GHelper.Input
|
|||||||
case "micmute":
|
case "micmute":
|
||||||
bool muteStatus = Audio.ToggleMute();
|
bool muteStatus = Audio.ToggleMute();
|
||||||
Program.toast.RunToast(muteStatus ? "Muted" : "Unmuted", muteStatus ? ToastIcon.MicrophoneMute : ToastIcon.Microphone);
|
Program.toast.RunToast(muteStatus ? "Muted" : "Unmuted", muteStatus ? ToastIcon.MicrophoneMute : ToastIcon.Microphone);
|
||||||
if (AppConfig.IsVivobook()) Program.acpi.DeviceSet(AsusACPI.MICMUTE_LED, muteStatus ? 1 : 0, "MicmuteLed");
|
if (AppConfig.IsVivobook()) Program.acpi.DeviceSet(AsusACPI.MicMuteLed, muteStatus ? 1 : 0, "MicmuteLed");
|
||||||
break;
|
break;
|
||||||
case "brightness_up":
|
case "brightness_up":
|
||||||
SetBrightness(+10);
|
SetBrightness(+10);
|
||||||
@@ -628,6 +628,9 @@ namespace GHelper.Input
|
|||||||
{
|
{
|
||||||
switch (EventID)
|
switch (EventID)
|
||||||
{
|
{
|
||||||
|
case 134: // FN + F12 ON OLD DEVICES
|
||||||
|
KeyProcess("m4");
|
||||||
|
return;
|
||||||
case 124: // M3
|
case 124: // M3
|
||||||
KeyProcess("m3");
|
KeyProcess("m3");
|
||||||
return;
|
return;
|
||||||
@@ -706,6 +709,9 @@ namespace GHelper.Input
|
|||||||
else
|
else
|
||||||
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness");
|
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness");
|
||||||
break;
|
break;
|
||||||
|
case 133: // Camera Toggle
|
||||||
|
ToggleCamera();
|
||||||
|
break;
|
||||||
case 107: // FN+F10
|
case 107: // FN+F10
|
||||||
ToggleTouchpadEvent();
|
ToggleTouchpadEvent();
|
||||||
break;
|
break;
|
||||||
@@ -784,6 +790,36 @@ namespace GHelper.Input
|
|||||||
Program.toast.RunToast($"Screen Pad " + (toggle == 1 ? "On" : "Off"), toggle > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
|
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)
|
public static void SetScreenpad(int delta)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,26 +24,30 @@ public sealed class KeyboardHook : IDisposable
|
|||||||
public static void KeyPress(Keys key)
|
public static void KeyPress(Keys key)
|
||||||
{
|
{
|
||||||
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
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)
|
public static void KeyKeyPress(Keys key, Keys key2)
|
||||||
{
|
{
|
||||||
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
||||||
keybd_event((byte)key2, 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)key2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
|
||||||
keybd_event((byte)key, 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 = 0)
|
public static void KeyKeyKeyPress(Keys key, Keys key2, Keys key3, int sleep = 1)
|
||||||
{
|
{
|
||||||
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
||||||
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
||||||
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
|
||||||
|
|
||||||
if (sleep > 0)
|
Thread.Sleep(sleep);
|
||||||
{
|
|
||||||
Thread.Sleep(sleep);
|
|
||||||
}
|
|
||||||
|
|
||||||
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
|
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
|
||||||
keybd_event((byte)key2, 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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.WriteLine(ex.ToString());
|
Logger.WriteLine($"Listener exited: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,18 +90,24 @@ public static class AsusHid
|
|||||||
if (devices is null) return;
|
if (devices is null) return;
|
||||||
|
|
||||||
foreach (var device in devices)
|
foreach (var device in devices)
|
||||||
using (var stream = device.Open())
|
try
|
||||||
foreach (var data in dataList)
|
{
|
||||||
try
|
using (var stream = device.Open())
|
||||||
{
|
foreach (var data in dataList)
|
||||||
stream.Write(data);
|
try
|
||||||
Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}");
|
{
|
||||||
}
|
stream.Write(data);
|
||||||
catch (Exception ex)
|
Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}");
|
||||||
{
|
}
|
||||||
Logger.WriteLine($"Error writing {log} {device.ProductID.ToString("X")}: {ex.Message} {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}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteAura(byte[] data)
|
public static void WriteAura(byte[] data)
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ namespace GHelper.USB
|
|||||||
private static AuraMode mode = AuraMode.AuraStatic;
|
private static AuraMode mode = AuraMode.AuraStatic;
|
||||||
private static AuraSpeed speed = AuraSpeed.Normal;
|
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 Color1 = Color.White;
|
||||||
public static Color Color2 = Color.Black;
|
public static Color Color2 = Color.Black;
|
||||||
|
|
||||||
@@ -289,6 +292,8 @@ namespace GHelper.USB
|
|||||||
|
|
||||||
public static void ApplyBrightness(int brightness, string log = "Backlight", bool delay = false)
|
public static void ApplyBrightness(int brightness, string log = "Backlight", bool delay = false)
|
||||||
{
|
{
|
||||||
|
if (brightness == 0) backlight = false;
|
||||||
|
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
if (delay) await Task.Delay(TimeSpan.FromSeconds(1));
|
if (delay) await Task.Delay(TimeSpan.FromSeconds(1));
|
||||||
@@ -301,6 +306,13 @@ namespace GHelper.USB
|
|||||||
|
|
||||||
if (AppConfig.IsAlly()) ApplyAura();
|
if (AppConfig.IsAlly()) ApplyAura();
|
||||||
|
|
||||||
|
if (brightness > 0)
|
||||||
|
{
|
||||||
|
if (!backlight) initDirect = true;
|
||||||
|
backlight = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -494,6 +506,8 @@ namespace GHelper.USB
|
|||||||
|
|
||||||
public static void ApplyDirect(Color[] color, bool init = false)
|
public static void ApplyDirect(Color[] color, bool init = false)
|
||||||
{
|
{
|
||||||
|
if (!backlight) return;
|
||||||
|
|
||||||
const byte keySet = 167;
|
const byte keySet = 167;
|
||||||
const byte ledCount = 178;
|
const byte ledCount = 178;
|
||||||
const ushort mapSize = 3 * ledCount;
|
const ushort mapSize = 3 * ledCount;
|
||||||
@@ -511,9 +525,9 @@ namespace GHelper.USB
|
|||||||
buffer[6] = 0;
|
buffer[6] = 0;
|
||||||
buffer[7] = 0x10;
|
buffer[7] = 0x10;
|
||||||
|
|
||||||
if (init)
|
if (init || initDirect)
|
||||||
{
|
{
|
||||||
Init();
|
initDirect = false;
|
||||||
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xBC });
|
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xBC });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,6 +588,8 @@ namespace GHelper.USB
|
|||||||
public static void ApplyDirect(Color color, bool init = false)
|
public static void ApplyDirect(Color color, bool init = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (!backlight) return;
|
||||||
|
|
||||||
if (isACPI)
|
if (isACPI)
|
||||||
{
|
{
|
||||||
Program.acpi.TUFKeyboardRGB(0, color, 0, null);
|
Program.acpi.TUFKeyboardRGB(0, color, 0, null);
|
||||||
@@ -592,9 +608,9 @@ namespace GHelper.USB
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (init)
|
if (init || initDirect)
|
||||||
{
|
{
|
||||||
//Init();
|
initDirect = false;
|
||||||
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc, 1 });
|
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc, 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,6 +737,8 @@ namespace GHelper.USB
|
|||||||
|
|
||||||
public static void ApplyAmbient(bool init = false)
|
public static void ApplyAmbient(bool init = false)
|
||||||
{
|
{
|
||||||
|
if (!backlight) return;
|
||||||
|
|
||||||
var bound = Screen.GetBounds(Point.Empty);
|
var bound = Screen.GetBounds(Point.Empty);
|
||||||
bound.Y += bound.Height / 3;
|
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
|
bound.Height -= (int)Math.Round(bound.Height * (0.33f + 0.022f)); // cut 1/3 of the top screen + windows panel
|
||||||
|
|||||||
@@ -107,13 +107,12 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio
|
|||||||
### ⌨️ Keybindings
|
### ⌨️ Keybindings
|
||||||
|
|
||||||
- ``Fn + F5 / Fn + Shift + F5`` - Toggle Performance Modes forwards / backwards
|
- ``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 + F5 / Ctrl + Shift + Alt + F5`` - Toggle Performance Modes forwards / backwards
|
||||||
- ``Ctrl + Shift + F12`` - Open G-Helper window
|
- ``Ctrl + Shift + F12`` - Open G-Helper window
|
||||||
- ``Ctrl + M1 / M2`` - Screen brightness Down / Up
|
- ``Ctrl + M1 / M2`` - Screen brightness Down / Up
|
||||||
- ``Shift + M1 / M2`` - Backlight brightness Down / Up
|
- ``Shift + M1 / M2`` - Backlight brightness Down / Up
|
||||||
- ``Fn + C`` - Fn-Lock
|
- ``Fn + C`` - Fn-Lock
|
||||||
- ``Fn + Shift + F7 / F8`` - Matrix brightness Down / Up
|
- ``Fn + Shift + F7 / F8`` - Matrix / Slash Lightning brightness Down / Up
|
||||||
- ``Fn + Shift + F7 / F8`` - Screenpad brightness Down / Up
|
- ``Fn + Shift + F7 / F8`` - Screenpad brightness Down / Up
|
||||||
- ``Ctrl + Shift + F20`` - Mute Microphone
|
- ``Ctrl + Shift + F20`` - Mute Microphone
|
||||||
- ``Ctrl + Shift + Alt + F14`` - Eco GPU Mode
|
- ``Ctrl + Shift + Alt + F14`` - Eco GPU Mode
|
||||||
|
|||||||
Reference in New Issue
Block a user