示例#1
0
            public override void Export(ContactWriter writer, Contact contact, OutboundVCardConverter.PropertyExporter.Context context)
            {
                writer.StartProperty(PropertyId.Address);
                writer.StartParameter(ParameterId.Type);
                writer.WriteParameterValue(this.type);
                PhysicalAddressType valueOrDefault = contact.GetValueOrDefault <PhysicalAddressType>(ContactSchema.PostalAddressId);

                if (valueOrDefault == this.addrType)
                {
                    writer.WriteParameterValue("PREF");
                }
                for (int i = 0; i < this.props.Length; i++)
                {
                    string text = string.Empty;
                    if (this.props[i] != null)
                    {
                        text = (contact.TryGetProperty(this.props[i]) as string);
                        if (text == null)
                        {
                            text = string.Empty;
                        }
                    }
                    writer.WritePropertyValue(text, ContactValueSeparators.Semicolon);
                }
                string text2 = contact.TryGetProperty(this.labelProp) as string;

                if (text2 != null)
                {
                    writer.StartProperty(PropertyId.Label);
                    writer.StartParameter(ParameterId.Type);
                    writer.WriteParameterValue(this.type);
                    if (valueOrDefault == this.addrType)
                    {
                        writer.WriteParameterValue("PREF");
                    }
                    writer.WritePropertyValue(text2);
                }
            }
示例#2
0
            public override void Export(ContactWriter writer, Contact contact, OutboundVCardConverter.PropertyExporter.Context context)
            {
                string text = contact.TryGetProperty(this.prop) as string;

                if (text != null)
                {
                    writer.StartProperty(this.propName);
                    if (this.types != null && this.types.Length > 0)
                    {
                        writer.StartParameter(ParameterId.Type);
                        foreach (string value in this.types)
                        {
                            writer.WriteParameterValue(value);
                        }
                    }
                    writer.WritePropertyValue(text);
                }
            }