当前位置: 首页>>代码示例>>C#>>正文


C# BigEndianStream.ReadBytes方法代码示例

本文整理汇总了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 ());
 }
开发者ID:pdelvo,项目名称:Pdelvo.Minecraft,代码行数:15,代码来源:EncryptionKeyResponse.cs

示例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;
        }
开发者ID:splitice,项目名称:Pdelvo.Minecraft,代码行数:31,代码来源:ItemStack.cs

示例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());
 }
开发者ID:splitice,项目名称:Pdelvo.Minecraft,代码行数:13,代码来源:PluginMessage.cs

示例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 ();
        }
开发者ID:pdelvo,项目名称:Pdelvo.Minecraft,代码行数:15,代码来源:LevelDataChunk.cs

示例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());
 }
开发者ID:pdelvo,项目名称:Pdelvo.Minecraft,代码行数:15,代码来源:ItemData.cs

示例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 ());
 }
开发者ID:pdelvo,项目名称:Pdelvo.Minecraft,代码行数:16,代码来源:MultiBlockChange.cs

示例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;
        }
开发者ID:splitice,项目名称:Pdelvo.Minecraft,代码行数:27,代码来源:MapChunkBulkPacket.cs

示例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 ();
     }
 }
开发者ID:pdelvo,项目名称:Pdelvo.Minecraft,代码行数:28,代码来源:UpdateTileEntity.cs

示例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);
        }
开发者ID:splitice,项目名称:Pdelvo.Minecraft,代码行数:22,代码来源:MapChunk.cs

示例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]);
            }
        }
开发者ID:splitice,项目名称:Pdelvo.Minecraft,代码行数:20,代码来源:BigEndianStreamTests.cs

示例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);
        }
开发者ID:pdelvo,项目名称:Pdelvo.Minecraft,代码行数:22,代码来源:MapChunkOld.cs


注:本文中的Pdelvo.Minecraft.Network.BigEndianStream.ReadBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。