Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
 public static bool IsSkip(byte c)
 {
     return(FieldAttribute.IsNumeric(c) && FieldAttribute.IsProtected(c));
 }