public HidReport(int reportSize, HidDeviceData deviceData) { _status = deviceData.Status; Array.Resize(ref _data, reportSize - 1); if ((deviceData.Data != null)) { if (deviceData.Data.Length > 0) { _reportId = deviceData.Data[0]; Exists = true; if (deviceData.Data.Length > 1) { var dataLength = reportSize - 1; if (deviceData.Data.Length < reportSize - 1) dataLength = deviceData.Data.Length; Array.Copy(deviceData.Data, 1, _data, 0, dataLength); } } else Exists = false; } else Exists = false; }
public HidReport(int reportSize, HidDeviceData deviceData) { _status = deviceData.Status; Array.Resize(ref _data, reportSize - 1); if ((deviceData.Data != null)) { if (deviceData.Data.Length > 0) { _reportId = deviceData.Data[0]; Exists = true; if (deviceData.Data.Length > 1) { var dataLength = reportSize - 1; if (deviceData.Data.Length < reportSize - 1) { dataLength = deviceData.Data.Length; } Array.Copy(deviceData.Data, 1, _data, 0, dataLength); } } else { Exists = false; } } else { Exists = false; } }