Exemple #1
0
        public override void Read(BinaryReader reader)
        {
            int           count         = reader.ReadInt32();
            NetworkObject networkObject = NetworkObject.UnPack(reader.ReadBytes(count));

            FromNetworkObject(networkObject);
        }
Exemple #2
0
        private void ProcessObjectPacket(byte[] payload)
        {
            NetworkObject networkObject = NetworkObject.UnPack(payload);

            ObjectOpcode opcode = (ObjectOpcode)NetworkObjectField.ReadIntField(networkObject.GetField(0));

            log.Trace($"Received object packet {opcode}(0x{opcode:X}).");

            if (opcode == ObjectOpcode.Authenticate)
            {
                PacketManager.InvokeObjectMessageHandler(this, opcode, networkObject);
            }
            else
            {
                PacketManager.InvokeObjectMessageHandler(this, opcode, networkObject.GetField(1).ReadObject());
            }
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        private void ProcessObjectPacket(byte[] payload)
        {
            try
            {
                NetworkObject networkObject = NetworkObject.UnPack(payload);

                ObjectOpcode opcode = (ObjectOpcode)NetworkObjectField.ReadIntField(networkObject.GetField(0));
                if (opcode == ObjectOpcode.Authenticate)
                {
                    PacketManager.InvokeObjectPacketHandler(this, opcode, networkObject);
                }
                else
                {
                    PacketManager.InvokeObjectPacketHandler(this, opcode, networkObject.GetField(1).ReadObject());
                }
            }
            catch (OutOfMemoryException exception)
            {
                log.Fatal(exception);
                log.Fatal($"Payload Length: {payload.Length}");
                throw;
            }
        }