System.Xml.XmlTextReaderImpl.UnDecodeChars C# (CSharp) Method

UnDecodeChars() private method

private UnDecodeChars ( ) : void
return void
        private void UnDecodeChars()
        {
            Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null);
            Debug.Assert(_ps.appendMode, "UnDecodeChars cannot be called after ps.appendMode has been changed to false");

            Debug.Assert(_ps.charsUsed >= _ps.charPos, "The current position must be in the valid character range.");
            if (_maxCharactersInDocument > 0)
            {
                // We're returning back in the input (potentially) so we need to fixup
                //   the character counters to avoid counting some of them twice.
                // The following code effectively rolls-back all decoded characters
                //   after the ps.charPos (which typically points to the first character
                //   after the XML decl).
                Debug.Assert(_charactersInDocument >= _ps.charsUsed - _ps.charPos,
                    "We didn't correctly count some of the decoded characters against the MaxCharactersInDocument.");
                _charactersInDocument -= _ps.charsUsed - _ps.charPos;
            }
            if (_maxCharactersFromEntities > 0)
            {
                if (InEntity)
                {
                    Debug.Assert(_charactersFromEntities >= _ps.charsUsed - _ps.charPos,
                        "We didn't correctly count some of the decoded characters against the MaxCharactersFromEntities.");
                    _charactersFromEntities -= _ps.charsUsed - _ps.charPos;
                }
            }

            _ps.bytePos = _documentStartBytePos; // byte position after preamble
            if (_ps.charPos > 0)
            {
                _ps.bytePos += _ps.encoding.GetByteCount(_ps.chars, 0, _ps.charPos);
            }
            _ps.charsUsed = _ps.charPos;
            _ps.isEof = false;
        }
XmlTextReaderImpl