using System.IO;
using System.Xml;
private void GetMsrStep()
{
if (File.Exists(strStepPath))
{
//读取
lstcStrStep.Clear();
XmlReader cXmlReader = XmlReader.Create(strStepPath);
cXmlReader.ReadStartElement("Operation-Steps");
while (XmlNodeType.EndElement != cXmlReader.MoveToContent())
{
XmlNodeType cXNT = cXmlReader.MoveToContent();
List lstTemp = new List(2);
lstTemp.Add(cXmlReader.LocalName);
lstTemp.Add(cXmlReader.ReadElementString());
lstcStrStep.Add(lstTemp);
}
cXmlReader.ReadEndElement();
cXmlReader.Close();
}
else
{
//保存
XmlWriterSettings cXmlWriterSetting = new XmlWriterSettings();
cXmlWriterSetting.ConformanceLevel = ConformanceLevel.Auto;
XmlWriter cXmlWriter = XmlWriter.Create(strStepPath, cXmlWriterSetting);
cXmlWriter.WriteStartDocument();
cXmlWriter.WriteWhitespace("
");
cXmlWriter.WriteStartElement("Operation-Steps");
cXmlWriter.WriteWhitespace("
");
foreach (List lstData in lstcStrStep)
{
cXmlWriter.WriteWhitespace(" ");
cXmlWriter.WriteElementString(lstData[0], lstData[1]);
cXmlWriter.WriteWhitespace("
");
}
cXmlWriter.WriteEndElement();
cXmlWriter.WriteEndDocument();
cXmlWriter.Close();
}
catch
{
}
}