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; } }
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; } }
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); }