Table of Contents

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 string

The 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

Key string

The key to delete.

Section string

The section to delete the key from.

Returns

IniFile

This IniFile object.

DeleteSection(string)

Deletes a section.

public IniFile DeleteSection(string Section = null)

Parameters

Section string

The 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

Key string

The key to test.

Section string

The section to read the key from.

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

string

Read(string, string, string)

Gets a key from a section.

public string Read(string Key, string Section = null, string pDefaultValue = null)

Parameters

Key string

The key of the item.

Section string

The section to read from.

pDefaultValue string

A 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 string

The key to write to.

Value string

The value to set.

Section string

The section for the key.

Returns

IniFile

This IniFile object.