IsProfilePresent
Tests that a profile exists and that a specific section and key exists within it.
Member of namespace
FileIOSyntax
bool IsProfilePresent (string filename, string section, string key, bool testExistence)
Parameters
- filename
- Type: string
- section
- Type: string
- key
- Type: string
- testExistence
- Type: bool
Parameters
- filename : The INI file name.
- section : The section within the file.
- key : The key within the section.
- testExistence : true tests that the it exists, false tests that it does not exist.
The filename, section, and key parameters can accept smart parameters.
Returns
True if testExistence is true and the section and key is found within the profile and the key has an assigned value. True if testExistence is false and the section or key is not found within the profile or the key value is blank. Otherwise, False.Level
All levels.Details
Checks that a specific section and key exists within a settings file, typically an INI file. It does not test the value of the key, only that a value exists.- Example
IsProfilePresent("C:\MyDir\settings.ini", "mysection", "mykey", true)In this example, if settings.ini exists and contains mysection, mykey and if mykey has a non-blank value, it returns True.