示例#1
0
        private void AddArchiveEntry(ZipArchive archive, Attachment attachment)
        {
            var entry = archive.CreateEntry(attachment.Path, CompressionLevel.Fastest);

            using (var writerStream = entry.Open())
                using (var binaryWriter = new BinaryWriter(writerStream))
                {
                    binaryWriter.Write(attachment.Content);
                }

            entry.LastWriteTime = attachment.LastWriteTime;
        }
示例#2
0
 public void AddAttachment(Attachment objAttachment) {
     Message.Attachments.Add(objAttachment);
 }
示例#3
0
 public void AddAttachment(string file, string mimeType) {
     Attachment attachment = new Attachment(file, mimeType);
     Message.Attachments.Add(attachment);
 }