Fix the last even line of bytes

linq does the job cleaner than ugly math...
This commit is contained in:
Kurt
2015-05-24 17:11:19 -07:00
parent 7dfd2d7a79
commit 9053f62ef3

View File

@@ -174,7 +174,7 @@ internal static string[] getHexLines(byte[] data, int count = 4)
// Generates an x-byte wide space separated string array; leftovers included at the end.
string[] s = new string[data.Length/count + ((data.Length % count > 0) ? 1 : 0)];
for (int i = 0; i < s.Length;i++)
s[i] += BitConverter.ToString(data, i*count, i+1<s.Length ? count : data.Length % count).Replace('-', ' ');
s[i] = BitConverter.ToString(data.Skip(i*4).Take(count).ToArray()).Replace('-', ' ');
return s;
}
}