for decompiling and compiling versioned XBF documents.
It supports XBF1 and XBF2/XBF2.1 documents, including the WUX and MUX dialects where applicable. The library exposes a semantic XAML object model so a document can be decompiled, edited, and recompiled.
XbfKit is used in a PRI file viewer, MrmTool, by @ahmed505.
> dotnet add package XbfKitFor a real file-to-file conversion, use the overload that accepts
XbfCompilationOptions and the decompilation formatting options:
using XbfKit;
const string inputPath = "Page.xaml";
const string xbfPath = "Page.xbf";
const string outputPath = "Page.decompiled.xaml";
using FileStream output = File.Create(xbfPath);
XbfCompiler.Compile(File.ReadAllText(inputPath), output, new XbfCompilationOptions());
using FileStream input = File.OpenRead(xbfPath);
var decompiled = XbfDecompiler.Decompile(input, XbfDialect.WUX, XbfDecompilationOptions());
File.WriteAllText(outputPath, decompiled);To access the validated in-memory representation directly, use the reader and
writer in XbfKit.IO:
using XbfKit;
using XbfKit.IO;
using FileStream input = File.OpenRead("Page.xbf");
var document = XbfDocumentReader.Read(input);
using FileStream output = File.Create("Page.copy.xbf");
XbfDocumentWriter.Write(document, output);The supported format and dialect combinations are:
- XBF1 with
XbfDialect.WUX - XBF2 or XBF2.1 with
XbfDialect.WUXorXbfDialect.MUX
WUX refers to Windows.UI.Xaml; MUX refers to Microsoft.UI.Xaml.
The dialect must be supplied when decompiling because XBF2 does not retain
enough information to distinguish those trusted framework schemas.