Esempio n. 1
0
        public void Create(IntPtr data, int length, PacketFlags flags)
        {
            if (_packet != null)
            {
                throw new InvalidOperationException("Already created.");
            }

            _packet = Native.enet_packet_create(data, (IntPtr)length, flags);
            if (_packet == null)
            {
                throw new ENetException(0, "Packet creation call failed.");
            }
        }
Esempio n. 2
0
        public void Create(IntPtr data, int length, PacketFlags flags)
        {
            if (data == IntPtr.Zero)
            {
                throw new ArgumentNullException("data");
            }

            if (length < 0)
            {
                throw new ArgumentOutOfRangeException("length");
            }

            nativePacket = Native.enet_packet_create(data, (IntPtr)length, flags);
        }
Esempio n. 3
0
        public void Create(byte[] data, int length, PacketFlags flags)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            if (length < 0 || length > data.Length)
            {
                throw new ArgumentOutOfRangeException("length");
            }

            nativePacket = Native.enet_packet_create(data, (IntPtr)length, flags);
        }