Exemple #1
0
        private static void ExtendedConsoleDemo()
        {
            Console.CursorVisible = false;
            short w = (short)Console.BufferWidth;
            short h = (short)Console.BufferHeight;

            var buf = new ExtendedConsole.CharInfo[w * h];

            var rect = new ExtendedConsole.SmallRect {
                Left = 0, Top = 0, Right = w, Bottom = h
            };

            var p     = ExtendedConsole.Coord.Zero;
            var s     = new ExtendedConsole.Coord(w, h);
            var chars = Encoding.GetEncoding(437).GetChars(Enumerable.Range(0, byte.MaxValue).Select(i => (byte)i).Except(new byte[] { 8, 9, 10, 7 }).ToArray());

            for (int x = 0; x < 10000; x++)
            {
                for (int i = 0; i < buf.Length; ++i)
                {
                    buf[i].Attributes     = (short)((x + i) % 0x80);
                    buf[i].Char.AsciiChar = (byte)chars[(x + i) % chars.Length];
                }

                ExtendedConsole.UpdateRegion(buf, p, s, ref rect);
            }
        }