本文整理汇总了C#中System.ByteBuffer.ReadInt16方法的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer.ReadInt16方法的具体用法?C# ByteBuffer.ReadInt16怎么用?C# ByteBuffer.ReadInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ByteBuffer
的用法示例。
在下文中一共展示了ByteBuffer.ReadInt16方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: handlePacket
public void handlePacket(byte[] packet)
{
ByteBuffer rawBuffer = new ByteBuffer(packet);
// Check if the size is the realsize
short size = rawBuffer.ReadInt16();
rawBuffer.SetIndex(0);
if (size < rawBuffer.Length())
{
byte[] pck1;
pck1 = rawBuffer.ReadBytes(size);
buffer.Enqueue(pck1);
short size2;
size2 = rawBuffer.ReadInt16();
rawBuffer.SetIndex(size);
byte[] pck2;
pck2 = rawBuffer.ReadBytes(size2);
buffer.Enqueue(pck2);
}
else
{
buffer.Enqueue(packet);
}
}
示例2: GetDebugHeader
public ImageDebugDirectory GetDebugHeader(out byte[] header)
{
var section = GetSectionAtVirtualAddress(Debug.VirtualAddress);
var buffer = new ByteBuffer(section.Data);
buffer.position = (int)(Debug.VirtualAddress - section.VirtualAddress);
var directory = new ImageDebugDirectory
{
Characteristics = buffer.ReadInt32(),
TimeDateStamp = buffer.ReadInt32(),
MajorVersion = buffer.ReadInt16(),
MinorVersion = buffer.ReadInt16(),
Type = buffer.ReadInt32(),
SizeOfData = buffer.ReadInt32(),
AddressOfRawData = buffer.ReadInt32(),
PointerToRawData = buffer.ReadInt32(),
};
if (directory.SizeOfData == 0 || directory.PointerToRawData == 0)
{
header = Empty<byte>.Array;
return directory;
}
buffer.position = (int)(directory.PointerToRawData - section.PointerToRawData);
header = new byte[directory.SizeOfData];
Buffer.BlockCopy(buffer.buffer, buffer.position, header, 0, header.Length);
return directory;
}