internal void SaveAsDefault()
        {
            RegistryHelper registry = new RegistryHelper();

            registry.Write(ConnectionHelper.ConnectionKey, "ConnectionName", Name);

            // encrypt and save the default connection string.
            registry.Write(ConnectionHelper.ConnectionKey, "ConnectionString", EncriptionHelper.EncryptString(ToString(), ConnectionHelper.Salt));
        }
        public void LoadFromRegistry(string key)
        {
            RegistryHelper registry = new RegistryHelper();

            _OrigionalString = registry.Read(key, "ConnectionString");

            // check if the read string was encrypted or not.
            // this is not a very reliable check as the database name could be different
            if (!_OrigionalString.Contains("Data"))
            {
                //
                _OrigionalString = EncriptionHelper.DecryptString(_OrigionalString, ConnectionHelper.Salt);
            }
            else
            {
                // write the ecrypted version instead of the version that is plain text.
                registry.Write(key, "ConnectionString",
                               EncriptionHelper.EncryptString(_OrigionalString, ConnectionHelper.Salt));
            }

            Parse(_OrigionalString);
            Name = registry.Read(key, "ConnectionName");
        }