Microsoft.Protocols.TestSuites.Common.RopGetAddressTypesResponse.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.AddressTypeCount = (ushort)BitConverter.ToInt16(ropBytes, index);
                index += sizeof(ushort);
                this.AddressTypeSize = (ushort)BitConverter.ToInt16(ropBytes, index);
                index += sizeof(ushort);

                this.AddressTypes = new List<string>();
                int start = index;
                int end = index;

                for (int i = index; i < index + this.AddressTypeSize; i++)
                {
                    // Skip non-nulls
                    if (0 != ropBytes[i])
                    {
                        continue;
                    }

                    // Null-terminator found
                    end = i;
                    string temp = Encoding.ASCII.GetString(ropBytes, start, (end - start) + 1);
                    this.AddressTypes.Add(temp);
                    start = ++end;                     
                }

                index += this.AddressTypeSize;
            }

            return index - startIndex;
        }
    }
RopGetAddressTypesResponse