public override bool BuildXml(RunRecordTableColums P) { lock (syncRoot) { XmlLoadElment = new XElement("TopoRunRecordTable"); XmlLoadElment.SetAttributeValue("SN", P.StrSN); XmlLoadElment.SetAttributeValue("StartTime", P.StrStartTime); XmlLoadElment.SetAttributeValue("EndTime", P.StrEndTime); XmlLoadElment.SetAttributeValue("FWRev", P.StrFw); XmlLoadElment.SetAttributeValue("IP", P.StrIP); XmlLoadElment.SetAttributeValue("LightSource", P.StrLightSource); XmlLoadElment.SetAttributeValue("Remark", P.StrRemark); XmlLoadElment.SetAttributeValue("PID", P.StrRemark); //PID //xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "yes"), NodeSN); //xdoc.Save(filePath); //doc = XDocument.Load(filePath); //XmlLoadElment = XElement.Load(filePath); XmlLoadElment.Save(filePath); NodeSN = XmlLoadElment; return(true); } }
public LocatDataXml(string StrPath, RunRecordTableColums P) { lock (syncRoot) { filePath = StrPath; if (!File.Exists(filePath)) { XmlLoadElment = new XElement("TopoRunRecordTable"); XmlLoadElment.SetAttributeValue("SN", P.StrSN); XmlLoadElment.SetAttributeValue("StartTime", P.StrStartTime); XmlLoadElment.SetAttributeValue("EndTime", P.StrEndTime); XmlLoadElment.SetAttributeValue("FWRev", P.StrFw); XmlLoadElment.SetAttributeValue("IP", P.StrIP); XmlLoadElment.SetAttributeValue("LightSource", P.StrLightSource); XmlLoadElment.SetAttributeValue("Remark", P.StrRemark); XmlLoadElment.SetAttributeValue("PID", P.StrPID); XmlLoadElment.Save(filePath); } else { XmlLoadElment = XElement.Load(filePath); } NodeSN = XmlLoadElment; } }