public static void WriteHex(string Text, byte[] Data) {
WriteLine(Text);
string Line = " ";
for (int i = 0; i < Data.Length; i++) {
if (i > 0) {
if (i % 16 == 0) {
WriteLine(Line);
Line = " ";
}
else if (i % 8 == 0) {
Line = Line + " ";
}
}
Line = Line + string.Format (" {0:x2}", Data[i]);
}
WriteLine(Line);
}