예제 #1
0
        // Token: 0x06000469 RID: 1129 RVA: 0x000193E4 File Offset: 0x000175E4
        public static int FindNextOf(MimeScan.Token token, byte[] bytes, int start, int length, out int characterCount, bool allowUTF8)
        {
            int num  = start - 1;
            int num2 = start + length;

            characterCount = 0;
            while (++num < num2 && (short)(MimeScan.Dictionary[(int)bytes[num]] & token) == 0)
            {
                if (allowUTF8 && bytes[num] >= 128)
                {
                    int num3 = 0;
                    if (MimeScan.IsUTF8NonASCII(bytes, num, num2, out num3))
                    {
                        if ((short)((MimeScan.Token.Token | MimeScan.Token.Atom) & token) == 0)
                        {
                            num += num3 - 1;
                            characterCount++;
                            continue;
                        }
                        break;
                    }
                }
                characterCount++;
            }
            return(num - start);
        }
예제 #2
0
        // Token: 0x06000467 RID: 1127 RVA: 0x00019318 File Offset: 0x00017518
        public static int FindEndOf(MimeScan.Token token, byte[] bytes, int start, int length, out int characterCount, bool allowUTF8)
        {
            int num  = start - 1;
            int num2 = start + length;

            characterCount = 0;
            while (++num < num2)
            {
                if ((short)(MimeScan.Dictionary[(int)bytes[num]] & token) != 0)
                {
                    characterCount++;
                }
                else
                {
                    if (!allowUTF8 || bytes[num] < 128)
                    {
                        break;
                    }
                    int num3 = 0;
                    if (!MimeScan.IsUTF8NonASCII(bytes, num, num2, out num3) || (short)((MimeScan.Token.Token | MimeScan.Token.Atom) & token) == 0)
                    {
                        break;
                    }
                    num += num3 - 1;
                    characterCount++;
                }
            }
            return(num - start);
        }
예제 #3
0
        public MimeString ParseToken(MimeScan.Token token)
        {
            MimeStringList mimeStringList = default(MimeStringList);

            while (this.position != this.end || this.ParseNextLine())
            {
                int num  = 0;
                int num2 = MimeScan.FindEndOf(token, this.bytes, this.position, this.end - this.position, out num, this.allowUTF8);
                if (num2 == 0)
                {
                    break;
                }
                mimeStringList.AppendFragment(new MimeString(this.bytes, this.position, num2));
                this.position += num2;
            }
            if (mimeStringList.Count == 0)
            {
                return(default(MimeString));
            }
            if (mimeStringList.Count == 1)
            {
                return(mimeStringList[0]);
            }
            byte[] sz = mimeStringList.GetSz();
            return(new MimeString(sz, 0, sz.Length));
        }
예제 #4
0
        // Token: 0x06000468 RID: 1128 RVA: 0x00019388 File Offset: 0x00017588
        public static int FindEndOf(MimeScan.Token token, string value, int currentOffset, bool allowUTF8)
        {
            int num = currentOffset - 1;

            while (++num < value.Length && ((value[num] < '\u0080' && (short)(MimeScan.Dictionary[(int)value[num]] & token) != 0) || (allowUTF8 && value[num] >= '\u0080' && (short)((MimeScan.Token.Token | MimeScan.Token.Atom) & token) != 0)))
            {
            }
            return(num - currentOffset);
        }
예제 #5
0
        // Token: 0x0600046B RID: 1131 RVA: 0x00019474 File Offset: 0x00017674
        public static int SkipToLwspOrEquals(byte[] bytes, int start, int length)
        {
            int num  = start - 1;
            int num2 = start + length;

            while (++num < num2)
            {
                byte           b     = bytes[num];
                MimeScan.Token token = MimeScan.Dictionary[(int)b];
                if ((short)(token & (MimeScan.Token.TSpec | MimeScan.Token.Lwsp)) != 0 && ((short)(token & MimeScan.Token.Lwsp) != 0 || b == 61))
                {
                    break;
                }
            }
            return(num - start);
        }
예제 #6
0
 // Token: 0x0600046F RID: 1135 RVA: 0x000195A4 File Offset: 0x000177A4
 // Note: this type is marked as 'beforefieldinit'.
 static MimeScan()
 {
     MimeScan.Token[] array = new MimeScan.Token[256];
     array[0]            = MimeScan.Token.Ctl;
     array[1]            = MimeScan.Token.Ctl;
     array[2]            = MimeScan.Token.Ctl;
     array[3]            = MimeScan.Token.Ctl;
     array[4]            = MimeScan.Token.Ctl;
     array[5]            = MimeScan.Token.Ctl;
     array[6]            = MimeScan.Token.Ctl;
     array[7]            = MimeScan.Token.Ctl;
     array[8]            = MimeScan.Token.Ctl;
     array[9]            = (MimeScan.Token.Ctl | MimeScan.Token.Lwsp | MimeScan.Token.Fwsp);
     array[10]           = (MimeScan.Token.Ctl | MimeScan.Token.Lwsp);
     array[11]           = MimeScan.Token.Ctl;
     array[12]           = MimeScan.Token.Ctl;
     array[13]           = (MimeScan.Token.Ctl | MimeScan.Token.Lwsp);
     array[14]           = MimeScan.Token.Ctl;
     array[15]           = MimeScan.Token.Ctl;
     array[16]           = MimeScan.Token.Ctl;
     array[17]           = MimeScan.Token.Ctl;
     array[18]           = MimeScan.Token.Ctl;
     array[19]           = MimeScan.Token.Ctl;
     array[20]           = MimeScan.Token.Ctl;
     array[21]           = MimeScan.Token.Ctl;
     array[22]           = MimeScan.Token.Ctl;
     array[23]           = MimeScan.Token.Ctl;
     array[24]           = MimeScan.Token.Ctl;
     array[25]           = MimeScan.Token.Ctl;
     array[26]           = MimeScan.Token.Ctl;
     array[27]           = MimeScan.Token.Ctl;
     array[28]           = MimeScan.Token.Ctl;
     array[29]           = MimeScan.Token.Ctl;
     array[30]           = MimeScan.Token.Ctl;
     array[31]           = MimeScan.Token.Ctl;
     array[32]           = (MimeScan.Token.Lwsp | MimeScan.Token.BChar | MimeScan.Token.Fwsp);
     array[33]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[34]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.Field);
     array[35]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[36]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[37]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[38]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[39]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[40]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[41]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[42]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[43]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[44]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[45]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[46]           = (MimeScan.Token.Spec | MimeScan.Token.Token | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[47]           = (MimeScan.Token.TSpec | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[48]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Digit | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[49]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Digit | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[50]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Digit | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[51]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Digit | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[52]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Digit | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[53]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Digit | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[54]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Digit | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[55]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Digit | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[56]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Digit | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[57]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Digit | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[58]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.BChar);
     array[59]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.Field);
     array[60]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.Field);
     array[61]           = (MimeScan.Token.TSpec | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[62]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.Field);
     array[63]           = (MimeScan.Token.TSpec | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[64]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.Field);
     array[65]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[66]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[67]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[68]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[69]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[70]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[71]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[72]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[73]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[74]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[75]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[76]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[77]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[78]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[79]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[80]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[81]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[82]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[83]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[84]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[85]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[86]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[87]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[88]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[89]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[90]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[91]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.Field);
     array[92]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.Field);
     array[93]           = (MimeScan.Token.Spec | MimeScan.Token.TSpec | MimeScan.Token.Field);
     array[94]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[95]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field);
     array[96]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[97]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[98]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[99]           = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[100]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[101]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[102]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Hex | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[103]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[104]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[105]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[106]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[107]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[108]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[109]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[110]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[111]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[112]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[113]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[114]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[115]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[116]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[117]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[118]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[119]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[120]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[121]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[122]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.BChar | MimeScan.Token.Field | MimeScan.Token.Alpha);
     array[123]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[124]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[125]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[126]          = (MimeScan.Token.Token | MimeScan.Token.Atom | MimeScan.Token.Field);
     array[127]          = MimeScan.Token.Ctl;
     MimeScan.Dictionary = array;
 }
예제 #7
0
        internal static long QuoteAndFold(Stream stream, MimeStringList fragments, uint inputMask, bool quoteOutput, bool addSpaceAtStart, bool allowUTF8, int lastLineReserve, ref MimeStringLength currentLineLength, ref byte[] scratchBuffer)
        {
            long num = 0L;

            Header.LineBuffer lineBuffer = default(Header.LineBuffer);
            lineBuffer.Length             = new MimeStringLength(0);
            lineBuffer.LengthTillLastLWSP = new MimeStringLength(-1);
            if (scratchBuffer == null || scratchBuffer.Length < 998)
            {
                scratchBuffer = new byte[998];
            }
            lineBuffer.Bytes = scratchBuffer;
            MimeScan.Token token = quoteOutput ? (MimeScan.Token.Spec | MimeScan.Token.Fwsp) : MimeScan.Token.Fwsp;
            bool           flag  = false;

            if (addSpaceAtStart && currentLineLength.InBytes != 0)
            {
                num += Header.WriteToken(Header.Space, 0, new MimeStringLength(1), stream, ref currentLineLength, ref lineBuffer, ref flag, allowUTF8);
                flag = true;
            }
            if (quoteOutput)
            {
                num += Header.WriteToken(Header.DoubleQuote, 0, new MimeStringLength(1), stream, ref currentLineLength, ref lineBuffer, ref flag, allowUTF8);
            }
            for (int i = 0; i < fragments.Count; i++)
            {
                MimeString mimeString = fragments[i];
                int        num2       = 0;
                int        num3       = 0;
                byte[]     data       = mimeString.GetData(out num2, out num3);
                if ((mimeString.Mask & inputMask) != 0U)
                {
                    do
                    {
                        int valueInChars = 0;
                        int num4         = MimeScan.FindNextOf(token, data, num2, num3, out valueInChars, allowUTF8);
                        if (num4 > 0)
                        {
                            num  += Header.WriteToken(data, num2, new MimeStringLength(valueInChars, num4), stream, ref currentLineLength, ref lineBuffer, ref flag, allowUTF8);
                            num2 += num4;
                            num3 -= num4;
                        }
                        if (num3 != 0)
                        {
                            byte b = data[num2];
                            if ((b == 34 || b == 92) && (mimeString.Mask & 3758096383U) != 0U)
                            {
                                num += Header.WriteToken(new byte[]
                                {
                                    92,
                                    data[num2]
                                }, 0, new MimeStringLength(2), stream, ref currentLineLength, ref lineBuffer, ref flag, allowUTF8);
                                num2++;
                                num3--;
                            }
                            else
                            {
                                num += Header.WriteToken(new byte[]
                                {
                                    data[num2]
                                }, 0, new MimeStringLength(1), stream, ref currentLineLength, ref lineBuffer, ref flag, allowUTF8);
                                num2++;
                                num3--;
                            }
                        }
                    }while (num3 != 0);
                }
            }
            if (quoteOutput)
            {
                num += Header.WriteToken(Header.DoubleQuote, 0, new MimeStringLength(1), stream, ref currentLineLength, ref lineBuffer, ref flag, allowUTF8);
            }
            if (lastLineReserve > 0)
            {
                num += Header.WriteToken(null, 0, new MimeStringLength(lastLineReserve), stream, ref currentLineLength, ref lineBuffer, ref flag, allowUTF8);
            }
            if (lineBuffer.Length.InBytes > 0)
            {
                stream.Write(lineBuffer.Bytes, 0, lineBuffer.Length.InBytes);
                num += (long)lineBuffer.Length.InBytes;
                currentLineLength.IncrementBy(lineBuffer.Length);
            }
            return(num);
        }