123456789101112131415161718192021222324252627 |
- using System.IO;
- using System.Xml;
- namespace UAS_AutoPass.ToolClass
- {
- class BaseUtil
- {
- public static void CreateXml(string iSN, string iTestResult)
- {
- //创建XML文档
- FileStream fcaches = new FileStream(iSN + ".xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);
- fcaches.Close();
- FileInfo info = new FileInfo(iSN + ".xml");
- if (info.Length == 0)
- {
- XmlDocument doc = new XmlDocument();
- //创建类型声明节点
- XmlNode node = doc.CreateXmlDeclaration("1.0", "utf-8", "");
- doc.AppendChild(node);
- //创建根节点
- XmlElement xeRoot = doc.CreateElement("cacheInfo");
- doc.AppendChild(xeRoot);
- doc.Save(iSN + ".xml");
- }
- }
- }
- }
|