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.ExpandedRowCount = (uint)BitConverter.ToInt32(ropBytes, index);
index += sizeof(uint);
this.RowCount = (ushort)BitConverter.ToInt16(ropBytes, index);
index += sizeof(ushort);
// Parse RowData
// Add RowData bytes into Context
Context.Instance.PropertyBytes = ropBytes;
Context.Instance.CurIndex = index;
// Allocate PropretyRowSetNode to parse RowData
this.RowData = new PropertyRowSet
{
// Set row count
Count = this.RowCount
};
this.RowData.Parse(Context.Instance);
// Context.Instance.CurIndex indicates the already deserialized bytes' index
index = Context.Instance.CurIndex;
}
return index - startIndex;
}
}