Ejemplo n.º 1
0
 internal bool IsRegistryKeyFound()
 {
     using (ChoRegistryKey registryKey = new ChoRegistryKey(RegistryKey, false, true))
     {
         return(registryKey.RegistrySubKey != null);
     }
 }
Ejemplo n.º 2
0
        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]);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        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);
                }
            }
        }