public XDocument Decompile(ModuleDef module, BamlDocument document, CancellationToken token) { var ctx = XamlContext.Construct(module, document, token); var handler = HandlerMap.LookupHandler(ctx.RootNode.Type); var elem = handler.Translate(ctx, ctx.RootNode, null); var xaml = new XDocument(); xaml.Add(elem.Xaml.Element); foreach (var pass in rewritePasses) { token.ThrowIfCancellationRequested(); pass.Run(ctx, xaml); } return(xaml); }
public XDocument Decompile(ModuleDef module, BamlDocument document, CancellationToken token, BamlDecompilerOptions bamlDecompilerOptions, List <string> assemblyReferences) { var ctx = XamlContext.Construct(module, document, token, bamlDecompilerOptions); var handler = HandlerMap.LookupHandler(ctx.RootNode.Type); var elem = handler.Translate(ctx, ctx.RootNode, null); var xaml = new XDocument(); xaml.Add(elem.Xaml.Element); foreach (var pass in rewritePasses) { token.ThrowIfCancellationRequested(); pass.Run(ctx, xaml); } if (assemblyReferences is not null) { assemblyReferences.AddRange(ctx.Baml.AssemblyIdMap.Select(a => a.Value.AssemblyFullName)); } return(xaml); }