Example #1
0
 public override void Execute()
 {
     try
     {
         base.Execute();
     }
     catch (EndOfStreamException ex)
     {
         LogUtil.ErrorException(ex, "End of stream on {0}. Length {1}. Position {2}",
                                (object)Parameter2, (object)Parameter2.Length, (object)Parameter2.Position);
         Parameter2.Position = 0;
         string stringRepresentation =
             Utility.GetStringRepresentation(Parameter2.ReadBytes(Parameter2.Length));
         LogUtil.ErrorException(ex, "Data {0}", (object)stringRepresentation);
     }
     catch (SocketException ex)
     {
         Parameter1.Disconnect(false);
     }
     catch (Exception ex)
     {
         LogUtil.ErrorException(ex, "Client {0} triggered an Exception.", (object)Parameter1);
     }
     finally
     {
         Parameter2.Dispose();
     }
 }
Example #2
0
        public override void Execute()
        {
            try
            {
                //var contextHandler = RealmPacketMgr.Instance.CheckConstraints(Parameter1, Parameter2);
                //if (contextHandler != null && contextHandler.IsInContext)

                // Character-messages are always executed in the right context
                base.Execute();
            }
            catch (System.IO.EndOfStreamException e) { LogUtil.ErrorException(e, "End of stream on {0}. Length {1}. Position {2}", Parameter2, Parameter2.Length, Parameter2.Position);
                                                       Parameter2.Position = 0;
                                                       var packetStr = Utility.GetStringRepresentation(Parameter2.ReadBytes(Parameter2.Length));
                                                       LogUtil.ErrorException(e, "Data {0}", packetStr); }
            catch (System.Net.Sockets.SocketException)
            {
                Parameter1.Disconnect();
            }
            catch (Exception e)
            {
                LogUtil.ErrorException(e, "Client {0} triggered an Exception.", Parameter1);

/*
 *                              if (Parameter1.ActiveCharacter != null)
 *                              {
 *                                      Parameter1.ActiveCharacter.SaveLater();
 *                              }
 *
 *                              Parameter1.Disconnect();*/
            }
            finally
            {
                ((IDisposable)Parameter2).Dispose();
            }
        }