private T ReceiveAndBuild <T>(ReportType report, int size) { byte[] array = new byte[size + 1]; array[0] = (byte)report; if (!GetInputReport(array)) { throw new Exception("Error accessing device"); } return(MarshalExt.ByteArrayToStructure <T>(array, 1, size)); }
private void BuildAndSend(object structure, int size, ReportType report) { byte[] array = new byte[size + 1]; array[0] = (byte)report; MarshalExt.StructureToByteArray(structure, array, 1, size); if (!SetOutputReport(array)) { throw new Exception("Error accessing device"); } }