• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# vCards.vCardProperty类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Thought.vCards.vCardProperty的典型用法代码示例。如果您正苦于以下问题:C# vCardProperty类的具体用法?C# vCardProperty怎么用?C# vCardProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



vCardProperty类属于Thought.vCards命名空间,在下文中一共展示了vCardProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Constructor_Name_Value

        public void Constructor_Name_Value()
        {

            // This function tests a constructor that accepts
            // a name and initial value.

            vCardProperty property = new vCardProperty("NAME", "VALUE");

            Assert.AreEqual(
                "NAME",
                property.Name,
                "The name is incorrect.");

            Assert.AreEqual(
                "VALUE",
                property.Value,
                "The value is incorrect.");

            Assert.IsNotNull(
                property.Subproperties,
                "The subproperties collection was not created.");

            Assert.IsEmpty(
                property.Subproperties,
                "The subproperties collection should be empty.");

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:27,代码来源:vCardPropertyTests.cs


示例2: Constructor

        public void Constructor()
        {

            vCardProperty property = new vCardProperty();

            Assert.IsNotNull(
                property.Subproperties,
                "The subproperties collection was not created.");

            Assert.IsEmpty(
                property.Subproperties,
                "The subproperties collection should be empty.");

            Assert.IsNull(
                property.Value,
                "The value should be null.");

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:18,代码来源:vCardPropertyTests.cs


示例3: Constructor_Name

        public void Constructor_Name()
        {

            vCardProperty property = new vCardProperty("NAME");

            Assert.AreEqual(
                "NAME",
                property.Name,
                "The name is incorrect.");

            Assert.IsNull(
                property.Value,
                "The value should be null.");

            Assert.IsNotNull(
                property.Subproperties,
                "The subproperties collection was not created.");

            Assert.IsEmpty(
                property.Subproperties,
                "The subproperties collection should be empty.");

        }
开发者ID:richardsalt,项目名称:Thought.vCards,代码行数:23,代码来源:vCardPropertyTests.cs


示例4: EncodeProperty_Name_Subproperty_Subvalue_Subproperty_Value

        public void EncodeProperty_Name_Subproperty_Subvalue_Subproperty_Value()
        {

            vCardStandardWriter writer =
                new vCardStandardWriter();

            vCardProperty property =
                new vCardProperty("NAME", "VALUE");

            property.Subproperties.Add("SUB1", "SUBVALUE");
            property.Subproperties.Add("SUB2");

            Assert.AreEqual(
                "NAME;SUB1=SUBVALUE;SUB2:VALUE",
                writer.EncodeProperty(property));

        }
开发者ID:drlongnecker,项目名称:Thought.vCards,代码行数:17,代码来源:vCardStandardWriterTests.cs


示例5: BuildProperties_PRODID

      /// <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);
        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:17,代码来源:vCardImprovedWriter.cs


示例6: BuildProperties_ORG

      /// <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;

          // Add department also
          if (!string.IsNullOrEmpty(card.Department))
          {
            vCardValueCollection values = new vCardValueCollection(';');
            values.Add(card.Organization);
            values.Add(card.Department);
            property = new vCardProperty("ORG", values);
          }
          else
          {
            property = new vCardProperty("ORG", card.Organization);
          }

          properties.Add(property);

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:36,代码来源:vCardImprovedWriter.cs


示例7: BuildProperties_NICKNAME

      /// <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);

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:34,代码来源:vCardImprovedWriter.cs


示例8: BuildProperties_N

      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);

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:26,代码来源:vCardImprovedWriter.cs


示例9: BuildProperties_LABEL

      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("TYPE", "DOM");

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

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

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

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

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

            // Don't use QUOTED-PRINTABLE.
            //property.Subproperties.Add("ENCODING", "QUOTED-PRINTABLE");
            properties.Add(property);


          }

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:41,代码来源:vCardImprovedWriter.cs


示例10: BuildProperties_URL

      private void BuildProperties_URL(
          vCardPropertyCollection properties,
          vCard card)
      {

        foreach (vCardWebsite webSite in card.Websites)
        {

          if (!string.IsNullOrEmpty(webSite.Url))
          {
            vCardProperty property =
                new vCardProperty("URL", webSite.Url.ToString());

            if (webSite.IsWorkSite)
              property.Subproperties.Add("TYPE", "WORK");

            // Add Subproperty for HOME aswell
            if (webSite.IsPersonalSite)
              property.Subproperties.Add("TYPE", "HOME");

            properties.Add(property);
          }

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:26,代码来源:vCardImprovedWriter.cs


示例11: BuildProperties_TITLE

      private void BuildProperties_TITLE(
          vCardPropertyCollection properties,
          vCard card)
      {

        // The TITLE property specifies the job title of 
        // the person.  Example:
        //
        // TITLE:Systems Analyst
        // TITLE:President

        if (!string.IsNullOrEmpty(card.Title))
        {
          vCardProperty property =
              new vCardProperty("TITLE", card.Title);

          properties.Add(property);
        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:20,代码来源:vCardImprovedWriter.cs


示例12: BuildProperties_TEL

      /// <summary>
      ///     Builds TEL properties.
      /// </summary>
      private void BuildProperties_TEL(
          vCardPropertyCollection properties,
          vCard card)
      {

        // The TEL property indicates a telephone number of
        // the person (including non-voice numbers like fax
        // and BBS numbers).
        //
        // TEL;VOICE;WORK:1-800-929-5805

        foreach (vCardPhone phone in card.Phones)
        {

          // A telephone entry has the property name TEL and
          // can have zero or more subproperties like FAX
          // or HOME.  Examples:
          //
          //   TEL;HOME:+1-612-555-1212
          //   TEL;FAX;HOME:+1-612-555-1212

          vCardProperty property = new vCardProperty();

          property.Name = "TEL";

          if (phone.IsBBS)
            property.Subproperties.Add("TYPE", "BBS");

          if (phone.IsCar)
            property.Subproperties.Add("TYPE", "CAR");

          if (phone.IsCellular)
            property.Subproperties.Add("TYPE", "CELL");

          if (phone.IsFax)
          {
            if (!phone.IsHome && !phone.IsWork)
            {
              property.Subproperties.Add("TYPE", "OTHER");
            }
            property.Subproperties.Add("TYPE", "FAX");
          }

          if (phone.IsHome)
            property.Subproperties.Add("TYPE", "HOME");

          if (phone.IsISDN)
            property.Subproperties.Add("TYPE", "ISDN");

          if (phone.IsMessagingService)
            property.Subproperties.Add("TYPE", "MSG");

          if (phone.IsModem)
            property.Subproperties.Add("TYPE", "MODEM");

          if (phone.IsPager)
            property.Subproperties.Add("TYPE", "PAGER");

          if (phone.IsPreferred)
            property.Subproperties.Add("TYPE", "PREF");

          if (phone.IsVideo)
            property.Subproperties.Add("TYPE", "VIDEO");

          if (phone.IsVoice)
          {
            if (!phone.IsHome && !phone.IsWork)
            {
              property.Subproperties.Add("TYPE", "OTHER");
            }
            property.Subproperties.Add("TYPE", "VOICE");

          }

          if (phone.IsWork)
            property.Subproperties.Add("TYPE", "WORK");

          if (phone.IsMain)
            property.Subproperties.Add("TYPE", "MAIN");

          property.Value = phone.FullNumber;
          properties.Add(property);

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:89,代码来源:vCardImprovedWriter.cs


示例13: BuildProperties_SOURCE

      /// <summary>
      ///     Builds SOURCE properties.
      /// </summary>
      private void BuildProperties_SOURCE(
          vCardPropertyCollection properties,
          vCard card)
      {

        foreach (vCardSource source in card.Sources)
        {

          vCardProperty property = new vCardProperty();

          property.Name = "SOURCE";
          property.Value = source.Uri.ToString();

          if (!string.IsNullOrEmpty(source.Context))
            property.Subproperties.Add("CONTEXT", source.Context);

          properties.Add(property);

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:24,代码来源:vCardImprovedWriter.cs


示例14: BuildProperties_ROLE

      /// <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);

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:22,代码来源:vCardImprovedWriter.cs


示例15: BuildProperties_REV

      /// <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);

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:19,代码来源:vCardImprovedWriter.cs


示例16: BuildProperties_GEO

      /// <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);

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:25,代码来源:vCardImprovedWriter.cs


示例17: BuildProperties_KEY

      /// <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("TYPE", certificate.KeyType);

          properties.Add(property);

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:24,代码来源:vCardImprovedWriter.cs


示例18: BuildProperties_IMPP

      private void BuildProperties_IMPP (
          vCardPropertyCollection properties,
          vCard card)
      {
        // Build IMPP and X-AIM properties

        foreach (vCardIMPP impp in card.IMs)
        {

          if (!string.IsNullOrEmpty(impp.Handle))
          {
            vCardProperty propertyIMPP;
            vCardProperty propertyXAIM;
            
            if (impp.ServiceType == IMServiceType.AIM)
            {
              propertyIMPP = new vCardProperty("IMPP", "aim:"+impp.Handle);
              propertyIMPP.Subproperties.Add("X-SERVICE-TYPE", "AIM");

              if (impp.ItemType == ItemType.HOME)
                propertyIMPP.Subproperties.Add("TYPE", "HOME");
              if (impp.ItemType == ItemType.WORK)
                propertyIMPP.Subproperties.Add("TYPE", "WORK");
              if (impp.IsPreferred)
                propertyIMPP.Subproperties.Add("TYPE", "PREF");

              properties.Add(propertyIMPP);

              propertyXAIM = new vCardProperty("X-AIM", impp.Handle);
              properties.Add(propertyXAIM);
            }
          }

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:36,代码来源:vCardImprovedWriter.cs


示例19: BuildProperties_MAILER

      /// <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);

        }

      }
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:23,代码来源:vCardImprovedWriter.cs


示例20: EncodeProperty

      /// <summary>
      ///     Returns property encoded into a standard vCard NAME:VALUE format.
      /// </summary>
      public string EncodeProperty(vCardProperty property)
      {

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

        if (string.IsNullOrEmpty(property.Name))
          throw new ArgumentException();

        StringBuilder builder = new StringBuilder();

        builder.Append(property.Name);

        foreach (vCardSubproperty subproperty in property.Subproperties)
        {
          builder.Append(';');
          builder.Append(subproperty.Name);

          if (!string.IsNullOrEmpty(subproperty.Value))
          {
            builder.Append('=');
            builder.Append(subproperty.Value);
          }
        }

        // The property name and all subproperties have been
        // written to the string builder (the colon separator
        // has not been written).  The next step is to write
        // the value.  Depending on the type of value and any
        // characters in the value, it may be necessary to
        // use an non-default encoding.  For example, byte arrays
        // are written encoded in BASE64.

        if (property.Value == null)
        {
          builder.Append(':');
        }
        else
        {

          Type valueType = property.Value.GetType();

          if (valueType == typeof(byte[]))
          {

            // A byte array should be encoded in BASE64 format.

            builder.Append(";ENCODING=b:");
            builder.Append(EncodeBase64((byte[])property.Value));

          }
          else if (valueType == typeof(vCardValueCollection))
          {

            vCardValueCollection values = (vCardValueCollection)property.Value;

            builder.Append(':');
            for (int index = 0; index < values.Count; index++)
            {

              builder.Append(EncodeEscaped(values[index]));
              if (index < values.Count - 1)
              {
                builder.Append(values.Separator);
              }
            }

          }
          else
          {

            // The object will be converted to a string (if it is
            // not a string already) and encoded if necessary.
            // The first step is to get the string value.

            string stringValue = null;

            if (valueType == typeof(char[]))
            {
              stringValue = new string(((char[])property.Value));
            }
            else
            {
              stringValue = property.Value.ToString();
            }

            builder.Append(':');

            switch (property.Subproperties.GetValue("ENCODING"))
            {

              case "QUOTED-PRINTABLE":
                builder.Append(EncodeQuotedPrintable(stringValue));
                break;

              default:
                builder.Append(EncodeEscaped(stringValue));
//.........这里部分代码省略.........
开发者ID:aluxnimm,项目名称:outlookcaldavsynchronizer,代码行数:101,代码来源:vCardImprovedWriter.cs



注:本文中的Thought.vCards.vCardProperty类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.IntegrationResult类代码示例发布时间:2022-05-26
下一篇:
C# vCards.vCard类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap