Beispiel #1
0
        public TransparentDataOrder(InputByteArray InputArray)
            : base(InputArray, WtdOrder.TransparentData)
        {
            if (InputArray.RemainingLength < 3)
            {
                this.Errmsg = "Transparent data order. end of stream.";
            }

            if (this.Errmsg == null)
            {
                var buf = InputArray.PeekBytes(3);
                this.LLBytes = buf.SubArray(1, 2);

                // this is all wrong. was a bug workaround. should instead process the
                // LLBytes as a big endian length value.
                //          throw new Exception("TransparentDataOrder order does not handle LL length correctly");

                // advance past order code and LL bytes.
                this.BytesLength += 2;
                InputArray.AdvanceIndex(3);

                // bytes after the LL byte pair are bytes to show on the display ??
                var rv     = Common5250.ScanNonTextDataByte(InputArray);
                int textLx = rv.Item2;
                this.BytesLength    += textLx;
                this.TransparentData = InputArray.GetEbcdicBytes(textLx);
            }
        }
Beispiel #2
0
        public static TextDataOrder Factory(InputByteArray InputArray)
        {
            byte?  attrByte    = null;
            string displayText = null;

            // scan forward in the input array for a non text character.
            int ix    = ScanNonTextDataByte(InputArray);
            int remLx = ix - InputArray.Index;

            // first byte is the attribute byte.
            {
                var b1 = InputArray.PeekByte(0);
                if ((b1 >= 0x20) && (b1 <= 0x2f))
                {
                    attrByte = b1;
                    InputArray.AdvanceIndex(1);
                    remLx -= 1;
                }
            }

            // remaining bytes are text characters in ebcdic.
            if (remLx > 0)
            {
                System.Text.Encoding encoding =
                    System.Text.Encoding.GetEncoding(37); // 37 = ebcdic
                displayText = InputArray.GetEbcdicBytes(remLx);
            }

            TextDataOrder tdOrder = new TextDataOrder(attrByte, displayText);

            return(tdOrder);
        }