From 61991860653fda65ec5f37b4f00e128ceec77f5e Mon Sep 17 00:00:00 2001 From: Carmine Date: Wed, 3 Jan 2018 21:03:05 +0100 Subject: [PATCH] added Xml parser for gtxd.meta --- GameFiles/FileTypes/GtxdFile.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/GameFiles/FileTypes/GtxdFile.cs b/GameFiles/FileTypes/GtxdFile.cs index 8a27eba..96735b8 100644 --- a/GameFiles/FileTypes/GtxdFile.cs +++ b/GameFiles/FileTypes/GtxdFile.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml; namespace CodeWalker.GameFiles { @@ -133,7 +134,24 @@ namespace CodeWalker.GameFiles private void LoadMapParentTxds(string xml) { - //TODO... + XmlDocument xmldoc = new XmlDocument(); + xmldoc.LoadXml(xml); + XmlNodeList items = xmldoc.SelectNodes("CMapParentTxds/txdRelationships/item"); + + CMapParentTxds = new Dictionary(); + for (int i = 0; i < items.Count; i++) + { + string parentstr = Xml.GetChildInnerText(items[i], "parent"); + string childstr = Xml.GetChildInnerText(items[i], "child"); + + if ((!string.IsNullOrEmpty(parentstr)) && (!string.IsNullOrEmpty(childstr))) + { + if (!CMapParentTxds.ContainsKey(childstr)) + { + CMapParentTxds.Add(childstr, parentstr); + } + } + } } }