C# Класс ClientLauncher.IniFiles

Provides methods for reading and writing to an INI file.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

AddDuplicateKey() публичный Метод

public AddDuplicateKey ( string strSectionName, string strKeyName, string strKeyValue ) : void
strSectionName string
strKeyName string
strKeyValue string
Результат void

DeleteKey() публичный Метод

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. ///
Результат void

DeleteSection() публичный Метод

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. ///
Результат void

GetDouble() публичный Метод

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.
Результат double

GetInt16() публичный Метод

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.
Результат int

GetInt32() публичный Метод

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.
Результат int

GetKeyNames() публичный Метод

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. ///
Результат string[]

GetSectionNames() публичный Метод

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[]
Результат string[]

GetSectionValues() публичный Метод

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. ///
Результат string>.Dictionary

GetSectionValuesAsList() публичный Метод

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. ///
Результат string>>.List

GetString() публичный Метод

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.
Результат string

IniFiles() публичный Метод

Initializes a new instance of the IniFile class.
public IniFiles ( string path ) : System
path string The ini file to read and write from.
Результат System

WriteValue() публичный Метод

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
Результат void

WriteValue() публичный Метод

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
Результат void

WriteValue() публичный Метод

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
Результат void

WriteValue() публичный Метод

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
Результат void

WriteValue() публичный Метод

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
Результат void