예제 #1
0
 internal BodyWriteStream(ICoreItem coreItem, BodyWriteConfiguration configuration, Stream outputStream) : base(StreamBase.Capabilities.Writable)
 {
     this.coreItem = coreItem;
     using (DisposeGuard disposeGuard = default(DisposeGuard))
     {
         Stream stream = null;
         if (outputStream == null)
         {
             stream = BodyWriteStream.OpenBodyStream(coreItem, configuration);
             disposeGuard.Add <Stream>(stream);
             outputStream = stream;
         }
         Stream disposable = BodyWriteDelegates.CreateStream(coreItem, configuration, outputStream, out this.conversionCallback);
         disposeGuard.Add <Stream>(disposable);
         disposeGuard.Success();
         this.writeStream = disposable;
         this.bodyStream  = stream;
     }
 }
예제 #2
0
 internal BodyTextWriter(ICoreItem coreItem, BodyWriteConfiguration configuration, Stream outputStream)
 {
     this.coreItem       = coreItem;
     this.disposeTracker = this.GetDisposeTracker();
     using (DisposeGuard disposeGuard = default(DisposeGuard))
     {
         Stream stream = null;
         if (outputStream == null)
         {
             stream = new StreamWrapper(BodyWriteStream.OpenBodyStream(coreItem, configuration), true);
             disposeGuard.Add <Stream>(stream);
             outputStream = stream;
         }
         TextWriter disposable = BodyWriteDelegates.CreateWriter(coreItem, configuration, outputStream, out this.conversionCallback);
         disposeGuard.Add <TextWriter>(disposable);
         disposeGuard.Success();
         this.writer     = disposable;
         this.bodyStream = stream;
     }
 }
예제 #3
0
        internal Stream InternalOpenWriteStream(BodyWriteConfiguration configuration, Stream outputStream)
        {
            Stream result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                BodyWriteStream bodyWriteStream;
                lock (this.bodyStreamsLock)
                {
                    this.CheckOpenBodyStreamForWrite();
                    bodyWriteStream = new BodyWriteStream(this.coreItem, configuration, outputStream);
                    disposeGuard.Add <BodyWriteStream>(bodyWriteStream);
                    this.bodyWriteStream = bodyWriteStream;
                }
                this.BodyChanged(configuration);
                this.bodyStreamingException = null;
                this.isBodyChanged          = true;
                this.cachedPreviewText      = null;
                disposeGuard.Success();
                result = bodyWriteStream;
            }
            return(result);
        }