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;
 }
예제 #2
0
 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;
 }
예제 #4
0
        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();
     }
 }
예제 #6
0
 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();
     }
 }
예제 #7
0
파일: MimeBasePart.cs 프로젝트: jnm2/corefx
 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;
 }
예제 #10
0
 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();
 }
예제 #11
0
        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);
 }
예제 #14
0
 internal MimePartContext(BaseWriter writer, LazyAsyncResult result)
 {
     _writer = writer;
     _result = result;
     _buffer = new byte[maxBufferSize];
 }
예제 #15
0
 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();
 }
예제 #17
0
 internal EmptySendContext(BaseWriter writer, LazyAsyncResult result)
 {
     _writer = writer;
     _result = result;
 }
예제 #18
0
 internal virtual IAsyncResult BeginSend(BaseWriter writer, AsyncCallback callback, 
     bool allowUnicode, object state) {
     throw new NotImplementedException(); 
 }
예제 #19
0
        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;
            }
        }
예제 #20
0
 internal IAsyncResult BeginSend(BaseWriter writer, bool sendEnvelope, bool allowUnicode,
     AsyncCallback callback, object state)
 {
     SetContent(allowUnicode);
     return _message.BeginSend(writer, sendEnvelope, allowUnicode, callback, state);
 }
예제 #21
0
 internal virtual void Send(BaseWriter writer, bool allowUnicode) { 
     throw new NotImplementedException(); 
 }
예제 #22
0
 internal MimePartContext(BaseWriter writer, LazyAsyncResult result)
 {
     _writer = writer;
     _result = result;
     _buffer = new byte[maxBufferSize];
 }
예제 #23
0
 internal void Send(BaseWriter writer, bool sendEnvelope, bool allowUnicode)
 {
     SetContent(allowUnicode);
     _message.Send(writer, sendEnvelope, allowUnicode);
 }
예제 #24
0
파일: MimePart.cs 프로젝트: REALTOBIZ/mono
 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();
     }
 }
예제 #26
0
파일: MimePart.cs 프로젝트: REALTOBIZ/mono
      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();
          }
      }
예제 #27
0
 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;
 }
예제 #28
0
 internal MimePartContext(BaseWriter writer, LazyAsyncResult result, IEnumerator<MimeBasePart> partsEnumerator) {
     this.writer = writer;
     this.result = result;
     this.partsEnumerator = partsEnumerator;
 }
예제 #29
0
 internal MimePartContext(BaseWriter writer, LazyAsyncResult result)
 {
     this.writer = writer;
     this.result = result;
     this.buffer = new byte[0x4400];
 }
예제 #30
0
파일: MimeBasePart.cs 프로젝트: jnm2/corefx
 internal virtual void Send(BaseWriter writer, bool allowUnicode)
 {
     throw new NotImplementedException();
 }