public override void Export(ContactWriter writer, Contact contact, OutboundVCardConverter.PropertyExporter.Context context) { writer.StartProperty(PropertyId.Organization); string valueOrDefault = contact.GetValueOrDefault <string>(InternalSchema.CompanyName, string.Empty); writer.WritePropertyValue(valueOrDefault, ContactValueSeparators.Semicolon); valueOrDefault = contact.GetValueOrDefault <string>(InternalSchema.Department, string.Empty); writer.WritePropertyValue(valueOrDefault, ContactValueSeparators.Semicolon); }
public override void Export(ContactWriter writer, Contact contact, OutboundVCardConverter.PropertyExporter.Context context) { object obj = contact.TryGetProperty(this.prop); if (obj is string) { writer.WriteProperty(this.propName, obj as string); return; } if (PropertyError.IsPropertyValueTooBig(obj)) { writer.StartProperty(this.propName); using (Stream stream = contact.OpenPropertyStream(this.prop, PropertyOpenMode.ReadOnly)) { using (Stream stream2 = new ConverterStream(stream, new TextToText { InputEncoding = Encoding.Unicode, OutputEncoding = context.Encoding }, ConverterStreamAccess.Read)) { writer.WritePropertyValue(stream2); } } } }
public override void Export(ContactWriter writer, Contact contact, OutboundVCardConverter.PropertyExporter.Context context) { byte[][] array = contact.TryGetProperty(InternalSchema.UserX509Certificates) as byte[][]; if (array != null) { foreach (byte[] array3 in array) { if (array3 != null) { writer.StartProperty(PropertyId.Key); writer.WriteParameter(ParameterId.Type, "X509"); writer.WriteParameter(ParameterId.Encoding, "B"); using (MemoryStream memoryStream = new MemoryStream()) { using (Stream stream = new EncoderStream(new StreamWrapper(memoryStream, false), new Base64Encoder(0), EncoderStreamAccess.Write)) { stream.Write(array3, 0, array3.Length); } memoryStream.Position = 0L; writer.WritePropertyValue(memoryStream); } } } } }
public override void Export(ContactWriter writer, Contact contact, OutboundVCardConverter.PropertyExporter.Context context) { ExDateTime?exDateTime = contact.TryGetProperty(this.prop) as ExDateTime?; if (exDateTime != null) { writer.StartProperty(this.propName); writer.WriteValueTypeParameter(this.type); writer.WritePropertyValue((DateTime)exDateTime.Value.ToUtc()); } }
public override void Export(ContactWriter writer, Contact contact, OutboundVCardConverter.PropertyExporter.Context context) { if (contact.Body.IsBodyDefined) { BodyReadConfiguration configuration = new BodyReadConfiguration(BodyFormat.TextPlain, context.Encoding.WebName); using (Stream stream = contact.Body.OpenReadStream(configuration)) { writer.StartProperty(PropertyId.Note); writer.WritePropertyValue(stream); } } }
public override void Export(ContactWriter writer, Contact contact, OutboundVCardConverter.PropertyExporter.Context context) { string[] array = contact.TryGetProperty(this.prop) as string[]; if (array != null && array.Length > 0) { writer.StartProperty(this.propName); foreach (string value in array) { writer.WritePropertyValue(value, ContactValueSeparators.Comma); } } }
public override void Export(ContactWriter writer, Contact contact, OutboundVCardConverter.PropertyExporter.Context context) { writer.StartProperty(PropertyId.StructuredName); for (int i = 0; i < OutboundVCardConverter.NameExporter.sourceProperties.Length; i++) { string text = contact.TryGetProperty(OutboundVCardConverter.NameExporter.sourceProperties[i]) as string; if (text == null) { text = string.Empty; } writer.WritePropertyValue(text, ContactValueSeparators.Semicolon); } }
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); } }
private void WriteParticipant(ContactWriter writer, Participant addr, OutboundConversionOptions options) { if (addr == null) { return; } string participantSmtpAddress = ItemToMimeConverter.GetParticipantSmtpAddress(addr, options); if (!string.IsNullOrEmpty(participantSmtpAddress)) { writer.StartProperty(PropertyId.EMail); writer.WriteParameter(ParameterId.Type, "INTERNET"); writer.WritePropertyValue(participantSmtpAddress); } }
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); } }
public override void Export(ContactWriter writer, Contact contact, OutboundVCardConverter.PropertyExporter.Context context) { foreach (AttachmentHandle handle in contact.AttachmentCollection) { using (Attachment attachment = contact.AttachmentCollection.Open(handle, null)) { if (attachment.IsContactPhoto) { StreamAttachment streamAttachment = attachment as StreamAttachment; if (streamAttachment != null) { string text = streamAttachment.ContentType; if (string.IsNullOrEmpty(text)) { text = streamAttachment.CalculatedContentType; } string value = null; if (!string.IsNullOrEmpty(text) && OutboundVCardConverter.PhotoExporter.contentTypeToType.TryGetValue(text, out value)) { using (Stream stream = streamAttachment.TryGetContentStream(PropertyOpenMode.ReadOnly)) { if (stream != null) { writer.StartProperty(PropertyId.Photo); writer.WriteParameter(ParameterId.Type, value); writer.WriteParameter(ParameterId.Encoding, "B"); using (Stream stream2 = new EncoderStream(stream, new Base64Encoder(0), EncoderStreamAccess.Read)) { writer.WritePropertyValue(stream2); break; } } } } } } } } }