コード例 #1
0
        // Token: 0x06000249 RID: 585 RVA: 0x0000A614 File Offset: 0x00008814
        public AddressParserResult ParseNextMailbox(ref MimeStringList displayName, ref MimeStringList address)
        {
            AddressParserResult result = this.groupInProgress ? AddressParserResult.GroupInProgress : AddressParserResult.Mailbox;

            MimeAddressParser.ParserStage parserStage = MimeAddressParser.ParserStage.BEGIN;
            MimeStringList mimeStringList             = default(MimeStringList);
            MimeStringList mimeStringList2            = default(MimeStringList);
            MimeStringList mimeStringList3            = default(MimeStringList);
            bool           flag           = true;
            bool           flag2          = false;
            bool           ignoreNextByte = false;

            if (!this.parserInit)
            {
                throw new InvalidOperationException(Strings.AddressParserNotInitialized);
            }
            for (;;)
            {
                if (this.valueParser.ParseToDelimiter(ignoreNextByte, !flag && flag2, ref mimeStringList))
                {
                    flag2          = false;
                    ignoreNextByte = false;
                    flag           = false;
                }
                byte b  = this.valueParser.ParseGet();
                byte b2 = b;
                if (b2 <= 34)
                {
                    if (b2 != 0)
                    {
                        switch (b2)
                        {
                        case 9:
                        case 10:
                        case 13:
                            break;

                        case 11:
                        case 12:
                            goto IL_200;

                        default:
                            switch (b2)
                            {
                            case 32:
                                break;

                            case 33:
                                goto IL_200;

                            case 34:
                                this.valueParser.ParseUnget();
                                if (mimeStringList.Length != 0 && !flag)
                                {
                                    this.valueParser.ParseAppendSpace(ref mimeStringList);
                                }
                                else
                                {
                                    flag = false;
                                }
                                this.valueParser.ParseQString(true, ref mimeStringList, true);
                                flag2 = true;
                                continue;

                            default:
                                goto IL_200;
                            }
                            break;
                        }
                        this.valueParser.ParseWhitespace(false, ref mimeStringList3);
                        flag2 = true;
                        continue;
                    }
                    goto IL_213;
                }
                else if (b2 <= 46)
                {
                    if (b2 == 40)
                    {
                        if (mimeStringList2.Length != 0)
                        {
                            mimeStringList2.Reset();
                        }
                        this.valueParser.ParseUnget();
                        if (this.ignoreComments)
                        {
                            this.valueParser.ParseComment(true, false, ref mimeStringList2, true);
                            if (flag2)
                            {
                                mimeStringList.AppendFragment(new MimeString(" "));
                            }
                            mimeStringList.TakeOverAppend(ref mimeStringList2);
                        }
                        else
                        {
                            this.valueParser.ParseComment(true, true, ref mimeStringList2, true);
                        }
                        flag2 = true;
                        continue;
                    }
                    switch (b2)
                    {
                    case 44:
                        goto IL_213;

                    case 46:
                        this.valueParser.ParseAppendLastByte(ref mimeStringList);
                        flag = true;
                        continue;
                    }
                }
                else
                {
                    switch (b2)
                    {
                    case 58:
                    case 59:
                    case 60:
                    case 62:
                    case 64:
                        goto IL_213;

                    case 61:
                    case 63:
                        break;

                    default:
                        switch (b2)
                        {
                        case 91:
                        case 93:
                            goto IL_213;
                        }
                        break;
                    }
                }
IL_200:
                this.valueParser.ParseUnget();
                ignoreNextByte = true;
                continue;
IL_213:
                switch (parserStage)
                {
                case MimeAddressParser.ParserStage.BEGIN:
                {
                    byte b3 = b;
                    if (b3 > 44)
                    {
                        switch (b3)
                        {
                        case 58:
                            if (mimeStringList.GetLength(4026531839U) != 0)
                            {
                                goto Block_26;
                            }
                            continue;

                        case 59:
                            this.groupInProgress = false;
                            result = AddressParserResult.Mailbox;
                            goto IL_28D;

                        case 60:
                            break;

                        case 61:
                        case 63:
                            goto IL_33D;

                        case 62:
                            mimeStringList.Reset();
                            continue;

                        case 64:
                        {
                            int length = mimeStringList.Length;
                            this.valueParser.ParseAppendLastByte(ref mimeStringList);
                            address.TakeOver(ref mimeStringList);
                            parserStage = MimeAddressParser.ParserStage.ADDRSPEC;
                            continue;
                        }

                        default:
                            if (b3 != 91)
                            {
                                goto IL_33D;
                            }
                            if (!this.useSquareBrackets)
                            {
                                this.valueParser.ParseUnget();
                                ignoreNextByte = true;
                                continue;
                            }
                            break;
                        }
                        displayName.TakeOver(ref mimeStringList);
                        parserStage = MimeAddressParser.ParserStage.ANGLEADDR;
                        continue;
                    }
                    if (b3 == 0)
                    {
                        goto IL_330;
                    }
                    if (b3 != 44)
                    {
                        goto IL_33D;
                    }
IL_28D:
                    if (mimeStringList.GetLength(4026531839U) != 0)
                    {
                        goto Block_25;
                    }
                    mimeStringList.Reset();
                    continue;
IL_33D:
                    this.valueParser.ParseUnget();
                    ignoreNextByte = true;
                    continue;
                }

                case MimeAddressParser.ParserStage.ANGLEADDR:
                {
                    byte b4 = b;
                    if (b4 <= 44)
                    {
                        if (b4 == 0)
                        {
                            goto IL_478;
                        }
                        if (b4 == 44)
                        {
                            if (displayName.Length != 0 || mimeStringList.Length != 0)
                            {
                                goto IL_478;
                            }
                            continue;
                        }
                    }
                    else
                    {
                        switch (b4)
                        {
                        case 58:
                            mimeStringList.Reset();
                            continue;

                        case 59:
                        case 61:
                        case 63:
                            goto IL_485;

                        case 60:
                            break;

                        case 62:
                            goto IL_432;

                        case 64:
                            if (mimeStringList.Length == 0)
                            {
                                parserStage = MimeAddressParser.ParserStage.ROUTEDOMAIN;
                                continue;
                            }
                            this.valueParser.ParseAppendLastByte(ref mimeStringList);
                            address.TakeOver(ref mimeStringList);
                            parserStage = MimeAddressParser.ParserStage.ADDRSPEC;
                            continue;

                        default:
                            switch (b4)
                            {
                            case 91:
                                if (!this.useSquareBrackets)
                                {
                                    this.valueParser.ParseUnget();
                                    ignoreNextByte = true;
                                    continue;
                                }
                                break;

                            case 92:
                                goto IL_485;

                            case 93:
                                if (!this.useSquareBrackets)
                                {
                                    this.valueParser.ParseUnget();
                                    ignoreNextByte = true;
                                    continue;
                                }
                                goto IL_432;

                            default:
                                goto IL_485;
                            }
                            break;
                        }
                        if (mimeStringList.Length != 0)
                        {
                            this.valueParser.ParseUnget();
                            ignoreNextByte = true;
                            continue;
                        }
                        continue;
IL_432:
                        address.TakeOver(ref mimeStringList);
                        if (address.Length != 0 || displayName.Length != 0)
                        {
                            parserStage = MimeAddressParser.ParserStage.END;
                            continue;
                        }
                        parserStage = MimeAddressParser.ParserStage.BEGIN;
                        continue;
                    }
IL_485:
                    this.valueParser.ParseUnget();
                    ignoreNextByte = true;
                    continue;
                }

                case MimeAddressParser.ParserStage.ADDRSPEC:
                {
                    byte b5 = b;
                    if (b5 > 44)
                    {
                        switch (b5)
                        {
                        case 59:
                            this.groupInProgress = false;
                            goto IL_58B;

                        case 60:
                            if (displayName.Length == 0)
                            {
                                displayName.TakeOverAppend(ref address);
                                parserStage = MimeAddressParser.ParserStage.ANGLEADDR;
                                continue;
                            }
                            this.valueParser.ParseUnget();
                            ignoreNextByte = true;
                            continue;

                        case 61:
                            goto IL_5B5;

                        case 62:
                            break;

                        default:
                            switch (b5)
                            {
                            case 91:
                                if (mimeStringList.Length == 0)
                                {
                                    this.valueParser.ParseUnget();
                                    this.valueParser.ParseDomainLiteral(true, ref mimeStringList);
                                    address.TakeOverAppend(ref mimeStringList);
                                    parserStage = MimeAddressParser.ParserStage.END;
                                    continue;
                                }
                                this.valueParser.ParseUnget();
                                ignoreNextByte = true;
                                continue;

                            case 92:
                                goto IL_5B5;

                            case 93:
                                if (!this.useSquareBrackets)
                                {
                                    this.valueParser.ParseUnget();
                                    ignoreNextByte = true;
                                    continue;
                                }
                                break;

                            default:
                                goto IL_5B5;
                            }
                            break;
                        }
                        address.TakeOverAppend(ref mimeStringList);
                        parserStage = MimeAddressParser.ParserStage.END;
                        continue;
                    }
                    if (b5 != 0 && b5 != 44)
                    {
                        goto IL_5B5;
                    }
IL_58B:
                    address.TakeOverAppend(ref mimeStringList);
                    if (address.Length == 0 && displayName.Length == 0 && b != 0)
                    {
                        continue;
                    }
                    break;
IL_5B5:
                    this.valueParser.ParseUnget();
                    ignoreNextByte = true;
                    continue;
                }

                case MimeAddressParser.ParserStage.ROUTEDOMAIN:
                {
                    byte b6 = b;
                    if (b6 <= 44)
                    {
                        if (b6 == 0)
                        {
                            break;
                        }
                        if (b6 != 44)
                        {
                            goto IL_665;
                        }
                    }
                    else if (b6 != 58)
                    {
                        if (b6 != 62)
                        {
                            switch (b6)
                            {
                            case 91:
                                mimeStringList.Reset();
                                this.valueParser.ParseUnget();
                                this.valueParser.ParseDomainLiteral(false, ref mimeStringList3);
                                continue;

                            case 92:
                                goto IL_665;

                            case 93:
                                if (!this.useSquareBrackets)
                                {
                                    this.valueParser.ParseUnget();
                                    ignoreNextByte = true;
                                    continue;
                                }
                                break;

                            default:
                                goto IL_665;
                            }
                        }
                        mimeStringList.Reset();
                        parserStage = MimeAddressParser.ParserStage.END;
                        continue;
                    }
                    mimeStringList.Reset();
                    parserStage = MimeAddressParser.ParserStage.ANGLEADDR;
                    continue;
IL_665:
                    this.valueParser.ParseUnget();
                    ignoreNextByte = true;
                    continue;
                }

                case MimeAddressParser.ParserStage.END:
                {
                    mimeStringList.Reset();
                    byte b7 = b;
                    if (b7 != 0 && b7 != 44)
                    {
                        if (b7 != 59)
                        {
                            continue;
                        }
                        this.groupInProgress = false;
                    }
                    if (address.Length == 0 && displayName.Length == 0 && b != 0)
                    {
                        parserStage = MimeAddressParser.ParserStage.BEGIN;
                        continue;
                    }
                    break;
                }
                }
                break;
            }
            goto IL_6B9;
Block_25:
            displayName.TakeOver(ref mimeStringList);
            goto IL_6B9;
Block_26:
            displayName.TakeOver(ref mimeStringList);
            this.groupInProgress = true;
            return(AddressParserResult.GroupStart);

IL_330:
            displayName.TakeOver(ref mimeStringList);
            goto IL_6B9;
IL_478:
            address.TakeOver(ref mimeStringList);
IL_6B9:
            if (displayName.Length == 0 && mimeStringList2.Length != 0 && address.Length != 0)
            {
                displayName.TakeOver(ref mimeStringList2);
            }
            if (address.Length == 0 && displayName.Length == 0)
            {
                result = AddressParserResult.End;
            }
            return(result);
        }