public static void SaveToXml(string filePath, SettingsManager sourceObj) { try { using (StreamWriter writer = new StreamWriter(filePath)) { System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(sourceObj.GetType()); xmlSerializer.Serialize(writer, sourceObj); } } catch(Exception ex) { MessageBox.Show(ex.Message); } }
public static void SaveToXml(string filePath, SettingsManager sourceObj) { try { using (StreamWriter writer = new StreamWriter(filePath)) { new XmlSerializer(sourceObj.GetType()).Serialize((TextWriter) writer, sourceObj); } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
public static void loadConfig() { sm = SettingsManager.LoadFromXml("ntrconfig.xml"); sm.init(); }