Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpbcgr.RdpbcgrServerDecoder.ParseUInt16 C# (CSharp) Method

ParseUInt16() private method

Parse UInt16 (parser index is updated according to parsed length)
private ParseUInt16 ( byte data, int &index, bool isBigEndian ) : UInt16
data byte data to be parsed
index int parser index
isBigEndian bool big endian format flag
return UInt16
        private UInt16 ParseUInt16(byte[] data, ref int index, bool isBigEndian)
        {
            // Read 2 bytes
            byte[] bytes = GetBytes(data, ref index, sizeof(UInt16));

            // Big Endian format requires reversed byte order
            if (isBigEndian)
            {
                Array.Reverse(bytes, 0, sizeof(UInt16));
            }

            // Convert
            return BitConverter.ToUInt16(bytes, 0);
        }
RdpbcgrServerDecoder