Add support for HX1500i (#865)

+ fix unsafe array trimming
This commit is contained in:
Rem0o
2022-11-01 09:48:06 +01:00
committed by GitHub
parent 53b0305512
commit ea87e39188
2 changed files with 6 additions and 10 deletions
@@ -8,6 +8,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using HidSharp;
@@ -343,15 +344,7 @@ internal static class UsbApi
string ArrayToString(byte[] ar)
{
int i = 0;
while (ar[i] != 0)
i++;
byte[] trimmed = new byte[i];
for (int j = 0; j < i; j++)
trimmed[j] = ar[j];
return Encoding.ASCII.GetString(trimmed);
return Encoding.ASCII.GetString(ar.TakeWhile(x => x != 0).ToArray());
}
return new FirmwareInfo { Vendor = ArrayToString(vendorArr), Product = ArrayToString(productArr) };
@@ -21,11 +21,14 @@ public class CorsairPsuGroup : IGroup
0x1c06, // HX850i
0x1c07, // HX1000i
0x1c08, // HX1200i
0x1c1f, // HX1500i
0x1c09, // RM550i
0x1c0a, // RM650i
0x1c0b, // RM750i
0x1c0c, // RM850i
0x1c0d // RM1000i
0x1c0d, // RM1000i
// 0x1c11, // AX1600i
};