示例#1
0
        private void SaveAttachmentContents(AttachmentData attachmentData, string attachmentPath)
        {
            var encoding = new UTF8Encoding(false);

            using (Stream attachmentStream = reportContainer.OpenWrite(attachmentPath, attachmentData.ContentType, encoding))
                attachmentData.SaveContents(attachmentStream, encoding);
        }
        private void SaveAttachment(string stepId, AttachmentData attachmentData)
        {
            string attachmentPath = GetAttachmentPath(stepId, attachmentData);

            if (attachmentPaths.Contains(attachmentPath))
            {
                return;
            }

            attachmentPaths.Add(attachmentPath);

            using (Stream fs = cacheGroup.OpenFile(attachmentPath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete))
                attachmentData.SaveContents(fs, Encoding.Default);
        }