Beispiel #1
0
        public static void Equals(
            vCardDeliveryLabel dl1,
            vCardDeliveryLabel dl2)
        {

            Assert.AreEqual(
                dl1.AddressType,
                dl2.AddressType,
                "vCardDeliveryLabel.AddressType differs.");

            Assert.AreEqual(
                dl1.IsDomestic,
                dl2.IsDomestic,
                "vCardDeliveryLabel.IsDomestic differs.");

            Assert.AreEqual(
                dl1.IsHome,
                dl2.IsHome,
                "vCardDeliveryLabel.IsHome differs.");

            Assert.AreEqual(
                dl1.IsInternational,
                dl2.IsInternational,
                "vCardDeliveryLabel.IsInternational differs.");

            Assert.AreEqual(
                dl1.IsParcel,
                dl2.IsParcel,
                "vCardDeliveryLabel.IsParcel differs.");

            Assert.AreEqual(
                dl1.IsPostal,
                dl2.IsPostal,
                "vCardDeliveryLabel.IsPostal differs.");

            Assert.AreEqual(
                dl1.IsWork,
                dl2.IsWork,
                "vCardDeliveryLabel.IsWork differs.");

            Assert.AreEqual(
                dl1.Text,
                dl2.Text,
                "vCardDeliveryLabel.Text differs.");

            Assert.AreEqual(
                dl1.ToString(),
                dl2.ToString(),
                "vCardDeliveryLabel.ToString differs.");

        }
        /// <summary>
        ///     Reads the LABEL property.
        /// </summary>
        private void ReadInto_LABEL(vCard card, vCardProperty property)
        {

            vCardDeliveryLabel label = new vCardDeliveryLabel();

            label.Text = property.Value.ToString();

            // Handle the old 2.1 format in which the ADR type names (e.g.
            // DOM, HOME, etc) were written directly as subproperties.
            // For example, "LABEL;HOME;POSTAL:...".

            label.AddressType =
                ParseDeliveryAddressType(property.Subproperties.GetNames(DeliveryAddressTypeNames));

            // Handle the new 3.0 format in which the delivery address
            // type is a comma-delimited list, e.g. "ADR;TYPE=HOME,POSTAL:".
            // It is possible for the TYPE subproperty to be listed multiple
            // times (this is allowed by the RFC, although irritating that
            // the authors allowed it).

            foreach (vCardSubproperty sub in property.Subproperties)
            {

                // If this subproperty is a TYPE subproperty and
                // has a non-null value, then parse it.

                if (
                    (!string.IsNullOrEmpty(sub.Value)) &&
                    (string.Compare("TYPE", sub.Name, StringComparison.OrdinalIgnoreCase) == 0))
                {

                    label.AddressType |=
                        ParseDeliveryAddressType(sub.Value.Split(new char[] { ',' }));

                }

            }

            card.DeliveryLabels.Add(label);


        }