Beispiel #1
0
        public void DecryptSettings()
        {
            var settingsFile = new AppSettingsFile(AppSettingsFilePath);

            if (settingsFile.IsEncrypted)
            {
                var values            = settingsFile.GetValues();
                var connectionStrings = settingsFile.GetConnectionStrings();
                settingsFile.IsEncrypted = false;

                foreach (var pair in values)
                {
                    settingsFile.SetSecret(pair.Key, pair.Value);
                }

                foreach (var pair in connectionStrings)
                {
                    settingsFile.SetConnectionString(pair.Key, pair.Value);
                }

                settingsFile.Commit();
            }
        }
        public void EncryptSettings()
        {
            var settingsFile = new AppSettingsFile(Path.Combine(Environment.CurrentDirectory, AppSettingsFileName));

            if (!settingsFile.IsEncrypted)
            {
                var values            = settingsFile.GetValues();
                var connectionStrings = settingsFile.GetConnectionStrings();
                settingsFile.IsEncrypted = true;

                foreach (var pair in values)
                {
                    settingsFile.SetSecret(pair.Key, pair.Value);
                }

                foreach (var pair in connectionStrings)
                {
                    settingsFile.SetConnectionString(pair.Key, pair.Value);
                }

                settingsFile.Commit();
            }
        }
Beispiel #3
0
        public void EncryptSettings()
        {
            var settingsFile = new AppSettingsFile(AppSettingsFilePath);

            if (!settingsFile.IsEncrypted)
            {
                var values            = settingsFile.GetValues();
                var connectionStrings = settingsFile.GetConnectionStrings();
                settingsFile.IsEncrypted = true;

                foreach (var pair in values)
                {
                    settingsFile.SetSecret(pair.Key, pair.Value);
                }

                foreach (var connectionString in connectionStrings)
                {
                    settingsFile.SetConnectionString(connectionString.Name, connectionString.Value, connectionString.ProviderName);
                }

                settingsFile.Commit();
            }
        }
Beispiel #4
0
        public IDictionary <string, string> GetSecrets()
        {
            var appSettingsFile = new AppSettingsFile(AppSettingsFilePath);

            return(appSettingsFile.GetValues());
        }
        public IDictionary <string, string> GetSecrets()
        {
            var appSettingsFile = new AppSettingsFile(Path.Combine(Environment.CurrentDirectory, AppSettingsFileName));

            return(appSettingsFile.GetValues());
        }