Пример #1
0
        private static void WritePacket(Packet packet)
        {
            Console.WriteLine("\t\t {0:X2} - {1} bytes", packet.Id, packet.Length);
            Console.WriteLine(" 0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F");
            Console.WriteLine("-- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --");

            packet.Seek(0);
            for (int i = 0; i < packet.Length; i++)
            {
                if (i % 16 == 0 && i != 0)
                    Console.WriteLine();
                if (i % 8 == 0 && i % 16 != 0)
                    Console.Write(" ");
                Console.Write(packet.ReadByte().ToString("X2"));
                Console.Write(" ");
            }

            Console.WriteLine();
            Console.WriteLine();
        }