// Token: 0x06000236 RID: 566 RVA: 0x00009CA8 File Offset: 0x00007EA8 public void WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter) { if (stream == null) { throw new ArgumentNullException("stream"); } if (encodingOptions == null) { encodingOptions = base.GetDocumentEncodingOptions(); } byte[] array = null; MimeStringLength mimeStringLength = new MimeStringLength(0); this.WriteTo(stream, encodingOptions, filter, ref mimeStringLength, ref array); }
// Token: 0x06000237 RID: 567 RVA: 0x00009CEC File Offset: 0x00007EEC internal override long WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { MimePart.CountingWriteStream countingWriteStream = null; MimePart.CountingWriteStream countingWriteStream2 = null; long num = 0L; long num2 = 0L; if (filter != null) { countingWriteStream = (stream as MimePart.CountingWriteStream); if (countingWriteStream == null) { countingWriteStream2 = new MimePart.CountingWriteStream(stream); countingWriteStream = countingWriteStream2; stream = countingWriteStream; } num = countingWriteStream.Count; } for (MimeNode mimeNode = base.FirstChild; mimeNode != null; mimeNode = mimeNode.NextSibling) { if (filter == null || !filter.FilterHeader(mimeNode as Header, countingWriteStream)) { num2 += mimeNode.WriteTo(stream, encodingOptions, filter, ref currentLineLength, ref scratchBuffer); } } if (countingWriteStream != null) { num2 = countingWriteStream.Count - num; if (countingWriteStream2 != null) { countingWriteStream2.Dispose(); } } currentLineLength.SetAs(0); return(num2); }
// Token: 0x06000302 RID: 770 RVA: 0x00010A58 File Offset: 0x0000EC58 internal override long WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { MimeStringList fragments = this.valueFragments; long num = 0L; if (this.valueFragments.Length == 0 && this.decodedValue != null && 0 < this.decodedValue.Length) { fragments = this.EncodeValue(this.decodedValue, encodingOptions); this.valueFragments = fragments; } else if ((byte)(EncodingFlags.ForceReencode & encodingOptions.EncodingFlags) != 0 && 0 >= this.segmentNumber) { fragments = this.EncodeValue(this.Value, encodingOptions); } bool flag = false; if (this.IsQuotingReqired() || fragments.Length == 0) { flag = true; } else { for (int i = 0; i < fragments.Count; i++) { MimeString str = fragments[i]; int num2 = 0; int num3 = ValueParser.ParseToken(str, out num2, encodingOptions.AllowUTF8); if (268435456U != str.Mask && str.Length != num3) { flag = true; break; } } } MimeNode mimeNode = null; if (this.segmentNumber == 0) { mimeNode = base.FirstChild; while (mimeNode != null && !(mimeNode is MimeParameter)) { mimeNode = mimeNode.NextSibling; } } MimeString mimeString = ((this.segmentNumber == 0 && mimeNode != null) || 0 < this.segmentNumber) ? new MimeString(this.segmentNumber.ToString()) : default(MimeString); if (1 < currentLineLength.InChars) { int num4 = 1 + this.paramName.Length + 1; byte[] sz = fragments.GetSz(); int num5 = ByteString.BytesToCharCount(sz, encodingOptions.AllowUTF8); if (mimeString.Length != 0) { num4 += 1 + mimeString.Length; } if (this.valueEncoded) { num4++; } int num6 = num5; if (flag) { num6 += 2; } if (base.NextSibling != null) { if (num5 == 0) { num4++; } else { num6++; } } num6 += num4; if (currentLineLength.InChars + num6 > 78) { num += Header.WriteLineEnd(stream, ref currentLineLength); stream.Write(Header.LineStartWhitespace, 0, Header.LineStartWhitespace.Length); num += (long)Header.LineStartWhitespace.Length; currentLineLength.IncrementBy(Header.LineStartWhitespace.Length); } else { stream.Write(MimeString.Space, 0, MimeString.Space.Length); num += (long)MimeString.Space.Length; currentLineLength.IncrementBy(MimeString.Space.Length); } } int num7 = ByteString.StringToBytesCount(this.paramName, false); if (scratchBuffer == null || scratchBuffer.Length < num7) { scratchBuffer = new byte[Math.Max(998, num7)]; } int num8 = ByteString.StringToBytes(this.paramName, scratchBuffer, 0, false); stream.Write(scratchBuffer, 0, num8); num += (long)num8; currentLineLength.IncrementBy(this.paramName.Length, num8); if (mimeString.Length != 0) { stream.Write(MimeString.Asterisk, 0, MimeString.Asterisk.Length); num += (long)MimeString.Asterisk.Length; currentLineLength.IncrementBy(MimeString.Asterisk.Length); mimeString.WriteTo(stream); num += (long)mimeString.Length; currentLineLength.IncrementBy(mimeString.Length); } if (this.valueEncoded) { stream.Write(MimeString.Asterisk, 0, MimeString.Asterisk.Length); num += (long)MimeString.Asterisk.Length; currentLineLength.IncrementBy(MimeString.Asterisk.Length); } stream.Write(MimeString.EqualTo, 0, MimeString.EqualTo.Length); num += (long)MimeString.EqualTo.Length; currentLineLength.IncrementBy(MimeString.EqualTo.Length); int num9 = 0; if (base.NextSibling != null) { num9++; } num += Header.QuoteAndFold(stream, fragments, 4026531839U, flag, false, encodingOptions.AllowUTF8, num9, ref currentLineLength, ref scratchBuffer); int num10 = 0; while (mimeNode != null) { MimeParameter mimeParameter = mimeNode as MimeParameter; if (mimeParameter != null) { num10++; mimeParameter.segmentNumber = num10; stream.Write(MimeString.Semicolon, 0, MimeString.Semicolon.Length); num += (long)MimeString.Semicolon.Length; currentLineLength.IncrementBy(MimeString.Semicolon.Length); num += Header.WriteLineEnd(stream, ref currentLineLength); stream.Write(Header.LineStartWhitespace, 0, Header.LineStartWhitespace.Length); num += (long)Header.LineStartWhitespace.Length; currentLineLength.IncrementBy(Header.LineStartWhitespace.Length); num += mimeNode.WriteTo(stream, encodingOptions, null, ref currentLineLength, ref scratchBuffer); } mimeNode = mimeNode.NextSibling; } return(num); }
// Token: 0x06000544 RID: 1348 RVA: 0x0001CD90 File Offset: 0x0001AF90 internal override long WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { MimeStringList displayNameToWrite = base.GetDisplayNameToWrite(encodingOptions); long num = 0L; int num2 = 0; if (base.NextSibling != null) { num2++; } else if (base.Parent is MimeGroup) { num2++; if (base.Parent.NextSibling != null) { num2++; } } byte[] sz = this.emailAddressFragments.GetSz(); int num3 = ByteString.BytesToCharCount(sz, encodingOptions.AllowUTF8); if (displayNameToWrite.GetLength(4026531839U) != 0) { num += Header.QuoteAndFold(stream, displayNameToWrite, 4026531839U, base.IsQuotingRequired(displayNameToWrite, encodingOptions.AllowUTF8), true, encodingOptions.AllowUTF8, (num3 == 0) ? num2 : 0, ref currentLineLength, ref scratchBuffer); } if (num3 != 0) { int num4 = (1 < currentLineLength.InChars) ? 1 : 0; if (1 < currentLineLength.InChars) { if (currentLineLength.InChars + num3 + 2 + num2 + num4 > 78) { num += Header.WriteLineEnd(stream, ref currentLineLength); stream.Write(Header.LineStartWhitespace, 0, Header.LineStartWhitespace.Length); num += (long)Header.LineStartWhitespace.Length; currentLineLength.IncrementBy(Header.LineStartWhitespace.Length); } else { stream.Write(MimeString.Space, 0, MimeString.Space.Length); num += (long)MimeString.Space.Length; currentLineLength.IncrementBy(MimeString.Space.Length); } } stream.Write(MimeString.LessThan, 0, MimeString.LessThan.Length); num += (long)MimeString.LessThan.Length; currentLineLength.IncrementBy(MimeString.LessThan.Length); stream.Write(sz, 0, sz.Length); num += (long)sz.Length; currentLineLength.IncrementBy(num3, sz.Length); stream.Write(MimeString.GreaterThan, 0, MimeString.GreaterThan.Length); num += (long)MimeString.GreaterThan.Length; currentLineLength.IncrementBy(MimeString.GreaterThan.Length); } return(num); }
internal override long WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { long num = this.WriteName(stream, ref scratchBuffer); currentLineLength.IncrementBy((int)num); bool flag = false; if (!this.IsDirty && this.RawLength != 0) { if (this.IsProtected) { num += Header.WriteLines(this.lines, stream); currentLineLength.SetAs(0); return(num); } if (!this.IsHeaderLineTooLong(num, out flag)) { num += Header.WriteLines(this.lines, stream); currentLineLength.SetAs(0); return(num); } } MimeStringList fragments = this.lines; if (flag) { fragments = Header.MergeLines(fragments); } num += Header.QuoteAndFold(stream, fragments, 4026531840U, false, fragments.Length > 0, encodingOptions.AllowUTF8, 0, ref currentLineLength, ref scratchBuffer); return(num + Header.WriteLineEnd(stream, ref currentLineLength)); }
internal abstract long WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer);
internal override long WriteValue(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { if (this.disp.Length == 0) { this.disp = "attachment"; } return(base.WriteValue(stream, encodingOptions, filter, ref currentLineLength, ref scratchBuffer)); }
internal override long WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { long num = base.WriteName(stream, ref scratchBuffer); currentLineLength.IncrementBy((int)num); if (!base.IsDirty && base.RawLength != 0 && base.IsProtected) { long num2 = Header.WriteLines(base.Lines, stream); num += num2; currentLineLength.SetAs(0); return(num); } if (!this.parsed) { this.Parse(); } num += DateHeader.WriteDateHeaderValue(stream, this.utcDateTime, this.timeZoneOffset, ref currentLineLength); currentLineLength.SetAs(0); return(num); }
internal virtual long WriteValue(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { long num = 0L; string value = this.Value; if (value != null) { int num2 = ByteString.StringToBytesCount(value, encodingOptions.AllowUTF8) + 1; if (scratchBuffer == null || scratchBuffer.Length < num2) { scratchBuffer = new byte[Math.Max(998, num2)]; } scratchBuffer[0] = 32; int num3 = ByteString.StringToBytes(value, scratchBuffer, 1, encodingOptions.AllowUTF8); stream.Write(scratchBuffer, 0, num3 + 1); num += (long)(num3 + 1); currentLineLength.IncrementBy(value.Length + 1, num3 + 1); } return(num); }
internal override long WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { long num = base.WriteName(stream, ref scratchBuffer); currentLineLength.IncrementBy((int)num); if (!base.IsDirty && base.RawLength != 0 && base.IsProtected) { long num2 = Header.WriteLines(base.Lines, stream); num += num2; currentLineLength.SetAs(0); return(num); } if (!this.parsed) { this.Parse(); } num += this.WriteValue(stream, encodingOptions, filter, ref currentLineLength, ref scratchBuffer); for (MimeNode mimeNode = base.FirstChild; mimeNode != null; mimeNode = mimeNode.NextSibling) { stream.Write(MimeString.Semicolon, 0, MimeString.Semicolon.Length); num += (long)MimeString.Semicolon.Length; currentLineLength.IncrementBy(MimeString.Semicolon.Length); num += mimeNode.WriteTo(stream, encodingOptions, filter, ref currentLineLength, ref scratchBuffer); } return(num + Header.WriteLineEnd(stream, ref currentLineLength)); }
// Token: 0x06000554 RID: 1364 RVA: 0x0001D1D4 File Offset: 0x0001B3D4 internal override long WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { long num = base.WriteName(stream, ref scratchBuffer); currentLineLength.IncrementBy((int)num); MimeStringList mimeStringList; if (base.RawLength == 0 && this.decodedValue != null && this.decodedValue.Length != 0) { mimeStringList = this.GetEncodedValue(encodingOptions, ValueEncodingStyle.Normal); } else if ((byte)(EncodingFlags.ForceReencode & encodingOptions.EncodingFlags) != 0) { this.ForceParse(); mimeStringList = this.GetEncodedValue(encodingOptions, ValueEncodingStyle.Normal); } else { bool flag = false; if (!base.IsDirty && base.RawLength != 0) { if (base.IsProtected) { num += Header.WriteLines(base.Lines, stream); currentLineLength.SetAs(0); return(num); } if (!base.IsHeaderLineTooLong(num, out flag)) { num += Header.WriteLines(base.Lines, stream); currentLineLength.SetAs(0); return(num); } } mimeStringList = base.Lines; if (flag) { mimeStringList = Header.MergeLines(mimeStringList); } } num += Header.QuoteAndFold(stream, mimeStringList, 4026531840U, false, mimeStringList.Length > 0, encodingOptions.AllowUTF8, 0, ref currentLineLength, ref scratchBuffer); return(num + Header.WriteLineEnd(stream, ref currentLineLength)); }
// Token: 0x0600018B RID: 395 RVA: 0x00007074 File Offset: 0x00005274 internal override long WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { long num = base.WriteName(stream, ref scratchBuffer); currentLineLength.IncrementBy((int)num); if (!base.IsDirty && base.RawLength != 0) { if (base.IsProtected) { num += Header.WriteLines(base.Lines, stream); currentLineLength.SetAs(0); return(num); } if (base.InternalLastChild == null) { bool flag = false; if (!base.IsHeaderLineTooLong(num, out flag)) { num += Header.WriteLines(base.Lines, stream); currentLineLength.SetAs(0); return(num); } } } if (!this.parsed) { this.Parse(); } MimeNode mimeNode = base.FirstChild; int num2 = 0; while (mimeNode != null) { if (1 < ++num2) { stream.Write(MimeString.Comma, 0, MimeString.Comma.Length); num += (long)MimeString.Comma.Length; currentLineLength.IncrementBy(MimeString.Comma.Length); } num += mimeNode.WriteTo(stream, encodingOptions, filter, ref currentLineLength, ref scratchBuffer); mimeNode = mimeNode.NextSibling; } return(num + Header.WriteLineEnd(stream, ref currentLineLength)); }
internal override long WriteTo(Stream stream, EncodingOptions encodingOptions, MimeOutputFilter filter, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer) { MimeNode nextSibling = base.NextSibling; MimeStringList displayNameToWrite = base.GetDisplayNameToWrite(encodingOptions); long num = 0L; if (displayNameToWrite.GetLength(4026531839U) != 0) { int num2 = 1; if (base.FirstChild == null) { num2++; } if (base.NextSibling != null) { num2++; } num += Header.QuoteAndFold(stream, displayNameToWrite, 4026531839U, base.IsQuotingRequired(displayNameToWrite, encodingOptions.AllowUTF8), true, encodingOptions.AllowUTF8, num2, ref currentLineLength, ref scratchBuffer); stream.Write(MimeString.Colon, 0, MimeString.Colon.Length); num += (long)MimeString.Colon.Length; currentLineLength.IncrementBy(MimeString.Colon.Length); } MimeNode mimeNode = base.FirstChild; int num3 = 0; while (mimeNode != null) { if (1 < ++num3) { stream.Write(MimeString.Comma, 0, MimeString.Comma.Length); num += (long)MimeString.Comma.Length; currentLineLength.IncrementBy(MimeString.Comma.Length); } num += mimeNode.WriteTo(stream, encodingOptions, filter, ref currentLineLength, ref scratchBuffer); mimeNode = mimeNode.NextSibling; } stream.Write(MimeString.Semicolon, 0, MimeString.Semicolon.Length); num += (long)MimeString.Semicolon.Length; currentLineLength.IncrementBy(MimeString.Semicolon.Length); return(num); }