byte[] ProcessPacketHeader(byte[] reply) {
Contract.Requires<ArgumentNullException>(reply != null);
var pos = 0;
byte[] header = {0xFF, 0xFF, 0xFF};
var match = header.All(b => reply[pos++] == b);
if (!match)
return null;
if (reply[pos] == 0xFF)
return reply;
if (reply[pos] == 0xFE)
return CollectPacket(reply, ++pos);
return null;
}