#region Add Guid to Target Tuv
/// <summary>
/// XMlDocument 处理 TTX文件,文件格式会变形
/// 设置XMlDocument的PreserveWhitespace会保留格式
/// PreserveWhitespace:Gets or sets a value indicating whether to preserve white space in element content.
/// </summary>
private static void addGuidToTgtTuv()
{
Guid myID = Guid.NewGuid();
string path = @"ast-mc-dash.rtf.ttx";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = true;
xmlDoc.Load(path);
XmlNodeList TuNodes = xmlDoc.SelectNodes("//Tu");
foreach (XmlNode TuNode in TuNodes)
{
XmlNode tgtTuvNode = TuNode.SelectNodes("./Tuv")[1];
tgtTuvNode.InnerXml = myID.ToString() + tgtTuvNode.InnerXml;
}
xmlDoc.Save(@"ast-mc-dash.rtf.ttx");
}
#endregion
XMlDocument 处理 TTX文件文件变形
最新推荐文章于 2018-03-30 14:35:52 发布