private byte[] EncodeFpInputData()
{
List<byte> fastpathInputData = new List<byte>();
// If the number of input events is greater than 15,
// then the numberEvents bit field in the fast-path header byte
// MUST be set to zero, and the numberEvents optional field inserted
// after the dataSignature field. This allows up to 255 input events in one PDU.
if (fpInputEvents.Count > 0x0F)
{
RdpbcgrEncoder.EncodeStructure(fastpathInputData, fpInputEvents.Count);
}
if (fpInputEvents != null)
{
foreach (TS_FP_INPUT_EVENT fpEvent in fpInputEvents)
{
RdpbcgrEncoder.EncodeStructure(fastpathInputData, fpEvent.eventHeader);
if (fpEvent.eventData.GetType() != typeof(TS_FP_SYNC_EVENT))
{
RdpbcgrEncoder.EncodeStructure(fastpathInputData, fpEvent.eventData);
}
// else type TS_FP_SYNC_EVENT has no following data
}
}
return fastpathInputData.ToArray();
}