/// <summary> /// Parse the ResolveNames request type response body. /// </summary> /// <param name="rawData">The raw data of response.</param> /// <returns>The ResolveNames request type response body.</returns> public static ResolveNamesResponseBody Parse(byte[] rawData) { ResolveNamesResponseBody responseBody = new ResolveNamesResponseBody(); int index = 0; responseBody.StatusCode = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.CodePage = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.HasMinimalIds = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); if (responseBody.HasMinimalIds) { responseBody.MinimalIdCount = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.MinimalIds = new uint[(uint)responseBody.MinimalIdCount]; 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.HasRowsAndPropertyTags = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); if (responseBody.HasRowsAndPropertyTags) { responseBody.PropertyTags = LargePropTagArray.Parse(rawData, ref index); responseBody.RowCount = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.RowData = new AddressBookPropertyRow[(uint)responseBody.RowCount]; for (int i = 0; i < responseBody.RowCount; i++) { responseBody.RowData[i] = AddressBookPropertyRow.Parse(rawData, (LargePropTagArray)responseBody.PropertyTags, ref index); } } 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); }
/// <summary> /// This method is used by the client to perform ambiguous name resolution(ANR). /// </summary> /// <param name="resolveNamesRequestBody">The ResolveNames request type request body.</param> /// <returns>The response body of the ResolveNames request type.</returns> public ResolveNamesResponseBody ResolveNames(ResolveNamesRequestBody resolveNamesRequestBody) { CommonResponse commonResponse = this.SendAddressBookRequest(resolveNamesRequestBody, RequestType.ResolveNames); ResolveNamesResponseBody resolveNamesResponseBody = ResolveNamesResponseBody.Parse(commonResponse.ResponseBodyRawData); this.VerifyResolveNamesResponseBody(resolveNamesResponseBody); if (resolveNamesResponseBody.HasRowsAndPropertyTags) { foreach (AddressBookPropertyRow row in resolveNamesResponseBody.RowData) { this.VerifyAddressBookPropertyRowStructure(row); } this.VerifyLargePropertyTagArrayStructure(resolveNamesResponseBody.PropertyTags.Value); } return(resolveNamesResponseBody); }