コード例 #1
0
        /// <summary>
        /// Gets the field attributes of the field at the specified coordinates.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public FieldAttributes GetFieldAttribute(int x, int y)
        {
            byte b = 0;

            lock (tn)
            {
                b = (byte)tn.Controller.GetFieldAttribute(tn.Controller.CursorAddress);
            }

            FieldAttributes fa = new FieldAttributes();

            fa.IsHigh       = FieldAttribute.IsHigh(b);
            fa.IsIntense    = FieldAttribute.IsIntense(b);
            fa.IsModified   = FieldAttribute.IsModified(b);
            fa.IsNormal     = FieldAttribute.IsNormal(b);
            fa.IsNumeric    = FieldAttribute.IsNumeric(b);
            fa.IsProtected  = FieldAttribute.IsProtected(b);
            fa.IsSelectable = FieldAttribute.IsSelectable(b);
            fa.IsSkip       = FieldAttribute.IsSkip(b);
            fa.IsZero       = FieldAttribute.IsZero(b);
            return(fa);
        }
コード例 #2
0
ファイル: Print.cs プロジェクト: xandr001/Open3270
        /// <summary>
        /// Print the ASCIIfied contents of the screen onto a stream.
        /// </summary>
        /// <param name="f"></param>
        /// <param name="even_if_empty"></param>
        /// <returns>Returns True if anything printed, False otherwise.</returns>
        bool PrintFormattedScreen(StreamWriter f, bool even_if_empty)
        {
            int  i;
            byte e;
            byte c;
            int  ns       = 0;
            int  nr       = 0;
            bool any      = false;
            byte fa       = telnet.Controller.FakeFA;
            int  fa_index = telnet.Controller.GetFieldAttribute(0);

            if (fa_index != -1)
            {
                fa = telnet.Controller.ScreenBuffer[fa_index];
            }

            for (i = 0; i < telnet.Controller.RowCount * telnet.Controller.ColumnCount; i++)
            {
                if (i != 0 && (i % telnet.Controller.ColumnCount) == 0)
                {
                    nr++;
                    ns = 0;
                }
                e = telnet.Controller.ScreenBuffer[i];
                if (FieldAttribute.IsFA(e))
                {
                    c  = (byte)' ';
                    fa = telnet.Controller.ScreenBuffer[i];
                }
                if (FieldAttribute.IsZero(fa))
                {
                    c = (byte)' ';
                }
                else
                {
                    c = Tables.Cg2Ascii[e];
                }
                if (c == (byte)' ')
                {
                    ns++;
                }
                else
                {
                    any = true;
                    while (nr != 0)
                    {
                        f.WriteLine();
                        nr--;
                    }
                    while (ns != 0)
                    {
                        f.WriteLine(" ");
                        ns--;
                    }
                    f.WriteLine(System.Convert.ToChar(c));
                }
            }
            nr++;
            if (!any && !even_if_empty)
            {
                return(false);
            }
            while (nr != 0)
            {
                f.WriteLine();
                nr--;
            }
            return(true);
        }