C# Class Fusion.Core.IniParser.Parser.IniDataParser

Responsible for parsing an string from an ini file, and creating an IniData structure.
Afficher le fichier Open project: demiurghg/FusionEngine Class Usage Examples

Méthodes publiques

Méthode Description
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

Méthodes protégées

Méthode Description
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.

Private Methods

Méthode Description
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

Method Details

ExtractComment() protected méthode

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. ///
Résultat string

ExtractKey() protected méthode

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 ///
Résultat string

ExtractValue() protected méthode

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 ///
Résultat string

HandleDuplicatedKeyInCollection() protected méthode

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
Résultat void

IniDataParser() public méthode

Ctor
The parser uses a IniParserConfiguration by default
public IniDataParser ( ) : System
Résultat System

IniDataParser() public méthode

Ctor
public IniDataParser ( IniParserConfiguration parserConfiguration ) : System
parserConfiguration Fusion.Core.IniParser.Model.Configuration.IniParserConfiguration /// Parser's instance. ///
Résultat System

LineContainsAComment() protected méthode

Checks if a given string contains a comment.
protected LineContainsAComment ( string line ) : bool
line string /// String with a line to be checked. ///
Résultat bool

LineMatchesAKeyOnly() protected méthode

Checks if a given string represents a key-only line
protected LineMatchesAKeyOnly ( string line ) : bool
line string /// The string to be checked. ///
Résultat bool

LineMatchesAKeyValuePair() protected méthode

Checks if a given string represents a key / value pair.
protected LineMatchesAKeyValuePair ( string line ) : bool
line string /// The string to be checked. ///
Résultat bool

LineMatchesASection() protected méthode

Checks if a given string represents a section delimiter.
protected LineMatchesASection ( string line ) : bool
line string /// The string to be checked. ///
Résultat bool

Parse() public méthode

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 ///
Résultat Fusion.Core.IniParser.Model.IniData

ProcessKeyOnly() protected méthode

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
Résultat void

ProcessKeyValuePair() protected méthode

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
Résultat void

ProcessLine() protected méthode

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
Résultat void

ProcessSection() protected méthode

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
Résultat void