public Deserialize ( byte ropBytes, int startIndex ) : int | ||
ropBytes | byte | ROPs bytes in response. |
startIndex | int | The start index of this ROP. |
return | int |
/// <summary> /// Parses a response with multiple ROPs. In this scenario, the response is designed as only containing two ROPs: RopSetColumn and RopQueryRows. /// </summary> /// <param name="rgbOutput">The raw data that contains the ROP response payload</param> /// <returns>The ROP response list which contains RopSetColumnResponse and RopQueryRawResponse</returns> private List<IDeserializable> ParseMultipleRopsResponse(byte[] rgbOutput) { int parseByteLength = 0; List<IDeserializable> multipleRopsResponse = new List<IDeserializable>(); RPC_HEADER_EXT rpcHeader = new RPC_HEADER_EXT { Version = BitConverter.ToUInt16(rgbOutput, parseByteLength) }; // Parse RPC_HEADER_EXT structure parseByteLength += sizeof(short); rpcHeader.Flags = BitConverter.ToUInt16(rgbOutput, parseByteLength); parseByteLength += sizeof(short); rpcHeader.Size = BitConverter.ToUInt16(rgbOutput, parseByteLength); parseByteLength += sizeof(short); rpcHeader.SizeActual = BitConverter.ToUInt16(rgbOutput, parseByteLength); parseByteLength += sizeof(short); // Passed 2 bytes which is size of ROP response. parseByteLength += sizeof(short); // Parse RopSetColumns response RopSetColumnsResponse setColumnsResponse = new RopSetColumnsResponse(); parseByteLength += setColumnsResponse.Deserialize(rgbOutput, parseByteLength); // Parse RopQueryRows response RopQueryRowsResponse queryRowsResponse = new RopQueryRowsResponse(); parseByteLength += queryRowsResponse.Deserialize(rgbOutput, parseByteLength); multipleRopsResponse.Add(setColumnsResponse); multipleRopsResponse.Add(queryRowsResponse); return multipleRopsResponse; }