Esempio n. 1
0
        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 != null)
            {
                assemblyReferences.AddRange(ctx.Baml.AssemblyIdMap.Select(a => a.Value.AssemblyFullName));
            }

            return(xaml);
        }