public string GetPasswordForLogin(ProviderConfigurationItem providerConfigurationItem, string userName) { RegistryKey companyKey = Registry.CurrentUser.OpenOrCreateCompanyKey(); RegistryKey geoPatKey = companyKey.OpenOrCreateKey("GeoPat"); RegistryKey configKey = geoPatKey.OpenOrCreateKey("Configuration"); RegistryKey providersKey = configKey.OpenOrCreateKey("Providers"); String providerKeyName = providerConfigurationItem.GetHash(); RegistryKey keyProvider = providersKey.OpenOrCreateKey(providerKeyName); if (keyProvider.GetValueNames().Contains(userName)) {return keyProvider.GetValue(userName).ToString();} return ""; }
public void SetLoginPassword(ProviderConfigurationItem providerConfigurationItem, string login, string passord) { RegistryKey companyKey = Registry.CurrentUser.OpenOrCreateCompanyKey(); RegistryKey geoPatKey = companyKey.OpenOrCreateKey("GeoPat"); RegistryKey configKey = geoPatKey.OpenOrCreateKey("Configuration"); RegistryKey providersKey = configKey.OpenOrCreateKey("Providers"); String providerKeyName = providerConfigurationItem.GetHash(); RegistryKey keyProvider = providersKey.OpenOrCreateKey(providerKeyName); keyProvider.SetValue(login, passord); }