mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Update ProtoUtils.cs
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace TEngine.Runtime
|
||||
{
|
||||
@@ -45,5 +46,33 @@ namespace TEngine.Runtime
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static StringBuilder _stringBuilder = new StringBuilder();
|
||||
|
||||
public static string GetBuffer(byte[] buffer)
|
||||
{
|
||||
_stringBuilder.Length = 0;
|
||||
_stringBuilder.Append("[");
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
{
|
||||
if (i == buffer.Length - 1)
|
||||
{
|
||||
_stringBuilder.Append(buffer[i]);
|
||||
_stringBuilder.Append("]");
|
||||
}
|
||||
else
|
||||
{
|
||||
_stringBuilder.Append(buffer[i]);
|
||||
_stringBuilder.Append(",");
|
||||
}
|
||||
}
|
||||
|
||||
return _stringBuilder.ToString();
|
||||
}
|
||||
|
||||
public static void PrintBuffer(byte[] buffer)
|
||||
{
|
||||
Log.Debug(GetBuffer(buffer));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user