OpenMetaverse.PacketEventDictionary.RaiseEvent C# (CSharp) Method

RaiseEvent() private method

Fire the events registered for this packet type synchronously
private RaiseEvent ( PacketType packetType, Packet packet, Simulator simulator ) : void
packetType PacketType Incoming packet type
packet OpenMetaverse.Packets.Packet Incoming packet
simulator Simulator Simulator this packet was received from
return void
        internal void RaiseEvent(PacketType packetType, Packet packet, Simulator simulator)
        {
            NetworkManager.PacketCallback callback;

            // Default handler first, if one exists
            if (_EventTable.TryGetValue(PacketType.Default, out callback))
            {
                try { callback(packet, simulator); }
                catch (Exception ex)
                {
                    Logger.Log("Default packet event handler: " + ex.ToString(), Helpers.LogLevel.Error, Client);
                }
            }

            if (_EventTable.TryGetValue(packetType, out callback))
            {
                try { callback(packet, simulator); }
                catch (Exception ex)
                {
                    Logger.Log("Packet event handler: " + ex.ToString(), Helpers.LogLevel.Error, Client);
                }

                return;
            }

            if (packetType != PacketType.Default && packetType != PacketType.PacketAck)
            {
                Logger.DebugLog("No handler registered for packet event " + packetType, Client);
            }
        }