Exemplo n.º 1
0
        /// <summary>
        ///     Returns a proper INI reader depending upon the type parameter.
        /// </summary>
        private IniReader GetIniReader(TextReader reader, IniFileType type)
        {
            var result = new IniReader(reader);

            switch (type)
            {
            case IniFileType.Standard:
                // do nothing
                break;

            case IniFileType.PythonStyle:
                result.AcceptCommentAfterKey = false;
                result.SetCommentDelimiters(new[] { ';', '#' });
                result.SetAssignDelimiters(new[] { ':' });
                break;

            case IniFileType.SambaStyle:
                result.AcceptCommentAfterKey = false;
                result.SetCommentDelimiters(new[] { ';', '#' });
                result.LineContinuation = true;
                break;

            case IniFileType.MysqlStyle:
                result.AcceptCommentAfterKey      = false;
                result.AcceptNoAssignmentOperator = true;
                result.SetCommentDelimiters(new[] { '#' });
                result.SetAssignDelimiters(new[] { ':', '=' });
                break;

            case IniFileType.WindowsStyle:
                result.ConsumeAllKeyText = true;
                break;
            }

            return(result);
        }
Exemplo n.º 2
0
 /// <include file='IniException.xml' path='//Constructor[@name="ConstructorTextReader"]/docs/*' />
 internal IniException(IniReader reader, string message)
     : this(message)
 {
     iniReader    = reader;
     this.message = message;
 }
Exemplo n.º 3
0
 /// <include file='IniDocument.xml' path='//Constructor[@name="ConstructorIniReader"]/docs/*' />
 public IniDocument(IniReader reader)
 {
     FileType = IniFileType.Standard;
     Load(reader);
 }
Exemplo n.º 4
0
 /// <include file='IniDocument.xml' path='//Method[@name="LoadIniReader"]/docs/*' />
 public void Load(IniReader reader)
 {
     LoadReader(reader);
 }