示例#1
0
        /// <include file='IniReader.xml' path='//Method[@name="Close"]/docs/*' />
        public void Close()
        {
            Reset();
            readState = IniReadState.Closed;

            if (textReader != null)
            {
                textReader.Close();
            }
        }
示例#2
0
        /// <include file='IniReader.xml' path='//Method[@name="Read"]/docs/*' />
        public bool Read()
        {
            bool result = false;

            if (readState != IniReadState.EndOfFile ||
                readState != IniReadState.Closed)
            {
                readState = IniReadState.Interactive;
                result    = ReadNext();
            }

            return(result);
        }
示例#3
0
        /// <summary>
        /// Reads the next INI line item.
        /// </summary>
        private bool ReadNext()
        {
            bool result = true;
            int  ch     = PeekChar();

            Reset();

            if (IsComment(ch))
            {
                iniType = IniType.Empty;
                ReadChar(); // consume comment character
                ReadComment();


                return(result);
            }


            switch (ch)
            {
            case ' ':
            case '\t':
            case '\r':
                SkipWhitespace();
                ReadNext();
                break;

            case '\n':
                ReadChar();
                break;

            case '[':
                ReadSection();
                break;

            case -1:
                readState = IniReadState.EndOfFile;
                result    = false;
                break;

            default:
                ReadKey();
                break;
            }

            return(result);
        }
        /// <summary>
        /// Reads the next INI line item.
        /// </summary>
        private bool ReadNext()
        {
            bool result = true;
            int ch = PeekChar ();
            Reset ();

            if (IsComment (ch)) {
                iniType = IniType.Empty;
                ReadChar (); // consume comment character
                ReadComment ();

                return result;
            }

            switch (ch)
            {
                case ' ':
                case '\t':
                case '\r':
                    SkipWhitespace ();
                    ReadNext ();
                    break;
                case '\n':
                    ReadChar ();
                    break;
                case '[':
                    ReadSection ();
                    break;
                case -1:
                    readState = IniReadState.EndOfFile;
                    result = false;
                    break;
                default:
                    ReadKey ();
                    break;
            }

            return result;
        }
        /// <include file='IniReader.xml' path='//Method[@name="Read"]/docs/*' />
        public bool Read()
        {
            bool result = false;

            if (readState != IniReadState.EndOfFile
                || readState != IniReadState.Closed) {
                readState = IniReadState.Interactive;
                result = ReadNext ();
            }

            return result;
        }
        /// <include file='IniReader.xml' path='//Method[@name="Close"]/docs/*' />
        public void Close()
        {
            Reset ();
            readState = IniReadState.Closed;

            if (textReader != null) {
                textReader.Close ();
            }
        }