mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa32942c92 | ||
|
|
4a3108a5e0 | ||
|
|
82f5afa278 | ||
|
|
cd95802912 | ||
|
|
0fed74e069 |
@@ -7,7 +7,9 @@ public static class AppConfig
|
|||||||
{
|
{
|
||||||
|
|
||||||
private static string configFile;
|
private static string configFile;
|
||||||
|
|
||||||
private static string? _model;
|
private static string? _model;
|
||||||
|
private static string? _bios;
|
||||||
|
|
||||||
private static Dictionary<string, object> config = new Dictionary<string, object>();
|
private static Dictionary<string, object> config = new Dictionary<string, object>();
|
||||||
|
|
||||||
@@ -69,6 +71,34 @@ public static class AppConfig
|
|||||||
return _model;
|
return _model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static (string, string) GetBiosAndModel()
|
||||||
|
{
|
||||||
|
if (_bios is not null && _model is not null) return (_bios, _model);
|
||||||
|
|
||||||
|
using (ManagementObjectSearcher objSearcher = new ManagementObjectSearcher(@"SELECT * FROM Win32_BIOS"))
|
||||||
|
{
|
||||||
|
using (ManagementObjectCollection objCollection = objSearcher.Get())
|
||||||
|
{
|
||||||
|
foreach (ManagementObject obj in objCollection)
|
||||||
|
if (obj["SMBIOSBIOSVersion"] is not null)
|
||||||
|
{
|
||||||
|
string[] results = obj["SMBIOSBIOSVersion"].ToString().Split(".");
|
||||||
|
if (results.Length > 1)
|
||||||
|
{
|
||||||
|
_model = results[0];
|
||||||
|
_bios = results[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_model = obj["SMBIOSBIOSVersion"].ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (_bios, _model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetModelShort()
|
public static string GetModelShort()
|
||||||
{
|
{
|
||||||
string model = GetModel();
|
string model = GetModel();
|
||||||
@@ -363,12 +393,21 @@ public static class AppConfig
|
|||||||
|
|
||||||
public static bool IsFanScale()
|
public static bool IsFanScale()
|
||||||
{
|
{
|
||||||
return ContainsModel("GU604");
|
if (!ContainsModel("GU604")) return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var (bios, model) = GetBiosAndModel();
|
||||||
|
return (Int32.Parse(bios) < 312);
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsFanRequired()
|
public static bool IsFanRequired()
|
||||||
{
|
{
|
||||||
return ContainsModel("GA402X") || ContainsModel("G513") || ContainsModel("G713R");
|
return ContainsModel("GA402X") || ContainsModel("G513") || ContainsModel("G713R") || ContainsModel("G713P");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsPowerRequired()
|
public static bool IsPowerRequired()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.125</AssemblyVersion>
|
<AssemblyVersion>0.126</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
177
app/Peripherals/Mouse/Models/StrixImpactII.cs
Normal file
177
app/Peripherals/Mouse/Models/StrixImpactII.cs
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
namespace GHelper.Peripherals.Mouse.Models
|
||||||
|
{
|
||||||
|
//P506
|
||||||
|
public class StrixImpactII : AsusMouse
|
||||||
|
{
|
||||||
|
public StrixImpactII() : base(0x0B05, 0x18E1, "mi_00", false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int DPIProfileCount()
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetDisplayName()
|
||||||
|
{
|
||||||
|
return "ROG Strix Impact II";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override PollingRate[] SupportedPollingrates()
|
||||||
|
{
|
||||||
|
return new PollingRate[] {
|
||||||
|
PollingRate.PR125Hz,
|
||||||
|
PollingRate.PR250Hz,
|
||||||
|
PollingRate.PR500Hz,
|
||||||
|
PollingRate.PR1000Hz
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int ProfileCount()
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
public override int MaxDPI()
|
||||||
|
{
|
||||||
|
return 6_200;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasRGB()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasAutoPowerOff()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasAngleSnapping()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasAngleTuning()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasDebounceSetting()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasLowBatteryWarning()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasBattery()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasDPIColors()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsLightingModeSupported(LightingMode lightingMode)
|
||||||
|
{
|
||||||
|
return lightingMode == LightingMode.Static
|
||||||
|
|| lightingMode == LightingMode.Breathing
|
||||||
|
|| lightingMode == LightingMode.ColorCycle
|
||||||
|
|| lightingMode == LightingMode.React;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override LightingZone[] SupportedLightingZones()
|
||||||
|
{
|
||||||
|
return new LightingZone[] { LightingZone.Logo, LightingZone.Scrollwheel, LightingZone.Underglow };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int DPIIncrements()
|
||||||
|
{
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanChangeDPIProfile()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int MaxBrightness()
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override byte IndexForLightingMode(LightingMode lightingMode)
|
||||||
|
{
|
||||||
|
if (lightingMode == LightingMode.React)
|
||||||
|
{
|
||||||
|
return 0x03;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((byte)lightingMode);
|
||||||
|
}
|
||||||
|
protected override LightingMode LightingModeForIndex(byte lightingMode)
|
||||||
|
{
|
||||||
|
if (lightingMode == 0x03)
|
||||||
|
{
|
||||||
|
return LightingMode.React;
|
||||||
|
}
|
||||||
|
return base.LightingModeForIndex(lightingMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override byte[] GetReadLightingModePacket(LightingZone zone)
|
||||||
|
{
|
||||||
|
return new byte[] { 0x00, 0x12, 0x03, 0x00 };
|
||||||
|
}
|
||||||
|
|
||||||
|
protected LightingSetting? ParseLightingSetting(byte[] packet, LightingZone zone)
|
||||||
|
{
|
||||||
|
if (packet[1] != 0x12 || packet[2] != 0x03)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int offset = 5 + (((int)zone) * 5);
|
||||||
|
|
||||||
|
LightingSetting setting = new LightingSetting();
|
||||||
|
|
||||||
|
setting.LightingMode = LightingModeForIndex(packet[offset + 0]);
|
||||||
|
setting.Brightness = packet[offset + 1];
|
||||||
|
|
||||||
|
setting.RGBColor = Color.FromArgb(packet[offset + 2], packet[offset + 3], packet[offset + 4]);
|
||||||
|
|
||||||
|
|
||||||
|
return setting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ReadLightingSetting()
|
||||||
|
{
|
||||||
|
if (!HasRGB())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Mouse sends all lighting zones in one response
|
||||||
|
//00 12 03 00 00 [00 04 ff 00 80] [00 04 00 ff ff] [00 04 ff ff ff] 00 00 00 00 00 00 00 00 00 00 00 00 00 0
|
||||||
|
byte[]? response = WriteForResponse(GetReadLightingModePacket(LightingZone.All));
|
||||||
|
if (response is null) return;
|
||||||
|
|
||||||
|
LightingZone[] lz = SupportedLightingZones();
|
||||||
|
for (int i = 0; i < lz.Length; ++i)
|
||||||
|
{
|
||||||
|
LightingSetting? ls = ParseLightingSetting(response, lz[i]);
|
||||||
|
if (ls is null)
|
||||||
|
{
|
||||||
|
Logger.WriteLine(GetDisplayName() + ": Failed to read RGB Setting for Zone " + lz[i].ToString());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.WriteLine(GetDisplayName() + ": Read RGB Setting for Zone " + lz[i].ToString() + ": " + ls.ToString());
|
||||||
|
LightingSetting[i] = ls;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -204,6 +204,7 @@ namespace GHelper.Peripherals
|
|||||||
DetectMouse(new KerisWirelssAimpointWired());
|
DetectMouse(new KerisWirelssAimpointWired());
|
||||||
DetectMouse(new PugioII());
|
DetectMouse(new PugioII());
|
||||||
DetectMouse(new PugioIIWired());
|
DetectMouse(new PugioIIWired());
|
||||||
|
DetectMouse(new StrixImpactII());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DetectMouse(AsusMouse am)
|
public static void DetectMouse(AsusMouse am)
|
||||||
|
|||||||
@@ -1187,8 +1187,16 @@ namespace GHelper
|
|||||||
|
|
||||||
if (m.IsDeviceReady)
|
if (m.IsDeviceReady)
|
||||||
{
|
{
|
||||||
b.Text = m.GetDisplayName() + "\n" + m.Battery + "%"
|
if (m.HasBattery())
|
||||||
+ (m.Charging ? "(" + Properties.Strings.Charging + ")" : "");
|
{
|
||||||
|
b.Text = m.GetDisplayName() + "\n" + m.Battery + "%"
|
||||||
|
+ (m.Charging ? "(" + Properties.Strings.Charging + ")" : "");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
b.Text = m.GetDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ namespace GHelper
|
|||||||
const int DRIVER_NEWER = 1;
|
const int DRIVER_NEWER = 1;
|
||||||
|
|
||||||
//static int rowCount = 0;
|
//static int rowCount = 0;
|
||||||
static string model;
|
|
||||||
static string bios;
|
static string bios;
|
||||||
|
static string model;
|
||||||
|
|
||||||
static int updatesCount = 0;
|
static int updatesCount = 0;
|
||||||
private static long lastUpdate;
|
private static long lastUpdate;
|
||||||
@@ -33,7 +33,7 @@ namespace GHelper
|
|||||||
if (!force && (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastUpdate) < 5000)) return;
|
if (!force && (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastUpdate) < 5000)) return;
|
||||||
lastUpdate = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
lastUpdate = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||||
|
|
||||||
InitBiosAndModel();
|
(bios, model) = AppConfig.GetBiosAndModel();
|
||||||
|
|
||||||
updatesCount = 0;
|
updatesCount = 0;
|
||||||
labelUpdates.ForeColor = colorEco;
|
labelUpdates.ForeColor = colorEco;
|
||||||
@@ -116,31 +116,6 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string InitBiosAndModel()
|
|
||||||
{
|
|
||||||
using (ManagementObjectSearcher objSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_BIOS"))
|
|
||||||
{
|
|
||||||
using (ManagementObjectCollection objCollection = objSearcher.Get())
|
|
||||||
{
|
|
||||||
foreach (ManagementObject obj in objCollection)
|
|
||||||
if (obj["SMBIOSBIOSVersion"] is not null)
|
|
||||||
{
|
|
||||||
string[] results = obj["SMBIOSBIOSVersion"].ToString().Split(".");
|
|
||||||
if (results.Length > 1)
|
|
||||||
{
|
|
||||||
model = results[0];
|
|
||||||
bios = results[1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
model = obj["SMBIOSBIOSVersion"].ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void VisualiseDriver(DriverDownload driver, TableLayoutPanel table)
|
public void VisualiseDriver(DriverDownload driver, TableLayoutPanel table)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user