Class IniParser
The parser for simple ini-style translation files.
public class IniParser : BaseKeyValueParser
- Inheritance
-
IniParser
- Inherited Members
Properties
LineCommentChar
protected override char LineCommentChar { get; }
Property Value
TextProcessingMode
Gets or sets the text processing mode to use when decoding potentially escaped strings and when recognizing template strings in translation entries.
public static TextFormat TextProcessingMode { get; set; }
Property Value
Methods
AcceptUnquotedEmptyValues()
protected override bool AcceptUnquotedEmptyValues()
Returns
CanHandleExtension(string)
Checks whether this parser can handle a translation file with the given extension.
This method is not used for configuration files.
public override bool CanHandleExtension(string fileExtension)
Parameters
fileExtensionstringThe extension to check.
Returns
GetTextProcessingMode()
Used for internal needs.
protected override TextFormat GetTextProcessingMode()
Returns
- TextFormat
The effective text processing mode.
InternalLoadTranslationStructure(string, TextFormat?)
Loads the keys from the default translation file and builds a tree of keys.
protected override TranslationTree? InternalLoadTranslationStructure(string content, TextFormat? textProcessingMode)
Parameters
contentstringThe content to parse.
textProcessingModeTextFormat?The mode of processing of the text of the default file.
Returns
- TranslationTree
The constructed TranslationTree upon success or null otherwise.
Exceptions
- TextParseException
Gets thrown when parsing of a default translation file fails.
IsEndOfKey(string, int, out int)
protected override bool? IsEndOfKey(string content, int offset, out int newPosition)
Parameters
Returns
- bool?
IsEndOfValue(string, int, out int)
Detects if the end of a value has been reached.
protected override bool? IsEndOfValue(string content, int offset, out int newPosition)
Parameters
contentstringcontent to check.
offsetintcurrent position within the content.
newPositionintupon return is set to a position next to the end-of-value marker (indicates to which value the pointer must be set).
Returns
- bool?
true if the end of the value has been reached, false if the end has not been reached, and null if the end of line was encountered and a single-line value was not closed.
Exceptions
- TextParseException
thrown when an error occurs.
IsSeparatorChar(char)
protected override bool IsSeparatorChar(char candidate)
Parameters
candidatechar
Returns
IsStartOfKey(string, int)
protected override bool IsStartOfKey(string content, int offset)
Parameters
Returns
IsStartOfValue(string, int, out int)
protected override bool IsStartOfValue(string content, int offset, out int posAfterStart)
Parameters
Returns
IsValidKeyChar(string, int)
protected override bool IsValidKeyChar(string content, int offset)
Parameters
Returns
UnwrapKey(string)
Strips format-specific markers that denote the beginning and the end of a value.
protected override string UnwrapKey(string value)
Parameters
valuestringThe value to strip.
Returns
- string
The text inside the markers.
UnwrapValue(string)
Strips format-specific markers that denote the beginning and the end of a value.
protected override (string? escaped, string unescaped) UnwrapValue(string value)
Parameters
valuestringThe value to strip.
Returns
Use()
Initializes the parser class, making it available for use.
public static void Use()