internal bool IsRegistryKeyFound() { using (ChoRegistryKey registryKey = new ChoRegistryKey(RegistryKey, false, true)) { return(registryKey.RegistrySubKey != null); } }
internal void SaveData(object data) { if (!(data is Dictionary <string, object>)) { throw new ChoConfigurationException("Data object is not Dictionary<string, object> object."); } Dictionary <string, object> dict = data as Dictionary <string, object>; if (!RegistryKey.IsNullOrWhiteSpace()) { using (ChoRegistryKey registryKey = new ChoRegistryKey(RegistryKey, true)) { foreach (string registryValueName in dict.Keys) { if (registryValueName.EndsWith(EXPAND_KEY_POSTFIX)) { continue; } if (dict[registryValueName] != null) { if (RegistryValueKindDict.ContainsKey(registryValueName)) { registryKey.SetValue(registryValueName, dict[registryValueName], RegistryValueKindDict[registryValueName]); } else { registryKey.SetValue(registryValueName, dict[registryValueName]); } } } } } }
public object LoadRegistryInfo() { if (ConfigObjectType == null) { return(null); } using (ChoRegistryKey registryKey = new ChoRegistryKey(RegistryKey, false, true)) { if (registryKey.RegistrySubKey == null) { return(null); } else { Dictionary <string, object> dict = new Dictionary <string, object>(); foreach (string registryValueName in registryKey.GetValueNames()) { dict.Add(registryValueName, registryKey.GetValue(registryValueName, RegistryValueOptions.DoNotExpandEnvironmentNames)); } return(dict); } } }