Exemplo n.º 1
0
        private void Run()
        {
            /*Size consoleSize = Size.Min(ConsoleRenderer.ConsoleLargestWindowSize, new Size((25 + 1) * 7 + 1, 60));
             * try {
             *  ConsoleRenderer.ConsoleWindowRect = new Rect(consoleSize);
             *  Console.BufferWidth = consoleSize.Width;
             * }
             * catch (Exception e) {
             *  var consoleRect = new Rect(Console.WindowLeft, Console.WindowTop, Console.WindowWidth, Console.WindowHeight);
             *  Console.WriteLine(consoleRect);
             *  var bufferRect = new Size(Console.BufferWidth, Console.BufferHeight);
             *  Console.WriteLine(bufferRect);
             *  Console.WriteLine(e.Message);
             * }*/
            Console.WindowWidth    = 80;
            Console.BufferWidth    = 80;
            Console.OutputEncoding = Encoding.UTF8;
            Console.Title          = Path.GetFileNameWithoutExtension(Console.Title);

            var data = new Data {
                Title           = "Header Title",
                SubTitle        = "Header SubTitle",
                Formatted       = "Aaaa\nBbbb\nCccc",
                LoremIpsum      = "Lo|rem ip|sum do|lor sit amet, con|sec|te|tur adi|pis|cing elit, sed do eius|mod tem|por in|ci|di|dunt ut la|bo|re et do|lo|re mag|na ali|qua. Ut enim ad mi|nim ve|ni|am, qu|is nos|trud exer|ci|ta|tion ul|lam|co la|bo|ris ni|si ut ali|quip ex ea com|mo|do con|se|quat. Du|is au|te iru|re do|lor in rep|re|hen|de|rit in vo|lup|ta|te ve|lit es|se cil|lum do|lo|re eu fu|gi|at nul|la pa|ri|a|tur. Ex|cep|te|ur sint oc|ca|e|cat cu|pi|da|tat non pro|i|dent, sunt in cul|pa qui of|fi|cia de|se|runt mol|lit anim id est la|bo|rum.",
                LoremIpsumShort = "Lo|rem ip|sum do|lor sit amet, con|sec|te|tur adi|pis|cing elit, sed do eius|mod tem|por in|ci|di|dunt ut la|bo|re et do|lo|re mag|na ali|qua. Ut enim ad mi|nim ve|ni|am, qu|is nos|trud exer|ci|ta|tion ul|lam|co la|bo|ris ni|si ut ali|quip ex ea com|mo|do con|se|quat.",
                Unicode         = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽž",
                Guid            = Guid.NewGuid(),
                Date            = DateTime.Now,
                Items           = new List <DataItem> {
                    new DataItem {
                        Id       = 1, Name = "Name 1", Value = "Value 1",
                        SubItems = new List <DataItem> {
                            new DataItem {
                                Id = 11, Name = "Name 1.1", Value = "Value 1.1"
                            },
                            new DataItem {
                                Id = 12, Name = "Name 1.2", Value = "Value 1.2"
                            },
                        }
                    },
                    new DataItem {
                        Id       = 2, Name = "Name 2", Value = "Value 2",
                        SubItems = new List <DataItem> {
                            new DataItem {
                                Id = 21, Name = "Name 2.1", Value = "Value 2.1"
                            },
                            new DataItem {
                                Id = 22, Name = "Name 2.2", Value = "Value 2.2"
                            },
                        }
                    },
                },
                Roman = FigletFont.Load(GetType().Assembly.GetManifestResourceStream(GetType(), "Resources.Roman.flf")),
            };

            /*if (MemoryProfiler.IsActive) {
             *  MemoryProfiler.EnableAllocations();
             *  MemoryProfiler.Dump();
             * }
             * new ConsoleRenderer().RenderDocument(ReadXaml<Document>(data));
             * if (MemoryProfiler.IsActive)
             *  MemoryProfiler.Dump();*/
            /*for (int i = 0; i < 100; i++)
             *  new ConsoleRenderer().RenderDocument(ReadXaml<Document>(data));*/
            /*if (MemoryProfiler.IsActive)
             *  MemoryProfiler.Dump();*/

            Document xamlDoc = ConsoleRenderer.ReadDocumentFromResource(GetType(), "Markup.xaml", data, new XamlElementReaderSettings {
                ReferenceAssemblies = { typeof(FigletDiv).Assembly }
            });

            //Document xamlDoc = ConsoleRenderer.ReadDocumentFromResource(GetType().Assembly, "Alba.CsConsoleFormat.ConsoleTest.Markup.xaml", data);
            Console.WriteLine("\nXAML\n");
            ConsoleRenderer.RenderDocument(xamlDoc);
            ConsoleRenderer.RenderDocument(xamlDoc, new HtmlRenderTarget(File.Create("../Tmp/0.html"), new UTF8Encoding(false)));

            Document builtDoc = new ViewBuilder().CreateDocument(data);

            Console.WriteLine("\nBUILDER\n");
            ConsoleRenderer.RenderDocument(builtDoc);
            ConsoleRenderer.RenderDocument(builtDoc, new HtmlRenderTarget(File.Create("../Tmp/0a.html"), new UTF8Encoding(false)));

            Console.WriteLine("\nBUILDER FLUENT\n");
            ConsoleRenderer.RenderDocument(new ViewBuilder().CreateDocumentFluent(data));

            var buffer = new ConsoleBuffer(80)
            {
                LineCharRenderer = LineCharRenderer.BoxExtended,
                //Clip = new Rect(1, 1, 78, 30),
            };
            var rainbow = new[] {
                Black,
                DarkRed, DarkYellow, DarkGreen, DarkCyan, DarkBlue, DarkMagenta, DarkRed,
                Black,
                Red, Yellow, Green, Cyan, Blue, Magenta, Red,
            };

            /*for (int i = 0; i < 16; i++)
             *  buffer.FillRectangle((ConsoleColor)i, i, i, 80 - i * 2, 31 - i * 2);*/
            const LineWidth Thick = LineWidth.Heavy;

            for (int i = 0; i < rainbow.Length; i++)
            {
                buffer.FillBackgroundRectangle(i, i, 80 - i * 2, (rainbow.Length - i) * 2, rainbow[i]);
            }
            buffer.DrawHorizontalLine(1, 0, 78, White);
            buffer.DrawHorizontalLine(1, 1, 78, White, Thick);
            buffer.DrawHorizontalLine(3, 3, 7, White);
            buffer.DrawVerticalLine(1, 1, 9, White);
            buffer.DrawVerticalLine(2, 2, 4, White);
            buffer.DrawVerticalLine(5, 0, 6, White, Thick);
            buffer.DrawVerticalLine(5, 0, 6, White);
            buffer.DrawVerticalLine(6, 0, 6, White);
            buffer.DrawVerticalLine(3, 0, 12, White, Thick);
            buffer.DrawRectangle(0, 0, 80, 32, White, Thick);
            buffer.FillBackgroundVerticalLine(40, 0, 32, Yellow);
            buffer.FillForegroundVerticalLine(41, 0, 32, White, FullBlock);
            buffer.FillForegroundVerticalLine(42, 0, 32, White, DarkShade);
            buffer.FillForegroundVerticalLine(43, 0, 32, White, MediumShade);
            buffer.FillForegroundVerticalLine(44, 0, 32, White, LightShade);
            buffer.DrawString(15, 15, Black, "Hello world!");
            buffer.DrawString(15, 16, White, "Hello world! Hello world! Hello world! Hello world! Hello world! Hello world!");
            //buffer.ApplyBackgroundColorMap(0, 0, buffer.Width, buffer.Height, ColorMaps.Invert);
            //buffer.ApplyForegroundColorMap(0, 0, buffer.Width, buffer.Height, ColorMaps.Invert);
            new ConsoleRenderTarget().Render(buffer);
            //new ConsoleRenderTarget { ColorOverride = White, BackgroundOverride = Black }.Render(buffer);

            Colors.WriteLine("Console without colors is boring...");
            Colors.WriteLine("Colors".Red(), " are".Green(), " fun!".Blue());
            Colors.WriteLine(
                "Background".Red().OnDarkRed(), "colors".Green().OnDarkGreen(), "are".Blue().OnDarkBlue(),
                "even".DarkRed().OnRed(), "more".DarkGreen().OnGreen(), "fun!".DarkBlue().OnBlue());
            Colors.WriteLine(new Border {
                Shadow   = new Thickness(-1, -1, 1, 1), ShadowColor = DarkGray,
                Align    = Align.Left,
                Children = { "Borders yay!".Yellow().OnGray() }
            });

            using (var file = File.Create("../Tmp/1.html"))
                new HtmlRenderTarget(file, new UTF8Encoding(false)).Render(buffer);
            using (var file = new StreamWriter(File.Create("../Tmp/1.ans"), Encoding.GetEncoding("ibm437"))
            {
                NewLine = ""
            })
                new AnsiRenderTarget(file).Render(buffer);
            using (var file = File.Create("../Tmp/1.txt"))
                new TextRenderTarget(file).Render(buffer);
            using (var file = File.Create("../Tmp/1.asc"))
                new TextRenderTarget(file, Encoding.GetEncoding("ibm437")).Render(buffer);

            /*var text = new TextRenderTarget();
             * text.Render(buffer);
             * Console.Write(text.OutputText);*/

            /*Console.WriteLine(Console.OutputEncoding);
             * Console.OutputEncoding = Encoding.UTF8;
             * Console.WriteLine("■▬▲►▼◄");
             * Console.WriteLine("▀▄█▌▐");
             * Console.WriteLine("♠♣♥♦");
             * Console.WriteLine("☺☻☼♀♂♫");
             * Console.WriteLine("«»‘’‚‛“”„‟‹›");*/
            /*const string TestString1 = "«»‘’‚‛“”„‟‹›", TestString2 = "─═│║┼╪╫╬";
             * foreach (EncodingInfo encodingInfo in Encoding.GetEncodings()) {
             *  try {
             *      Encoding encoding = encodingInfo.GetEncoding();
             *      bool matched1 = encoding.GetString(encoding.GetBytes(TestString1)) == TestString1;
             *      bool matched2 = encoding.GetString(encoding.GetBytes(TestString2)) == TestString2;
             *      Console.OutputEncoding = encoding;
             *      Console.WriteLine("{0,-10}{1,-20}{2}{3} {4} {5}",
             *          encodingInfo.CodePage, encodingInfo.Name, matched1 ? "+" : "-", matched2 ? "+" : "-", TestString1, TestString2);
             *  }
             *  catch {
             *      Console.WriteLine("{0,-10}{1,-20}xx FAILED",
             *          encodingInfo.CodePage, encodingInfo.Name);
             *  }
             * }*/
            /*for (int i = 1; i < 10000; i += 10) {
             *  var sb = new StringBuilder();
             *  for (int j = 0; j < 10; j++)
             *      sb.AppendFormat("{0,-6}{1} ", (i + j), (char)(i + j));
             *  Console.Write(sb);
             * }*/
        }
Exemplo n.º 2
0
        private void Run ()
        {
            /*Size consoleSize = Size.Min(ConsoleRenderer.ConsoleLargestWindowSize, new Size((25 + 1) * 7 + 1, 60));
            try {
                ConsoleRenderer.ConsoleWindowRect = new Rect(consoleSize);
                Console.BufferWidth = consoleSize.Width;
            }
            catch (Exception e) {
                var consoleRect = new Rect(Console.WindowLeft, Console.WindowTop, Console.WindowWidth, Console.WindowHeight);
                Console.WriteLine(consoleRect);
                var bufferRect = new Size(Console.BufferWidth, Console.BufferHeight);
                Console.WriteLine(bufferRect);
                Console.WriteLine(e.Message);
            }*/
            Console.OutputEncoding = Encoding.UTF8;
            Console.Title = Path.GetFileNameWithoutExtension(Console.Title);

            var data = new Data {
                Title = "Header Title",
                SubTitle = "Header SubTitle",
                Formatted = "Aaaa\nBbbb\nCccc",
                LoremIpsum = "Lo|rem ip|sum do|lor sit amet, con|sec|te|tur adi|pis|cing elit, sed do eius|mod tem|por in|ci|di|dunt ut la|bo|re et do|lo|re mag|na ali|qua. Ut enim ad mi|nim ve|ni|am, qu|is nos|trud exer|ci|ta|tion ul|lam|co la|bo|ris ni|si ut ali|quip ex ea com|mo|do con|se|quat. Du|is au|te iru|re do|lor in rep|re|hen|de|rit in vo|lup|ta|te ve|lit es|se cil|lum do|lo|re eu fu|gi|at nul|la pa|ri|a|tur. Ex|cep|te|ur sint oc|ca|e|cat cu|pi|da|tat non pro|i|dent, sunt in cul|pa qui of|fi|cia de|se|runt mol|lit anim id est la|bo|rum.",
                LoremIpsumShort = "Lo|rem ip|sum do|lor sit amet, con|sec|te|tur adi|pis|cing elit, sed do eius|mod tem|por in|ci|di|dunt ut la|bo|re et do|lo|re mag|na ali|qua. Ut enim ad mi|nim ve|ni|am, qu|is nos|trud exer|ci|ta|tion ul|lam|co la|bo|ris ni|si ut ali|quip ex ea com|mo|do con|se|quat.",
                Guid = Guid.NewGuid(),
                Date = DateTime.Now,
                Items = new List<DataItem> {
                    new DataItem {
                        Id = 1, Name = "Name 1", Value = "Value 1",
                        SubItems = new List<DataItem> {
                            new DataItem { Id = 11, Name = "Name 1.1", Value = "Value 1.1" },
                            new DataItem { Id = 12, Name = "Name 1.2", Value = "Value 1.2" },
                        }
                    },
                    new DataItem { Id = 2, Name = "Name 2", Value = "Value 2" },
                }
            };

            /*if (MemoryProfiler.IsActive) {
                MemoryProfiler.EnableAllocations();
                MemoryProfiler.Dump();
            }
            new ConsoleRenderer().RenderDocument(ReadXaml<Document>(data));
            if (MemoryProfiler.IsActive)
                MemoryProfiler.Dump();*/
            /*for (int i = 0; i < 100; i++)
                new ConsoleRenderer().RenderDocument(ReadXaml<Document>(data));*/
            /*if (MemoryProfiler.IsActive)
                MemoryProfiler.Dump();*/

            Document xamlDoc = ConsoleRenderer.ReadDocumentFromResource(GetType(), "Markup.xaml", data);
            //Document xamlDoc = ConsoleRenderer.ReadDocumentFromResource(GetType().Assembly, "Alba.CsConsoleFormat.ConsoleTest.Markup.xaml", data);
            Console.WriteLine("XAML");
            ConsoleRenderer.RenderDocument(xamlDoc);
            ConsoleRenderer.RenderDocument(xamlDoc, new HtmlRenderTarget(File.Create(@"../../Tmp/0.html"), new UTF8Encoding(false)));

            Document builtDoc = new ViewBuilder().CreateDocument(data);
            Console.WriteLine("Builder");
            ConsoleRenderer.RenderDocument(builtDoc);
            ConsoleRenderer.RenderDocument(builtDoc, new HtmlRenderTarget(File.Create(@"../../Tmp/0a.html"), new UTF8Encoding(false)));

            var buffer = new ConsoleBuffer(80) {
                LineCharRenderer = LineCharRenderer.Box,
                //Clip = new Rect(1, 1, 78, 30),
            };
            var rainbow = new[] {
                Black,
                DarkRed, DarkYellow, DarkGreen, DarkCyan, DarkBlue, DarkMagenta, DarkRed,
                Black,
                Red, Yellow, Green, Cyan, Blue, Magenta, Red,
            };
            /*for (int i = 0; i < 16; i++)
                buffer.FillRectangle((ConsoleColor)i, i, i, 80 - i * 2, 31 - i * 2);*/
            for (int i = 0; i < rainbow.Length; i++)
                buffer.FillBackgroundRectangle(i, i, 80 - i * 2, (rainbow.Length - i) * 2, rainbow[i]);
            buffer.DrawHorizontalLine(1, 0, 78, White);
            buffer.DrawHorizontalLine(1, 1, 78, White, LineWidth.Wide);
            buffer.DrawHorizontalLine(3, 3, 7, White);
            buffer.DrawVerticalLine(1, 1, 9, White);
            buffer.DrawVerticalLine(2, 2, 4, White);
            buffer.DrawVerticalLine(5, 0, 6, White, LineWidth.Wide);
            buffer.DrawVerticalLine(5, 0, 6, White);
            buffer.DrawVerticalLine(6, 0, 6, White);
            buffer.DrawVerticalLine(3, 0, 12, White, LineWidth.Wide);
            buffer.DrawRectangle(0, 0, 80, 32, White, LineWidth.Wide);
            buffer.FillBackgroundVerticalLine(40, 0, 32, Yellow);
            buffer.FillForegroundVerticalLine(41, 0, 32, White, FullBlock);
            buffer.FillForegroundVerticalLine(42, 0, 32, White, DarkShade);
            buffer.FillForegroundVerticalLine(43, 0, 32, White, MediumShade);
            buffer.FillForegroundVerticalLine(44, 0, 32, White, LightShade);
            buffer.DrawString(15, 15, Black, "Hello world!");
            buffer.DrawString(15, 16, White, "Hello world! Hello world! Hello world! Hello world! Hello world! Hello world!");
            //buffer.ApplyBackgroundColorMap(0, 0, buffer.Width, buffer.Height, ColorMaps.Invert);
            //buffer.ApplyForegroundColorMap(0, 0, buffer.Width, buffer.Height, ColorMaps.Invert);

            //new ConsoleRenderTarget().Render(buffer);
            //new ConsoleRenderTarget { ColorOverride = ConsoleColor.White, BackgroundOverride = ConsoleColor.Black }.Render(buffer);
            using (var file = File.Create(@"../../Tmp/1.html"))
                new HtmlRenderTarget(file, new UTF8Encoding(false)).Render(buffer);
            using (var file = new StreamWriter(File.Create(@"../../Tmp/1.ans"), Encoding.GetEncoding("ibm437")) { NewLine = "" })
                new AnsiRenderTarget(file).Render(buffer);
            using (var file = File.Create(@"../../Tmp/1.txt"))
                new TextRenderTarget(file).Render(buffer);
            using (var file = File.Create(@"../../Tmp/1.asc"))
                new TextRenderTarget(file, Encoding.GetEncoding("ibm437")).Render(buffer);

            /*var text = new TextRenderTarget();
            text.Render(buffer);
            Console.Write(text.OutputText);*/

            /*Console.WriteLine(Console.OutputEncoding);
            Console.OutputEncoding = Encoding.UTF8;
            Console.WriteLine("■▬▲►▼◄");
            Console.WriteLine("▀▄█▌▐");
            Console.WriteLine("♠♣♥♦");
            Console.WriteLine("☺☻☼♀♂♫");
            Console.WriteLine("«»‘’‚‛“”„‟‹›");*/
            /*const string TestString1 = "«»‘’‚‛“”„‟‹›", TestString2 = "─═│║┼╪╫╬";
            foreach (EncodingInfo encodingInfo in Encoding.GetEncodings()) {
                try {
                    Encoding encoding = encodingInfo.GetEncoding();
                    bool matched1 = encoding.GetString(encoding.GetBytes(TestString1)) == TestString1;
                    bool matched2 = encoding.GetString(encoding.GetBytes(TestString2)) == TestString2;
                    Console.OutputEncoding = encoding;
                    Console.WriteLine("{0,-10}{1,-20}{2}{3} {4} {5}",
                        encodingInfo.CodePage, encodingInfo.Name, matched1 ? "+" : "-", matched2 ? "+" : "-", TestString1, TestString2);
                }
                catch {
                    Console.WriteLine("{0,-10}{1,-20}xx FAILED",
                        encodingInfo.CodePage, encodingInfo.Name);
                }
            }*/
            /*for (int i = 1; i < 10000; i += 10) {
                var sb = new StringBuilder();
                for (int j = 0; j < 10; j++)
                    sb.AppendFormat("{0,-6}{1} ", (i + j), (char)(i + j));
                Console.Write(sb);
            }*/
        }
Exemplo n.º 3
0
        private void Run()
        {
            /*Size consoleSize = Size.Min(ConsoleRenderer.ConsoleLargestWindowSize, new Size((25 + 1) * 7 + 1, 60));
             * try {
             *  ConsoleRenderer.ConsoleWindowRect = new Rect(consoleSize);
             *  Console.BufferWidth = consoleSize.Width;
             * }
             * catch (Exception e) {
             *  var consoleRect = new Rect(Console.WindowLeft, Console.WindowTop, Console.WindowWidth, Console.WindowHeight);
             *  Console.WriteLine(consoleRect);
             *  var bufferRect = new Size(Console.BufferWidth, Console.BufferHeight);
             *  Console.WriteLine(bufferRect);
             *  Console.WriteLine(e.Message);
             * }*/
            Console.WindowWidth    = 80;
            Console.BufferWidth    = 80;
            Console.OutputEncoding = Encoding.UTF8;
            Console.Title          = Path.GetFileNameWithoutExtension(Console.Title);

            var data = new Data {
                Title           = "Header Title",
                SubTitle        = "Header SubTitle",
                Formatted       = "Aaaa\nBbbb\nCccc",
                LoremIpsum      = "Lo|rem ip|sum do|lor sit amet, con|sec|te|tur adi|pis|cing elit, sed do eius|mod tem|por in|ci|di|dunt ut la|bo|re et do|lo|re mag|na ali|qua. Ut enim ad mi|nim ve|ni|am, qu|is nos|trud exer|ci|ta|tion ul|lam|co la|bo|ris ni|si ut ali|quip ex ea com|mo|do con|se|quat. Du|is au|te iru|re do|lor in rep|re|hen|de|rit in vo|lup|ta|te ve|lit es|se cil|lum do|lo|re eu fu|gi|at nul|la pa|ri|a|tur. Ex|cep|te|ur sint oc|ca|e|cat cu|pi|da|tat non pro|i|dent, sunt in cul|pa qui of|fi|cia de|se|runt mol|lit anim id est la|bo|rum.",
                LoremIpsumShort = "Lo|rem ip|sum do|lor sit amet, con|sec|te|tur adi|pis|cing elit, sed do eius|mod tem|por in|ci|di|dunt ut la|bo|re et do|lo|re mag|na ali|qua. Ut enim ad mi|nim ve|ni|am, qu|is nos|trud exer|ci|ta|tion ul|lam|co la|bo|ris ni|si ut ali|quip ex ea com|mo|do con|se|quat.",
                Guid            = Guid.NewGuid(),
                Date            = DateTime.Now,
                Items           = new List <DataItem> {
                    new DataItem {
                        Id       = 1, Name = "Name 1", Value = "Value 1",
                        SubItems = new List <DataItem> {
                            new DataItem {
                                Id = 11, Name = "Name 1.1", Value = "Value 1.1"
                            },
                            new DataItem {
                                Id = 12, Name = "Name 1.2", Value = "Value 1.2"
                            },
                        }
                    },
                    new DataItem {
                        Id       = 2, Name = "Name 2", Value = "Value 2",
                        SubItems = new List <DataItem> {
                            new DataItem {
                                Id = 21, Name = "Name 2.1", Value = "Value 2.1"
                            },
                            new DataItem {
                                Id = 22, Name = "Name 2.2", Value = "Value 2.2"
                            },
                        }
                    },
                }
            };

            /*if (MemoryProfiler.IsActive) {
             *  MemoryProfiler.EnableAllocations();
             *  MemoryProfiler.Dump();
             * }
             * new ConsoleRenderer().RenderDocument(ReadXaml<Document>(data));
             * if (MemoryProfiler.IsActive)
             *  MemoryProfiler.Dump();*/
            /*for (int i = 0; i < 100; i++)
             *  new ConsoleRenderer().RenderDocument(ReadXaml<Document>(data));*/
            /*if (MemoryProfiler.IsActive)
             *  MemoryProfiler.Dump();*/

            Document xamlDoc = ConsoleRenderer.ReadDocumentFromResource(GetType(), "Markup.xaml", data);

            //Document xamlDoc = ConsoleRenderer.ReadDocumentFromResource(GetType().Assembly, "Alba.CsConsoleFormat.ConsoleTest.Markup.xaml", data);
            Console.WriteLine("XAML");
            ConsoleRenderer.RenderDocument(xamlDoc);
            ConsoleRenderer.RenderDocument(xamlDoc, new HtmlRenderTarget(File.Create(@"../../Tmp/0.html"), new UTF8Encoding(false)));

            Document builtDoc = new ViewBuilder().CreateDocument(data);

            Console.WriteLine("Builder");
            ConsoleRenderer.RenderDocument(builtDoc);
            ConsoleRenderer.RenderDocument(builtDoc, new HtmlRenderTarget(File.Create(@"../../Tmp/0a.html"), new UTF8Encoding(false)));

            var buffer = new ConsoleBuffer(80)
            {
                LineCharRenderer = LineCharRenderer.Box,
                //Clip = new Rect(1, 1, 78, 30),
            };
            var rainbow = new[] {
                Black,
                DarkRed, DarkYellow, DarkGreen, DarkCyan, DarkBlue, DarkMagenta, DarkRed,
                Black,
                Red, Yellow, Green, Cyan, Blue, Magenta, Red,
            };

            /*for (int i = 0; i < 16; i++)
             *  buffer.FillRectangle((ConsoleColor)i, i, i, 80 - i * 2, 31 - i * 2);*/
            for (int i = 0; i < rainbow.Length; i++)
            {
                buffer.FillBackgroundRectangle(i, i, 80 - i * 2, (rainbow.Length - i) * 2, rainbow[i]);
            }
            buffer.DrawHorizontalLine(1, 0, 78, White);
            buffer.DrawHorizontalLine(1, 1, 78, White, LineWidth.Wide);
            buffer.DrawHorizontalLine(3, 3, 7, White);
            buffer.DrawVerticalLine(1, 1, 9, White);
            buffer.DrawVerticalLine(2, 2, 4, White);
            buffer.DrawVerticalLine(5, 0, 6, White, LineWidth.Wide);
            buffer.DrawVerticalLine(5, 0, 6, White);
            buffer.DrawVerticalLine(6, 0, 6, White);
            buffer.DrawVerticalLine(3, 0, 12, White, LineWidth.Wide);
            buffer.DrawRectangle(0, 0, 80, 32, White, LineWidth.Wide);
            buffer.FillBackgroundVerticalLine(40, 0, 32, Yellow);
            buffer.FillForegroundVerticalLine(41, 0, 32, White, FullBlock);
            buffer.FillForegroundVerticalLine(42, 0, 32, White, DarkShade);
            buffer.FillForegroundVerticalLine(43, 0, 32, White, MediumShade);
            buffer.FillForegroundVerticalLine(44, 0, 32, White, LightShade);
            buffer.DrawString(15, 15, Black, "Hello world!");
            buffer.DrawString(15, 16, White, "Hello world! Hello world! Hello world! Hello world! Hello world! Hello world!");
            //buffer.ApplyBackgroundColorMap(0, 0, buffer.Width, buffer.Height, ColorMaps.Invert);
            //buffer.ApplyForegroundColorMap(0, 0, buffer.Width, buffer.Height, ColorMaps.Invert);

            //new ConsoleRenderTarget().Render(buffer);
            //new ConsoleRenderTarget { ColorOverride = ConsoleColor.White, BackgroundOverride = ConsoleColor.Black }.Render(buffer);
            using (var file = File.Create(@"../../Tmp/1.html"))
                new HtmlRenderTarget(file, new UTF8Encoding(false)).Render(buffer);
            using (var file = new StreamWriter(File.Create(@"../../Tmp/1.ans"), Encoding.GetEncoding("ibm437"))
            {
                NewLine = ""
            })
                new AnsiRenderTarget(file).Render(buffer);
            using (var file = File.Create(@"../../Tmp/1.txt"))
                new TextRenderTarget(file).Render(buffer);
            using (var file = File.Create(@"../../Tmp/1.asc"))
                new TextRenderTarget(file, Encoding.GetEncoding("ibm437")).Render(buffer);

            /*var text = new TextRenderTarget();
             * text.Render(buffer);
             * Console.Write(text.OutputText);*/

            /*Console.WriteLine(Console.OutputEncoding);
             * Console.OutputEncoding = Encoding.UTF8;
             * Console.WriteLine("■▬▲►▼◄");
             * Console.WriteLine("▀▄█▌▐");
             * Console.WriteLine("♠♣♥♦");
             * Console.WriteLine("☺☻☼♀♂♫");
             * Console.WriteLine("«»‘’‚‛“”„‟‹›");*/
            /*const string TestString1 = "«»‘’‚‛“”„‟‹›", TestString2 = "─═│║┼╪╫╬";
             * foreach (EncodingInfo encodingInfo in Encoding.GetEncodings()) {
             *  try {
             *      Encoding encoding = encodingInfo.GetEncoding();
             *      bool matched1 = encoding.GetString(encoding.GetBytes(TestString1)) == TestString1;
             *      bool matched2 = encoding.GetString(encoding.GetBytes(TestString2)) == TestString2;
             *      Console.OutputEncoding = encoding;
             *      Console.WriteLine("{0,-10}{1,-20}{2}{3} {4} {5}",
             *          encodingInfo.CodePage, encodingInfo.Name, matched1 ? "+" : "-", matched2 ? "+" : "-", TestString1, TestString2);
             *  }
             *  catch {
             *      Console.WriteLine("{0,-10}{1,-20}xx FAILED",
             *          encodingInfo.CodePage, encodingInfo.Name);
             *  }
             * }*/
            /*for (int i = 1; i < 10000; i += 10) {
             *  var sb = new StringBuilder();
             *  for (int j = 0; j < 10; j++)
             *      sb.AppendFormat("{0,-6}{1} ", (i + j), (char)(i + j));
             *  Console.Write(sb);
             * }*/
        }