AddinHeaderXml ReadHeader() { var header = new AddinHeaderXml(); for (int i = 0; i < _rootNode.Attributes.Count; i++) { var attrib = _rootNode.Attributes[i]; string val; if (header.Guid == null) { val = XmlHelper.GetMatchingAttribueValue(attrib, AttributeGuid); if (val != null) { header.Guid = val; continue; } } if (header.AddinCategory == null) { val = XmlHelper.GetMatchingAttribueValue(attrib, AttributeCategory); if (val != null) { header.AddinCategory = val; continue; } } if (header.Name == null) { val = XmlHelper.GetMatchingAttribueValue(attrib, AttributeName); if (val != null) { header.Name = val; continue; } } if (header.Description == null) { val = XmlHelper.GetMatchingAttribueValue(attrib, AttributeDescription); if (val != null) { header.Description = val; continue; } } if (header.Version == null) { val = XmlHelper.GetMatchingAttribueValue(attrib, AttributeVersion); if (val != null) { header.Version = val; continue; } } if (header.CompatVersion == null) { val = XmlHelper.GetMatchingAttribueValue(attrib, AttributeCompatVersion); if (val != null) { header.CompatVersion = val; continue; } } if (header.Enabled == null) { val = XmlHelper.GetMatchingAttribueValue(attrib, AttributeEnabled); if (val != null) { header.Enabled = val; continue; } } header.AddProperty(XmlHelper.GetAttribueName(attrib), XmlHelper.GetAttribueValue(attrib)); } //foreach (XmlNode node in _headerNode.ChildNodes) //{ // if (node.NodeType != XmlNodeType.Element) // continue; // string val; // if (header.Guid == null) // { // val = XmlHelper.GetMatchingNodeValue(node, Guid); // if (val != null) // { // header.Guid = val; // continue; // } // } // if (header.AddinCategory == null) // { // val = XmlHelper.GetMatchingNodeValue(node, Category); // if (val != null) // { // header.AddinCategory = val; // continue; // } // } // if (header.Name == null) // { // val = XmlHelper.GetMatchingNodeValue(node, Name); // if (val != null) // { // header.Name = val; // continue; // } // } // if (header.Description == null) // { // val = XmlHelper.GetMatchingNodeValue(node, Description); // if (val != null) // { // header.Description = val; // continue; // } // } // if (header.Version == null) // { // val = XmlHelper.GetMatchingNodeValue(node, Version); // if (val != null) // { // header.Version = val; // continue; // } // } // if (header.CompatVersion == null) // { // val = XmlHelper.GetMatchingNodeValue(node, CompatVersion); // if (val != null) // { // header.CompatVersion = val; // continue; // } // } // if (header.Enabled == null) // { // val = XmlHelper.GetMatchingNodeValue(node, Enabled); // if (val != null) // { // header.Enabled = val; // continue; // } // } // header.AddProperty(XmlHelper.GetNodeName(node), XmlHelper.GetNodeValue(node)); //} return(header); }
AddinHeaderXml ReadHeader() { if (_headerNode == null || _headerNode.NodeType != XmlNodeType.Element || !_headerNode.HasChildNodes) { return(null); } var header = new AddinHeaderXml(); foreach (XmlNode node in _headerNode.ChildNodes) { if (node.NodeType != XmlNodeType.Element) { continue; } string val; if (header.Guid == null) { val = XmlHelper.GetMatchingNodeValue(node, Guid); if (val != null) { header.Guid = val; continue; } } if (header.AddinCategory == null) { val = XmlHelper.GetMatchingNodeValue(node, Category); if (val != null) { header.AddinCategory = val; continue; } } if (header.FriendName == null) { val = XmlHelper.GetMatchingNodeValue(node, FriendName); if (val != null) { header.FriendName = val; continue; } } if (header.Description == null) { val = XmlHelper.GetMatchingNodeValue(node, Description); if (val != null) { header.Description = val; continue; } } if (header.Version == null) { val = XmlHelper.GetMatchingNodeValue(node, Version); if (val != null) { header.Version = val; continue; } } if (header.CompatVersion == null) { val = XmlHelper.GetMatchingNodeValue(node, CompatVersion); if (val != null) { header.CompatVersion = val; continue; } } if (header.Url == null) { val = XmlHelper.GetMatchingNodeValue(node, Url); if (val != null) { header.Url = val; continue; } } if (header.Enabled == null) { val = XmlHelper.GetMatchingNodeValue(node, Enabled); if (val != null) { header.Enabled = val; continue; } } header.AddProperty(XmlHelper.GetNodeName(node), XmlHelper.GetNodeValue(node)); } return(header); }