Esempio n. 1
0
 internal override long WriteTo(System.IO.Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer)
 {
     var nameLength = this.WriteName(stream, ref scratchBuffer);
     currentLineLength.IncrementBy((int) nameLength);
     var merge = false;
     if (!this.IsDirty && this.RawLength != 0) {
         if (this.IsProtected) {
             var num = nameLength + Header.WriteLines(lines, stream);
             currentLineLength.SetAs(0);
             return num;
         }
         if (!this.IsHeaderLineTooLong(nameLength, out merge)) {
             var num = nameLength + Header.WriteLines(lines, stream);
             currentLineLength.SetAs(0);
             return num;
         }
     }
     var mimeStringList = lines;
     if (merge)
         mimeStringList = Header.MergeLines(mimeStringList);
     return nameLength + Header.QuoteAndFold(stream, mimeStringList, 4026531840U, false, mimeStringList.Length > 0, encodingOptions.AllowUTF8, 0, ref currentLineLength, ref scratchBuffer) +
            Header.WriteLineEnd(stream, ref currentLineLength);
 }
Esempio n. 2
0
 internal override long WriteValue(System.IO.Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer)
 {
     if (disp.Length == 0)
         disp = "attachment";
     return base.WriteValue(stream, encodingOptions, filter, ref currentLineLength, ref scratchBuffer);
 }
Esempio n. 3
0
 internal override long WriteTo(System.IO.Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer)
 {
     var num1 = this.WriteName(stream, ref scratchBuffer);
     currentLineLength.IncrementBy((int) num1);
     if (!this.IsDirty && this.RawLength != 0 && this.IsProtected) {
         var num2 = Header.WriteLines(this.Lines, stream);
         var num3 = num1 + num2;
         currentLineLength.SetAs(0);
         return num3;
     }
     if (!parsed)
         this.Parse();
     var num4 = num1 + DateHeader.WriteDateHeaderValue(stream, utcDateTime, timeZoneOffset, ref currentLineLength);
     currentLineLength.SetAs(0);
     return num4;
 }
Esempio n. 4
0
 internal override long WriteTo(System.IO.Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer)
 {
     var nameLength = this.WriteName(stream, ref scratchBuffer);
     currentLineLength.IncrementBy((int) nameLength);
     MimeStringList mimeStringList;
     if (this.RawLength == 0 && decodedValue != null && decodedValue.Length != 0)
         mimeStringList = this.GetEncodedValue(encodingOptions, ValueEncodingStyle.Normal);
     else if ((EncodingFlags.ForceReencode & encodingOptions.EncodingFlags) != EncodingFlags.None) {
         this.ForceParse();
         mimeStringList = this.GetEncodedValue(encodingOptions, ValueEncodingStyle.Normal);
     } else {
         var merge = false;
         if (!this.IsDirty && this.RawLength != 0) {
             if (this.IsProtected) {
                 var num = nameLength + Header.WriteLines(this.Lines, stream);
                 currentLineLength.SetAs(0);
                 return num;
             }
             if (!this.IsHeaderLineTooLong(nameLength, out merge)) {
                 var num = nameLength + Header.WriteLines(this.Lines, stream);
                 currentLineLength.SetAs(0);
                 return num;
             }
         }
         mimeStringList = this.Lines;
         if (merge)
             mimeStringList = Header.MergeLines(mimeStringList);
     }
     return nameLength + Header.QuoteAndFold(stream, mimeStringList, 4026531840U, false, mimeStringList.Length > 0, encodingOptions.AllowUTF8, 0, ref currentLineLength, ref scratchBuffer) +
            Header.WriteLineEnd(stream, ref currentLineLength);
 }