The TAppSettingsManager class allows reading of AppSettings section values in any .NET Configuration File (not just the one that has the same name as the Application itself). It also supports parameters on the command line which override the values in the config file.
More...
|
static StringCollection | GetKeys (String AStartingWith="") |
| return all keys of available options and configuration parameters More...
|
|
static Boolean | HasValue (String Key) |
| returns true if the value is on the command line or in the config file More...
|
|
static String | GetValue (String AKey, Boolean ALogErrorIfNotPresent) |
| Returns the Value of a specified AppSetting key. More...
|
|
static String | GetValue (String AKey) |
| returns the string value of a parameter, either from command line or from the current config file More...
|
|
static String | GetValue (String AKey, String ADefaultValue) |
| returns the string value of a parameter or the default value More...
|
|
static String | GetValue (String AKey, String ADefaultValue, Boolean ALogErrorIfNotPresent) |
| returns the string value of a parameter or the default value More...
|
|
static System.Int16 | GetInt16 (String AKey, Int16 ADefaultValue=-1) |
| return the Integer value of a parameter or its default value More...
|
|
static System.Int32 | GetInt32 (String AKey, System.Int32 ADefaultValue=-1) |
| Return the Integer value of a parameter or its default value More...
|
|
static System.Int64 | GetInt64 (String AKey, System.Int64 ADefaultValue=-1) |
| return the Integer value of a parameter or its default value More...
|
|
static float | GetFloat (String AKey) |
| read a float value More...
|
|
static double | GetDouble (String AKey, double ADefault) |
| read a double value More...
|
|
static bool | GetBoolean (String AKey, bool ADefaultValue) |
| return the Boolean value of a parameter or its default value More...
|
|
static bool | ToBoolean (String AValue, bool ADefaultValue) |
| Converts a value given as a string to boolean. If the value cannot be interpreted, the default value is returned. More...
|
|
static string | GetLocalAppDataPath () |
| Gets the Local AppData path, which is normally in (for GB) c:\users\{username}\AppData\Local. On 2X systems this does not persist (it is deleted at the end of a session) - so we need to store local settings somewhere else. More...
|
|
|
static string | ConfigFileName [get] |
| read only property for the filename of the current config file More...
|
|
static string | ApplicationDirectory [get] |
| read only property for the directory where all the binary exe and dll files are More...
|
|
static string | ApplicationBaseDirectory [get] |
| read only property for the base (top level) directory that contains the folders such as db, etc, log and so on More...
|
|
The TAppSettingsManager class allows reading of AppSettings section values in any .NET Configuration File (not just the one that has the same name as the Application itself). It also supports parameters on the command line which override the values in the config file.
◆ TAppSettingsManager() [1/3]
Ict.Common.TAppSettingsManager.TAppSettingsManager |
( |
String |
CustomConfigFileName | ) |
|
|
inline |
Create a TAppSettingsManager that reads AppSettings values from the specified .NET Configuration File.
- Parameters
-
CustomConfigFileName | Name of the .NET Configuration File to read from |
◆ TAppSettingsManager() [2/3]
Ict.Common.TAppSettingsManager.TAppSettingsManager |
( |
| ) |
|
|
inline |
Create a TAppSettingsManager that reads AppSettings values from the Application's standard .NET Configuration File.
◆ TAppSettingsManager() [3/3]
Ict.Common.TAppSettingsManager.TAppSettingsManager |
( |
bool |
AFailOnMissingConfigFile | ) |
|
|
inline |
Create a TAppSettingsManager that reads AppSettings values from the Application's standard .NET Configuration File.
- Parameters
-
AFailOnMissingConfigFile | if this is true and there is no config file, an exception is raised |
◆ GetBoolean()
static bool Ict.Common.TAppSettingsManager.GetBoolean |
( |
String |
AKey, |
|
|
bool |
ADefaultValue |
|
) |
| |
|
inlinestatic |
return the Boolean value of a parameter or its default value
- Parameters
-
AKey | the name of the parameter |
ADefaultValue | the default value in case the parameter cannot be found |
- Returns
- the value of the parameter, or the default value
◆ GetDouble()
static double Ict.Common.TAppSettingsManager.GetDouble |
( |
String |
AKey, |
|
|
double |
ADefault |
|
) |
| |
|
inlinestatic |
read a double value
- Returns
- the value of the parameter or -1.0 if the parameter does not exist on the command line or in the config file
◆ GetFloat()
static float Ict.Common.TAppSettingsManager.GetFloat |
( |
String |
AKey | ) |
|
|
inlinestatic |
read a float value
- Parameters
-
AKey | the name of the parameter |
- Returns
- the value of the parameter or -1.0 if the parameter does not exist on the command line or in the config file
◆ GetInt16()
static System.Int16 Ict.Common.TAppSettingsManager.GetInt16 |
( |
String |
AKey, |
|
|
Int16 |
ADefaultValue = -1 |
|
) |
| |
|
inlinestatic |
return the Integer value of a parameter or its default value
- Parameters
-
AKey | the name of the parameter |
ADefaultValue | the default value in case the parameter cannot be found |
- Returns
- the value of the parameter, or the default value
◆ GetInt32()
static System.Int32 Ict.Common.TAppSettingsManager.GetInt32 |
( |
String |
AKey, |
|
|
System.Int32 |
ADefaultValue = -1 |
|
) |
| |
|
inlinestatic |
Return the Integer value of a parameter or its default value
- Parameters
-
AKey | the name of the parameter |
ADefaultValue | the default value in case the parameter cannot be found |
- Returns
- the value of the parameter, or the default value
◆ GetInt64()
static System.Int64 Ict.Common.TAppSettingsManager.GetInt64 |
( |
String |
AKey, |
|
|
System.Int64 |
ADefaultValue = -1 |
|
) |
| |
|
inlinestatic |
return the Integer value of a parameter or its default value
- Parameters
-
AKey | the name of the parameter |
ADefaultValue | the default value in case the parameter cannot be found |
- Returns
- the value of the parameter, or the default value
◆ GetKeys()
static StringCollection Ict.Common.TAppSettingsManager.GetKeys |
( |
String |
AStartingWith = "" | ) |
|
|
inlinestatic |
return all keys of available options and configuration parameters
- Parameters
-
AStartingWith | only keys starting with this string |
- Returns
◆ GetLocalAppDataPath()
static string Ict.Common.TAppSettingsManager.GetLocalAppDataPath |
( |
| ) |
|
|
inlinestatic |
Gets the Local AppData path, which is normally in (for GB) c:\users\{username}\AppData\Local. On 2X systems this does not persist (it is deleted at the end of a session) - so we need to store local settings somewhere else.
- Returns
◆ GetValue() [1/4]
static String Ict.Common.TAppSettingsManager.GetValue |
( |
String |
AKey | ) |
|
|
inlinestatic |
returns the string value of a parameter, either from command line or from the current config file
- Parameters
-
AKey | the name of the parameter |
- Returns
- returns the string value
◆ GetValue() [2/4]
static String Ict.Common.TAppSettingsManager.GetValue |
( |
String |
AKey, |
|
|
Boolean |
ALogErrorIfNotPresent |
|
) |
| |
|
inlinestatic |
Returns the Value of a specified AppSetting key.
- Parameters
-
AKey | Key of the AppSetting |
ALogErrorIfNotPresent | |
- Returns
- Value of the AppSetting
◆ GetValue() [3/4]
static String Ict.Common.TAppSettingsManager.GetValue |
( |
String |
AKey, |
|
|
String |
ADefaultValue |
|
) |
| |
|
inlinestatic |
returns the string value of a parameter or the default value
- Parameters
-
AKey | the name of the parameter |
ADefaultValue | the default value in case the parameter cannot be found |
- Returns
- returns the string value or the default value
◆ GetValue() [4/4]
static String Ict.Common.TAppSettingsManager.GetValue |
( |
String |
AKey, |
|
|
String |
ADefaultValue, |
|
|
Boolean |
ALogErrorIfNotPresent |
|
) |
| |
|
inlinestatic |
returns the string value of a parameter or the default value
- Parameters
-
AKey | the name of the parameter |
ADefaultValue | the default value in case the parameter cannot be found |
ALogErrorIfNotPresent | |
- Returns
- returns the string value or the default value
◆ HasValue()
static Boolean Ict.Common.TAppSettingsManager.HasValue |
( |
String |
Key | ) |
|
|
inlinestatic |
returns true if the value is on the command line or in the config file
- Returns
- void
◆ ToBoolean()
static bool Ict.Common.TAppSettingsManager.ToBoolean |
( |
String |
AValue, |
|
|
bool |
ADefaultValue |
|
) |
| |
|
inlinestatic |
Converts a value given as a string to boolean. If the value cannot be interpreted, the default value is returned.
- Parameters
-
AValue | the value as a string (true|false|yes|no|0|1) |
ADefaultValue | default value for the situation that AValue does not have a valid value |
- Returns
- boolean value
◆ UNDEFINEDVALUE
const String Ict.Common.TAppSettingsManager.UNDEFINEDVALUE = "#UNDEFINED#" |
|
static |
constant for undefined value
◆ ApplicationBaseDirectory
string Ict.Common.TAppSettingsManager.ApplicationBaseDirectory |
|
staticget |
read only property for the base (top level) directory that contains the folders such as db, etc, log and so on
◆ ApplicationDirectory
string Ict.Common.TAppSettingsManager.ApplicationDirectory |
|
staticget |
read only property for the directory where all the binary exe and dll files are
◆ ConfigFileName
string Ict.Common.TAppSettingsManager.ConfigFileName |
|
staticget |
read only property for the filename of the current config file
The documentation for this class was generated from the following file: