/// <summary>
        /// Adds a configuration to the environment
        /// </summary>
        /// <typeparam name="TConfiguration">The type of configuration to add</typeparam>
        /// <param name="name">The name of the configuration</param>
        public ConfigurationEnvironmentBuilder WithConfiguration <TConfiguration>(string name)
            where TConfiguration : IConfiguration, new()
        {
            Validator.Validate(name);

            // Get a new instance of the configuration type
            IConfiguration instance = new TConfiguration();

            // Add to the collection
            mConfigurationCollection.Add(instance, name, null);

            // Not found directory
            if (!Directory.Exists(mPath))
            {
                throw new DirectoryNotFoundException($"Directory '{mPath}' not found.");
            }

            // Create the file
            ConfigurationFile file = new ConfigurationFile(Path.Combine(mPath, $"{name}{ConfigurationManager.DEFAULT_EXTENSION}"));

            file.Create();
            file.WriteHeader();

            return(this);
        }
        private void bLoad_Click(object sender, EventArgs e)
        {
            m_ConfigurationFile = ConfigurationFile.Create(editFileName.Text, "settings");
            m_PropertyCollectionNames.Clear();

            UpdateInfoOutputPropertyCollectionNames();
        }
Exemple #3
0
 public void OnExecute() => ConfigurationFile.Create(new Configuration(this));
Exemple #4
0
 /// <summary>
 /// Speichert die Konfiguration in der aktuellen Konfigurationsdatei.
 /// </summary>
 public void Save()
 {
     // Open the file and process
     using (var stream = ConfigurationFile.Create())
         Save(stream);
 }