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

Responsible for parsing an string from an ini file, and creating an IniData structure.
显示文件 Open project: demiurghg/FusionEngine Class Usage Examples

Public Methods

Method 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

Protected Methods

Method 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

Method 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 method

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. ///
return string

ExtractKey() protected method

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 ///
return string

ExtractValue() protected method

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 ///
return string

HandleDuplicatedKeyInCollection() protected method

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
return void

IniDataParser() public method

Ctor
The parser uses a IniParserConfiguration by default
public IniDataParser ( ) : System
return System

IniDataParser() public method

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

LineContainsAComment() protected method

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

LineMatchesAKeyOnly() protected method

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

LineMatchesAKeyValuePair() protected method

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

LineMatchesASection() protected method

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

Parse() public method

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 ///
return Fusion.Core.IniParser.Model.IniData

ProcessKeyOnly() protected method

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
return void

ProcessKeyValuePair() protected method

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
return void

ProcessLine() protected method

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
return void

ProcessSection() protected method

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
return void