2.2.1.5.4 16-bit Stream Object Header End
Наследование: StreamObjectHeader
 /// <summary>
 /// Parse the TargetPartitionId structure.
 /// </summary>
 /// <param name="s">An stream containing TargetPartitionId structure.</param>
 public override void Parse(Stream s)
 {
     base.Parse(s);
     this.TargetPartitionIdStart = new bit32StreamObjectHeaderStart();
     this.TargetPartitionIdStart.Parse(s);
     this.PartitionIdGUID = ReadGuid();
     this.TargetPartitionIdEnd = new bit16StreamObjectHeaderEnd();
     this.TargetPartitionIdEnd.Parse(s);
 }
        /// <summary>
        /// Parse the SpecializedKnowledge structure.
        /// </summary>
        /// <param name="s">An stream containing SpecializedKnowledge structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.SpecializedKnowledgeStart = new bit32StreamObjectHeaderStart();
            this.SpecializedKnowledgeStart.Parse(s);
            this.GUID = ReadGuid();

            switch (this.GUID.ToString().ToUpper())
            {
                case "327A35F6-0761-4414-9686-51E900667A4D":
                    this.SpecializedKnowledgeData = new CellKnowLedge();
                    ((CellKnowLedge)this.SpecializedKnowledgeData).Parse(s);
                    break;
                case "3A76E90E-8032-4D0C-B9DD-F3C65029433E":
                    this.SpecializedKnowledgeData = new WaterlineKnowledge();
                    ((WaterlineKnowledge)this.SpecializedKnowledgeData).Parse(s);
                    break;
                case "0ABE4F35-01DF-4134-A24A-7C79F0859844":
                    this.SpecializedKnowledgeData = new FragmentKnowledge();
                    ((FragmentKnowledge)this.SpecializedKnowledgeData).Parse(s);
                    break;
                case "10091F13-C882-40FB-9886-6533F934C21D":
                    this.SpecializedKnowledgeData = new ContentTagKnowledge();
                    ((ContentTagKnowledge)this.SpecializedKnowledgeData).Parse(s);
                    break;
                default:
                    throw new Exception("The GUID is not right.");

            }
            this.SpecializedKnowledgeEnd = new bit16StreamObjectHeaderEnd();
            this.SpecializedKnowledgeEnd.Parse(s);
        }
        /// <summary>
        /// Parse the StreamObjectHeader structure.
        /// </summary>
        /// <param name="s">An stream containing StreamObjectHeader structure.</param>
        public StreamObjectHeader TryParse(Stream s)
        {
            base.Parse(s);
            byte temp = ReadByte();
            s.Position -= 1;
            StreamObjectHeader streamObjectHeader = new StreamObjectHeader();
            if ((temp & 0x03) == 0x0)
            {
                streamObjectHeader = new bit16StreamObjectHeaderStart();
                streamObjectHeader.Parse(s);
            }
            else if ((temp & 0x03) == 0x02)
            {
                streamObjectHeader = new bit32StreamObjectHeaderStart();
                streamObjectHeader.Parse(s);
            }
            else if ((temp & 0x03) == 0x01)
            {
                streamObjectHeader = new bit8StreamObjectHeaderEnd();
                streamObjectHeader.Parse(s);
            }
            else if ((temp & 0x03) == 0x03)
            {
                streamObjectHeader = new bit16StreamObjectHeaderEnd();
                streamObjectHeader.Parse(s);
            }

            return streamObjectHeader;
        }
 /// <summary>
 /// Parse the QueryAccessResponse structure.
 /// </summary>
 /// <param name="s">An stream containing QueryAccessResponse structure.</param>
 public override void Parse(Stream s)
 {
     base.Parse(s);
     this.ReadAccessResponseStart = new bit32StreamObjectHeaderStart();
     this.ReadAccessResponseStart.Parse(s);
     this.ReadAccessResponseError = new ResponseError();
     this.ReadAccessResponseError.Parse(s);
     this.ReadAccessResponseEnd = new bit16StreamObjectHeaderEnd();
     this.ReadAccessResponseEnd.Parse(s);
     this.WriteAccessResponseStart = new bit32StreamObjectHeaderStart();
     this.WriteAccessResponseStart.Parse(s);
     this.WriteAccessResponseError = new ResponseError();
     this.WriteAccessResponseError.Parse(s);
     this.WriteAccessResponseEnd = new bit16StreamObjectHeaderEnd();
     this.WriteAccessResponseEnd.Parse(s);
 }
        /// <summary>
        /// Parse the ResponseError structure.
        /// </summary>
        /// <param name="s">An stream containing ResponseError structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.ErrorStart = new bit32StreamObjectHeaderStart();
            this.ErrorStart.Parse(s);
            this.ErrorTypeGUID = ReadGuid();
            if (this.ErrorTypeGUID.ToString().ToUpper() == "5A66A756-87CE-4290-A38B-C61C5BA05A67")
            {
                this.ErrorData = new CellError();
                ((CellError)this.ErrorData).Parse(s);
            }
            else if (this.ErrorTypeGUID.ToString().ToUpper() == "7AFEAEBF-033D-4828-9C31-3977AFE58249")
            {
                this.ErrorData = new ProtocolError();
                ((ProtocolError)this.ErrorData).Parse(s);
            }
            else if (this.ErrorTypeGUID.ToString().ToUpper() == "32C39011-6E39-46C4-AB78-DB41929D679E")
            {
                this.ErrorData = new Win32Error();
                ((Win32Error)this.ErrorData).Parse(s);
            }
            else if (this.ErrorTypeGUID.ToString().ToUpper() == "8454C8F2-E401-405A-A198-A10B6991B56E")
            {
                this.ErrorData = new HRESULTError();
                ((HRESULTError)this.ErrorData).Parse(s);
            }

            if (ContainsStreamObjectHeader(0x04E))
            {
                this.ErrorStringSupplementalInfoStart = new bit32StreamObjectHeaderStart();
                this.ErrorStringSupplementalInfoStart.Parse(s);
                this.ErrorStringSupplementalInfo = new StringItem();
                this.ErrorStringSupplementalInfo.Parse(s);
            }

            if (ContainsStreamObjectStart32BitHeader(0x04D))
            {
                this.ChainedError = new ResponseError();
                this.ChainedError.Parse(s);
            }
            this.ErrorEnd = new bit16StreamObjectHeaderEnd();
            this.ErrorEnd.Parse(s);
        }
        /// <summary>
        /// Parse the FsshttpbSubResponse structure.
        /// </summary>
        /// <param name="s">An stream containing FsshttpbSubResponse structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.SubResponseStart = new bit32StreamObjectHeaderStart();
            this.SubResponseStart.Parse(s);
            this.RequestID = new CompactUnsigned64bitInteger();
            this.RequestID = RequestID.TryParse(s);
            this.RequestType = new CompactUnsigned64bitInteger();
            this.RequestType = RequestType.TryParse(s);
            byte tempByte = ReadByte();
            this.Status = GetBits(tempByte, 0, 1);
            this.Reserved = GetBits(tempByte, 1, 7);
            if (this.Status == 0x1)
            {
                this.ResponseError = new ResponseError();
                this.ResponseError.Parse(s);
            }
            else
            {
                if (this.RequestType.GetUint(RequestType) == 0x01)
                {
                    this.SubResponseData = new QueryAccessResponse();
                    ((QueryAccessResponse)this.SubResponseData).Parse(s);
                }
                else if (this.RequestType.GetUint(RequestType) == 0x02)
                {
                    this.SubResponseData = new QueryChangesResponse();
                    ((QueryChangesResponse)this.SubResponseData).Parse(s);
                }
                else if (this.RequestType.GetUint(RequestType) == 0x05)
                {
                    this.SubResponseData = new PutChangesResponse();
                    ((PutChangesResponse)this.SubResponseData).Parse(s);
                }
                else if (this.RequestType.GetUint(RequestType) == 0x0B)
                {
                    this.SubResponseData = new AllocateExtendedGUIDRange();
                    ((AllocateExtendedGUIDRange)this.SubResponseData).Parse(s);
                }

            }
            this.SubResponseEnd = new bit16StreamObjectHeaderEnd();
            this.SubResponseEnd.Parse(s);
        }
        /// <summary>
        /// Parse the ObjectMetadataDeclaration structure.
        /// </summary>
        /// <param name="s">An stream containing ObjectMetadataDeclaration structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.ObjectGroupMetadataDeclarations = new bit32StreamObjectHeaderStart();
            this.ObjectGroupMetadataDeclarations.Parse(s);

            List<ObjectMetadata> ObjectMetadataList = new List<ObjectMetadata>();
            while (ContainsStreamObjectHeader(0x78))
            {
                ObjectMetadata tempObjectMetadata = new ObjectMetadata();
                tempObjectMetadata.Parse(s);
                ObjectMetadataList.Add(tempObjectMetadata);
            }
            this.ObjectMetadata = ObjectMetadataList.ToArray();
            this.ObjectGroupMetadataDeclarationsEnd = new bit16StreamObjectHeaderEnd();
            this.ObjectGroupMetadataDeclarationsEnd.Parse(s);
        }
        /// <summary>
        /// Parse the FsshttpbSubRequests structure.
        /// </summary>
        /// <param name="s">An stream containing FsshttpbSubRequests structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.SubRequestStart = new bit32StreamObjectHeaderStart();
            this.SubRequestStart.Parse(s);
            this.RequestID = new CompactUnsigned64bitInteger();
            this.RequestID = this.RequestID.TryParse(s);
            this.RequestType = new CompactUnsigned64bitInteger();
            this.RequestType = this.RequestType.TryParse(s);
            this.Priority = new CompactUnsigned64bitInteger();
            this.Priority = this.Priority.TryParse(s);
            if (ContainsStreamObjectHeader(0x83))
            {
                this.TargetPartitionId = new TargetPartitionId();
                this.TargetPartitionId.Parse(s);
            }

            switch (RequestType.GetUint(RequestType))
            {
                case 0x01:
                    this.SubRequestData = new QueryAccessRequest();
                    break;
                case 0x02:
                    this.SubRequestData = new QueryChangesRequest();
                    ((QueryChangesRequest)this.SubRequestData).Parse(s);
                    break;
                case 0x05:
                    this.SubRequestData = new PutChangesRequest();
                    ((PutChangesRequest)this.SubRequestData).Parse(s);
                    break;
                case 0x0B:
                    this.SubRequestData = new AllocateExtendedGUIDRangeRequest();
                    ((AllocateExtendedGUIDRangeRequest)this.SubRequestData).Parse(s);
                    break;
                default:
                    throw new Exception("The RequestType is not right.");
            }
            this.SubRequestEnd = new bit16StreamObjectHeaderEnd();
            this.SubRequestEnd.Parse(s);
        }
        /// <summary>
        /// Parse the FsshttpbResponse structure.
        /// </summary>
        /// <param name="s">An stream containing FsshttpbResponse structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.ProtocolVersion = ReadUshort();
            this.MinimumVersion = ReadUshort();
            this.Signature = ReadUlong();
            this.ResponseStart = new bit32StreamObjectHeaderStart();
            this.ResponseStart.Parse(s);
            byte tempByte = ReadByte();
            this.Status = GetBits(tempByte, 0, 1);
            this.Reserved = GetBits(tempByte, 1, 7);

            if (this.Status == 0x1)
            {
                this.ResponseError = new ResponseError();
                this.ResponseError.Parse(s);
            }
            else
            {
                if (ContainsStreamObjectHeader(0x15))
                {
                    this.DataElementPackage = new DataElementPackage();
                    this.DataElementPackage.Parse(s);
                }

                if (ContainsStreamObjectHeader(0x041))
                {
                    List<FsshttpbSubResponse> tempResponses = new List<FsshttpbSubResponse>();
                    do
                    {
                        FsshttpbSubResponse subResponse = new FsshttpbSubResponse();
                        subResponse.Parse(s);
                        tempResponses.Add(subResponse);
                        this.SubResponses = tempResponses.ToArray();
                    } while (ContainsStreamObjectHeader(0x041));
                }
            }

            this.ResponseEnd = new bit16StreamObjectHeaderEnd();
            this.ResponseEnd.Parse(s);
        }
        /// <summary>
        /// Parse the FsshttpbRequest structure.
        /// </summary>
        /// <param name="s">An stream containing FsshttpbRequest structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.ProtocolVersion = ReadUshort();
            this.MinimumVersion = ReadUshort();
            this.Signature = ReadUlong();
            this.RequestStart = new bit32StreamObjectHeaderStart();
            this.RequestStart.Parse(s);
            this.UserAgentStart = new bit32StreamObjectHeaderStart();
            this.UserAgentStart.Parse(s);
            if (ContainsStreamObjectHeader(0x055))
            {
                this.UserAgentGUID = new bit32StreamObjectHeaderStart();
                this.UserAgentGUID.Parse(s);
            }
            if (this.UserAgentGUID != null)
            {
                this.GUID = ReadGuid();
            }
            if (ContainsStreamObjectHeader(0x8B))
            {
                this.UserAgentClientAndPlatform = new bit32StreamObjectHeaderStart();
                this.UserAgentClientAndPlatform.Parse(s);
            }

            if (this.UserAgentClientAndPlatform != null)
            {
                this.ClientCount = new CompactUnsigned64bitInteger();
                this.ClientCount = this.ClientCount.TryParse(s);
                this.ClientByteArray = ReadBytes((int)this.ClientCount.GetUint(this.ClientCount));
                this.PlatformCount = new CompactUnsigned64bitInteger();
                this.PlatformCount = this.PlatformCount.TryParse(s);
                this.PlatformByteArray = ReadBytes((int)this.PlatformCount.GetUint(this.PlatformCount));
            }

            this.UserAgentVersion = new bit32StreamObjectHeaderStart();
            this.UserAgentVersion.Parse(s);
            this.Version = ReadUint();
            this.UserAgentEnd = new bit16StreamObjectHeaderEnd();
            this.UserAgentEnd.Parse(s);
            if (ContainsStreamObjectHeader(0x8D))//TODO: This should be 0x88 accroding to TD, but in the capture files of sharepoint server 2013, it is 0x8D.
            {
                this.RequestHashingOptionsDeclaration = new bit32StreamObjectHeaderStart();
                this.RequestHashingOptionsDeclaration.Parse(s);
            }

            if (this.RequestHashingOptionsDeclaration != null)
            {
                // TODO: Missing fields (A B C D E) here, because it's seems these is not containd in capture files of sharepoint server 13.
                this.RequestHasingSchema = new CompactUnsigned64bitInteger();
                this.RequestHasingSchema = this.RequestHasingSchema.TryParse(s);
            }

            if (ContainsStreamObjectHeader(0x042))
            {
                List<FsshttpbSubRequest> tempRequest = new List<FsshttpbSubRequest>();
                do
                {
                    FsshttpbSubRequest subRequest = new FsshttpbSubRequest();
                    subRequest.Parse(s);
                    tempRequest.Add(subRequest);
                    this.SubRequest = tempRequest.ToArray();
                } while (ContainsStreamObjectHeader(0x042));
            }
            if (ContainsStreamObjectHeader(0x15))
            {
                this.DataElementPackage = new DataElementPackage();
                this.DataElementPackage.Parse(s);
            }
            this.RequestEnd = new bit16StreamObjectHeaderEnd();
            this.RequestEnd.Parse(s);
        }
 /// <summary>
 /// Parse the FragmentKnowledge structure.
 /// </summary>
 /// <param name="s">An stream containing FragmentKnowledge structure.</param>
 public override void Parse(Stream s)
 {
     base.Parse(s);
     this.FragmentKnowledgeStart = new bit32StreamObjectHeaderStart();
     this.FragmentKnowledgeStart.Parse(s);
     List<FragmentKnowledgeEntry> tempFragment = new List<FragmentKnowledgeEntry>();
     do
     {
         FragmentKnowledgeEntry Fragmentknowledge = new FragmentKnowledgeEntry();
         Fragmentknowledge.Parse(s);
         tempFragment.Add(Fragmentknowledge);
     } while (ContainsStreamObjectHeader(0x06C));
     this.FragmentKnowledgeEntries = tempFragment.ToArray();
     this.FragmentKnowledgeEnd = new bit16StreamObjectHeaderEnd();
     this.FragmentKnowledgeEnd.Parse(s);
 }
        /// <summary>
        /// Parse the Filter structure.
        /// </summary>
        /// <param name="s">An stream containing Filter structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.QueryChangesFilterStart = new bit32StreamObjectHeaderStart();
            this.QueryChangesFilterStart.Parse(s);
            this.FilterType = (FilterType)ReadByte();
            this.FilterOperation = ReadByte();

            switch (this.FilterType)
            {
                case Parsers.FilterType.AllFilter:
                case Parsers.FilterType.StorageIndexReferencedDataElementsFilter:
                    break;
                case Parsers.FilterType.DataElementIDsFilter:
                    this.QueryChangesFilterData = new DataElementIDsFilter();
                    ((DataElementIDsFilter)this.QueryChangesFilterData).Parse(s);
                    break;
                case Parsers.FilterType.DataElementTypeFilter:
                    this.QueryChangesFilterData = new DataElementTypeFilter();
                    ((DataElementTypeFilter)this.QueryChangesFilterData).Parse(s);
                    break;
                case Parsers.FilterType.CellIDFilter:
                    this.QueryChangesFilterData = new CellIDFilter();
                    ((CellIDFilter)this.QueryChangesFilterData).Parse(s);
                    break;
                case Parsers.FilterType.CustomFilter:
                    this.QueryChangesFilterData = new CustomFilter();
                    ((CustomFilter)this.QueryChangesFilterData).Parse(s);
                    break;
                case Parsers.FilterType.HierarchyFilter:
                    this.QueryChangesFilterData = new HierarchyFilter();
                    ((HierarchyFilter)this.QueryChangesFilterData).Parse(s);
                    break;
                default:
                    throw new Exception("The FilterType is not right.");
            }

            this.QueryChangesFilterEnd = new bit16StreamObjectHeaderEnd();
            this.QueryChangesFilterEnd.Parse(s);

            if (ContainsStreamObjectStart32BitHeader(0x87))
            {
                this.QueryChangesFilterFlags = new bit32StreamObjectHeaderStart();
                this.QueryChangesFilterFlags.Parse(s);
            }
            if (this.QueryChangesFilterFlags != null)
            {
                byte tempByte = ReadByte();
                this.F = GetBits(tempByte, 0, 1);
                this.Reserved = GetBits(tempByte, 1, 7);
            }
        }