Microsoft.Protocols.TestSuites.Common.PropertyName.Deserialize C# (CSharp) Method

Deserialize() public method

Deserialize the ROP response buffer.
public Deserialize ( byte ropBytes, int startIndex ) : int
ropBytes byte ROPs bytes in response.
startIndex int The start index of this ROP.
return int
        public int Deserialize(byte[] ropBytes, int startIndex)
        {
            int index = startIndex;
            this.Kind = ropBytes[index++];

            // Guid holds 16 bytes.
            this.Guid = new byte[16];
            Array.Copy(ropBytes, index, this.Guid, 0, 16);
            index += 16;
            if (this.Kind == (byte)TestSuites.Common.Kind.LidField)
            {
                this.LID = (uint)BitConverter.ToInt32(ropBytes, index);
                index += 4;
            }
            else if (this.Kind == (byte)TestSuites.Common.Kind.NameField)
            {
                this.NameSize = ropBytes[index++];
                if (this.NameSize > 0)
                {
                    this.Name = new byte[(int)this.NameSize];
                    Array.Copy(ropBytes, index, this.Name, 0, (byte)this.NameSize);
                    index += (byte)this.NameSize;
                }
            }

            return index - startIndex;
        }
    }