本文整理汇总了C#中PropertyValue.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyValue.Parse方法的具体用法?C# PropertyValue.Parse怎么用?C# PropertyValue.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyValue
的用法示例。
在下文中一共展示了PropertyValue.Parse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
/// <summary>
/// Parse the AddressBookPropertyRow structure.
/// </summary>
/// <param name="rawBuffer">The raw data returned from server.</param>
/// <param name="propTagArray">The list of property tags.</param>
/// <param name="index">The start index.</param>
/// <returns>Return an instance of AddressBookPropertyRow.</returns>
public static AddressBookPropertyRow Parse(byte[] rawBuffer, LargePropTagArray propTagArray, ref int index)
{
AddressBookPropertyRow addressBookPropertyRow = new AddressBookPropertyRow();
addressBookPropertyRow.Flag = rawBuffer[index];
index++;
addressBookPropertyRow.ValueArray = new List<PropertyValue>();
Context.Instance.PropertyBytes = rawBuffer;
Context.Instance.CurIndex = index;
Context.Instance.CurProperty = new Property(PropertyType.PtypUnspecified);
// If the value of the Flags field is set to 0x00: The array contains either a PropertyValue structure, or a TypedPropertyValue structure.
// If the value of the Flags field is set to 0x01: The array contains either a FlaggedPropertyValue structure, or a FlaggedPropertyValueWithType structure.
if (addressBookPropertyRow.Flag == 0x00)
{
foreach (PropertyTag propertyTag in propTagArray.PropertyTags)
{
if (propertyTag.PropertyType == 0x0000)
{
// If the value of the Flags field is set to 0x00: The array contains a TypedPropertyValue structure, if the type of property is PtyUnspecified.
TypedPropertyValue typedPropertyValue = new TypedPropertyValue();
typedPropertyValue.Parse(Context.Instance);
addressBookPropertyRow.ValueArray.Add(typedPropertyValue);
index = Context.Instance.CurIndex;
}
else
{
// If the value of the Flags field is set to 0x00: The array contains a PropertyValue structure, if the type of property is specified.
Context.Instance.CurProperty.Type = (PropertyType)propertyTag.PropertyType;
PropertyValue propertyValue = new PropertyValue();
propertyValue.Parse(Context.Instance);
addressBookPropertyRow.ValueArray.Add(propertyValue);
index = Context.Instance.CurIndex;
}
}
}
else if (addressBookPropertyRow.Flag == 0x01)
{
foreach (PropertyTag propertyTag in propTagArray.PropertyTags)
{
if (propertyTag.PropertyType == 0x0000)
{
// If the value of the Flags field is set to 0x01: The array contains a FlaggedPropertyValueWithType structure, if the type of property is PtyUnspecified.
FlaggedPropertyValueWithType flaggedPropertyValue = new FlaggedPropertyValueWithType();
flaggedPropertyValue.Parse(Context.Instance);
addressBookPropertyRow.ValueArray.Add(flaggedPropertyValue);
index = Context.Instance.CurIndex;
}
else
{
// If the value of the Flags field is set to 0x01: The array contains a FlaggedPropertyValue structure, if the type of property is specified.
Context.Instance.CurProperty.Type = (PropertyType)propertyTag.PropertyType;
FlaggedPropertyValue propertyValue = new FlaggedPropertyValue();
propertyValue.Parse(Context.Instance);
addressBookPropertyRow.ValueArray.Add(propertyValue);
index = Context.Instance.CurIndex;
}
}
}
return addressBookPropertyRow;
}