mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
[Decompiler] Added post-processing step; Host elements that only reference another element use me namespace
This commit is contained in:
@@ -1560,6 +1560,7 @@ namespace Microsoft.Iris.Markup
|
||||
xmlStack.Pop();
|
||||
}
|
||||
|
||||
CleanUpXmlDoc();
|
||||
InterpreterContext.DecompileResults.Add(XmlDoc);
|
||||
return result;
|
||||
}
|
||||
@@ -1621,5 +1622,26 @@ namespace Microsoft.Iris.Markup
|
||||
return objXml;
|
||||
}
|
||||
}
|
||||
|
||||
private static void CleanUpXmlDoc()
|
||||
{
|
||||
XmlNamespaceManager nsManager = new XmlNamespaceManager(XmlDoc.NameTable);
|
||||
var hosts = XmlDoc.DocumentElement.SelectNodes("*//Host", nsManager);
|
||||
foreach (XmlNode node in hosts)
|
||||
{
|
||||
if (!(node is XmlElement host))
|
||||
continue;
|
||||
|
||||
if (host.Attributes.Count == 1 && host.HasAttribute("Name"))
|
||||
{
|
||||
string uiElemName = host.GetAttribute("Name");
|
||||
nsManager.AddNamespace("me", "Me");
|
||||
XmlDoc.DocumentElement.SetAttribute("xmlns:me", "Me");
|
||||
|
||||
XmlElement uiElem = XmlDoc.CreateElement("me", uiElemName, "Me");
|
||||
host.ParentNode.ReplaceChild(uiElem, host);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user