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


C# BitStream.PrintHex方法代码示例

本文整理汇总了C#中RakNet.BitStream.PrintHex方法的典型用法代码示例。如果您正苦于以下问题:C# BitStream.PrintHex方法的具体用法?C# BitStream.PrintHex怎么用?C# BitStream.PrintHex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RakNet.BitStream的用法示例。


在下文中一共展示了BitStream.PrintHex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main


//.........这里部分代码省略.........
            while (bitStreamTestPacket == null || bitStreamTestPacket.data[0] != (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM)
            {
                if (bitStreamTestPacket != null)
                {
                    testServer.DeallocatePacket(bitStreamTestPacket);
                }
                bitStreamTestPacket = testServer.Receive();
                testClient.Send(testBitStream1, PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, (char)0, new AddressOrGUID(RakNet.RakNet.UNASSIGNED_SYSTEM_ADDRESS), true);
            }

            testBitStream2.Reset();
            testBitStream2 = new BitStream(bitStreamTestPacket.data, bitStreamTestPacket.length, true);

            testBitStream2.IgnoreBytes(1);
            testBitStream2.ResetReadPointer();
            testBitStream2.IgnoreBits(8);
            testBitStream2.ResetReadPointer();
            testBitStream2.ReadBits(testBuffer, 8);
            Console.WriteLine(testBuffer[0]);
            Console.WriteLine(DefaultMessageIDTypes.ID_USER_PACKET_ENUM);
            testBitStream2.ResetReadPointer();
            testBitStream2.ReadAlignedVar8(testBuffer);
            Console.WriteLine(testBuffer[0]);
            testBitStream2.ResetReadPointer();
            testBitStream2.ReadAlignedVar16(testBuffer);
            Console.WriteLine(testBuffer[1]);
            testBitStream2.ResetReadPointer();
            testBitStream2.ReadAlignedVar32(testBuffer);
            Console.WriteLine(testBuffer[1]);
            testBitStream2.ResetReadPointer();
            testBitStream2.IgnoreBits(8);

            Console.WriteLine("testBitStream1 hex and bits");
            testBitStream1.PrintHex();
            Console.WriteLine("\n");
            testBitStream1.PrintBits();
            Console.WriteLine("\ntestBitStream1 hex and bits");

            Console.WriteLine("testBitStream2 hex and bits end");
            testBitStream2.PrintHex();
            Console.WriteLine("\n");
            testBitStream2.PrintBits();
            Console.WriteLine("\ntestBitStream2 hex and bits end");

            String testString;
            Console.WriteLine("testBitStream2 hex and bits string output");
            testBitStream2.PrintHex(out testString);
            Console.WriteLine(testString + "\n");
            testBitStream2.PrintBits(out testString);
            Console.WriteLine(testString);
            Console.WriteLine("testBitStream2 hex and bits string output end");

            testBitStream2.Read(out testString);
            Console.WriteLine(testString);

            Console.WriteLine(testBitStream2.ReadCompressed(out testString));
            Console.WriteLine(testString);
            testBitStream2.WriteCompressedDelta("xy", "yz");
            testBitStream2.WriteCompressedDelta("xy", "xy");
            Console.WriteLine(testBitStream2.ReadCompressedDelta(out testString));
            Console.WriteLine(testString);
            Console.WriteLine(testBitStream2.ReadCompressedDelta(out testString));
            Console.WriteLine(testString);
            testBitStream2.WriteDelta("xy", "yz");
            testBitStream2.WriteDelta("xy", "xy");
            Console.WriteLine(testBitStream2.ReadDelta(out testString));
开发者ID:0521guo,项目名称:RakNet,代码行数:67,代码来源:TestMain.cs


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