我正在尝试制作NDS Wiiu VC Injector(它将nds游戏注入wiiu vc),我正在尝试编辑XML长短名称,但它不起作用,它不会将内容写入该文件
这是xml的一部分:
<?xml version="1.0" encoding="utf-8"?>
<menu type="complex" access="777">
<invisible_flag type="hexBinary" length="4">00000000</invisible_flag>
<reserved_flag0 type="hexBinary" length="4">00010001</reserved_flag0>
<reserved_flag1 type="hexBinary" length="4">00000000</reserved_flag1>
<reserved_flag2 type="hexBinary" length="4">00000000</reserved_flag2>
<reserved_flag3 type="hexBinary" length="4">00000000</reserved_flag3>
<reserved_flag4 type="hexBinary" length="4">00000000</reserved_flag4>
<reserved_flag5 type="hexBinary" length="4">00000000</reserved_flag5>
<reserved_flag6 type="hexBinary" length="4">00000003</reserved_flag6>
<reserved_flag7 type="hexBinary" length="4">00000001</reserved_flag7>
<longname_ja type="string" length="512">
</longname_ja>
<longname_en type="string" length="512">WarioWare: Touched!</longname_en>
<longname_fr type="string" length="512">WarioWare: Touched!</longname_fr>
<longname_de type="string" length="512">WarioWare: Touched!</longname_de>
<longname_it type="string" length="512">WarioWare: Touched!</longname_it>
<longname_es type="string" length="512">WarioWare: Touched!</longname_es>
这是我正在使用的代码:
string xmlFile = Path.Combine(
Path.GetDirectoryName(
Assembly.GetExecutingAssembly().Location
)
, @"TOOLS\EDIT\meta.xml"
);
XmlDocument doc = new XmlDocument();
doc.Load(xmlFile);
string newValue = textBox5.Text;
XmlNodeList list = doc.SelectNodes("//@*"); // Forgot the slashes here...
IEnumerable<XmlNode> filteredList = list.Cast<XmlNode>().
Where(item => item.Name.ToLower().Contains("longname")); // Name property instead of Value
foreach (XmlNode n in filteredList)
{
n.Value = newValue; // Setting the value.
}
doc.Save(xmlFile);