PropertyValueNode with property's value and error code
Inheritance: AddressBookPropertyValue
Ejemplo n.º 1
0
        /// <summary>
        /// Verify the AddressBookFlaggedPropertyValue structure related requirements.
        /// </summary>
        /// <param name="addressBookFlaggedPropertyValue">The AddressBookFlaggedPropertyValue value to be verified.</param>
        private void VerifyAddressBookFlaggedPropertyValueStructure(AddressBookFlaggedPropertyValue addressBookFlaggedPropertyValue)
        {
            // Since Test Suite parsed AddressBookFlaggedPropertyValue structure according to Specification, if the program run to here, R2018 can be verified directly.
            this.Site.CaptureRequirement(
                2018,
                @"[In AddressBookFlaggedPropertyValue Structure] The AddressBookFlaggedPropertyValue structure includes a flag to indicate whether the value was successfully retrieved or not.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2019");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2019
            this.Site.CaptureRequirementIfIsInstanceOfType(
                addressBookFlaggedPropertyValue.Flag,
                typeof(byte),
                2019,
                @"[In AddressBookFlaggedPropertyValue Structure] Flag (1 byte): An unsigned integer. ");

            if (addressBookFlaggedPropertyValue.Flag != 0x1)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2027");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2027
                this.Site.CaptureRequirementIfIsInstanceOfType(
                    addressBookFlaggedPropertyValue,
                    typeof(AddressBookPropertyValue),
                    2027,
                    @"[In AddressBookFlaggedPropertyValue Structure] PropertyValue (optional) (variable): An AddressBookPropertyValue structure, as specified in section 2.2.1.1, unless the Flag field is set to 0x1.");
            }
        }
        /// <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, LargePropertyTagArray propTagArray, ref int index)
        {
            AddressBookPropertyRow addressBookPropertyRow = new AddressBookPropertyRow();

            addressBookPropertyRow.Flag = rawBuffer[index];
            index++;
            List <AddressBookPropertyValue> valueArray = new List <AddressBookPropertyValue>();

            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 AddressBookPropertyValue structure, or a AddressBookTypedPropertyValue structure.
            // If the value of the Flags field is set to 0x01: The array contains either a AddressBookFlaggedPropertyValue structure, or a AddressBookFlaggedPropertyValueWithType 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 AddressBookTypedPropertyValue structure, if the type of property is PtyUnspecified.
                        AddressBookTypedPropertyValue typedPropertyValue = new AddressBookTypedPropertyValue();

                        // Parse the AddressBookTypedPropertyValue with the instance of the context which contains the datas and start index.
                        typedPropertyValue.Parse(Context.Instance);
                        valueArray.Add(typedPropertyValue);
                        index = Context.Instance.CurIndex;
                    }
                    else
                    {
                        // If the value of the Flags field is set to 0x00: The array contains a AddressBookPropertyValue structure, if the type of property is specified.
                        Context.Instance.CurProperty.Type = (PropertyType)propertyTag.PropertyType;
                        AddressBookPropertyValue propertyValue = new AddressBookPropertyValue();

                        // Parse the AddressBookTypedPropertyValue with the instance of the context which contains the datas and start index.
                        propertyValue.Parse(Context.Instance);
                        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 AddressBookFlaggedPropertyValueWithType structure, if the type of property is PtyUnspecified.
                        AddressBookFlaggedPropertyValueWithType flaggedPropertyValue = new AddressBookFlaggedPropertyValueWithType();

                        // Parse the AddressBookTypedPropertyValue with the instance of the context which contains the datas and start index.
                        flaggedPropertyValue.Parse(Context.Instance);
                        valueArray.Add(flaggedPropertyValue);
                        index = Context.Instance.CurIndex;
                    }
                    else
                    {
                        // If the value of the Flags field is set to 0x01: The array contains a AddressBookFlaggedPropertyValue structure, if the type of property is specified.
                        Context.Instance.CurProperty.Type = (PropertyType)propertyTag.PropertyType;
                        AddressBookFlaggedPropertyValue propertyValue = new AddressBookFlaggedPropertyValue();

                        // Parse the AddressBookTypedPropertyValue with the instance of the context which contains the datas and start index.
                        propertyValue.Parse(Context.Instance);
                        valueArray.Add(propertyValue);
                        index = Context.Instance.CurIndex;
                    }
                }
            }

            addressBookPropertyRow.ValueArray = valueArray.ToArray();

            return(addressBookPropertyRow);
        }