public static void XmbToXml(IO.EndianStream xmbStream, System.IO.Stream outputStream, Shell.ProcessorSize vaSize) { byte[] xmbBytes; using (var xmb = new ECF.EcfFileXmb()) { xmb.Serialize(xmbStream); xmbBytes = xmb.FileData; } var context = new Xmb.XmbFileContext() { PointerSize = vaSize, }; using (var ms = new System.IO.MemoryStream(xmbBytes, false)) using (var s = new IO.EndianReader(ms, xmbStream.ByteOrder)) { s.UserData = context; using (var xmbf = new Phoenix.Xmb.XmbFile()) { xmbf.Read(s); xmbf.ToXml(outputStream); } } }
private void TransformXmbToXml(byte[] eraFileEntryBuffer, string fullPath, Shell.EndianFormat byteOrder, Shell.ProcessorSize vaSize) { byte[] xmb_buffer; using (var xmb = new ECF.EcfFileXmb()) using (var ms = new System.IO.MemoryStream(eraFileEntryBuffer)) using (var es = new IO.EndianStream(ms, byteOrder, permissions: System.IO.FileAccess.Read)) { es.StreamMode = System.IO.FileAccess.Read; xmb.Serialize(es); xmb_buffer = xmb.FileData; } string xmb_path = fullPath; ResourceUtils.RemoveXmbExtension(ref xmb_path); var context = new Xmb.XmbFileContext() { PointerSize = vaSize, }; using (var ms = new System.IO.MemoryStream(xmb_buffer, false)) using (var s = new IO.EndianReader(ms, byteOrder)) { s.UserData = context; using (var xmbf = new Phoenix.Xmb.XmbFile()) { xmbf.Read(s); xmbf.ToXml(xmb_path); } } }