Added a root "File" node to the XML engine. Fixed a bug that deleted the "SegmentTracks" node.

This commit is contained in:
2017-09-05 13:26:40 -05:00
parent 646ea08f3e
commit fcbdbf15a4
4 changed files with 110 additions and 63 deletions
+36
View File
@@ -1,8 +1,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;
namespace MKVTest
{
@@ -272,5 +275,38 @@ namespace MKVTest
{
return File.Exists("mkvpropedit.exe") && File.Exists("mkvinfo.exe");
}
private void ReadXml()
{
var xReader = new XmlTextReader(File.OpenRead("Test.info"));
var r = new StringBuilder();
while (xReader.Read())
{
switch (xReader.NodeType)
{
case XmlNodeType.Element:
r.Append("<" + xReader.Name + ">");
//listBox1.Items.Add("<" + xReader.Name + ">");
break;
case XmlNodeType.Text:
r.Append(xReader.Value);
//listBox1.Items.Add(xReader.Value);
break;
case XmlNodeType.EndElement:
//listBox1.Items.Add("");
break;
}
}
//MessageBox.Show(r.ToString());
}
private void debugToolStripMenuItem_Click(object sender, EventArgs e)
{
var xml = new SerializeMkvInfo();
var x = xml.SerializeFile("info.txt");
File.WriteAllLines("Test.info", x.ToArray());
ReadXml();
}
}
}