/// <summary> /// Reads a value from the packet /// </summary> /// <returns>value</returns> public ulong ReadULong() { ulong res = ByteManipulator.ReadUInt64(Data, CurrentSeek); CurrentSeek += sizeof(ulong); return(res); }
public void TestListUlongReadRedLight() { List <byte> arr = new List <byte>(sizeof(ulong)); for (int i = 0; i < sizeof(ulong); i++) { arr.Add(0); } ByteManipulator.Write(arr, 0, (ulong)25000544); Assert.That(ByteManipulator.ReadUInt64(arr, 0), Is.Not.EqualTo(9)); }
public void TestListUlongRead() { List <byte> arr = new List <byte>(sizeof(ulong)); for (int i = 0; i < sizeof(ulong); i++) { arr.Add(0); } ByteManipulator.Write(arr, 0, (ulong)18446744073709551614); Assert.That(ByteManipulator.ReadUInt64(arr, 0), Is.EqualTo(18446744073709551614)); }
void Receive(uint lenght) { byte[] receiver = ArrayPool <byte> .Get((int)lenght); uint dataLenght; CSteamID sender; SteamNetworking.ReadP2PPacket(receiver, lenght, out dataLenght, out sender); int command = receiver[0]; CSteamID packetSender = (CSteamID)ByteManipulator.ReadUInt64(receiver, 1); int finalLength = (int)lenght - HeaderLength; ByteManipulator.Write <byte>(receiver, HeaderLength, receiver, 0, finalLength); InvokeCommand(command, receiver, (uint)finalLength, packetSender); ArrayPool <byte> .Recycle(receiver); }
public void TestUlongReadRedLight() { byte[] arr = new byte[sizeof(ulong)]; ByteManipulator.Write(arr, 0, (ulong)25000544); Assert.That(ByteManipulator.ReadUInt64(arr, 0), Is.Not.EqualTo(9)); }
public void TestUlongRead() { byte[] arr = new byte[sizeof(ulong)]; ByteManipulator.Write(arr, 0, (ulong)18446744073709551614); Assert.That(ByteManipulator.ReadUInt64(arr, 0), Is.EqualTo(18446744073709551614)); }