C# Class BEGroup.Utility.IniFile

Represents a Windows standard INI file
ファイルを表示 Open project: betenner/betrainer

Public Methods

Method Description
Clear ( ) : void

Clears the entire INI file.

ContainsKey ( string section, string key ) : bool

Determines whether this INI file contains the specified key in the specified section.

ContainsSection ( string section ) : bool

Determines whether this INI file contains the specified section.

CreateKey ( string section, string key ) : void

Creates an empty key to this INI file, if the key already exists, nothing will be done. If the section does not exist, it will be created.

CreateSection ( string section ) : void

Creates an empty section to this INI file, if the section already exists, nothing will be done.

GetValue ( string section, string key ) : string

Gets the value with the specified section and the specified key.

IniFile ( string path ) : System

Opens the specified INI file, if the file does not exist, create one.

RemoveKey ( string section, string key ) : void

Removes the specified key in the specified section, if the key and/or section does not exist, nothing will be done.

RemoveKeysStartsWith ( string section, string startsWith, bool ignoreCase = true ) : void

Removes all key/value pairs that with the key starts with the specified string in the specified section.

RemoveSection ( string section ) : void

Removes the specified section and all its key/value pairs, if the section does not exist, nothing will be done.

RemoveSectionsStartsWith ( string startsWith, bool ignoreCase = true ) : void

Removes all sections that with the name starts with the specified string.

Save ( ) : void

Saves the current INI file.

SaveAs ( string path, bool overwrite = true ) : void

Saves this INI file to the specified path.

SetValue ( string section, string key, string value ) : void

Sets the value of the specified key in the specified section. If the section and/or key does not exist, they will be created.

Method Details

Clear() public method

Clears the entire INI file.
public Clear ( ) : void
return void

ContainsKey() public method

Determines whether this INI file contains the specified key in the specified section.
public ContainsKey ( string section, string key ) : bool
section string Section name
key string Key name
return bool

ContainsSection() public method

Determines whether this INI file contains the specified section.
public ContainsSection ( string section ) : bool
section string Section name
return bool

CreateKey() public method

Creates an empty key to this INI file, if the key already exists, nothing will be done. If the section does not exist, it will be created.
public CreateKey ( string section, string key ) : void
section string Section name
key string Key name
return void

CreateSection() public method

Creates an empty section to this INI file, if the section already exists, nothing will be done.
public CreateSection ( string section ) : void
section string Section name
return void

GetValue() public method

Gets the value with the specified section and the specified key.
public GetValue ( string section, string key ) : string
section string Section name
key string Key name
return string

IniFile() public method

Opens the specified INI file, if the file does not exist, create one.
public IniFile ( string path ) : System
path string Path of the file
return System

RemoveKey() public method

Removes the specified key in the specified section, if the key and/or section does not exist, nothing will be done.
public RemoveKey ( string section, string key ) : void
section string Section name
key string Key name
return void

RemoveKeysStartsWith() public method

Removes all key/value pairs that with the key starts with the specified string in the specified section.
public RemoveKeysStartsWith ( string section, string startsWith, bool ignoreCase = true ) : void
section string Section name
startsWith string Starts with string
ignoreCase bool true to ignore case; otherwise false
return void

RemoveSection() public method

Removes the specified section and all its key/value pairs, if the section does not exist, nothing will be done.
public RemoveSection ( string section ) : void
section string Section name
return void

RemoveSectionsStartsWith() public method

Removes all sections that with the name starts with the specified string.
public RemoveSectionsStartsWith ( string startsWith, bool ignoreCase = true ) : void
startsWith string Starts with string
ignoreCase bool true to ignore case; otherwise false
return void

Save() public method

Saves the current INI file.
public Save ( ) : void
return void

SaveAs() public method

Saves this INI file to the specified path.
public SaveAs ( string path, bool overwrite = true ) : void
path string Path of the INI file
overwrite bool whether to overwrite if the target file exists
return void

SetValue() public method

Sets the value of the specified key in the specified section. If the section and/or key does not exist, they will be created.
public SetValue ( string section, string key, string value ) : void
section string Section name
key string Key name
value string Value
return void