2.2.1.12 Data Element Package
Inheritance: BaseStructure
        /// <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);
        }