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


C# BitStream.AddBitsAndReallocate方法代码示例

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


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

示例1: Main


//.........这里部分代码省略.........
            testBitStream2.ReadBits(testBuffer, 7);
            Console.WriteLine(testBuffer[0]);
            testBitStream2.ReadAlignedBytesSafe(testBuffer, 1, 1);
            Console.WriteLine(testBuffer[0]);
            testBitStream2.ReadAlignedBytes(testBuffer, 1);
            Console.WriteLine(testBuffer[0]);
            Console.WriteLine(testBitStream2.ReadBit());
            Console.WriteLine(testBitStream2.ReadBit());
            int intForSerialization2 = 0;
            testBitStream2.Serialize(false, ref intForSerialization2);
            Console.WriteLine(intForSerialization2);

            testBitStream2.PadWithZeroToByteLength(99);
            testBitStream2.PrintBits();
            testBitStream2.SetData(testBuffer);
            Console.WriteLine("setbuff");
            testBitStream2.PrintBits();

            Console.WriteLine(testBitStream2.GetNumberOfBitsAllocated());

            //ByteQueue
            Console.WriteLine("ByteQueue");
            ByteQueue testByteQueue = new ByteQueue();
            testByteQueue.WriteBytes(testBuffer, (uint)testBuffer.Length, "", 0);
            testByteQueue.DecrementReadOffset(1);
            Console.WriteLine(testByteQueue.GetBytesWritten());
            testByteQueue.IncrementReadOffset(1);
            uint testUint;
            byte[] returnArray = testByteQueue.PeekContiguousBytes(out testUint);
            testByteQueue.Print();
            testByteQueue.ReadBytes(returnArray, (uint)returnArray.Length, true);
            testByteQueue.Clear("", 0);

            testBitStream2.AddBitsAndReallocate(99);
            testBitStream2.AlignReadToByteBoundary();
            testBitStream2.AlignWriteToByteBoundary();
            testBitStream2.EndianSwapBytes(5, 5);
            returnArray = testBitStream2.GetData();
            Console.WriteLine(testBitStream2.GetNumberOfBitsAllocated());
            Console.WriteLine(testBitStream2.GetNumberOfBitsUsed());
            Console.WriteLine(testBitStream2.GetNumberOfBytesUsed());
            Console.WriteLine(testBitStream2.GetNumberOfUnreadBits());
            Console.WriteLine(testBitStream2.GetReadOffset());
            Console.WriteLine(testBitStream2.GetWriteOffset());
            testBitStream2.SetData(returnArray);
            testBitStream2.SetNumberOfBitsAllocated(testBitStream2.GetNumberOfBitsAllocated());
            testBitStream2.SetReadOffset(3);
            testBitStream2.SetWriteOffset(3);
            testBitStream2.WriteBits(returnArray, (uint)returnArray.Length);

            //Cell, Table, Row
            Console.WriteLine("Cell, Table, Row");
            Cell testCell = new Cell();
            Byte[] tableTestByteArray = new byte[1];
            tableTestByteArray[0] = (byte)'t';
            int outInt;
            double outDouble;

            testCell.Set("test1232");
            testCell.Get(out testString);
            Console.WriteLine(testString);
            Console.WriteLine((int)testCell.EstimateColumnType());
            testCell.CopyData(testCell);
            testCell.Set(12.5d);
            testCell.Get(out outDouble);
            Console.WriteLine(outDouble);
开发者ID:0521guo,项目名称:RakNet,代码行数:67,代码来源:TestMain.cs


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