Example #1
0
        public void WriteProperty(ContactPropertyReader reader)
        {
            this.StartProperty(reader.Name);
            ContactParameterReader parameterReader = reader.ParameterReader;

            while (parameterReader.ReadNextParameter())
            {
                this.WriteParameter(parameterReader);
            }
            ContactValueSeparators separator          = ContactValueSeparators.None;
            ContactValueSeparators expectedSeparators = ContactValueSeparators.Comma | ContactValueSeparators.Semicolon;
            ContactValueType       contactValueType   = reader.ValueType;

            switch (contactValueType)
            {
            case ContactValueType.Binary:
                expectedSeparators = ContactValueSeparators.None;
                break;

            case ContactValueType.Boolean:
                break;

            case ContactValueType.Date:
            case ContactValueType.DateTime:
                goto IL_55;

            default:
                if (contactValueType == ContactValueType.Time)
                {
                    goto IL_55;
                }
                break;
            }
IL_70:
            while (reader.ReadNextValue())
            {
                this.WritePropertyValue(reader.ReadValue(expectedSeparators), separator);
                separator = reader.LastValueSeparator;
            }
            this.EndProperty();
            return;

IL_55:
            expectedSeparators = ContactValueSeparators.Semicolon;
            goto IL_70;
        }
Example #2
0
 public void WriteContact(ContactReader reader)
 {
     if (reader == null)
     {
         throw new ArgumentNullException("reader");
     }
     if (reader.ComplianceMode == ContactComplianceMode.Loose)
     {
         this.SetLooseMode();
     }
     while (reader.ReadNext())
     {
         this.StartVCard();
         ContactPropertyReader propertyReader = reader.PropertyReader;
         while (propertyReader.ReadNextProperty())
         {
             this.WriteProperty(propertyReader);
         }
         this.EndVCard();
     }
 }