简单粗暴,直接上代码:
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.Load(Help.basePath);
XmlNode root = xmlDoc.SelectSingleNode("//screenshot");
if (root != null)
{
string screenshotsavepath = root.SelectSingleNode("screenshotsavepath").InnerText;
//打开文件夹
}
else
{
MessageBox.Show("亲,没有有效存储路径");
}
}
catch (Exception ex)
{
//显示错误信息
MessageBox.Show(ex.Message);
}
Help.basePath-------------------文件路径
screenshot--------------------节点名
screenshotsavepath-----想要查找的节点
时间: 2024-10-13 16:59:01