// Token: 0x060004A4 RID: 1188 RVA: 0x0001A7C4 File Offset: 0x000189C4 public override string ToString() { int count = this.Count; if (count <= 1) { return(this.first.ToString()); } StringBuilder stringBuilder = ScratchPad.GetStringBuilder(this.Length); for (int i = 0; i < count; i++) { MimeString mimeString = this[i]; string value = ByteString.BytesToString(mimeString.Data, mimeString.Offset, mimeString.Length, true); stringBuilder.Append(value); } ScratchPad.ReleaseStringBuilder(); return(stringBuilder.ToString()); }
public bool TryDecodeValue(Charset defaultCharset, bool enableFallback, bool allowControlCharacters, bool enable2047, bool enableJisDetection, bool enableUtf8Detection, bool enableDbcsDetection, out string charsetName, out string cultureName, out EncodingScheme encodingScheme, out string value) { charsetName = null; cultureName = null; encodingScheme = EncodingScheme.None; value = null; StringBuilder stringBuilder = ScratchPad.GetStringBuilder(Math.Min(1024, this.iterator.TotalLength)); char[] array = null; byte[] array2 = null; ValuePosition currentPosition = this.iterator.CurrentPosition; bool flag = false; bool flag2 = false; if (defaultCharset != null && (enableJisDetection || enableUtf8Detection || (enableDbcsDetection && FeInboundCharsetDetector.IsSupportedFarEastCharset(defaultCharset)))) { defaultCharset = this.DetectValueCharset(defaultCharset, enableJisDetection, enableUtf8Detection, enableDbcsDetection, out encodingScheme); flag2 = true; } Decoder decoder = null; string text = null; if (!enable2047) { this.iterator.SkipToEof(); } else { string lastEncodedWordLanguage = null; Charset charset = null; Decoder decoder2 = null; bool flag3 = true; string text2; for (;;) { this.ParseRawFragment(ref flag); if (this.iterator.Eof) { goto IL_217; } ValuePosition currentPosition2 = this.iterator.CurrentPosition; string text3; byte bOrQ; ValuePosition encodedWordContentStart; ValuePosition encodedWordContentEnd; if (!this.ParseEncodedWord(text, lastEncodedWordLanguage, ref array2, out text2, out text3, out bOrQ, out encodedWordContentStart, out encodedWordContentEnd)) { flag = false; } else { if (text == null) { encodingScheme = EncodingScheme.Rfc2047; charsetName = text2; cultureName = text3; } text = text2; if (currentPosition != currentPosition2 && !flag) { if (!flag3) { this.FlushDecoder(decoder2, allowControlCharacters, ref array2, ref array, stringBuilder); flag3 = true; } if (decoder == null) { if (defaultCharset == null || !defaultCharset.IsAvailable) { if (!enableFallback) { break; } } else { decoder = defaultCharset.GetEncoding().GetDecoder(); } } if (decoder != null) { this.ConvertRawFragment(currentPosition, currentPosition2, decoder, allowControlCharacters, ref array, stringBuilder); } else { this.ZeroExpandFragment(currentPosition, currentPosition2, allowControlCharacters, stringBuilder); } } Charset charset2; if (!Charset.TryGetCharset(text2, out charset2)) { if (!flag3) { this.FlushDecoder(decoder2, allowControlCharacters, ref array2, ref array, stringBuilder); flag3 = true; } if (!enableFallback) { goto Block_19; } decoder2 = null; } else if (charset2 != charset) { if (!flag3) { this.FlushDecoder(decoder2, allowControlCharacters, ref array2, ref array, stringBuilder); flag3 = true; } if (!charset2.IsAvailable) { if (!enableFallback) { goto Block_23; } decoder2 = null; } else { decoder2 = charset2.GetEncoding().GetDecoder(); charset = charset2; } } if (decoder2 != null) { this.DecodeEncodedWord(bOrQ, decoder2, encodedWordContentStart, encodedWordContentEnd, allowControlCharacters, ref array2, ref array, stringBuilder); flag3 = false; } else { this.ZeroExpandFragment(currentPosition2, this.iterator.CurrentPosition, allowControlCharacters, stringBuilder); } currentPosition = this.iterator.CurrentPosition; flag = true; } } charsetName = ((defaultCharset == null) ? null : defaultCharset.Name); return(false); Block_19: charsetName = text2; return(false); Block_23: charsetName = text2; return(false); IL_217: if (!flag3) { this.FlushDecoder(decoder2, allowControlCharacters, ref array2, ref array, stringBuilder); } } if (currentPosition != this.iterator.CurrentPosition) { if (text == null) { if (flag2 && encodingScheme == EncodingScheme.None && defaultCharset != null && !defaultCharset.IsSevenBit && defaultCharset.AsciiSupport == CodePageAsciiSupport.Complete) { charsetName = Charset.ASCII.Name; } else { charsetName = ((defaultCharset == null) ? null : defaultCharset.Name); } } if (decoder == null) { if (defaultCharset == null || !defaultCharset.IsAvailable) { if (!enableFallback) { charsetName = ((defaultCharset == null) ? null : defaultCharset.Name); return(false); } decoder = null; } else { decoder = defaultCharset.GetEncoding().GetDecoder(); } } if (decoder != null) { this.ConvertRawFragment(currentPosition, this.iterator.CurrentPosition, decoder, allowControlCharacters, ref array, stringBuilder); } else { this.ZeroExpandFragment(currentPosition, this.iterator.CurrentPosition, allowControlCharacters, stringBuilder); } } ScratchPad.ReleaseStringBuilder(); value = stringBuilder.ToString(); return(true); }