C# Class CustomConfigurations.Config

The Config class is a wrapper around the ConfigurationSectionLoader. It deals with creating and loading in the variables. It allows easier access to any Value for a given key. For a given key it will return NULL or the value if found.
Inheritance: IDisposable
Exibir arquivo Open project: twistedtwig/CustomConfigurations Class Usage Examples

Public Methods

Method Description
Config ( ) : System

Default constructor will give a blank configuration path and section, it will try and determine a the config path and choose the first valid section it can find.

Config ( bool allowValueInheritance ) : System
Config ( string configurationPath, bool allowValueInheritance = true ) : System

Constructor with the full configuration path given.

Config ( string pathToConfigFile, string configurationPath ) : System

Constructor with the full configuration path given.

Config ( string pathToConfigFile, string configurationPath, bool allowValueInheritance ) : System
ContainsKey ( string sectionName ) : bool

Determines if the loader has a config section by the given name.

CreateConfigKey ( ) : void
DecryptConfigurationSection ( ) : void
DecryptConfigurationSection ( string sectionName ) : void
DecryptConfigurationSection ( string configPath, string sectionName ) : void

This method is used to decrypt the particular section of the application config

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

EncryptConfigurationSection ( ) : void
EncryptConfigurationSection ( string sectionName ) : void
GetSection ( string sectionName ) : ConfigSection

Get the config section by the name attribute.

Private Methods

Method Description
CreateConfigurationLoaderObject ( string pathToConfigFile, string configPath, bool allowValueInheritance ) : bool

creates the configurationLoader for the given path.

DetermineConfigurationPath ( string pathToConfigFile ) : IEnumerable

Tries to find all valid configuration section / group paths that are valid for this loader.

DetermineValidSectionElements ( Regex configRegex, string parentSection, XPathNodeIterator parentGroupIterator ) : IEnumerable

Looks at the given iterator and tries to find any valid section groups that match the regex given for the config transform type.

DetermineValidSectionGroups ( Regex configRegex, XPathNodeIterator sectionGroupIterator ) : IEnumerable

tries to find any valid section groups which contain the correct section to match the regex given for the transform type.

EncryptConfigurationSection ( string configPath, string sectionName ) : void

This method is used to encrypt the particular section in the application config

FindConfigFileLocation ( string pathToConfigFile ) : string
GetConfiguration ( string configPath ) : Configuration
GetConfigurationSection ( string sectionName, Configuration config ) : ConfigurationSection
SetIndexesForConfigGroupCollectionRecursively ( ConfigurationGroupCollection configGroupCollection ) : void
SetIndexesForConfigGroupElementRecursively ( ConfigurationGroupElement configGroup ) : void

Method Details

Config() public method

Default constructor will give a blank configuration path and section, it will try and determine a the config path and choose the first valid section it can find.
public Config ( ) : System
return System

Config() public method

public Config ( bool allowValueInheritance ) : System
allowValueInheritance bool
return System

Config() public method

Constructor with the full configuration path given.
error if section is null or empty string error if fails to load given configuration section
public Config ( string configurationPath, bool allowValueInheritance = true ) : System
configurationPath string The xml path in the config file.
allowValueInheritance bool
return System

Config() public method

Constructor with the full configuration path given.
error if section is null or empty string error if fails to load given configuration section
public Config ( string pathToConfigFile, string configurationPath ) : System
pathToConfigFile string
configurationPath string The xml path in the config file.
return System

Config() public method

public Config ( string pathToConfigFile, string configurationPath, bool allowValueInheritance ) : System
pathToConfigFile string
configurationPath string
allowValueInheritance bool
return System

ContainsKey() public method

Determines if the loader has a config section by the given name.
public ContainsKey ( string sectionName ) : bool
sectionName string
return bool

CreateConfigKey() public method

public CreateConfigKey ( ) : void
return void

DecryptConfigurationSection() public method

public DecryptConfigurationSection ( ) : void
return void

DecryptConfigurationSection() public method

public DecryptConfigurationSection ( string sectionName ) : void
sectionName string
return void

DecryptConfigurationSection() public method

This method is used to decrypt the particular section of the application config
public DecryptConfigurationSection ( string configPath, string sectionName ) : void
configPath string file path the configuration file.
sectionName string Section to encrypt
return void

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

EncryptConfigurationSection() public method

public EncryptConfigurationSection ( ) : void
return void

EncryptConfigurationSection() public method

public EncryptConfigurationSection ( string sectionName ) : void
sectionName string
return void

GetSection() public method

Get the config section by the name attribute.
public GetSection ( string sectionName ) : ConfigSection
sectionName string
return ConfigSection