public XmlCommandStructDefinition Clone() { XmlCommandStructDefinition pacektStruct = new XmlCommandStructDefinition(_headerFileName, _structType); pacektStruct._header = _header.Clone(); pacektStruct._data = _data.Clone(_data.Name); return(pacektStruct); }
public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false) { if (rootNode == null) { return; } _xDoc = xDoc; XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this); try { XmlNode infoNode = XmlGetter.Child(rootNode, "Info"); _info.LoadXml(xDoc, infoNode, refLoad); } catch (Exception e) { throw new Exception("Error On Loading Template [" + _filePath + "].Info.." + e.Message); } try { XmlNode commandNode = XmlGetter.Child(rootNode, "Command"); if (commandNode != null) { _command = new XmlCommandStructDefinition("CommandHeader.xml", StructType.Command); _command.LoadXml(_xDoc, commandNode); } } catch (Exception e) { throw new Exception("Error on Loading Template [" + _info.Name + "].Command..." + e.Message); } try { XmlNodeList responseNodeList = XmlGetter.Children(rootNode, "Response"); foreach (XmlNode responseNode in responseNodeList) { String type = XmlGetter.Attribute(responseNode, "Type"); if (type.ToLower().Equals("continuous")) { _autoResponse = new XmlCommandStructDefinition("ResponseHeader.xml", StructType.Response); _autoResponse.LoadXml(_xDoc, responseNode); } else { _response = new XmlCommandStructDefinition("ResponseHeader.xml", StructType.Response); _response.LoadXml(_xDoc, responseNode); } } } catch (Exception e) { throw new Exception("Error on Loading Template [" + _info.Name + "].Response..." + e.Message); } }