Update ProtoUtils.cs

This commit is contained in:
ALEXTANG
2022-09-02 16:01:10 +08:00
parent af96cd0649
commit a2503421b8

View File

@@ -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));
}
}
}