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