public int Deserialize(byte[] ropBytes, int startIndex)
{
int index = startIndex;
this.RopId = ropBytes[index++];
this.SourceHandleIndex = ropBytes[index++];
this.ReturnValue = (uint)BitConverter.ToInt32(ropBytes, index);
index += sizeof(uint);
// Check return value with 0x00000503.
if (this.ReturnValue != 0x00000503)
{
this.ReadByteCount = (ulong)BitConverter.ToInt64(ropBytes, index);
index += sizeof(ulong);
this.WrittenByteCount = (ulong)BitConverter.ToInt64(ropBytes, index);
index += sizeof(ulong);
}
else
{
this.DestHandleIndex = (uint)BitConverter.ToInt32(ropBytes, index);
index += sizeof(uint);
this.ReadByteCount = (ulong)BitConverter.ToInt64(ropBytes, index);
index += sizeof(ulong);
this.WrittenByteCount = (ulong)BitConverter.ToInt64(ropBytes, index);
index += sizeof(ulong);
}
return index - startIndex;
}
}