// Token: 0x06000104 RID: 260 RVA: 0x00004177 File Offset: 0x00002377
 public AttachmentHandler(string id, IAttachmentWebOperationContext webOperationContext, CallContext callContext, ConfigurationContextBase configurationContext)
 {
     this.id                   = id;
     this.callContext          = callContext;
     this.webOperationContext  = webOperationContext;
     this.configurationContext = configurationContext;
 }
Ejemplo n.º 2
0
        // Token: 0x06000333 RID: 819 RVA: 0x0000CAF8 File Offset: 0x0000ACF8
        public Stream WriteArchive(ConfigurationContextBase configurationContext, IAttachmentWebOperationContext webOperationContext, OutboundConversionOptions outboundConversionOptions, AttachmentCollection attachmentCollection)
        {
            Stream stream = new MemoryStream();

            ZipFileAttachments.SetResponseHeadersForZipAttachments(webOperationContext, this.zipFileName);
            List <string> list = new List <string>();

            if (this.hasEmbeddedItem)
            {
                foreach (KeyValuePair <string, ZipEntryAttachment> keyValuePair in this.files)
                {
                    list.Add(keyValuePair.Key);
                }
            }
            foreach (ZipEntryAttachment zipEntryAttachment in this.files.Values)
            {
                this.bytesWritten += zipEntryAttachment.WriteToStream(configurationContext, stream, outboundConversionOptions, this.blockStatus, this.bytesWritten, list, attachmentCollection);
            }
            long startOfDirectory = this.bytesWritten;

            foreach (ZipEntryAttachment zipEntryAttachment2 in this.files.Values)
            {
                this.bytesWritten += (long)((ulong)zipEntryAttachment2.WriteCentralDirectoryStructure(stream));
            }
            long endOfDirectory = this.bytesWritten;

            this.WriteTrailer(stream, startOfDirectory, endOfDirectory);
            return(stream);
        }
Ejemplo n.º 3
0
        // Token: 0x06000335 RID: 821 RVA: 0x0000CCC4 File Offset: 0x0000AEC4
        private static void SetZipContentDispositionResponseHeader(IAttachmentWebOperationContext webOperationContext, string fileName)
        {
            bool   chrome = webOperationContext.UserAgent.IsBrowserChrome();
            string str    = AttachmentUtilities.ToHexString(fileName, chrome);

            webOperationContext.Headers["Content-Disposition"] = "filename=" + str;
        }
Ejemplo n.º 4
0
        // Token: 0x06000334 RID: 820 RVA: 0x0000CC4C File Offset: 0x0000AE4C
        private static void SetResponseHeadersForZipAttachments(IAttachmentWebOperationContext webOperationContext, string fileName)
        {
            if (webOperationContext == null)
            {
                throw new ArgumentNullException("webOperationContext");
            }
            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("Argument fileName may not be null or empty string");
            }
            webOperationContext.ContentType = "application/zip; authoritative=true;";
            ZipFileAttachments.SetZipContentDispositionResponseHeader(webOperationContext, fileName);
            DateHeader dateHeader = new DateHeader("Date", DateTime.UtcNow.AddDays(-1.0));

            webOperationContext.Headers["Expires"] = dateHeader.Value;
        }