A class indicates the response body of GetProps request
Наследование: AddressBookResponseBodyBase
        /// <summary>
        /// Parse the response data into response body.
        /// </summary>
        /// <param name="rawData">The raw data of response</param>
        /// <returns>The response body of the request</returns>
        public static GetPropsResponseBody Parse(byte[] rawData)
        {
            GetPropsResponseBody responseBody = new GetPropsResponseBody();
            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.HasPropertyValues = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasPropertyValues)
            {
                responseBody.PropertyValues = AddressBookPropValueList.Parse(rawData, ref index);
            }
            else
            {
                responseBody.PropertyValues = 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;
        }
Пример #2
0
        /// <summary>
        /// Parse the response data into response body.
        /// </summary>
        /// <param name="rawData">The raw data of response</param>
        /// <returns>The response body of the request</returns>
        public static GetPropsResponseBody Parse(byte[] rawData)
        {
            GetPropsResponseBody responseBody = new GetPropsResponseBody();
            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.HasPropertyValues = BitConverter.ToBoolean(rawData, index);
            index += sizeof(bool);
            if (responseBody.HasPropertyValues)
            {
                responseBody.PropertyValues = AddressBookPropValueList.Parse(rawData, ref index);
            }
            else
            {
                responseBody.PropertyValues = 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);
        }