Пример #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);
 }
Пример #2
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;
 }
Пример #3
0
 internal static long WriteLineEnd(System.IO.Stream stream, ref MimeStringLength currentLineLength)
 {
     var num1 = 0L;
     stream.Write(MimeString.CrLf, 0, MimeString.CrLf.Length);
     var num2 = num1 + MimeString.CrLf.Length;
     currentLineLength.SetAs(0);
     return num2;
 }
Пример #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);
 }