/// <summary> /// Copy the contents of the source settings into this settings /// </summary> /// <param name="sourceSettings"></param> public void CopyFrom(SettingsPersisterHelper sourceSettings, bool recursive, bool overWrite) { // copy root-level values (to work with types generically we need references // to the underlying settings persister objects) ISettingsPersister source = sourceSettings.SettingsPersister; ISettingsPersister destination = SettingsPersister; foreach (string name in source.GetNames()) { if (overWrite || destination.Get(name) == null) { destination.Set(name, source.Get(name)); } } // if this is recursive then copy all of the sub-settings if (recursive) { foreach (string subSetting in sourceSettings.GetSubSettingNames()) { using (SettingsPersisterHelper sourceSubSetting = sourceSettings.GetSubSettings(subSetting), destinationSubSetting = this.GetSubSettings(subSetting)) { destinationSubSetting.CopyFrom(sourceSubSetting, recursive, overWrite); } } } }
/// <summary> /// Sets the Unicode character setting with the specified name. /// </summary> /// <param name="name">Name of the setting to set.</param> /// <param name="value">The value to set.</param> public void SetChar(string name, char value) { settingsPersister.Set(name, value); }