public Task <Values> Get(RegistrySettingGroup group, IEnumerable <Setting> settings) { Values values = new Values(); using IRegistryKey? key = this.OpenKey(group.RootKeyName, group.KeyPath); if (key != null) { foreach (Setting setting in settings) { object?value = key.GetValue(setting.Name); values.Add(setting, value); } } return(Task.FromResult(values)); }
public Task <bool> Set(RegistrySettingGroup settingGroup, Values values) { using IRegistryKey? key = this.OpenKey(settingGroup.RootKeyName, settingGroup.KeyPath, true); if (key != null) { foreach ((Setting setting, object?value) in values) { // TODO: Infer value kind from the setting data type, or set it explicitly. RegistryValueKind valueKind = RegistryValueKind.Unknown;// RegistrySettingsHandler.GetValueKind(setting.DataType); key?.SetValue(setting.Name, value, valueKind); } } return(Task.FromResult(key != null)); }