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

Serialize() public method

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

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

            Array.Copy(BitConverter.GetBytes((ushort)this.HierarchyValueCount), 0, serializedBuffer, index, sizeof(ushort));
            index += sizeof(ushort);
            for (int i = 0; i < this.HierarchyValueCount; i++)
            {
                if (this.HierarchyValues[i].Value != null)
                {
                    Array.Copy(this.HierarchyValues[i].Serialize(), 0, serializedBuffer, index, this.HierarchyValues[i].Size());
                    index += this.HierarchyValues[i].Size();
                }
            }

            Array.Copy(BitConverter.GetBytes((ushort)this.PropertyValueCount), 0, serializedBuffer, index, sizeof(ushort));
            index += sizeof(ushort);
            for (int i = 0; i < this.PropertyValueCount; i++)
            {
                if (this.PropertyValues[i].Value != null)
                {
                    Array.Copy(this.PropertyValues[i].Serialize(), 0, serializedBuffer, index, this.PropertyValues[i].Size());
                    index += this.PropertyValues[i].Size();
                }
            }
                                                                                                                                                                                                
            return serializedBuffer;
        }
RopSynchronizationImportHierarchyChangeRequest