예제 #1
0
 public void PacketSent(Packet packet, byte[] buffer, int offset, int length)
 {
     this._output.WriteLine("Packet Client->Server '{0}' ( {1:N0} bytes ) @ {2} {3}", (object)packet.GetType().Name, (object)length, (object)DateTime.Now.Date.ToShortDateString(), (object)DateTime.Now.TimeOfDay);
     PacketLogger.WriteBuffer(this._output, buffer, offset, length);
     this._output.WriteLine();
     this._output.WriteLine();
 }
예제 #2
0
 public void PacketReceived(PacketHandler packetHandler, byte[] buffer, int offset, int length)
 {
     this._output.WriteLine("Packet Server->Client '{0}' ( {1:N0} bytes ) @ {2} {3}", (object)packetHandler.Callback.Method.Name, (object)length, (object)DateTime.Now.Date.ToShortDateString(), (object)DateTime.Now.TimeOfDay);
     PacketLogger.WriteBuffer(this._output, buffer, offset, length);
     this._output.WriteLine();
     this._output.WriteLine();
 }
예제 #3
0
        internal void Trace(bool silent = false)
        {
            if (!silent)
            {
                Engine.AddTextMessage(string.Format("Tracing packet 0x{0:X2} '{1}' of length {2} ( 0x{2:X} ). (Prior: 0x{3:X2}, 0x{4:X2}, 0x{5:X2})", (object)this.m_Command, (object)this.m_Name, (object)this.m_Count, (object)NetworkContext.prior1, (object)NetworkContext.prior2, (object)NetworkContext.prior3));
            }
            StreamWriter streamWriter = new StreamWriter("PacketTrace.log", true);

            if (this.m_Count < 16)
            {
                streamWriter.WriteLine("Packet Server->Client '{0}' ( {1} bytes )", (object)this.m_ReturnName, (object)this.m_Count);
            }
            else
            {
                streamWriter.WriteLine("Packet Server->Client '{0}' ( {1} [0x{1:X}] bytes )", (object)this.m_ReturnName, (object)this.m_Count);
            }
            streamWriter.WriteLine();
            PacketLogger.WriteBuffer((TextWriter)streamWriter, this.m_Data, this.m_Start, this.m_Count);
            streamWriter.WriteLine();
            streamWriter.Flush();
            streamWriter.Close();
        }