public static XmlNode GetNode(this XmlNode node, string name) { return(XMLUtil.GetNode(node, name)); }
public void LoadSettings() { if (xml == null) { xml = new XmlDocument(); } if (defaultxml == null) { defaultxml = new XmlDocument(); if (File.Exists(DefaultSettingFilePath)) { try { defaultxml.Load(DefaultSettingFilePath); defaultroot = XMLUtil.GetNode(defaultxml, "root"); } catch { defaultroot = null; } if (defaultroot == null) { defaultxml = new XmlDocument(); defaultroot = XMLUtil.AddNode(defaultxml, "root"); } } else { defaultroot = XMLUtil.AddNode(defaultxml, "root"); } } try { if (SettingFilePath == DefaultSettingFilePath) { xml = defaultxml; root = defaultroot; if (loadSaved) { var lastFile = GetDefaultSettingValue("lastSettingFile"); if (!string.IsNullOrEmpty(lastFile) && File.Exists(lastFile) && lastFile != DefaultSettingFilePath) { SettingFilePath = lastFile; if (File.Exists(SettingFilePath)) { try { XmlDocument doc = new XmlDocument(); doc.Load(SettingFilePath); this.xml = doc; root = XMLUtil.GetNode(xml, "root"); if (root == null) { xml = null; } } catch { } } } loadSaved = false; } } else { if (root == null) { if (File.Exists(SettingFilePath)) { try { XmlDocument x = new XmlDocument(); x.Load(SettingFilePath); this.xml = x; root = XMLUtil.GetNode(xml, "root"); if (root == null) { xml = null; } } catch { } } } } } catch { xml = defaultxml; root = defaultroot; } }
public static XmlNode GetNode(this XmlDocument doc, string xpath) { return(XMLUtil.GetNode(doc, xpath)); }