ConfigurationFinder

Provides methods to help find .json configuration files like settings.json.

Namespace:
Inetdev
Type:
Class
Public:
Yes
Protected:
No
Sealed:
Yes
Abstract:
Yes
Inherits from:
System.Object

Methods

FindConfigurationDirectory

Finds the default configuration directory by looking the directory tree upwards from the application location.

Signature:
public DirectoryInfo FindConfigurationDirectory()
Returns

A DirectoryInfo for the cnfg directory or null if it is not found.

Exceptions
Type Summary
InvalidOperationException Thrown when the location of the application is not found.

FindConfigurationDirectory

Finds the configuration directory named directoryName by looking the directory tree upwards from the application location.

Signature:
public DirectoryInfo FindConfigurationDirectory(directoryName)
Returns

A DirectoryInfo for the specified directoryName or null if it is not found.

Parameters
Name Type Summary
directoryName String The name of the configuration directory to find.
Exceptions
Type Summary
ArgumentNullOrEmptyException Thrown when directoryName is null or empty.
InvalidOperationException Thrown when the location of the application is not found.

FindConfigurationFileName

Finds the full path of the default configuration file.

Signature:
public String FindConfigurationFileName()
Returns

The full path of the settings.json file.

FindConfigurationFileName

Finds the full path of fileName in the configuration directory named directoryName.

Signature:
public String FindConfigurationFileName(directoryName, fileName)
Returns

The full path name of the configuration file.

Parameters
Name Type Summary
directoryName String Name of the configuration directory to find.
fileName String Name of the configuration file to find.
Exceptions
Type Summary
ArgumentNullOrEmptyException Thrown when directoryName is null or empty.
ArgumentNullOrEmptyException Thrown when fileName is null or empty.
DirectoryNotFoundException Thrown when directoryName cannot be found.
FileNotFoundException Thrown when fileName cannot be found.