Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.GetMatchesResponseBody.Parse C# (CSharp) Method

Parse() public static method

Parse the GetMatches request type response body.
public static Parse ( byte rawData ) : GetMatchesResponseBody
rawData byte The raw data of response.
return GetMatchesResponseBody
        public static GetMatchesResponseBody Parse(byte[] rawData)
        {
            GetMatchesResponseBody responseBody = new GetMatchesResponseBody();
            int index = 0;
            responseBody.StatusCode = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index);
            index += sizeof(uint);
            responseBody.HasState = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasState)
            {
                responseBody.State = STAT.Parse(rawData, ref index);
            }
            else
            {
                responseBody.State = null;
            }

            responseBody.HasMinimalIds = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasMinimalIds)
            {
                responseBody.MinimalIdCount = BitConverter.ToUInt32(rawData, index);
                responseBody.MinimalIds = new uint[(uint)responseBody.MinimalIdCount];
                index += sizeof(uint);
                for (int i = 0; i < responseBody.MinimalIdCount; i++)
                {
                    responseBody.MinimalIds[i] = BitConverter.ToUInt32(rawData, index);
                    index += sizeof(uint);
                }
            }
            else
            {
                responseBody.MinimalIdCount = null;
                responseBody.MinimalIds = null;
            }

            responseBody.HasColumnsAndRows = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasColumnsAndRows)
            {
                responseBody.Columns = LargePropertyTagArray.Parse(rawData, ref index);
                responseBody.RowCount = BitConverter.ToUInt32(rawData, index);
                responseBody.RowData = new AddressBookPropertyRow[(uint)responseBody.RowCount];
                index += sizeof(uint);
                for (int i = 0; i < responseBody.RowCount; i++)
                {
                    responseBody.RowData[i] = AddressBookPropertyRow.Parse(rawData, (LargePropertyTagArray)responseBody.Columns, ref index);
                }
            }
            else
            {
                responseBody.Columns = null;
                responseBody.RowCount = null;
                responseBody.RowData = null;
            }

            responseBody.AuxiliaryBufferSize = BitConverter.ToUInt32(rawData, index);
            index += 4;
            responseBody.AuxiliaryBuffer = new byte[responseBody.AuxiliaryBufferSize];
            Array.Copy(rawData, index, responseBody.AuxiliaryBuffer, 0, responseBody.AuxiliaryBufferSize);
            return responseBody;
        }
    }

Usage Example

        /// <summary>
        /// This method is used by the client to get an Explicit Table, in which the rows are determined by the specified criteria.
        /// </summary>
        /// <param name="getMatchesRequestBody">The GetMatches request type request body.</param>
        /// <returns>The response body of the GetMatches request type.</returns>
        public GetMatchesResponseBody GetMatches(GetMatchesRequestBody getMatchesRequestBody)
        {
            CommonResponse         commonResponse         = this.SendAddressBookRequest(getMatchesRequestBody, RequestType.GetMatches);
            GetMatchesResponseBody getMatchesResponseBody = GetMatchesResponseBody.Parse(commonResponse.ResponseBodyRawData);

            this.VerifyGetMatchsResponseBody(getMatchesRequestBody, getMatchesResponseBody);

            if (getMatchesResponseBody.HasColumnsAndRows)
            {
                foreach (AddressBookPropertyRow row in getMatchesResponseBody.RowData)
                {
                    this.VerifyAddressBookPropertyRowStructure(row);
                }
            }

            return(getMatchesResponseBody);
        }
GetMatchesResponseBody