Beispiel #1
0
        /// <summary>
        /// Deserialize sub response data from byte array.
        /// </summary>
        /// <param name="byteArray">The byte array which contains sub response data.</param>
        /// <param name="currentIndex">The index special where to start.</param>
        protected override void DeserializeSubResponseDataFromByteArray(byte[] byteArray, ref int currentIndex)
        {
            int index        = currentIndex;
            int headerLength = 0;
            StreamObjectHeaderStart header;

            if ((headerLength = StreamObjectHeaderStart.TryParse(byteArray, index, out header)) == 0)
            {
                throw new ResponseParseErrorException(index, "Failed to parse the QueryChangesData stream object header", null);
            }

            if (header.Type != StreamObjectTypeHeaderStart.QueryChangesResponse)
            {
                throw new ResponseParseErrorException(index, "Failed to extract the QueryChangesData stream object header type, unexpected value " + header.Type, null);
            }

            index += headerLength;
            this.QueryChangesResponseStart = header as StreamObjectHeaderStart32bit;

            int currentTmpIndex = index;

            this.StorageIndexExtendedGUID = BasicObject.Parse <ExGuid>(byteArray, ref index);
            this.PartialResult            = (byteArray[index] & 0x1) == 0x1 ? true : false;
            this.ReservedQueryChanges     = (byte)(byteArray[index] >> 1);
            index += 1;

            if (index - currentTmpIndex != header.Length)
            {
                throw new ResponseParseErrorException(-1, "QueryChangesData object over-parse error", null);
            }

            this.Knowledge = StreamObject.GetCurrent <Knowledge>(byteArray, ref index);
            currentIndex   = index;
        }