示例#1
0
        private List <string> GetMysoftSubKey()
        {
            RegistryKey localMachine = Registry.LocalMachine;
            string      name         = string.Empty;

            if (OSHelper.Is64Bit())
            {
                name = @"SOFTWARE\Wow6432Node\mysoft";
            }
            else
            {
                name = @"SOFTWARE\mysoft";
            }
            RegistryKey key2 = localMachine.OpenSubKey(name);

            if (key2 != null)
            {
                try
                {
                    foreach (string str2 in key2.GetSubKeyNames())
                    {
                        RegistryKey key3   = key2.OpenSubKey(str2);
                        DbConfig    config = new DbConfig();
                        object      obj2   = key3.GetValue("DBName");
                        config.DBName     = (obj2 == null) ? "" : obj2.ToString();
                        obj2              = key3.GetValue("SaPassword");
                        config.SaPassword = (obj2 == null) ? "" : Decode(obj2.ToString());
                        obj2              = key3.GetValue("ServerName");
                        config.ServerName = (obj2 == null) ? "" : obj2.ToString();
                        obj2              = key3.GetValue("UserName");
                        config.UserName   = (obj2 == null) ? "" : obj2.ToString();
                        key3.Close();
                        if (!this.dbDic.ContainsKey(str2))
                        {
                            this.dbDic.Add(str2, config);
                        }
                    }
                }
                finally
                {
                    key2.Close();
                    localMachine.Close();
                }
            }
            return(this.dbDic.Keys.ToList <string>());
        }