public static void Load() { try { XmlDocument xdoc = new XmlDocument(); xdoc.Load(SettingsFile); XmlElement xroot = xdoc["settings"] ?? xdoc["root"]; // first load the simplest properties if (xroot["Email"] != null) { Email = xroot["Email"].InnerText; } if (xroot["DataSource"] != null) { DataSource = DataSourceFactory.CreateFrom(xroot["DataSource"]); } if (xroot["ReadConfigAfterConnect"] != null) { ReadConfigAfterConnect = bool.Parse(xroot["ReadConfigAfterConnect"].InnerText); } if (xroot["LogPanelExpanded"] != null) { LogPanelExpanded = bool.Parse(xroot["LogPanelExpanded"].InnerText); } if (xroot["WindowSize"] != null) { string size = xroot["WindowSize"].InnerText; WindowSize = new Size(int.Parse(size.Substring(0, size.IndexOf("x"))), int.Parse(size.Substring(size.IndexOf("x") + 1))); } if (xroot["NameMapping"] != null) { NameMapping.LoadFrom(xroot["NameMapping"]); } } catch { } Sanitize(); }