Cosmos/source/Cosmos.System.VSTests/Utilities.cs
2014-12-07 14:27:28 +01:00

32 lines
No EOL
776 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cosmos.System.VSTests
{
public static class Utilities
{
public static string PrettyPrint(byte[] data)
{
if (data == null)
{
throw new ArgumentNullException("data");
}
var xSB = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
if (i > 0
&& (i % 8 == 0))
{
xSB.AppendLine();
}
xSB.Append(data[i].ToString("X2"));
xSB.Append(" ");
}
return xSB.ToString().Trim();
}
}
}