Пример #1
0
 internal void ProcessPacket(Packet pkt)
 {
     try
     {
         log.Logger.Log(typeof(Client), Level.Verbose,
                        $"Handling packet '{pkt}'...", null);
         if (pkt.ID == (PacketID)255)
         {
             return;
         }
         IPacketHandler handler;
         if (!PacketHandlers.Handlers.TryGetValue(pkt.ID, out handler))
         {
             log.Warn($"Unhandled packet '{pkt.ID}'.");
         }
         else
         {
             handler.Handle(this, (ClientPacket)pkt);
         }
     }
     catch (Exception e)
     {
         log.Error($"Error when handling packet '{pkt}'...", e);
         Disconnect();
     }
 }
Пример #2
0
 internal void ProcessPacket(Packet pkt)
 {
     try
     {
         log.Logger.Log(typeof(Client), log4net.Core.Level.Verbose,
                        string.Format("Handling packet '{0}'...", pkt.ID), null);
         if (pkt.ID == PacketID.Packet)
         {
             return;
         }
         IPacketHandler handler;
         if (!PacketHandlers.Handlers.TryGetValue(pkt.ID, out handler))
         {
             log.WarnFormat("Unhandled packet '{0}'.", pkt.ID);
         }
         else
         {
             handler.Handle(this, (ClientPacket)pkt);
         }
     }
     catch (Exception e)
     {
         log.Error(string.Format("Error when handling packet '{0}'...", pkt.ToString()), e);
         psr.Disconnect();
     }
 }
Пример #3
0
 internal void ProcessPacket(Packet pkt)
 {
     try
     {
         log.Logger.Log(typeof(Client), Level.Verbose,
                        $"Handling packet '{pkt.ID}'...", null);
         if (pkt.ID == PacketID.Packet)
         {
             return;
         }
         IPacketHandler handler;
         if (!PacketHandlers.Handlers.TryGetValue(pkt.ID, out handler))
         {
             log.WarnFormat("Unhandled packet '{0}'.", pkt.ID);
         }
         else
         {
             handler.Handle(this, (ClientPacket)pkt); //object not set to an instance error (sometimes)
         }
     }
     catch (Exception e)
     {
         log.Error($"Error when handling packet '{pkt}'...", e);
         Disconnect();
     }
 }
Пример #4
0
 internal void ProcessPacket(Packet pkt)
 {
     try
     {
         if (pkt.ID == (PacketID)255)
         {
             return;
         }
         IPacketHandler handler;
         if (!PacketHandlers.Handlers.TryGetValue(pkt.ID, out handler))
         {
             Console.WriteLine($"Unhandled packet '{pkt.ID}'.");
         }
         else
         {
             handler.Handle(this, (ClientPacket)pkt);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine($"Error when handling packet '{pkt}'...", e);
         Disconnect();
     }
 }