Exemplo n.º 1
0
        private void _ValidateData()
        {
            int dataLen = _bytes.Length;

            if (dataLen <= 0)
            {
                return;
            }
            _version = PrnVersion.V2;
            while (_bt == ESC && _index < 120)
            {
                _next();
            }
            if (_index == V2_HEADER_LENGTH)
            {
            }
            else
            {
            }
            if (!(_bt == ESC && _next() == RESET))
            {
                return;
            }
            if (_next() == ESC && _next() == DOT_TAB_OFFSET)
            {
                _dotTabOffset = _next();
            }
            if (_next() == ESC && _next() == LENGTH_COMMAND)
            {
                //  _labelLen = _next() + _next() * 255;
                _labelLen = _next() * 256 + _next();
                //ESC, LCmd, (byte) (length >> 8), (byte) length }; - label len
            }
            if (_next() == ESC && _next() == WIDTH_COMMAND)
            {
                _labelWidth = _next() * 256 + _next();
            }
            if (_next() == ESC)
            {
                _next();
                if (_bt != RESOLUTION_HIGH && _bt != RESOLUTION_NORMAL)
                {
                    throw new Exception("Invalide format");
                }
                _use_high_resolution = _bt == RESOLUTION_HIGH;
            }
            //if(_next() == ESC && _next() == FEED_LINES_COMMAND)
            //{
            //    _feedLines = _next() * 256 + _next();
            //}
            //int i = 0;
            //while(i< _labelWidth)
            //{
            //    i++;
            //    _next();
            //}
            _next();
            _dataOffset = _index;
        }
Exemplo n.º 2
0
        private void _ValidateDataV3()
        {
            int dataLen = _bytes.Length;

            if (dataLen <= 0)
            {
                return;
            }
            _version = PrnVersion.V2;
            if (!(_bt == ESC && _next() == RESET))
            {
                return;
            }
            if (_next() == ESC && _next() == DOT_TAB_OFFSET)
            {
                _dotTabOffset = _next();
            }
            if (_next() == ESC)
            {
                _next();
                if (_bt != RESOLUTION_HIGH_V3)
                {
                    throw new Exception("Invalide format");
                }
                _use_high_resolution = _bt == RESOLUTION_HIGH_V3;
            }
            //if(_next() == ESC && _next() == FEED_LINES_COMMAND)
            //{
            //    _feedLines = _next() * 256 + _next();
            //}
            //int i = 0;
            //while(i< _labelWidth)
            //{
            //    i++;
            //    _next();
            //}
            _next();
            _dataOffset = _index;
        }