本文整理汇总了C#中Pdelvo.Minecraft.Network.BigEndianStream.ReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C# BigEndianStream.ReadBytes方法的具体用法?C# BigEndianStream.ReadBytes怎么用?C# BigEndianStream.ReadBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pdelvo.Minecraft.Network.BigEndianStream
的用法示例。
在下文中一共展示了BigEndianStream.ReadBytes方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
SharedKey = reader.ReadBytes(reader.ReadInt16 ());
if (version >= 37)
VerifyToken = reader.ReadBytes(reader.ReadInt16 ());
}
示例2: Read
/// <summary>
/// Reads the specified stream.
/// </summary>
/// <param name="stream">The stream.</param>
/// <returns></returns>
/// <remarks></remarks>
public static ItemStack Read(BigEndianStream stream)
{
if (stream == null)
throw new System.ArgumentNullException("stream");
var stack = new ItemStack();
if ((stack.ItemType = stream.ReadInt16()) >= 0)
{
stack.Count = stream.ReadByte();
stack.Durability = stream.ReadInt16();
}
else
return stack;
if (((stream.Owner as PacketEndPoint).Version >=36 && stack.ItemType != -1) || (EnchantHelper.Enchantable.Contains(stack.ItemType) && !((stream.Owner as PacketEndPoint).Use12w18aFix && !(_12w18a.Contains(stack.ItemType)))))//12w18a fix
{
short hasData = stream.ReadInt16();
if (hasData > 0)
{
stack.AdditionalData = stream.ReadBytes(hasData);
}
}
if (stack.AdditionalData == null)
stack.AdditionalData = new byte[0];
return stack;
}
示例3: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="version">The version.</param>
/// <remarks></remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new System.ArgumentNullException("reader");
Channel = reader.ReadString16();
InternalData = reader.ReadBytes(reader.ReadInt16());
}
示例4: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
ChunkData = reader.ReadBytes(reader.ReadInt16 ());
PercentComplete = reader.ReadByte ();
}
示例5: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
ItemType = reader.ReadInt16 ();
ItemId = reader.ReadInt16 ();
InnerData = reader.ReadBytes(version >= 49 ? reader.ReadInt16() : reader.ReadByte());
}
示例6: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
ChunkX = reader.ReadInt32 ();
ChunkZ = reader.ReadInt32 ();
Unknown = reader.ReadInt16 ();
DataArray = reader.ReadBytes(reader.ReadInt32 ());
}
示例7: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="version">The version.</param>
/// <remarks></remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
Count = reader.ReadInt16();
DataLength = reader.ReadInt32();
ChunkData = reader.ReadBytes(DataLength);
var list = new List<ChunkBulkMetaData>();
for (int i = 0; i < Count; i++)
{
list.Add(new ChunkBulkMetaData
{
PositionX = reader.ReadInt32(),
PositionZ = reader.ReadInt32(),
PrimaryBitmap = reader.ReadInt16(),
AddBitmap = reader.ReadInt16(),
});
}
ChunkMetaData = list;
}
示例8: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
PositionX = reader.ReadInt32 ();
PositionY = reader.ReadInt16 ();
PositionZ = reader.ReadInt32 ();
Action = reader.ReadByte ();
if (version >= 39)
{
short length = reader.ReadInt16 ();
length = length == -1 ? (short) 0 : length;
DataNBT = reader.ReadBytes(length);
}
else
{
Custom1 = reader.ReadInt32 ();
Custom2 = reader.ReadInt32 ();
Custom3 = reader.ReadInt32 ();
}
}
示例9: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="version">The version.</param>
/// <remarks></remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new System.ArgumentNullException("reader");
PositionX = reader.ReadInt32();
PositionZ = reader.ReadInt32();
GroundUpContiguous = reader.ReadBoolean();
PrimaryBitmap = reader.ReadInt16();
AddBitmap = reader.ReadInt16();
CompressedSize = reader.ReadInt32();
if (version < 38)
UnusedInt32 = reader.ReadInt32();
CompressedData = reader.ReadBytes(CompressedSize);
}
示例10: BytesTest
public void BytesTest()
{
MemoryStream memStream = new MemoryStream();
BigEndianStream bigEndianStream = new BigEndianStream(memStream);
var testBytes = new byte[1024];
new Random().NextBytes(testBytes);
bigEndianStream.Write(testBytes);
memStream.Seek(0, SeekOrigin.Begin);
var result = bigEndianStream.ReadBytes(1024);
for (int i = 0; i < 1024; i++)
{
Assert.AreEqual(testBytes[i], result[i]);
}
}
示例11: OnReceive
/// <summary>
/// Receives the specified reader.
/// </summary>
/// <param name="reader"> The reader. </param>
/// <param name="version"> The version. </param>
/// <remarks>
/// </remarks>
protected override void OnReceive(BigEndianStream reader, int version)
{
if (reader == null)
throw new ArgumentNullException("reader");
PositionX = reader.ReadInt32 ();
PositionY = reader.ReadInt16 ();
PositionZ = reader.ReadInt32 ();
SizeX = reader.ReadByte ();
SizeY = reader.ReadByte ();
SizeZ = reader.ReadByte ();
CompressedSize = reader.ReadInt32 ();
CompressedData = reader.ReadBytes(CompressedSize);
}