Class IniFile
- Namespace
- PolarStudioGlobals
- Assembly
- PolarStudioGlobals.dll
This class is a wrapper to read/modify an ini-file. Uses win32 API's.
public class IniFile
- Inheritance
-
IniFile
- Inherited Members
- Extension Methods
Constructors
IniFile(string)
Constructor for a specific ini file. If no file is specified, the ExeName.ini in the exe-folder is used.
public IniFile(string IniPath = null)
Parameters
IniPath
stringThe ini file to use. May also start with '#PRIVATE#' or 'WINDIR' for private ini files or the Windows folder.
Methods
DeleteKey(string, string)
Deletes a key from a section.
public IniFile DeleteKey(string Key, string Section = null)
Parameters
Returns
- IniFile
This IniFile object.
DeleteSection(string)
Deletes a section.
public IniFile DeleteSection(string Section = null)
Parameters
Section
stringThe section to delete.
Returns
- IniFile
This IniFile object.
KeyExists(string, string)
Returns True if the key in the section is set to a non-empty value.
public bool KeyExists(string Key, string Section = null)
Parameters
Returns
- bool
True if the key has a non-empty value.
Path()
Returns the actual full path of the ini file.
public string Path()
Returns
Read(string, string, string)
Gets a key from a section.
public string Read(string Key, string Section = null, string pDefaultValue = null)
Parameters
Key
stringThe key of the item.
Section
stringThe section to read from.
pDefaultValue
stringA value to use if the key is not found in the specified section. Is also used if the value was an empty string.
Returns
- string
The value of the key in the specified section or the DefaultValue.
Write(string, string, string)
Writes a value to a key in a section.
public IniFile Write(string Key, string Value, string Section = null)
Parameters
Key
stringThe key to write to.
Value
stringThe value to set.
Section
stringThe section for the key.
Returns
- IniFile
This IniFile object.