Microsoft.Protocols.TestSuites.Common.RopGetPropertiesAllResponse.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.RopId = ropBytes[index++];
            this.InputHandleIndex = ropBytes[index++];
            this.ReturnValue = (uint)BitConverter.ToInt32(ropBytes, index);
            index += sizeof(uint);

            // Only success response has below fields
            if (this.ReturnValue == 0)
            {
                this.PropertyValueCount = (ushort)BitConverter.ToInt16(ropBytes, index);
                index += sizeof(ushort);
                if (this.PropertyValueCount > 0)
                {
                    this.PropertyValues = new TaggedPropertyValue[this.PropertyValueCount];

                    Context.Instance.PropertyBytes = ropBytes;
                    Context.Instance.CurIndex = index;
                    Context.Instance.CurProperty = new Property(PropertyType.PtypUnspecified);
                    for (int i = 0; i < this.PropertyValueCount; i++)
                    {
                        this.PropertyValues[i] = new TaggedPropertyValue();

                        this.PropertyValues[i].Parse(Context.Instance);
                        index = Context.Instance.CurIndex;
                    }
                }
            }

            return index - startIndex;
        }
    }
RopGetPropertiesAllResponse