public void SaveConfig(Config config) { string fileName = AppDomain.CurrentDomain.BaseDirectory + "/config.xml"; var xml = XmlSerialize.Serialize <Config>(config); System.IO.File.WriteAllText(fileName, xml); }
public Config GetConfig() { Config config = null; string fileName = AppDomain.CurrentDomain.BaseDirectory + "/config.xml"; if (System.IO.File.Exists(fileName)) { config = XmlSerialize.Deserialize <Config>(System.IO.File.ReadAllText(fileName)); } else { config = new Config(); } return(config); }