Microsoft.Protocols.TestSuites.Common.RopOptionsDataResponse.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.Reserved = ropBytes[index++];
                this.OptionsInfoSize = (ushort)BitConverter.ToInt16(ropBytes, index);
                index += sizeof(ushort);
                if (this.OptionsInfoSize > 0)
                {
                    this.OptionsInfo = new byte[this.OptionsInfoSize];
                    Array.Copy(ropBytes, index, this.OptionsInfo, 0, this.OptionsInfoSize);
                    index += this.OptionsInfoSize;
                }

                this.HelpFileSize = (ushort)BitConverter.ToInt16(ropBytes, index);
                index += sizeof(ushort);
                if (this.HelpFileSize >= 0)
                {
                    this.HelpFile = new byte[this.HelpFileSize];
                    Array.Copy(ropBytes, index, this.HelpFile, 0, this.HelpFileSize);
                    index += this.HelpFileSize;

                    if (this.HelpFileSize > 0)
                    {
                        this.HelpFileName = new byte[ropBytes.Length - index];
                        Array.Copy(ropBytes, index, this.HelpFileName, 0, ropBytes.Length - index);
                        index += ropBytes.Length - index - 1;
                    }
                }
            }

            return index - startIndex;
        }
    }
RopOptionsDataResponse