Cosmos/Tests/Cosmos.System.Tests/Utilities.cs
2016-12-13 22:39:41 -06: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();
}
}
}