예제 #1
0
        // Token: 0x06001A06 RID: 6662 RVA: 0x000CE368 File Offset: 0x000CC568
        public void Run()
        {
            if (this.endOfFile)
            {
                return;
            }
            char[] buffer = null;
            int    num    = 0;
            int    num2   = 0;
            int    num3   = 0;

            if (!this.input.ReadMore(ref buffer, ref num, ref num2, ref num3))
            {
                return;
            }
            if (this.input.EndOfFile)
            {
                this.endOfFile = true;
            }
            if (num3 - num != 0)
            {
                if (!this.gotAnyText)
                {
                    if (this.output is ConverterEncodingOutput)
                    {
                        ConverterEncodingOutput converterEncodingOutput = this.output as ConverterEncodingOutput;
                        if (converterEncodingOutput.CodePageSameAsInput)
                        {
                            if (this.input is ConverterDecodingInput)
                            {
                                converterEncodingOutput.Encoding = (this.input as ConverterDecodingInput).Encoding;
                            }
                            else
                            {
                                converterEncodingOutput.Encoding = Encoding.UTF8;
                            }
                        }
                    }
                    this.gotAnyText = true;
                }
                this.output.Write(buffer, num, num3 - num);
                this.input.ReportProcessed(num3 - num);
            }
            if (this.endOfFile)
            {
                this.output.Flush();
            }
        }
예제 #2
0
        // Token: 0x060013C5 RID: 5061 RVA: 0x0008BA64 File Offset: 0x00089C64
        private void Process(HtmlTokenId tokenId)
        {
            HtmlToken token = this.parser.Token;

            switch (tokenId)
            {
            case HtmlTokenId.EndOfFile:
                this.output.Write("\r\n");
                this.output.Flush();
                this.endOfFile = true;
                break;

            case HtmlTokenId.Text:
                if (!this.insideComment)
                {
                    token.Text.WriteToAndCollapseWhitespace(this.output, ref this.collapseWhitespaceState);
                    return;
                }
                break;

            case HtmlTokenId.EncodingChange:
            {
                ConverterEncodingOutput converterEncodingOutput = this.output as ConverterEncodingOutput;
                if (converterEncodingOutput != null && converterEncodingOutput.CodePageSameAsInput)
                {
                    converterEncodingOutput.Encoding = token.TokenEncoding;
                    return;
                }
                break;
            }

            case HtmlTokenId.Tag:
            {
                if (token.IsTagBegin)
                {
                    switch (token.TagIndex)
                    {
                    case HtmlTagIndex.A:
                        if (!token.IsEndTag)
                        {
                        }
                        break;

                    case HtmlTagIndex.Address:
                    case HtmlTagIndex.BlockQuote:
                    case HtmlTagIndex.BR:
                    case HtmlTagIndex.Caption:
                    case HtmlTagIndex.Center:
                    case HtmlTagIndex.Col:
                    case HtmlTagIndex.ColGroup:
                    case HtmlTagIndex.DD:
                    case HtmlTagIndex.Dir:
                    case HtmlTagIndex.Div:
                    case HtmlTagIndex.DL:
                    case HtmlTagIndex.DT:
                    case HtmlTagIndex.FieldSet:
                    case HtmlTagIndex.Form:
                    case HtmlTagIndex.H1:
                    case HtmlTagIndex.H2:
                    case HtmlTagIndex.H3:
                    case HtmlTagIndex.H4:
                    case HtmlTagIndex.H5:
                    case HtmlTagIndex.H6:
                    case HtmlTagIndex.HR:
                    case HtmlTagIndex.LI:
                    case HtmlTagIndex.Listing:
                    case HtmlTagIndex.Map:
                    case HtmlTagIndex.Marquee:
                    case HtmlTagIndex.Menu:
                    case HtmlTagIndex.OL:
                    case HtmlTagIndex.OptGroup:
                    case HtmlTagIndex.Option:
                    case HtmlTagIndex.P:
                    case HtmlTagIndex.PlainText:
                    case HtmlTagIndex.Pre:
                    case HtmlTagIndex.Select:
                    case HtmlTagIndex.Table:
                    case HtmlTagIndex.Tbody:
                    case HtmlTagIndex.TC:
                    case HtmlTagIndex.Tfoot:
                    case HtmlTagIndex.Thead:
                    case HtmlTagIndex.TR:
                    case HtmlTagIndex.UL:
                        this.collapseWhitespaceState = CollapseWhitespaceState.NewLine;
                        break;

                    case HtmlTagIndex.Comment:
                    case HtmlTagIndex.Script:
                    case HtmlTagIndex.Style:
                        this.insideComment = !token.IsEndTag;
                        break;

                    case HtmlTagIndex.NoEmbed:
                    case HtmlTagIndex.NoFrames:
                        this.insideComment = !token.IsEndTag;
                        break;

                    case HtmlTagIndex.TD:
                    case HtmlTagIndex.TH:
                        if (!token.IsEndTag)
                        {
                            this.output.Write("\t");
                        }
                        break;
                    }
                }
                HtmlTagIndex tagIndex = token.TagIndex;
                if (tagIndex != HtmlTagIndex.A)
                {
                    if (tagIndex != HtmlTagIndex.Area)
                    {
                        switch (tagIndex)
                        {
                        case HtmlTagIndex.Image:
                        case HtmlTagIndex.Img:
                            if (!token.IsEndTag)
                            {
                                return;
                            }
                            break;

                        default:
                            return;
                        }
                    }
                    else if (!token.IsEndTag)
                    {
                        return;
                    }
                }
                else if (!token.IsEndTag)
                {
                    return;
                }
                break;
            }

            case HtmlTokenId.Restart:
            case HtmlTokenId.OverlappedClose:
            case HtmlTokenId.OverlappedReopen:
                break;

            default:
                return;
            }
        }