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.RestrictionDataSize = (ushort)BitConverter.ToInt16(ropBytes, index);
index += sizeof(ushort);
if (this.RestrictionDataSize > 0)
{
this.RestrictionData = new byte[this.RestrictionDataSize];
Array.Copy(ropBytes, index, this.RestrictionData, 0, this.RestrictionDataSize);
index += this.RestrictionDataSize;
}
this.LogonId = ropBytes[index++];
this.FolderIdCount = (ushort)BitConverter.ToInt16(ropBytes, index);
index += sizeof(ushort);
if (this.FolderIdCount > 0)
{
this.FolderIds = new ulong[this.FolderIdCount];
for (int i = 0; i < this.FolderIdCount; i++)
{
this.FolderIds[i] = (ulong)BitConverter.ToInt64(ropBytes, index);
index += sizeof(ulong);
}
}
this.SearchFlags = (uint)BitConverter.ToInt32(ropBytes, index);
index += sizeof(uint);
}
return index - startIndex;
}
}