/// <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(Microsoft.Protocols.TestSuites.Common.PropertyType.PtypUnspecified); addressBookPropValueList.PropertyValues = new AddressBookTaggedPropertyValue[addressBookPropValueList.PropertyValueCount]; for (int i = 0; i < addressBookPropValueList.PropertyValueCount; i++) { // Parse the TaggedPropertyValue from the response buffer. AddressBookTaggedPropertyValue taggedPropertyValue = new AddressBookTaggedPropertyValue(); taggedPropertyValue.Parse(Context.Instance); addressBookPropValueList.PropertyValues[i] = taggedPropertyValue; } index = Context.Instance.CurIndex; return addressBookPropValueList; }
/// <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(Microsoft.Protocols.TestSuites.Common.PropertyType.PtypUnspecified); addressBookPropValueList.PropertyValues = new AddressBookTaggedPropertyValue[addressBookPropValueList.PropertyValueCount]; for (int i = 0; i < addressBookPropValueList.PropertyValueCount; i++) { // Parse the TaggedPropertyValue from the response buffer. AddressBookTaggedPropertyValue taggedPropertyValue = new AddressBookTaggedPropertyValue(); taggedPropertyValue.Parse(Context.Instance); addressBookPropValueList.PropertyValues[i] = taggedPropertyValue; } index = Context.Instance.CurIndex; return(addressBookPropValueList); }
/// <summary> /// Parse the PropertyRow_r structure. /// </summary> /// <param name="row">The row which contains property tags and property values</param> /// <returns>Instance of the PropertyRow_r.</returns> public static PropertyRow_r ParsePropertyRow_r(AddressBookPropValueList row) { PropertyRow_r propertyRow_r = new PropertyRow_r(); propertyRow_r.Reserved = 0; propertyRow_r.Values = row.PropertyValueCount; propertyRow_r.Props = new PropertyValue_r[row.PropertyValueCount]; for (int i = 0; i < row.PropertyValueCount; i++) { propertyRow_r.Props[i].PropTag = BitConverter.ToUInt32(row.PropertyValues[i].PropertyTag.Serialize(), 0); propertyRow_r.Props[i].Reserved = 0; propertyRow_r.Props[i].Value = AdapterHelper.ParsePROP_VAL_UNION((AddressBookPropertyValue)row.PropertyValues[i], (PropertyTypeValue)row.PropertyValues[i].PropertyTag.PropertyType); } return propertyRow_r; }
/// <summary> /// Parse PropertyRowSet_r structure. /// </summary> /// <param name="rowsCount">The row count of the PropertyRowSet_r.</param> /// <param name="rows">The rows which contains property tags and property values.</param> /// <returns>Instance of PropertyRowSet_r structure.</returns> public static PropertyRowSet_r ParsePropertyRowSet_r(uint rowsCount, AddressBookPropValueList[] rows) { PropertyRowSet_r propertyRowSet_r = new PropertyRowSet_r(); propertyRowSet_r.Rows = rowsCount; if (rowsCount == 0) { propertyRowSet_r.PropertyRowSet = null; } else { propertyRowSet_r.PropertyRowSet = new PropertyRow_r[rowsCount]; for (int i = 0; i < rowsCount; i++) { propertyRowSet_r.PropertyRowSet[i].Reserved = 0; propertyRowSet_r.PropertyRowSet[i].Values = rows[i].PropertyValueCount; propertyRowSet_r.PropertyRowSet[i].Props = new PropertyValue_r[rows[i].PropertyValueCount]; for (int j = 0; j < rows[i].PropertyValueCount; j++) { propertyRowSet_r.PropertyRowSet[i].Props[j].PropTag = BitConverter.ToUInt32(rows[i].PropertyValues[j].PropertyTag.Serialize(), 0); propertyRowSet_r.PropertyRowSet[i].Props[j].Reserved = 0; propertyRowSet_r.PropertyRowSet[i].Props[j].Value = AdapterHelper.ParsePROP_VAL_UNION((AddressBookPropertyValue)rows[i].PropertyValues[j], (PropertyTypeValue)rows[i].PropertyValues[j].PropertyTag.PropertyType); } } } return propertyRowSet_r; }