public void SaveSettings(PKSettingsModel settings) { if (settings == null) { return; } using (rwlock.Write()) { settingsModel = settings.Clone(); try { var serializer = new DataContractSerializer(typeof(PKSettingsModel)); using (var fs = File.Open(settingsFileName, FileMode.Create)) { using (var writer = new XmlTextWriter(fs, Encoding.UTF8)) { writer.Formatting = Formatting.Indented; serializer.WriteObject(writer, settingsModel); } } } catch (Exception e) { LogProvider.Log.Error(this, e); } } }
public PKSettingsModel GetSettings() { using (rwlock.Read()) { return(settingsModel.Clone()); } }