本文整理匯總了C#中System.ByteBuffer.appendBuffer方法的典型用法代碼示例。如果您正苦於以下問題:C# ByteBuffer.appendBuffer方法的具體用法?C# ByteBuffer.appendBuffer怎麽用?C# ByteBuffer.appendBuffer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.ByteBuffer
的用法示例。
在下文中一共展示了ByteBuffer.appendBuffer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: appendField
private static void appendField(object field, ref ByteBuffer buff)
{
if (field is CLRSharp_Instance)
{
buff.appendBuffer(clrObjectToByteBuffer(field as CLRSharp_Instance));
}
else
{
Type type = field.GetType();
if (type.BaseType != null && type.BaseType.FullName == "System.Array")
{
appendArray(field as Array, ref buff);
}
else
{
append(field, ref buff);
}
}
}
示例2: packet
/// <summary>
/// 封包,時間戳 + 協議號 + 內容長度 + 內容
/// </summary>
/// <param name="protocol"></param>
/// <param name="data"></param>
/// <returns></returns>
private ByteBuffer packet(int protocol, object data)
{
ByteBuffer buff = PackageUtil.clrObjectToByteBuffer(data as CLRSharp_Instance);
Package package = new Package();
package.timeStamp = TimeUtil.getTimeStamp();
package.protocol = protocol;
package.len = (ushort)buff.length;
package.data = data;
Debug.Log("[發送] " + package.toString());
ByteBuffer buffer = new ByteBuffer();
buffer.appendInt(package.timeStamp);
buffer.appendInt(package.protocol);
buffer.appendUshort(package.len);
buffer.appendBuffer(buff);
return buffer;
}