internal static SerializeableAttachment GetSerializeableAttachment(Attachment att)
{
if (att == null)
return null;
var saa = new SerializeableAttachment();
saa._contentId = att.ContentId;
saa._contentDisposition =
SerializeableContentDisposition.GetSerializeableContentDisposition(att.ContentDisposition);
if (att.ContentStream != null)
{
var bytes = new byte[att.ContentStream.Length];
att.ContentStream.Read(bytes, 0, bytes.Length);
saa._contentStream = new MemoryStream(bytes);
}
saa._contentType = SerializeableContentType.GetSerializeableContentType(att.ContentType);
saa._name = att.Name;
saa._transferEncoding = att.TransferEncoding;
saa._nameEncoding = att.NameEncoding;
return saa;
}