Server.Network.PacketReader.Trace C# (CSharp) Méthode

Trace() public méthode

public Trace ( Server.Network.NetState state ) : void
state Server.Network.NetState
Résultat void
		public void Trace( NetState state )
		{
			try
			{
				using ( StreamWriter sw = new StreamWriter( "Packets.log", true ) )
				{
					byte[] buffer = m_Data;

					if ( buffer.Length > 0 )
						sw.WriteLine( "Client: {0}: Unhandled packet 0x{1:X2}", state, buffer[0] );

					using ( MemoryStream ms = new MemoryStream( buffer ) )
						Utility.FormatBuffer( sw, ms, buffer.Length );

					sw.WriteLine();
					sw.WriteLine();
				}
			}
			catch
			{
			}
		}

Usage Example

        public static void ExtendedCommand(NetState state, PacketReader pvSrc)
        {
            int packetID = pvSrc.ReadUInt16();

            PacketHandler ph = GetExtendedHandler(packetID);

            if (ph != null)
            {
                if (ph.Ingame && state.Mobile == null)
                {
                    Console.WriteLine("Client: {0}: Sent ingame packet (0xBFx{1:X2}) before having been attached to a mobile", state, packetID);
                    state.Dispose();
                }
                else if (ph.Ingame && state.Mobile.Deleted)
                {
                    state.Dispose();
                }
                else
                {
                    ph.OnReceive(state, pvSrc);
                }
            }
            else
            {
                pvSrc.Trace(state);
            }
        }
All Usage Examples Of Server.Network.PacketReader::Trace