internal override IAsyncResult BeginSend(BaseWriter writer, AsyncCallback callback, object state) { writer.WriteHeaders(base.Headers); MimeBasePart.MimePartAsyncResult result = new MimeBasePart.MimePartAsyncResult(this, state, callback); MimePartContext context = new MimePartContext(writer, result, this.Parts.GetEnumerator()); IAsyncResult result2 = writer.BeginGetContentStream(new AsyncCallback(this.ContentStreamCallback), context); if (result2.CompletedSynchronously) { this.ContentStreamCallbackHandler(result2); } return result; }
internal override IAsyncResult BeginSend(BaseWriter writer, AsyncCallback callback, bool allowUnicode, object state) { _allowUnicode = allowUnicode; base.PrepareHeaders(allowUnicode); writer.WriteHeaders(base.Headers, allowUnicode); var result = new MimeBasePart.MimePartAsyncResult(this, state, callback); var context = new MimePartContext(writer, result, Parts.GetEnumerator()); var result2 = writer.BeginGetContentStream(new AsyncCallback(ContentStreamCallback), context); if (result2.CompletedSynchronously) ContentStreamCallbackHandler(result2); return result; }
internal virtual IAsyncResult BeginSend(BaseWriter writer, bool sendEnvelope, AsyncCallback callback, object state) { this.PrepareHeaders(sendEnvelope); writer.WriteHeaders(this.Headers); if (this.Content != null) { return this.Content.BeginSend(writer, callback, state); } LazyAsyncResult result = new LazyAsyncResult(this, state, callback); IAsyncResult result2 = writer.BeginGetContentStream(new AsyncCallback(this.EmptySendCallback), new EmptySendContext(writer, result)); if (result2.CompletedSynchronously) { writer.EndGetContentStream(result2).Close(); } return result; }
internal override void Send(BaseWriter writer, bool allowUnicode) { PrepareHeaders(allowUnicode); writer.WriteHeaders(Headers, allowUnicode); Stream outputStream = writer.GetContentStream(); MimeWriter mimeWriter = new MimeWriter(outputStream, ContentType.Boundary); foreach (MimeBasePart part in Parts) { part.Send(mimeWriter, allowUnicode); } mimeWriter.Close(); outputStream.Close(); }
internal override void Send(BaseWriter writer) { if (this.Stream != null) { int num; byte[] buffer = new byte[0x4400]; writer.WriteHeaders(base.Headers); System.IO.Stream contentStream = writer.GetContentStream(); contentStream = this.GetEncodedStream(contentStream); this.ResetStream(); this.streamUsedOnce = true; while ((num = this.Stream.Read(buffer, 0, 0x4400)) > 0) { contentStream.Write(buffer, 0, num); } contentStream.Close(); } }
internal override void Send(BaseWriter writer, bool allowUnicode) { if (Stream != null) { int num; var buffer = new byte[0x4400]; base.PrepareHeaders(allowUnicode); writer.WriteHeaders(base.Headers, allowUnicode); var contentStream = writer.GetContentStream(); contentStream = GetEncodedStream(contentStream); ResetStream(); _streamUsedOnce = true; while ((num = Stream.Read(buffer, 0, 0x4400)) > 0) contentStream.Write(buffer, 0, num); contentStream.Close(); } }
internal virtual IAsyncResult BeginSend(BaseWriter writer, AsyncCallback callback, bool allowUnicode, object state) { throw new NotImplementedException(); }
internal override void Send(BaseWriter writer) { writer.WriteHeaders(base.Headers); Stream contentStream = writer.GetContentStream(); MimeWriter writer2 = new MimeWriter(contentStream, base.ContentType.Boundary); foreach (MimeBasePart part in this.Parts) { part.Send(writer2); } writer2.Close(); contentStream.Close(); }
internal EmptySendContext(BaseWriter writer, LazyAsyncResult result) { this.writer = writer; this.result = result; }
internal override void Send(BaseWriter writer, bool allowUnicode) { base.PrepareHeaders(allowUnicode); writer.WriteHeaders(base.Headers, allowUnicode); var contentStream = writer.GetContentStream(); var writer2 = new MimeWriter(contentStream, base.ContentType.Boundary); foreach (var part in Parts) part.Send(writer2, allowUnicode); writer2.Close(); contentStream.Close(); }
internal virtual void Send(BaseWriter writer, bool sendEnvelope, bool allowUnicode) { if (sendEnvelope) { PrepareEnvelopeHeaders(sendEnvelope, allowUnicode); writer.WriteHeaders(EnvelopeHeaders, allowUnicode); } PrepareHeaders(sendEnvelope, allowUnicode); writer.WriteHeaders(Headers, allowUnicode); if (Content != null) { Content.Send(writer, allowUnicode); } else { writer.GetContentStream().Close(); } }
internal void Send(BaseWriter writer, bool sendEnvelope) { this.SetContent(); this.message.Send(writer, sendEnvelope); }
internal IAsyncResult BeginSend(BaseWriter writer, bool sendEnvelope, AsyncCallback callback, object state) { this.SetContent(); return this.message.BeginSend(writer, sendEnvelope, callback, state); }
internal MimePartContext(BaseWriter writer, LazyAsyncResult result) { _writer = writer; _result = result; _buffer = new byte[maxBufferSize]; }
internal MimePartContext(BaseWriter writer, LazyAsyncResult result, IEnumerator <MimeBasePart> partsEnumerator) { this.writer = writer; this.result = result; this.partsEnumerator = partsEnumerator; }
internal virtual void Send(BaseWriter writer) { throw new NotImplementedException(); }
internal EmptySendContext(BaseWriter writer, LazyAsyncResult result) { _writer = writer; _result = result; }
internal virtual IAsyncResult BeginSend(BaseWriter writer, bool sendEnvelope, bool allowUnicode, AsyncCallback callback, object state) { PrepareHeaders(sendEnvelope, allowUnicode); writer.WriteHeaders(Headers, allowUnicode); if (Content != null) { return Content.BeginSend(writer, callback, allowUnicode, state); } else { LazyAsyncResult result = new LazyAsyncResult(this, state, callback); IAsyncResult newResult = writer.BeginGetContentStream(EmptySendCallback, new EmptySendContext(writer, result)); if (newResult.CompletedSynchronously) { writer.EndGetContentStream(newResult).Close(); } return result; } }
internal IAsyncResult BeginSend(BaseWriter writer, bool sendEnvelope, bool allowUnicode, AsyncCallback callback, object state) { SetContent(allowUnicode); return _message.BeginSend(writer, sendEnvelope, allowUnicode, callback, state); }
internal virtual void Send(BaseWriter writer, bool allowUnicode) { throw new NotImplementedException(); }
internal void Send(BaseWriter writer, bool sendEnvelope, bool allowUnicode) { SetContent(allowUnicode); _message.Send(writer, sendEnvelope, allowUnicode); }
internal MimePartContext(BaseWriter writer, LazyAsyncResult result) { this.writer = writer; this.result = result; buffer = new byte[maxBufferSize]; }
internal virtual void Send(BaseWriter writer, bool sendEnvelope) { if (sendEnvelope) { this.PrepareEnvelopeHeaders(sendEnvelope); writer.WriteHeaders(this.EnvelopeHeaders); } this.PrepareHeaders(sendEnvelope); writer.WriteHeaders(this.Headers); if (this.Content != null) { this.Content.Send(writer); } else { writer.GetContentStream().Close(); } }
internal override void Send(BaseWriter writer, bool allowUnicode) { if (Stream != null) { byte[] buffer = new byte[maxBufferSize]; PrepareHeaders(allowUnicode); writer.WriteHeaders(Headers, allowUnicode); Stream outputStream = writer.GetContentStream(); outputStream = GetEncodedStream(outputStream); int read; ResetStream(); streamUsedOnce = true; while ((read = Stream.Read(buffer, 0, maxBufferSize)) > 0) { outputStream.Write(buffer, 0, read); } outputStream.Close(); } }
internal override IAsyncResult BeginSend(BaseWriter writer, AsyncCallback callback, bool allowUnicode, object state) { this.allowUnicode = allowUnicode; PrepareHeaders(allowUnicode); writer.WriteHeaders(Headers, allowUnicode); MimePartAsyncResult result = new MimePartAsyncResult(this, state, callback); MimePartContext context = new MimePartContext(writer, result, Parts.GetEnumerator()); IAsyncResult contentResult = writer.BeginGetContentStream(new AsyncCallback(ContentStreamCallback), context); if (contentResult.CompletedSynchronously) { ContentStreamCallbackHandler(contentResult); } return result; }
internal MimePartContext(BaseWriter writer, LazyAsyncResult result, IEnumerator<MimeBasePart> partsEnumerator) { this.writer = writer; this.result = result; this.partsEnumerator = partsEnumerator; }
internal MimePartContext(BaseWriter writer, LazyAsyncResult result) { this.writer = writer; this.result = result; this.buffer = new byte[0x4400]; }