Microsoft.Protocols.TestSuites.Common.RopSetSearchCriteriaRequest.Serialize C# (CSharp) Method

Serialize() public method

Serialize the ROP request buffer.
public Serialize ( ) : byte[]
return byte[]
        public byte[] Serialize()
        {
            int index = 0;
            byte[] serializeBuffer = new byte[this.Size()];

            serializeBuffer[index++] = this.RopId;
            serializeBuffer[index++] = this.LogonId;
            serializeBuffer[index++] = this.InputHandleIndex;

            // Serialize RestrictionDataSize
            Array.Copy(BitConverter.GetBytes((ushort)this.RestrictionDataSize), 0, serializeBuffer, index, sizeof(ushort));
            index += sizeof(ushort);

            if (this.RestrictionDataSize > 0)
            {
                // Serialize RestrictionData
                Array.Copy(this.RestrictionData, 0, serializeBuffer, index, this.RestrictionDataSize);
                index += this.RestrictionDataSize;
            }

            // Serialize FolderIdCount
            Array.Copy(BitConverter.GetBytes((ushort)this.FolderIdCount), 0, serializeBuffer, index, sizeof(ushort));
            index += sizeof(ushort);

            for (int i = 0; i < this.FolderIdCount; i++)
            {
                // Serialize FolderIds
                Array.Copy(BitConverter.GetBytes((ulong)this.FolderIds[i]), 0, serializeBuffer, index, sizeof(ulong));
                index += sizeof(ulong);
            }

            // Serialize SearchFlags
            Array.Copy(BitConverter.GetBytes((uint)this.SearchFlags), 0, serializeBuffer, index, sizeof(uint));
            index += sizeof(uint);

            return serializeBuffer;
        }
RopSetSearchCriteriaRequest