/// <summary> /// Deserialize the PropertyRestriction data. /// </summary> /// <param name="restrictionData">The restriction data.</param> public override void Deserialize(byte[] restrictionData) { int index = 0; this.RestrictType = (Restrictions)restrictionData[index]; if (this.RestrictType != Restrictions.PropertyRestriction) { throw new ArgumentException("The restrict type is not PropertyRestriction type."); } index++; this.RelOp = restrictionData[index]; index++; index += this.PropTag.Deserialize(restrictionData, index); Context.Instance.PropertyBytes = restrictionData; Context.Instance.CurIndex = index; Context.Instance.CurProperty = new Property(PropertyType.PtypUnspecified); TaggedPropertyValue taggedPropertyValue = new TaggedPropertyValue(); taggedPropertyValue.Parse(Context.Instance); this.TaggedValue = taggedPropertyValue; }
/// <summary> /// Parse the AddressBookPropValueList structure. /// </summary> /// <param name="rawData">The raw data of response buffer.</param> /// <param name="index">The start index.</param> /// <returns>Instance of the AddressBookPropValueList.</returns> public static AddressBookPropValueList Parse(byte[] rawData, ref int index) { AddressBookPropValueList addressBookPropValueList = new AddressBookPropValueList(); addressBookPropValueList.PropertyValueCount = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); Context.Instance.PropertyBytes = rawData; Context.Instance.CurIndex = index; Context.Instance.CurProperty = new Property(PropertyType.PtypUnspecified); addressBookPropValueList.PropertyValues = new TaggedPropertyValue[addressBookPropValueList.PropertyValueCount]; for (int i = 0; i < addressBookPropValueList.PropertyValueCount; i++) { // Parse the TaggedPropertyValue from the response buffer. TaggedPropertyValue taggedPropertyValue = new TaggedPropertyValue(); taggedPropertyValue.Parse(Context.Instance); addressBookPropValueList.PropertyValues[i] = taggedPropertyValue; } index = Context.Instance.CurIndex; return(addressBookPropValueList); }