public XMLConfig cloneXMLObject() { XMLConfig result; result = new XMLConfig(); result.loadXML(this.GetXML()); return(result); }
public XMLConfig cloneXMLObjectFromNode(string nodePath, Boolean deep) { XmlNode xmlNode; XMLConfig result = null; if (this.HasNode(nodePath)) { result = new XMLConfig(); xmlNode = GetNode(nodePath).CloneNode(deep); result.loadXML(xmlNode.OuterXml); xmlNode = null; } return(result); }
/// <summary> /// 应答码解析 /// </summary> /// <param name="code">应答码</param> /// <param name="mean">意义</param> /// <param name="show">显示的内容</param> /// <returns></returns> private static void ParseRespMessage(string configFile, string code, ref string mean, ref string show) { if (string.IsNullOrEmpty(configFile) || Path.GetExtension(configFile) != ".xml") { return; } lock (sErrorLock) { if (!sParsedInfo.ContainsKey(configFile)) { XMLConfig config = new XMLConfig(configFile); XmlNode node; int elementCount = config.GetNodeElementCount("/Config"); if (elementCount > 0) { Dictionary <string, MeanAndShow> infos = new Dictionary <string, MeanAndShow>(); for (int iPer = 0; iPer <= elementCount - 1; iPer++) { node = config.GetNodeElementById("/Config", iPer); MeanAndShow ins = new MeanAndShow(); ins.Mean = config.GetAttributeValue(node, "Mean"); ins.Show = config.GetAttributeValue(node, "Show"); infos.Add(config.GetAttributeValue(node, "Code"), ins); } sParsedInfo.Add(configFile, infos); } } Dictionary <string, MeanAndShow> ret = sParsedInfo[configFile]; if (ret.ContainsKey(code)) { mean = ret[code].Mean; show = ret[code].Show; } } }