當前位置: 首頁>>代碼示例>>C#>>正文


C# BitStream.ReadAlignedBytesSafe方法代碼示例

本文整理匯總了C#中RakNet.BitStream.ReadAlignedBytesSafe方法的典型用法代碼示例。如果您正苦於以下問題:C# BitStream.ReadAlignedBytesSafe方法的具體用法?C# BitStream.ReadAlignedBytesSafe怎麽用?C# BitStream.ReadAlignedBytesSafe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在RakNet.BitStream的用法示例。


在下文中一共展示了BitStream.ReadAlignedBytesSafe方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Main


//.........這裏部分代碼省略.........
            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));
            Console.WriteLine(testString);
            Console.WriteLine(testBitStream2.ReadDelta(out testString));
            Console.WriteLine(testString);

            float testFloat;
            testBitStream2.ReadFloat16(out testFloat, 0, 100);
            Console.WriteLine(testFloat);
            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();
開發者ID:0521guo,項目名稱:RakNet,代碼行數:67,代碼來源:TestMain.cs


注:本文中的RakNet.BitStream.ReadAlignedBytesSafe方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。