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); } AddXmlDocumentation(ref state, langSettings.Settings, astBuilder); astBuilder.GenerateCode(output); }
internal static void AddXmlDocumentation(ref BuilderState state, DecompilerSettings settings, AstBuilder astBuilder) { if (settings.ShowXmlDocumentation) { try { new AddXmlDocTransform(state.State.XmlDoc_StringBuilder).Run(astBuilder.SyntaxTree); } catch (XmlException ex) { string[] msg = (" Exception while reading XmlDoc: " + ex.ToString()).Split(newLineChars, StringSplitOptions.RemoveEmptyEntries); var insertionPoint = astBuilder.SyntaxTree.FirstChild; for (int i = 0; i < msg.Length; i++) { astBuilder.SyntaxTree.InsertChildBefore(insertionPoint, new Comment(msg[i], CommentType.Documentation), Roles.Comment); } } } }
BuilderState CreateAstBuilder(DecompilationContext ctx, DecompilerSettings settings, ModuleDef currentModule = null, TypeDef currentType = null, bool isSingleMember = false) { if (currentModule == null) { currentModule = currentType.Module; } if (isSingleMember) { settings = settings.Clone(); settings.UsingDeclarations = false; } var cache = ctx.GetOrCreate <BuilderCache>(); var state = new BuilderState(ctx, cache); state.AstBuilder.Context.CurrentModule = currentModule; state.AstBuilder.Context.CancellationToken = ctx.CancellationToken; state.AstBuilder.Context.CurrentType = currentType; state.AstBuilder.Context.Settings = settings; return(state); }
BuilderState CreateAstBuilder(DecompilationContext ctx, DecompilerSettings settings, ModuleDef currentModule = null, TypeDef currentType = null, bool isSingleMember = false) { if (currentModule == null) currentModule = currentType.Module; if (isSingleMember) { settings = settings.Clone(); settings.UsingDeclarations = false; } var cache = ctx.GetOrCreate<BuilderCache>(); var state = new BuilderState(ctx, cache); state.AstBuilder.Context.CurrentModule = currentModule; state.AstBuilder.Context.CancellationToken = ctx.CancellationToken; state.AstBuilder.Context.CurrentType = currentType; state.AstBuilder.Context.Settings = settings; return state; }
internal static void AddXmlDocumentation(ref BuilderState state, DecompilerSettings settings, AstBuilder astBuilder) { if (settings.ShowXmlDocumentation) { try { new AddXmlDocTransform(state.State.XmlDoc_StringBuilder).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 Comment(msg[i], CommentType.Documentation), Roles.Comment); } } }
void RunTransformsAndGenerateCode(ref BuilderState state, ITextOutput output, DecompilationContext ctx, IAstTransform additionalTransform = null) { var astBuilder = state.AstBuilder; astBuilder.RunTransformations(transformAbortCondition); if (additionalTransform != null) { additionalTransform.Run(astBuilder.SyntaxTree); } AddXmlDocumentation(ref state, langSettings.Settings, astBuilder); astBuilder.GenerateCode(output); }