コード例 #1
0
ファイル: Helper.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Writes a card, then reads it back and compares fields.
        /// </summary>
        public static void CycleStandard21(vCard card)
        {

            if (card == null)
                throw new ArgumentNullException("cycle");

            // Create a memory stream to hold the contents of the card.

            MemoryStream stream = new MemoryStream();

            StreamWriter textWriter = new StreamWriter(stream);

            // Create a standard vCard writer and export the
            // card data to the stream.

            vCardStandardWriter writer = new vCardStandardWriter();
            writer.Write(card, textWriter);
            textWriter.Flush();

            // Reset the stream (back to its beginning), then
            // create a stream reader capable of reading text
            // lines from the stream.

            stream.Seek(0, SeekOrigin.Begin);
            StreamReader streamReader = new StreamReader(stream);

            vCardStandardReader standardReader = new vCardStandardReader();
            vCard reloaded = standardReader.Read(streamReader);

            Equals(card, reloaded);

        }
コード例 #2
0
ファイル: XPalmWithPhotoTests.cs プロジェクト: xxjeng/nuxleus
        public void CycleXPlanWithPhoto()
        {

            vCard card = new vCard(
                new StreamReader(new MemoryStream(SampleCards.XPalmWithPhoto)));

            Helper.CycleStandard(card);

        }
コード例 #3
0
ファイル: vCardTests.cs プロジェクト: xxjeng/nuxleus
        public void ReadWriteProperty_Department()
        {

            vCard card = new vCard();
            card.Department = "DOD";

            Assert.AreEqual(
                "DOD",
                card.Department,
                "The Department property is not working.");

        }
コード例 #4
0
ファイル: vCardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Writes the vCard to the specified filename.
        /// </summary>
        public virtual void Write(vCard card, string filename)
        {

            if (card == null)
                throw new ArgumentNullException("card");

            using (StreamWriter output = new StreamWriter(filename))
            {
                Write(card, output);
            }
                
        }
コード例 #5
0
ファイル: vCardTests.cs プロジェクト: xxjeng/nuxleus
        public void ReadWriteProperty_AdditionalNames()
        {

            // Make sure .AdditionalNames reads/writes

            vCard card = new vCard();
            card.AdditionalNames = "John";

            Assert.AreEqual(
                "John",
                card.AdditionalNames,
                "The AdditionalNames property is not working.");

        }
コード例 #6
0
ファイル: RfcAuthorTests.cs プロジェクト: xxjeng/nuxleus
        public void CycleRfcAuthors()
        {

            using (StreamReader reader = new StreamReader(
                new MemoryStream(SampleCards.RfcAuthors)))
            {

                vCard card1 = new vCard(reader);
                vCard card2 = new vCard(reader);

                Helper.CycleStandard(card1);
                Helper.CycleStandard(card2);

            }

        }
コード例 #7
0
ファイル: RfcAuthorTests.cs プロジェクト: xxjeng/nuxleus
        public void ParseRfcAuthors()
        {

            using (StreamReader reader = new StreamReader(
                new MemoryStream(SampleCards.RfcAuthors)))
            {

                vCard card1 = new vCard(reader);
                vCard card2 = new vCard(reader);

                _parseCard1(card1);
                _parseCard2(card2);

            }


        }
コード例 #8
0
ファイル: vCardTests.cs プロジェクト: xxjeng/nuxleus
        public void ReadWriteProperty_BirthDate()
        {

            vCard card = new vCard();
            card.BirthDate = DateTime.Parse("04/04/04");

            Assert.AreEqual(
                DateTime.Parse("04/04/04"),
                card.BirthDate.Value,
                "The BirthDate property was not set.");

            card.BirthDate = null;

            Assert.IsNull(
                card.BirthDate,
                "The BirthDate property was not set to null.");

        }
コード例 #9
0
ファイル: Default.aspx.cs プロジェクト: xxjeng/nuxleus
    /// <summary>
    ///     Executed when the Submit button is clicked.
    /// </summary>
    protected void SubmitButton_Click(object sender, EventArgs e)
    {

        vCard card = new vCard();

        // Simple properties

        card.AdditionalNames = AdditionalNames.Text;
        card.FamilyName = FamilyName.Text;
        card.GivenName = GivenName.Text;
        card.NamePrefix = NamePrefix.Text;
        card.NameSuffix = NameSuffix.Text;
        card.Organization = Organization.Text;
        card.Role = Role.Text;
        card.Title = Title.Text;

        // ---------------------------------------------------------------
        // Email Addresses
        // ---------------------------------------------------------------
        // A vCard supports any number of email addresses.

        if (!string.IsNullOrEmpty(WorkEmail.Text))
        {
            card.EmailAddresses.Add(
                new vCardEmailAddress(WorkEmail.Text));

        }

        // ---------------------------------------------------------------
        // Notes
        // ---------------------------------------------------------------
        // The vCard specification allows for multiple notes, although
        // most applications seem to support a maximum of one note.

        if (Note.Text.Length > 0)
        {
            card.Notes.Add(new vCardNote(Note.Text));
        }


        // ---------------------------------------------------------------
        // Phones
        // ---------------------------------------------------------------
        //
        // A vCard supports any number of telephones.  Each telephone can
        // have a different type (such as a video phone or a fax) and a
        // purpose (e.g. a home number or a work number).

        if (!string.IsNullOrEmpty(WorkPhone.Text))
        {
            card.Phones.Add(
                new vCardPhone(WorkPhone.Text, vCardPhoneType.WorkVoice));
        }

        if (!string.IsNullOrEmpty(WorkFax.Text))
        {
            card.Phones.Add(
                new vCardPhone(WorkFax.Text, vCardPhoneType.WorkFax));
        }


        // ---------------------------------------------------------------
        // Web Sites
        // ---------------------------------------------------------------

        if (WorkWebSite.Text.Length > 0)
        {
            card.WebSites.Add(
                new vCardWebSite(WorkWebSite.Text, vCardWebSiteType.Work));
        }

        // ---------------------------------------------------------------
        // Nicknames
        // ---------------------------------------------------------------

        string[] nicklist = Nicknames.Text.Split(new char[] { ',' });
        foreach (string nick in nicklist)
        {
            if (nick.Length > 0)
                card.Nicknames.Add(nick);
        }

        // The vCard object has been populated.  The rest of
        // the code generates the vCard file format and exports
        // it to the response stream.

        Response.ContentType = "text/x-vcard";

        // The "content-disposition" is a special HTTP header
        // that tells the web browser how to interpreted the
        // output.  In this case, the browser is informed the
        // content should be treated as an attachment with
        // a default filename.  This should cause the browser
        // to display a dialog box to save the vCard (instead
        // of displaying the vCard as inline text).

        Response.AppendHeader(
            "content-disposition", "attachment;filename=vCard.vcf");

        vCardStandardWriter writer = new vCardStandardWriter();

        writer.EmbedInternetImages = false;
        writer.EmbedLocalImages = true;
        writer.Options = vCardStandardWriterOptions.IgnoreCommas;

        writer.Write(card, Response.Output);
        Response.End();

    }
コード例 #10
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds the REV property.
        /// </summary>
        private void BuildProperties_REV(
            vCardPropertyCollection properties,
            vCard card)
        {

            if (card.RevisionDate.HasValue)
            {

                vCardProperty property =
                    new vCardProperty("REV", card.RevisionDate.Value.ToString());

                properties.Add(property);

            }

        }
コード例 #11
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        private void BuildProperties_PHOTO(
            vCardPropertyCollection properties,
            vCard card)
        {

            foreach(vCardPhoto photo in card.Photos)
            {

                if (photo.Url == null)
                {

                    // This photo does not have a URL associated
                    // with it.  Therefore a property can be
                    // generated only if the image data is loaded.
                    // Otherwise there is not enough information.

                    if (photo.IsLoaded)
                    {

                        properties.Add(
                            new vCardProperty("PHOTO", photo.GetBytes()));

                    }

                }
                else
                {

                    // This photo has a URL associated with it.  The
                    // PHOTO property can either be linked as an image
                    // or embedded, if desired.

                    bool doEmbedded = 
                        photo.Url.IsFile ? this.embedLocalImages : this.embedInternetImages;

                    if(doEmbedded)
                    {

                        // According to the settings of the card writer,
                        // this linked image should be embedded into the
                        // vCard data.  Attempt to fetch the data.

                        try
                        {
                            photo.Fetch();
                        }
                        catch
                        {

                            // An error was encountered.  The image can
                            // still be written as a link, however.

                            doEmbedded = false;
                        }

                    }

                    // At this point, doEmbedded is true only if (a) the
                    // writer was configured to embed the image, and (b)
                    // the image was successfully downloaded.

                    if(doEmbedded)
                    {
                        properties.Add(
                            new vCardProperty("PHOTO", photo.GetBytes()));
                    }
                    else
                    {

                        vCardProperty uriPhotoProperty =
                            new vCardProperty("PHOTO");

                        // Set the VALUE property to indicate that
                        // the data for the photo is a URI.

                        uriPhotoProperty.Subproperties.Add("VALUE", "URI");
                        uriPhotoProperty.Value = photo.Url.ToString();

                        properties.Add(uriPhotoProperty);
                    }

                }
            }
        }
コード例 #12
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds the NOTE property.
        /// </summary>
        private void BuildProperties_NOTE(
            vCardPropertyCollection properties,
            vCard card)
        {

            foreach (vCardNote note in card.Notes)
            {

                if (!string.IsNullOrEmpty(note.Text))
                {

                    vCardProperty property = new vCardProperty();

                    property.Name = "NOTE";
                    property.Value = note.Text;

                    if (!string.IsNullOrEmpty(note.Language))
                    {
                        property.Subproperties.Add("language", note.Language);
                    }

                    property.Subproperties.Add("ENCODING", "QUOTED-PRINTABLE");
                    properties.Add(property);

                }

            }

        }
コード例 #13
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        private void BuildProperties_NAME(
            vCardPropertyCollection properties,
            vCard card)
        {

            if (!string.IsNullOrEmpty(card.DisplayName))
            {

                vCardProperty property =
                    new vCardProperty("NAME", card.DisplayName);

                properties.Add(property);
            }

        }
コード例 #14
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds the BDAY property.
        /// </summary>
        private void BuildProperties_BDAY(
            vCardPropertyCollection properties,
            vCard card)
        {

            // The BDAY property indicates the birthdate
            // of the person.  The output format here is based on
            // Microsoft Outlook, which writes the date as YYYMMDD.

            if (card.BirthDate.HasValue)
            {

                vCardProperty property =
                    new vCardProperty("BDAY", card.BirthDate.Value);

                properties.Add(property);
            }

        }
コード例 #15
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds ADR properties.
        /// </summary>
        private void BuildProperties_ADR(
            vCardPropertyCollection properties,
            vCard card)
        {

            foreach (vCardDeliveryAddress address in card.DeliveryAddresses)
            {

                // Do not generate a postal address (ADR) property
                // if the entire address is blank.

                if (
                    (!string.IsNullOrEmpty(address.City)) ||
                    (!string.IsNullOrEmpty(address.Country)) ||
                    (!string.IsNullOrEmpty(address.PostalCode)) ||
                    (!string.IsNullOrEmpty(address.Region)) ||
                    (!string.IsNullOrEmpty(address.Street)))
                {

                    // The ADR property contains the following
                    // subvalues in order.  All are required:
                    //
                    //   - Post office box
                    //   - Extended address
                    //   - Street address
                    //   - Locality (e.g. city)
                    //   - Region (e.g. province or state)
                    //   - Postal code (e.g. ZIP code)
                    //   - Country name

                    vCardValueCollection values = new vCardValueCollection(';');

                    values.Add(string.Empty);
                    values.Add(string.Empty);
                    values.Add(address.Street);
                    values.Add(address.City);
                    values.Add(address.Region);
                    values.Add(address.PostalCode);
                    values.Add(address.Country);

                    vCardProperty property =
                        new vCardProperty("ADR", values);

                    if (address.IsDomestic)
                        property.Subproperties.Add("DOM");

                    if (address.IsInternational)
                        property.Subproperties.Add("INTL");

                    if (address.IsParcel)
                        property.Subproperties.Add("PARCEL");

                    if (address.IsPostal)
                        property.Subproperties.Add("POSTAL");

                    if (address.IsHome)
                        property.Subproperties.Add("HOME");

                    if (address.IsWork)
                        property.Subproperties.Add("WORK");

                    properties.Add(property);

                }

            }

        }
コード例 #16
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds the MAILER property.
        /// </summary>
        private void BuildProperties_MAILER(
            vCardPropertyCollection properties,
            vCard card)
        {

            // The MAILER property indicates the software that
            // generated the vCard.  See section 2.4.3 of the
            // vCard 2.1 specification.  Support is not widespread.

            if (!string.IsNullOrEmpty(card.Mailer))
            {

                vCardProperty property =
                    new vCardProperty("MAILER", card.Mailer);

                properties.Add(property);

            }

        }
コード例 #17
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        private void BuildProperties_N(
            vCardPropertyCollection properties,
            vCard card)
        {

            // The property has the following components: Family Name,
            // Given Name, Additional Names, Name Prefix, and Name
            // Suffix.  Example:
            //
            //   N:Pinch;David
            //   N:Pinch;David;John
            //
            // The N property is required (see section 3.1.2 of RFC 2426).

            vCardValueCollection values = new vCardValueCollection(';');
            values.Add(card.FamilyName);
            values.Add(card.GivenName);
            values.Add(card.AdditionalNames);
            values.Add(card.NamePrefix);
            values.Add(card.NameSuffix);

            vCardProperty property = new vCardProperty("N", values);

            properties.Add(property);

        }
コード例 #18
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        private void BuildProperties_CATEGORIES(
            vCardPropertyCollection properties,
            vCard card)
        {

            if (card.Categories.Count > 0)
            {

                vCardValueCollection values = new vCardValueCollection(',');

                foreach (string category in card.Categories)
                {

                    if (!string.IsNullOrEmpty(category))
                        values.Add(category);
                }

                properties.Add(
                    new vCardProperty("CATEGORIES", values));

            }

        }
コード例 #19
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds the NICKNAME property.
        /// </summary>
        private void BuildProperties_NICKNAME(
            vCardPropertyCollection properties,
            vCard card)
        {

            // The NICKNAME property specifies the familiar name
            // of the person, such as Jim.  This is defined in
            // section 3.1.3 of RFC 2426.  Multiple names can
            // be listed, separated by commas.

            if (card.Nicknames.Count > 0)
            {

                // A NICKNAME property is a comma-separated
                // list of values.  Create a value list and
                // add the nicknames collection to it.

                vCardValueCollection values = new vCardValueCollection(',');
                values.Add(card.Nicknames);

                // Create the new properties with each name separated
                // by a comma.

                vCardProperty property =
                    new vCardProperty("NICKNAME", values);

                properties.Add(property);

            }

        }
コード例 #20
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        private void BuildProperties_CLASS(
            vCardPropertyCollection properties,
            vCard card)
        {

            vCardProperty property = new vCardProperty("CLASS");

            switch (card.AccessClassification)
            {

                case vCardAccessClassification.Unknown:
                    // No value is written.
                    return;

                case vCardAccessClassification.Confidential:
                    property.Value = "CONFIDENTIAL";
                    break;

                case vCardAccessClassification.Private:
                    property.Value = "PRIVATE";
                    break;

                case vCardAccessClassification.Public:
                    property.Value = "PUBLIC";
                    break;

                default:
                    throw new NotSupportedException();

            }

            properties.Add(property);

        }
コード例 #21
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds the ORG property.
        /// </summary>
        private void BuildProperties_ORG(
            vCardPropertyCollection properties,
            vCard card)
        {

            // The ORG property specifies the name of the
            // person's company or organization. Example:
            //
            // ORG:FairMetric LLC

            if (!string.IsNullOrEmpty(card.Organization))
            {

                vCardProperty property =
                    new vCardProperty("ORG", card.Organization);

                properties.Add(property);

            }

        }
コード例 #22
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds EMAIL properties.
        /// </summary>
        private void BuildProperties_EMAIL(
            vCardPropertyCollection properties,
            vCard card)
        {

            // The EMAIL property contains an electronic
            // mail address for the purpose.  A vCard may contain
            // as many email addresses as needed.  The format also
            // supports various vendors, such as CompuServe addresses
            // and Internet SMTP addresses.
            //
            // EMAIL;INTERNET:[email protected]

            foreach (vCardEmailAddress emailAddress in card.EmailAddresses)
            {

                vCardProperty property = new vCardProperty();
                property.Name = "EMAIL";
                property.Value = emailAddress.Address;

                if (emailAddress.IsPreferred)
                {
                    property.Subproperties.Add("PREF");
                }

                switch (emailAddress.EmailType)
                {

                    case vCardEmailAddressType.Internet:
                        property.Subproperties.Add("INTERNET");
                        break;

                    case vCardEmailAddressType.AOL:
                        property.Subproperties.Add("AOL");
                        break;

                    case vCardEmailAddressType.AppleLink:
                        property.Subproperties.Add("AppleLink");
                        break;

                    case vCardEmailAddressType.AttMail:
                        property.Subproperties.Add("ATTMail");
                        break;

                    case vCardEmailAddressType.CompuServe:
                        property.Subproperties.Add("CIS");
                        break;

                    case vCardEmailAddressType.eWorld:
                        property.Subproperties.Add("eWorld");
                        break;

                    case vCardEmailAddressType.IBMMail:
                        property.Subproperties.Add("IBMMail");
                        break;

                    case vCardEmailAddressType.MCIMail:
                        property.Subproperties.Add("MCIMail");
                        break;

                    case vCardEmailAddressType.PowerShare:
                        property.Subproperties.Add("POWERSHARE");
                        break;

                    case vCardEmailAddressType.Prodigy:
                        property.Subproperties.Add("PRODIGY");
                        break;

                    case vCardEmailAddressType.Telex:
                        property.Subproperties.Add("TLX");
                        break;

                    case vCardEmailAddressType.X400:
                        property.Subproperties.Add("X400");
                        break;

                    default:
                        property.Subproperties.Add("INTERNET");
                        break;

                }

                properties.Add(property);

            }

        }
コード例 #23
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds PRODID properties.
        /// </summary>
        private void BuildProperties_PRODID(
            vCardPropertyCollection properties,
            vCard card)
        {

            if (!string.IsNullOrEmpty(card.ProductId))
            {
                vCardProperty property = new vCardProperty();
                property.Name = "PRODID";
                property.Value = card.ProductId;
                properties.Add(property);
            }

        }
コード例 #24
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        private void BuildProperties_FN(
            vCardPropertyCollection properties,
            vCard card)
        {

            // The FN property indicates the formatted 
            // name of the person.  This can be something
            // like "John Smith".

            if (!string.IsNullOrEmpty(card.FormattedName))
            {

                vCardProperty property =
                    new vCardProperty("FN", card.FormattedName);

                properties.Add(property);

            }

        }
コード例 #25
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds the ROLE property.
        /// </summary>
        private void BuildProperties_ROLE(
            vCardPropertyCollection properties,
            vCard card)
        {

            // The ROLE property identifies the role of
            // the person at his/her organization.

            if (!string.IsNullOrEmpty(card.Role))
            {

                vCardProperty property =
                    new vCardProperty("ROLE", card.Role);

                properties.Add(property);

            }

        }
コード例 #26
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds the GEO property.
        /// </summary>
        private void BuildProperties_GEO(
            vCardPropertyCollection properties,
            vCard card)
        {

            // The GEO properties contains the latitude and
            // longitude of the person or company of the vCard.

            if (card.Latitude.HasValue && card.Longitude.HasValue)
            {

                vCardProperty property = new vCardProperty();

                property.Name = "GEO";
                property.Value =
                    card.Latitude.ToString() + ";" + card.Longitude.ToString();

                properties.Add(property);

            }

        }
コード例 #27
0
ファイル: Helper.cs プロジェクト: xxjeng/nuxleus
        // The following functions export a vCard and then re-read it back
        // as a new vCard.  All fields and collections are compared to ensure
        // the full fidelity of the export/import process.

        #region [ CycleStandard ]

        public static void CycleStandard(vCard card)
        {
            CycleStandard21(card);
        }
コード例 #28
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        /// <summary>
        ///     Builds KEY properties.
        /// </summary>
        private void BuildProperties_KEY(
            vCardPropertyCollection properties,
            vCard card)
        {

            // A KEY field contains an embedded security certificate.

            foreach (vCardCertificate certificate in card.Certificates)
            {

                vCardProperty property = new vCardProperty();

                property.Name = "KEY";
                property.Value = certificate.Data;
                property.Subproperties.Add(certificate.KeyType);

                properties.Add(property);

            }

        }
コード例 #29
0
ファイル: Helper.cs プロジェクト: xxjeng/nuxleus
        // The following functions compare two vCard-related objects.
        
        #region [ Equals(vCard) ]

        public static void Equals(vCard c1, vCard c2)
        {

            // Start by comparing the base fields.

            Assert.AreEqual(
                c1.AdditionalNames,
                c2.AdditionalNames,
                "AdditionalNames does not match.");

            Assert.AreEqual(
                c1.BirthDate,
                c2.BirthDate,
                "BirthDate does not match.");

            Assert.AreEqual(
                c1.DisplayName,
                c2.DisplayName,
                "DisplayName does not match.");

            Assert.AreEqual(
                c1.FamilyName,
                c2.FamilyName,
                "FamilyName does not match.");

            Assert.AreEqual(
                c1.FormattedName,
                c2.FormattedName,
                "FormattedName does not match.");

            Assert.AreEqual(
                c1.Gender,
                c2.Gender,
                "Gender does not match.");

            Assert.AreEqual(
                c1.GivenName,
                c2.GivenName,
                "GivenName does not match.");

            Assert.AreEqual(
                c1.Mailer,
                c2.Mailer,
                "Mailer does not match.");

            Assert.AreEqual(
                c1.NamePrefix,
                c2.NamePrefix,
                "NamePrefix does not match.");

            Assert.AreEqual(
                c1.NameSuffix,
                c2.NameSuffix,
                "NameSuffix does not match.");

            Assert.AreEqual(
                c1.Organization,
                c2.Organization,
                "Organization does not match.");

            Assert.AreEqual(
                c1.ProductId,
                c2.ProductId,
                "ProductId does not match.");

            Assert.AreEqual(
                c1.RevisionDate,
                c2.RevisionDate,
                "RevisionDate does not match.");

            Assert.AreEqual(
                c1.Role,
                c2.Role,
                "Role does not match.");

            Assert.AreEqual(
                c1.TimeZone,
                c2.TimeZone,
                "TimeZone does not match.");

            Assert.AreEqual(
                c1.Title,
                c2.Title,
                "Title does not match.");

            Assert.AreEqual(
                c1.ToString(),
                c2.ToString(),
                "ToString() does not match.");

            Assert.AreEqual(
                c1.UniqueId,
                c2.UniqueId,
                "UniqueId does not match.");

            // Compare collections

            Equals(
                c1.Categories,
                c2.Categories);

            Equals(
                c1.DeliveryAddresses,
                c2.DeliveryAddresses);

            Equals(
                c1.DeliveryLabels,
                c2.DeliveryLabels);

            Equals(
                c1.EmailAddresses,
                c2.EmailAddresses);

            Equals(
                c1.Nicknames,
                c2.Nicknames);

            Equals(
                c1.Notes,
                c2.Notes);

            Equals(
                c1.Phones,
                c2.Phones);

            Equals(
                c1.Photos,
                c2.Photos);

            Equals(
                c1.Sources,
                c2.Sources);

            Equals(
                c1.WebSites,
                c2.WebSites);

        }
コード例 #30
0
ファイル: vCardStandardWriter.cs プロジェクト: xxjeng/nuxleus
        private void BuildProperties_LABEL(
            vCardPropertyCollection properties,
            vCard card)
        {

            foreach (vCardDeliveryLabel label in card.DeliveryLabels)
            {

                if (label.Text.Length > 0)
                {

                    vCardProperty property = new vCardProperty("LABEL", label.Text);

                    if (label.IsDomestic)
                        property.Subproperties.Add("DOM");

                    if(label.IsInternational)
                        property.Subproperties.Add("INTL");

                    if(label.IsParcel)
                        property.Subproperties.Add("PARCEL");

                    if(label.IsPostal)
                        property.Subproperties.Add("POSTAL");

                    if(label.IsHome)
                        property.Subproperties.Add("HOME");

                    if(label.IsWork)
                        property.Subproperties.Add("WORK");

                    // Give a hint to use QUOTED-PRINTABLE.

                    property.Subproperties.Add("ENCODING", "QUOTED-PRINTABLE");
                    properties.Add(property);
                    

                }

            }

        }