Ejemplo n.º 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();
            }
        }
Ejemplo n.º 2
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();
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        public IDictionary <string, string> GetConnectionStrings()
        {
            var appSettingsFile = new AppSettingsFile(AppSettingsFilePath);

            return(appSettingsFile.GetConnectionStrings());
        }
Ejemplo n.º 5
0
        public IEnumerable <ConnectionString> GetConnectionStrings()
        {
            var appSettingsFile = new AppSettingsFile(AppSettingsFilePath);

            return(appSettingsFile.GetConnectionStrings());
        }
Ejemplo n.º 6
0
        public IDictionary <string, string> GetConnectionStrings()
        {
            var appSettingsFile = new AppSettingsFile(Path.Combine(Environment.CurrentDirectory, AppSettingsFileName));

            return(appSettingsFile.GetConnectionStrings());
        }