示例#1
0
        static public void View(char[] dat, string file)
        {
            //var s = new StringBuilder($"<h2>File: {file}</h2><pre>");
            var t = new StringBuilder("");
            var p = 0;

            Console = new KittyViewer();
            Console.WriteLine($"<h2>File: {file}</h2><pre>");
            for (int i = 0; i < dat.Length; ++i)
            {
                p = i % 16;
                var b = (byte)dat[i];
                if (p == 0)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.Write($"  {t}\n");
                    Console.ForegroundColor = ConsoleColor.DarkGray;
                    Console.Write(Fmt.sprintf("%09X | ", i));
                    t.Clear();
                }
                Console.ForegroundColor = ConsoleColor.Cyan;
                //Console.Write(Fmt.sprintf("%02X ", (byte)dat[i]));
                Console.Write(("0" + b.ToString("X")).Substring(0, 2) + " ");
                if (b >= 32 && b < 127)
                {
                    t.Append(dat[i]);
                }
                else
                {
                    t.Append(".");
                }
            }
            for (int i = p; i < 15; ++i)
            {
                Console.ForegroundColor = ConsoleColor.Black;
                Console.Write("   ");
            }
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write($"  {t}");
            Directory.CreateDirectory(Core.ViewSwap);
            QuickStream.SaveString($"{Core.ViewSwap}/ViewFile.html", Console.ToString());
            Console = null;
        }