public static void Main(string[] args) { bool showHelp = false; var options = new OptionSet() { { "h|help", "show this message and exit", v => showHelp = v != null }, }; List <string> extras; try { extras = options.Parse(args); } catch (OptionException e) { Console.Write("{0}: ", GetExecutableName()); Console.WriteLine(e.Message); Console.WriteLine("Try `{0} --help' for more information.", GetExecutableName()); return; } if (extras.Count < 1 || extras.Count > 2 || showHelp == true) { Console.WriteLine("Usage: {0} [OPTIONS]+ input_binary [output_xml]", GetExecutableName()); Console.WriteLine(); Console.WriteLine("Options:"); options.WriteOptionDescriptions(Console.Out); return; } var inputPath = Path.GetFullPath(extras[0]); var outputPath = extras.Count > 1 ? extras[1] : Path.ChangeExtension(inputPath, null) + "_converted.xml"; BinaryXmlFile binaryXml; using (var input = File.OpenRead(inputPath)) { binaryXml = new BinaryXmlFile(); binaryXml.Read(input); } using (var output = File.Create(outputPath)) using (var writer = new XmlTextWriter(output, Encoding.UTF8)) { writer.Formatting = Formatting.Indented; writer.WriteStartDocument(); WriteNode(writer, binaryXml.Root); writer.WriteEndDocument(); writer.Flush(); } }
public BinaryXmlFile ReadXMLFile(string pakFile, string internalFile) { var itempak = OpenPAKFile(Path.Combine(aionPath, pakFile)); Debug.Assert(internalFile.EndsWith("xml")); using (ZipFile zFile = new ZipFile(itempak)) { var assemblyItems = zFile[internalFile]; BinaryXmlFile bxml = new BinaryXmlFile(); bxml.Read(zFile.GetInputStream(assemblyItems)); return(bxml); } }
public XMLViewer(string file, byte[] xml) { InitializeComponent(); try { BinaryXmlFile f = new BinaryXmlFile(); f.Read(new MemoryStream(xml)); treeView1.Nodes.Add(MakeTree(f.Root)); Text = "bxml://" + file; } catch { XmlDocument xdoc = new XmlDocument(); xdoc.Load(new MemoryStream(xml)); treeView1.Nodes.Add(MakeTree(xdoc)); Text = "xml://" + file; } }
public BinaryXmlFile ReadXMLFile(string pakFile, string internalFile) { var itempak = OpenPAKFile(Path.Combine(aionPath, pakFile)); Debug.Assert(internalFile.EndsWith("xml")); using (ZipFile zFile = new ZipFile(itempak)) { var assemblyItems = zFile[internalFile]; BinaryXmlFile bxml = new BinaryXmlFile(); bxml.Read(zFile.GetInputStream(assemblyItems)); return bxml; } }