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

ParseNetworkDetectionResponse() public method

Parse Network Detection Response Structures
public ParseNetworkDetectionResponse ( byte data, int &currentIndex, bool isSubHeader = false ) : NETWORK_DETECTION_RESPONSE
data byte
currentIndex int
isSubHeader bool
return NETWORK_DETECTION_RESPONSE
        public NETWORK_DETECTION_RESPONSE ParseNetworkDetectionResponse(byte[] data, ref int currentIndex, bool isSubHeader = false)
        {
            byte headerLength = (byte)data.Length;
            HeaderTypeId_Values headerTypeId = HeaderTypeId_Values.TYPE_ID_AUTODETECT_RESPONSE;
            if (isSubHeader)
            {
                headerLength += 2;
            }
            else
            {
                headerLength = ParseByte(data, ref currentIndex);
                headerTypeId = (HeaderTypeId_Values)ParseByte(data, ref currentIndex);
            }
            ushort sequenceNumber = ParseUInt16(data, ref currentIndex, false);
            AUTO_DETECT_RESPONSE_TYPE responseType = (AUTO_DETECT_RESPONSE_TYPE)ParseUInt16(data, ref currentIndex, false);
            if (responseType == AUTO_DETECT_RESPONSE_TYPE.RDP_RTT_RESPONSE)
            {
                RDP_RTT_RESPONSE rttResp = new RDP_RTT_RESPONSE();
                rttResp.headerLength = headerLength;
                rttResp.headerTypeId = headerTypeId;
                rttResp.sequenceNumber = sequenceNumber;
                rttResp.responseType = responseType;
                return rttResp;
            }
            else if (responseType == AUTO_DETECT_RESPONSE_TYPE.RDP_BW_RESULTS_AFTER_CONNECT || responseType == AUTO_DETECT_RESPONSE_TYPE.RDP_BW_RESULTS_DURING_CONNECT)
            {
                RDP_BW_RESULTS bwResults = new RDP_BW_RESULTS();
                bwResults.headerLength = headerLength;
                bwResults.headerTypeId = headerTypeId;
                bwResults.sequenceNumber = sequenceNumber;
                bwResults.responseType = responseType;
                bwResults.timeDelta = ParseUInt32(data, ref currentIndex, false);
                bwResults.byteCount = ParseUInt32(data, ref currentIndex, false);
                return bwResults;
            }
            else if (responseType == AUTO_DETECT_RESPONSE_TYPE.RDP_NETCHAR_SYNC)
            {
                RDP_NETCHAR_SYNC netCharSync = new RDP_NETCHAR_SYNC();
                netCharSync.headerLength = headerLength;
                netCharSync.headerTypeId = headerTypeId;
                netCharSync.sequenceNumber = sequenceNumber;
                netCharSync.responseType = responseType;
                netCharSync.bandwidth = ParseUInt32(data, ref currentIndex, false);
                netCharSync.rtt = ParseUInt32(data, ref currentIndex, false);
                return netCharSync;
            }
            else
            {
                throw new FormatException(ConstValue.ERROR_MESSAGE_ENUM_UNRECOGNIZED);
            }
        }
RdpbcgrServerDecoder