diff --git a/UIXC/Properties/launchSettings.json b/UIXC/Properties/launchSettings.json index 2a51a7f..6227e60 100644 --- a/UIXC/Properties/launchSettings.json +++ b/UIXC/Properties/launchSettings.json @@ -3,7 +3,7 @@ "UIXC": { "commandName": "Project", - "commandLineArgs": "decompile E:\\Repos\\ZuneDev\\ZuneUIXTools\\test\\ABOUTDIALOG.31_48.UIB -l xml -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o E:\\Repos\\ZuneDev\\ZuneUIXTools\\test", + "commandLineArgs": "decompile E:\\Repos\\ZuneDev\\ZuneUIXTools\\test\\ADDTOCOLLECTION.31_48.UIB -l xml -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o E:\\Repos\\ZuneDev\\ZuneUIXTools\\test", //"commandLineArgs": "compile E:\\Repos\\ZuneDev\\ZuneUIXTools\\test\\ADDTOCOLLECTION.31_48.UIX -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o E:\\Repos\\ZuneDev\\ZuneUIXTools\\test", //"commandLineArgs": "decompile E:\\Documents\\REProj\\Zune\\Resources\\ZuneShellResources48\\ABOUTDIALOG.UIX -l xml -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o E:\\Documents\\REProj\\Zune\\Resources\\ZuneShellResources48_xml -t E:\\Documents\\REProj\\Zune\\Resources\\ZuneShellResources48\\_DATATABLE.uib", diff --git a/libs/UIX.DecompXml/Decompiler.cs b/libs/UIX.DecompXml/Decompiler.cs index 71da296..9ec11b2 100644 --- a/libs/UIX.DecompXml/Decompiler.cs +++ b/libs/UIX.DecompXml/Decompiler.cs @@ -40,14 +40,14 @@ public partial class Decompiler foreach (var export in _context.LoadResult.ExportTable.Cast()) { var name = export.Name; - + XElement xExport = new(_nsUix + export.MarkupType.ToString(), new XAttribute("Name", name)); var baseType = export.MarkupTypeBase; if (baseType is not null) { - var baseTypeName = _context.GetQualifiedName(baseType); + var baseTypeName = _context.GetQualifiedName(baseType); xExport.SetAttributeValue("Base", baseTypeName); } @@ -189,10 +189,13 @@ public partial class Decompiler var key = _context.GetConstant(keyReference).Value.ToString(); var dictValue = stack.Pop(); + var dictValueType = initType.InheritableSymbolsTable? + .FirstOrDefault(s => s.Name == key)? + .Type; var targetInstance = (XElement)stack.Peek(); - PropertyDictionaryAddOnXElement(targetInstance, targetDictProperty, IrisObject.Create(dictValue, null, _context), key); + PropertyDictionaryAddOnXElement(targetInstance, targetDictProperty, IrisObject.Create(dictValue, dictValueType, _context), key); break; case OpCode.PropertyListAdd: @@ -226,7 +229,7 @@ public partial class Decompiler return elem; } - private object ToXmlFriendlyObject(object obj, TypeSchema type = null) + private object ToXmlFriendlyObject(object obj) { if (obj is Disassembler.RawConstantInfo rci) { @@ -279,7 +282,7 @@ public partial class Decompiler private XObject PropertyAssignOnXElement(XElement xTarget, PropertySchema property, IrisObject value) { - object xfValue = ToXmlFriendlyObject(value.Object, value.Type); + object xfValue = ToXmlFriendlyObject(value); switch (xfValue) { @@ -300,13 +303,9 @@ public partial class Decompiler private XElement PropertyListAddOnXElement(XElement xTarget, PropertySchema property, IrisObject value) { - var xDictionary = GetOrCreateElement(xTarget, _nsUix + property.Name); - return PropertyListAddOnXElement(xDictionary, value); - } + var xList = GetOrCreateElement(xTarget, _nsUix + property.Name); - private XElement PropertyListAddOnXElement(XElement xList, IrisObject value) - { - object xValue = ToXmlFriendlyObject(value.Object, value.Type); + object xValue = ToXmlFriendlyObject(value); XElement xListEntry; @@ -330,13 +329,7 @@ public partial class Decompiler private XElement PropertyDictionaryAddOnXElement(XElement xTarget, PropertySchema property, IrisObject value, string key) { - var xDictionary = GetOrCreateElement(xTarget, _nsUix + property.Name); - return PropertyDictionaryAddOnXElement(xDictionary, value, key); - } - - private XElement PropertyDictionaryAddOnXElement(XElement xDictionary, IrisObject value, string key) - { - var xDictionaryEntry = PropertyListAddOnXElement(xDictionary, value); + var xDictionaryEntry = PropertyListAddOnXElement(xTarget, property, value); xDictionaryEntry.SetAttributeValue("Name", key); return xDictionaryEntry; } diff --git a/test/ADDTOCOLLECTION.31_48_decomp.uix b/test/ADDTOCOLLECTION.31_48_decomp.uix new file mode 100644 index 0000000..cf7fe87 --- /dev/null +++ b/test/ADDTOCOLLECTION.31_48_decomp.uix @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file