C# Class ClientLauncher.IniFiles

Provides methods for reading and writing to an INI file.
Mostra file Open project: swganhtools/swganhclientlauncher Class Usage Examples

Public Methods

Method Description
AddDuplicateKey ( string strSectionName, string strKeyName, string strKeyValue ) : void
DeleteKey ( string sectionName, string keyName ) : void

Deletes the specified key from the specified section.

DeleteSection ( string sectionName ) : void

Deletes a section from the ini file.

GetDouble ( string sectionName, string keyName, double defaultValue ) : double

Gets the value of a setting in an ini file as a T:System.Double.

GetInt16 ( string sectionName, string keyName, short defaultValue ) : int

Gets the value of a setting in an ini file as a T:System.Int16.

GetInt32 ( string sectionName, string keyName, int defaultValue ) : int

Gets the value of a setting in an ini file as a T:System.Int32.

GetKeyNames ( string sectionName ) : string[]

Gets the names of all keys under a specific section in the ini file.

The total length of all key names in the section must be less than 32KB in length.

GetSectionNames ( ) : string[]

Gets the names of all sections in the ini file.

The total length of all section names in the section must be less than 32KB in length.

GetSectionValues ( string sectionName ) : string>.Dictionary

Gets all of the values in a section as a dictionary.

If a section contains more than one key with the same name, this function only returns the first instance. If you need to get all key/value pairs within a section even when keys have the same name, use GetSectionValuesAsList.

GetSectionValuesAsList ( string sectionName ) : string>>.List

Gets all of the values in a section as a list.

GetString ( string sectionName, string keyName, string defaultValue ) : string

Gets the value of a setting in an ini file as a T:System.String.

The retreived value must be less than 32KB in length.

IniFiles ( string path ) : System

Initializes a new instance of the IniFile class.

WriteValue ( string sectionName, string keyName, double value ) : void

Writes an T:System.Double value to the ini file.

WriteValue ( string sectionName, string keyName, float value ) : void

Writes an T:System.Single value to the ini file.

WriteValue ( string sectionName, string keyName, int value ) : void

Writes an T:System.Int32 value to the ini file.

WriteValue ( string sectionName, string keyName, short value ) : void

Writes an T:System.Int16 value to the ini file.

WriteValue ( string sectionName, string keyName, string value ) : void

Writes a T:System.String value to the ini file.

Private Methods

Method Description
ConvertNullSeperatedStringToStringArray ( IntPtr ptr, int valLength ) : string[]

Converts the null seperated pointer to a string into a string array.

WriteValueInternal ( string sectionName, string keyName, string value ) : void

Writes a T:System.String value to the ini file.

Method Details

AddDuplicateKey() public method

public AddDuplicateKey ( string strSectionName, string strKeyName, string strKeyValue ) : void
strSectionName string
strKeyName string
strKeyValue string
return void

DeleteKey() public method

Deletes the specified key from the specified section.
/// or are /// a null reference (Nothing in VB) ///
public DeleteKey ( string sectionName, string keyName ) : void
sectionName string /// Name of the section to remove the key from. ///
keyName string /// Name of the key to remove. ///
return void

DeleteSection() public method

Deletes a section from the ini file.
/// is a null reference (Nothing in VB) ///
public DeleteSection ( string sectionName ) : void
sectionName string /// Name of the section to delete. ///
return void

GetDouble() public method

Gets the value of a setting in an ini file as a T:System.Double.
/// or are /// a null reference (Nothing in VB) ///
public GetDouble ( string sectionName, string keyName, double defaultValue ) : double
sectionName string The name of the section to read from.
keyName string The name of the key in section to read.
defaultValue double The default value to return if the key /// cannot be found.
return double

GetInt16() public method

Gets the value of a setting in an ini file as a T:System.Int16.
/// or are /// a null reference (Nothing in VB) ///
public GetInt16 ( string sectionName, string keyName, short defaultValue ) : int
sectionName string The name of the section to read from.
keyName string The name of the key in section to read.
defaultValue short The default value to return if the key /// cannot be found.
return int

GetInt32() public method

Gets the value of a setting in an ini file as a T:System.Int32.
/// or are /// a null reference (Nothing in VB) ///
public GetInt32 ( string sectionName, string keyName, int defaultValue ) : int
sectionName string The name of the section to read from.
keyName string The name of the key in section to read.
defaultValue int The default value to return if the key /// cannot be found.
return int

GetKeyNames() public method

Gets the names of all keys under a specific section in the ini file.
The total length of all key names in the section must be less than 32KB in length.
/// is a null reference (Nothing in VB) ///
public GetKeyNames ( string sectionName ) : string[]
sectionName string /// The name of the section to read key names from. ///
return string[]

GetSectionNames() public method

Gets the names of all sections in the ini file.
The total length of all section names in the section must be less than 32KB in length.
public GetSectionNames ( ) : string[]
return string[]

GetSectionValues() public method

Gets all of the values in a section as a dictionary.
If a section contains more than one key with the same name, this function only returns the first instance. If you need to get all key/value pairs within a section even when keys have the same name, use GetSectionValuesAsList.
/// is a null reference (Nothing in VB) ///
public GetSectionValues ( string sectionName ) : string>.Dictionary
sectionName string /// Name of the section to retrieve values from. ///
return string>.Dictionary

GetSectionValuesAsList() public method

Gets all of the values in a section as a list.
/// is a null reference (Nothing in VB) ///
public GetSectionValuesAsList ( string sectionName ) : string>>.List
sectionName string /// Name of the section to retrieve values from. ///
return string>>.List

GetString() public method

Gets the value of a setting in an ini file as a T:System.String.
The retreived value must be less than 32KB in length.
/// or are /// a null reference (Nothing in VB) ///
public GetString ( string sectionName, string keyName, string defaultValue ) : string
sectionName string The name of the section to read from.
keyName string The name of the key in section to read.
defaultValue string The default value to return if the key /// cannot be found.
return string

IniFiles() public method

Initializes a new instance of the IniFile class.
public IniFiles ( string path ) : System
path string The ini file to read and write from.
return System

WriteValue() public method

Writes an T:System.Double value to the ini file.
/// The write failed. /// /// or are /// a null reference (Nothing in VB) ///
public WriteValue ( string sectionName, string keyName, double value ) : void
sectionName string The name of the section to write to .
keyName string The name of the key to write to.
value double The value to write
return void

WriteValue() public method

Writes an T:System.Single value to the ini file.
/// The write failed. /// /// or are /// a null reference (Nothing in VB) ///
public WriteValue ( string sectionName, string keyName, float value ) : void
sectionName string The name of the section to write to .
keyName string The name of the key to write to.
value float The value to write
return void

WriteValue() public method

Writes an T:System.Int32 value to the ini file.
/// The write failed. /// /// or are /// a null reference (Nothing in VB) ///
public WriteValue ( string sectionName, string keyName, int value ) : void
sectionName string The name of the section to write to .
keyName string The name of the key to write to.
value int The value to write
return void

WriteValue() public method

Writes an T:System.Int16 value to the ini file.
/// The write failed. ///
public WriteValue ( string sectionName, string keyName, short value ) : void
sectionName string The name of the section to write to .
keyName string The name of the key to write to.
value short The value to write
return void

WriteValue() public method

Writes a T:System.String value to the ini file.
/// The write failed. /// /// or or /// are a null reference (Nothing in VB) ///
public WriteValue ( string sectionName, string keyName, string value ) : void
sectionName string The name of the section to write to .
keyName string The name of the key to write to.
value string The string value to write
return void