// Token: 0x06000256 RID: 598 RVA: 0x0000B710 File Offset: 0x00009910 private static void CalculateMethodAndChunkSize_Utf8(bool allowQEncoding, ByteEncoder.Tables.CharClasses unsafeCharClassesForQEncoding, Encoding encoding, string value, int valueOffset, int encodedWordSpace, out byte method, out int chunkSize) { int num = encodedWordSpace / 4 * 3; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = valueOffset; bool flag = false; bool flag2 = false; while (num6 != value.Length && (!flag || !flag2)) { int num7 = 1; int num8 = 1; int num9 = 1; char c = value[num6++]; if (MimeCommon.QEncodingRequired(c, unsafeCharClassesForQEncoding)) { if (c > '\u007f') { num9++; if (c > '߿') { num9++; if (MimeCommon.IsAnySurrogate(c) && MimeCommon.IsHighSurrogate(c) && num6 != value.Length && MimeCommon.IsLowSurrogate(value[num6])) { num6++; num7++; num9++; } } } num8 = num9 * 3; } flag = (flag || num5 + num9 > num); flag2 = (flag2 || num3 + num8 > encodedWordSpace); if (!flag) { num5 += num9; num4 += num7; } if (!flag2) { num3 += num8; num2 += num7; } } if (num2 >= num4 && num3 < num5 + 3) { chunkSize = num2; method = 81; return; } chunkSize = MimeCommon.AdjustChunkSize(encoding, num4, value, valueOffset, num); method = 66; }
// Token: 0x06000254 RID: 596 RVA: 0x0000B4B0 File Offset: 0x000096B0 private static void CalculateMethodAndChunkSize_Sbcs(bool allowQEncoding, ByteEncoder.Tables.CharClasses unsafeCharClassesForQEncoding, Encoding encoding, string value, int valueOffset, int encodedWordSpace, out byte method, out int chunkSize) { int num = encodedWordSpace / 4 * 3; int num2 = Math.Min(num, value.Length - valueOffset); if (num2 != value.Length - valueOffset && MimeCommon.IsHighSurrogate(value[valueOffset + num2 - 1]) && MimeCommon.IsLowSurrogate(value[valueOffset + num2])) { num2--; } int num3 = (num2 + 2) / 3 * 4; if (!allowQEncoding) { chunkSize = MimeCommon.AdjustChunkSize(encoding, num2, value, valueOffset, num); method = 66; return; } int num4 = 0; int num5 = 0; int num6 = valueOffset; while (num6 != value.Length && num5 < encodedWordSpace) { int num7 = 1; int num8 = 1; char ch = value[num6++]; if (MimeCommon.QEncodingRequired(ch, unsafeCharClassesForQEncoding)) { num8 = 3; if (MimeCommon.IsHighSurrogate(ch) && num6 != value.Length && MimeCommon.IsLowSurrogate(value[num6])) { num6++; num7++; num8 = 6; } } if (num5 + num8 > encodedWordSpace) { break; } num5 += num8; num4 += num7; if (num5 > num3 && num4 <= num2) { break; } } if (num4 >= num2 && num5 < num3 + 3) { chunkSize = num4; method = 81; return; } chunkSize = MimeCommon.AdjustChunkSize(encoding, num2, value, valueOffset, num); method = 66; }
// Token: 0x06000259 RID: 601 RVA: 0x0000B934 File Offset: 0x00009B34 private static void CalculateMethodAndChunkSize_Mbcs(bool allowQEncoding, ByteEncoder.Tables.CharClasses unsafeCharClassesForQEncoding, Encoding encoding, string value, int valueOffset, int encodedWordSpace, out byte method, out int chunkSize) { int num = encodedWordSpace / 4 * 3; chunkSize = Math.Min(num, value.Length - valueOffset); if (chunkSize < value.Length - valueOffset && MimeCommon.IsLowSurrogate(value[valueOffset + chunkSize]) && MimeCommon.IsHighSurrogate(value[valueOffset + chunkSize - 1])) { chunkSize--; } chunkSize = MimeCommon.AdjustChunkSize(encoding, chunkSize, value, valueOffset, num); method = 66; }