Example #1
0
        void RunTransformsAndGenerateCode(AstBuilder astBuilder, ITextOutput output, DecompilationOptions options, ModuleDefinition module)
        {
            astBuilder.RunTransformations(transformAbortCondition);
            if (options.DecompilerSettings.ShowXmlDocumentation)
            {
                try {
                    AddXmlDocTransform.Run(astBuilder.SyntaxTree);
                } catch (XmlException ex) {
                    string[] msg            = (" Exception while reading XmlDoc: " + ex.ToString()).Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                    var      insertionPoint = astBuilder.SyntaxTree.FirstChild;
                    for (int i = 0; i < msg.Length; i++)
                    {
                        astBuilder.SyntaxTree.InsertChildBefore(insertionPoint, new CSharp.Comment(msg[i], CSharp.CommentType.Documentation), CSharp.Roles.Comment);
                    }
                }
            }
            var csharpUnit = astBuilder.SyntaxTree;

            csharpUnit.AcceptVisitor(new NRefactory.CSharp.InsertParenthesesVisitor()
            {
                InsertParenthesesForReadability = true
            });
            var unit             = csharpUnit.AcceptVisitor(new CSharpToVBConverterVisitor(new ILSpyEnvironmentProvider()), null);
            var outputFormatter  = new VBTextOutputFormatter(output);
            var formattingPolicy = new VBFormattingOptions();

            unit.AcceptVisitor(new OutputVisitor(outputFormatter, formattingPolicy), null);
        }
Example #2
0
        void RunTransformsAndGenerateCode(AstBuilder astBuilder, ITextOutput output, DecompilationOptions options, ModuleDefinition module)
        {
            astBuilder.RunTransformations(transformAbortCondition);
            if (options.DecompilerSettings.ShowXmlDocumentation)
            {
                AddXmlDocTransform.Run(astBuilder.CompilationUnit);
            }
            var unit             = astBuilder.CompilationUnit.AcceptVisitor(new CSharpToVBConverterVisitor(new ILSpyEnvironmentProvider(CreateResolveContext(module))), null);
            var outputFormatter  = new VBTextOutputFormatter(output);
            var formattingPolicy = new VBFormattingOptions();

            unit.AcceptVisitor(new OutputVisitor(outputFormatter, formattingPolicy), null);
        }
Example #3
0
        void RunTransformsAndGenerateCode(AstBuilder astBuilder, ITextOutput output, DecompilationOptions options, ModuleDefinition module)
        {
            astBuilder.RunTransformations(transformAbortCondition);
            //if (options.DecompilerSettings.ShowXmlDocumentation)
            //	AddXmlDocTransform.Run(astBuilder.CompilationUnit);
            var csharpUnit = astBuilder.SyntaxTree;

            csharpUnit.AcceptVisitor(new NRefactory.CSharp.InsertParenthesesVisitor()
            {
                InsertParenthesesForReadability = true
            });
            var unit             = csharpUnit.AcceptVisitor(new CSharpToVBConverterVisitor(new ILSpyEnvironmentProvider()), null);
            var outputFormatter  = new VBTextOutputFormatter(output);
            var formattingPolicy = new VBFormattingOptions();

            unit.AcceptVisitor(new OutputVisitor(outputFormatter, formattingPolicy), null);
        }
Example #4
0
        void RunTransformsAndGenerateCode(AstBuilder astBuilder, ITextOutput output, DecompilationContext ctx, IAstTransform additionalTransform = null)
        {
            astBuilder.RunTransformations(transformAbortCondition);
            if (additionalTransform != null)
            {
                additionalTransform.Run(astBuilder.SyntaxTree);
            }
            CSharpLanguage.AddXmlDocumentation(langSettings.Settings, astBuilder);
            var csharpUnit = astBuilder.SyntaxTree;

            csharpUnit.AcceptVisitor(new ICSharpCode.NRefactory.CSharp.InsertParenthesesVisitor()
            {
                InsertParenthesesForReadability = true
            });
            var unit             = csharpUnit.AcceptVisitor(new CSharpToVBConverterVisitor(new ILSpyEnvironmentProvider()), null);
            var outputFormatter  = new VBTextOutputFormatter(output);
            var formattingPolicy = new VBFormattingOptions();

            unit.AcceptVisitor(new OutputVisitor(outputFormatter, formattingPolicy), null);
        }
Example #5
0
        void RunTransformsAndGenerateCode(ref BuilderState state, IDecompilerOutput output, DecompilationContext ctx, IAstTransform additionalTransform = null)
        {
            var astBuilder = state.AstBuilder;

            astBuilder.RunTransformations(transformAbortCondition);
            if (additionalTransform != null)
            {
                additionalTransform.Run(astBuilder.SyntaxTree);
            }
            CSharpDecompiler.AddXmlDocumentation(ref state, GetDecompilerSettings(), astBuilder);
            var csharpUnit = astBuilder.SyntaxTree;

            csharpUnit.AcceptVisitor(new ICSharpCode.NRefactory.CSharp.InsertParenthesesVisitor()
            {
                InsertParenthesesForReadability = true
            });
            var unit             = csharpUnit.AcceptVisitor(new CSharpToVBConverterVisitor(state.AstBuilder.Context.CurrentModule, new ILSpyEnvironmentProvider(state.State.XmlDoc_StringBuilder)), null);
            var outputFormatter  = new VBTextOutputFormatter(output, astBuilder.Context);
            var formattingPolicy = new VBFormattingOptions();

            unit.AcceptVisitor(new OutputVisitor(outputFormatter, formattingPolicy), null);
        }