C# Класс Fusion.Core.IniParser.Parser.IniDataParser

Responsible for parsing an string from an ini file, and creating an IniData structure.
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
IniDataParser ( ) : System

Ctor

The parser uses a IniParserConfiguration by default

IniDataParser ( IniParserConfiguration parserConfiguration ) : System

Ctor

Parse ( string iniDataString ) : IniData

Parses a string containing valid ini data

Защищенные методы

Метод Описание
ExtractComment ( string line ) : string

Removes a comment from a string if exist, and returns the string without the comment substring.

ExtractKey ( string s ) : string

Extracts the key portion of a string containing a key/value pair..

ExtractValue ( string s ) : string

Extracts the value portion of a string containing a key/value pair..

HandleDuplicatedKeyInCollection ( string key, string value, KeyDataCollection keyDataCollection, string sectionName ) : void

Abstract Method that decides what to do in case we are trying to add a duplicated key to a section

LineContainsAComment ( string line ) : bool

Checks if a given string contains a comment.

LineMatchesAKeyOnly ( string line ) : bool

Checks if a given string represents a key-only line

LineMatchesAKeyValuePair ( string line ) : bool

Checks if a given string represents a key / value pair.

LineMatchesASection ( string line ) : bool

Checks if a given string represents a section delimiter.

ProcessKeyOnly ( string line, IniData currentIniData ) : void

Processes a string containing an ini key/value pair.

ProcessKeyValuePair ( string line, IniData currentIniData ) : void

Processes a string containing an ini key/value pair.

ProcessLine ( string currentLine, IniData currentIniData ) : void

Processes one line and parses the data found in that line (section or key/value pair who may or may not have comments)

ProcessSection ( string line, IniData currentIniData ) : void

Proccess a string which contains an ini section.

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

Метод Описание
AddKeyToKeyValueCollection ( string key, string value, KeyDataCollection keyDataCollection, string sectionName ) : void

Adds a key to a concrete KeyDataCollection instance, checking if duplicate keys are allowed in the configuration

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

ExtractComment() защищенный Метод

Removes a comment from a string if exist, and returns the string without the comment substring.
protected ExtractComment ( string line ) : string
line string /// The string we want to remove the comments from. ///
Результат string

ExtractKey() защищенный Метод

Extracts the key portion of a string containing a key/value pair..
protected ExtractKey ( string s ) : string
s string /// The string to be processed, which contains a key/value pair ///
Результат string

ExtractValue() защищенный Метод

Extracts the value portion of a string containing a key/value pair..
protected ExtractValue ( string s ) : string
s string /// The string to be processed, which contains a key/value pair ///
Результат string

HandleDuplicatedKeyInCollection() защищенный Метод

Abstract Method that decides what to do in case we are trying to add a duplicated key to a section
protected HandleDuplicatedKeyInCollection ( string key, string value, KeyDataCollection keyDataCollection, string sectionName ) : void
key string
value string
keyDataCollection KeyDataCollection
sectionName string
Результат void

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

Ctor
The parser uses a IniParserConfiguration by default
public IniDataParser ( ) : System
Результат System

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

Ctor
public IniDataParser ( IniParserConfiguration parserConfiguration ) : System
parserConfiguration Fusion.Core.IniParser.Model.Configuration.IniParserConfiguration /// Parser's instance. ///
Результат System

LineContainsAComment() защищенный Метод

Checks if a given string contains a comment.
protected LineContainsAComment ( string line ) : bool
line string /// String with a line to be checked. ///
Результат bool

LineMatchesAKeyOnly() защищенный Метод

Checks if a given string represents a key-only line
protected LineMatchesAKeyOnly ( string line ) : bool
line string /// The string to be checked. ///
Результат bool

LineMatchesAKeyValuePair() защищенный Метод

Checks if a given string represents a key / value pair.
protected LineMatchesAKeyValuePair ( string line ) : bool
line string /// The string to be checked. ///
Результат bool

LineMatchesASection() защищенный Метод

Checks if a given string represents a section delimiter.
protected LineMatchesASection ( string line ) : bool
line string /// The string to be checked. ///
Результат bool

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

Parses a string containing valid ini data
/// Thrown if the data could not be parsed ///
public Parse ( string iniDataString ) : IniData
iniDataString string /// String with data ///
Результат Fusion.Core.IniParser.Model.IniData

ProcessKeyOnly() защищенный Метод

Processes a string containing an ini key/value pair.
protected ProcessKeyOnly ( string line, IniData currentIniData ) : void
line string /// The string to be processed ///
currentIniData Fusion.Core.IniParser.Model.IniData
Результат void

ProcessKeyValuePair() защищенный Метод

Processes a string containing an ini key/value pair.
protected ProcessKeyValuePair ( string line, IniData currentIniData ) : void
line string /// The string to be processed ///
currentIniData Fusion.Core.IniParser.Model.IniData
Результат void

ProcessLine() защищенный Метод

Processes one line and parses the data found in that line (section or key/value pair who may or may not have comments)
protected ProcessLine ( string currentLine, IniData currentIniData ) : void
currentLine string The string with the line to process
currentIniData Fusion.Core.IniParser.Model.IniData
Результат void

ProcessSection() защищенный Метод

Proccess a string which contains an ini section.
protected ProcessSection ( string line, IniData currentIniData ) : void
line string /// The string to be processed ///
currentIniData Fusion.Core.IniParser.Model.IniData
Результат void