コード例 #1
0
        public override RichText GetRichTextTooltip(IEntity entity)
        {
            var flags           = ConversionFlags.All & ~(ConversionFlags.ShowBody | ConversionFlags.PlaceReturnTypeAfterParameterList);
            var output          = new StringWriter();
            var decoratedWriter = new TextWriterTokenWriter(output);
            var writer          = new CSharpHighlightingTokenWriter(TokenWriter.InsertRequiredSpaces(decoratedWriter), locatable: decoratedWriter);

            new CSharpAmbience()
            {
                ConversionFlags = flags
            }.ConvertSymbol(entity, writer, new DecompilerSettings().CSharpFormattingOptions);
            return(new RichText(output.ToString(), writer.HighlightingModel));
        }
コード例 #2
0
ファイル: CSharpLanguage.cs プロジェクト: zarumaru/ILSpy
        void WriteCode(ITextOutput output, DecompilerSettings settings, SyntaxTree syntaxTree, IDecompilerTypeSystem typeSystem)
        {
            syntaxTree.AcceptVisitor(new InsertParenthesesVisitor {
                InsertParenthesesForReadability = true
            });
            output.IndentationString = settings.CSharpFormattingOptions.IndentationString;
            TokenWriter tokenWriter = new TextTokenWriter(output, settings, typeSystem);

            if (output is ISmartTextOutput highlightingOutput)
            {
                tokenWriter = new CSharpHighlightingTokenWriter(tokenWriter, highlightingOutput);
            }
            syntaxTree.AcceptVisitor(new CSharpOutputVisitor(tokenWriter, settings.CSharpFormattingOptions));
        }
コード例 #3
0
ファイル: CSharpLanguage.cs プロジェクト: AdamWhiteHat/ILSpy
        void WriteCode(ITextOutput output, DecompilerSettings settings, SyntaxTree syntaxTree, IDecompilerTypeSystem typeSystem)
        {
            syntaxTree.AcceptVisitor(new InsertParenthesesVisitor {
                InsertParenthesesForReadability = true
            });
            TokenWriter tokenWriter = new TextTokenWriter(output, settings, typeSystem)
            {
                FoldBraces = settings.FoldBraces, ExpandMemberDefinitions = settings.ExpandMemberDefinitions
            };

            if (output is ISmartTextOutput highlightingOutput)
            {
                tokenWriter = new CSharpHighlightingTokenWriter(tokenWriter, highlightingOutput);
            }
            syntaxTree.AcceptVisitor(new CSharpOutputVisitor(tokenWriter, settings.CSharpFormattingOptions));
        }