diff --git a/tools/DMTreeToGlobalsList/DMTreeToGlobalsList.csproj b/tools/DMTreeToGlobalsList/DMTreeToGlobalsList.csproj new file mode 100644 index 00000000000..db4350daa48 --- /dev/null +++ b/tools/DMTreeToGlobalsList/DMTreeToGlobalsList.csproj @@ -0,0 +1,59 @@ + + + + + Debug + AnyCPU + {9799169C-0C95-4873-B6B5-211E007A15F4} + Exe + Properties + DMTreeToGlobalsList + DMTreeToGlobalsList + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/DMTreeToGlobalsList/Program.cs b/tools/DMTreeToGlobalsList/Program.cs new file mode 100644 index 00000000000..44258824d46 --- /dev/null +++ b/tools/DMTreeToGlobalsList/Program.cs @@ -0,0 +1,65 @@ +using System; +using System.IO; +using System.Xml; + +namespace DMTreeToGlobalsList +{ + class Program + { + static void Main(string[] args) + { + if (args.Length < 1 || !File.Exists(args[0])) + { + Console.WriteLine("Usage: DMTreeToGlobalsList.exe [Prefix] [Postfix]"); + return; + } + + var XMLPath = args[0]; + string Prefix = "", Postfix = ""; + if (args.Length > 1) + { + Prefix = args[1]; + if (args.Length > 2) + Postfix = args[2]; + } + + XmlDocument Doc; + using (var FS = new FileStream(XMLPath, FileMode.Open, FileAccess.Read)) + { + try + { + while (FS.ReadByte() != '<') ; + } + catch + { + Console.WriteLine("Failed to find start point of XML in output"); + return; + } + FS.Seek(-1, SeekOrigin.Current); + + Doc = new XmlDocument(); + try + { + Doc.Load(FS); + } + catch + { + Console.WriteLine("Failed to load the XML document"); + return; + } + } + try + { + var DMNode = Doc.ChildNodes[1]; + foreach (XmlNode Child in DMNode.ChildNodes) + if (Child.Name == "var") + Console.WriteLine(Prefix + Child.FirstChild.Value.Trim() + Postfix); + } + catch + { + Console.WriteLine("Failed parsing the XML"); + return; + } + } + } +}