public override int ReadElementContentAsBinHex(byte[] buffer, int index, int count)
        {
            if (ReadState != ReadState.Interactive)
            {
                return(0);
            }

            // init ReadContentAsBinaryHelper when called first time
            if (_state != State.InReadBinary)
            {
                _readBinaryHelper = ReadContentAsBinaryHelper.CreateOrReset(_readBinaryHelper, this);
                _savedState       = _state;
            }

            // turn off InReadBinary state in order to have a normal Read() behavior when called from readBinaryHelper
            _state = _savedState;

            // call to the helper
            int readCount = _readBinaryHelper.ReadElementContentAsBinHex(buffer, index, count);

            // turn on InReadBinary state again and return
            _savedState = _state;
            _state      = State.InReadBinary;
            return(readCount);
        }
        public override int ReadElementContentAsBinHex(byte[] buffer, int index, int count)
        {
            if (this.ReadState != System.Xml.ReadState.Interactive)
            {
                return(0);
            }
            if (this.state != State.InReadBinary)
            {
                this.readBinaryHelper = ReadContentAsBinaryHelper.CreateOrReset(this.readBinaryHelper, this);
                this.savedState       = this.state;
            }
            this.state = this.savedState;
            int num = this.readBinaryHelper.ReadElementContentAsBinHex(buffer, index, count);

            this.savedState = this.state;
            this.state      = State.InReadBinary;
            return(num);
        }
示例#3
0
        public override int ReadElementContentAsBinHex(byte[] buffer, int index, int count)
        {
            if (ReadState != ReadState.Interactive)
            {
                return 0;
            }

            // init ReadContentAsBinaryHelper when called first time
            if (_state != State.InReadBinary)
            {
                _readBinaryHelper = ReadContentAsBinaryHelper.CreateOrReset(_readBinaryHelper, this);
                _savedState = _state;
            }

            // turn off InReadBinary state in order to have a normal Read() behavior when called from readBinaryHelper
            _state = _savedState;

            // call to the helper
            int readCount = _readBinaryHelper.ReadElementContentAsBinHex(buffer, index, count);

            // turn on InReadBinary state again and return
            _savedState = _state;
            _state = State.InReadBinary;
            return readCount;
        }