public void RegisterExtended(int packetID, OnPacketReceive onReceive)
 {
     if (packetID >= 0 && packetID < 0x100)
         _extendedHandlersLow[packetID] = new PacketHandler(packetID, 0, onReceive);
     else
         _extendedHandlersHigh[packetID] = new PacketHandler(packetID, 0, onReceive);
 }
 public ClientPacketHandler(PacketType type, int length, int minimumLength, OnPacketReceive onReceive)
 {
     _packetId = type;
     _length = length;
     _minimumLength = minimumLength;
     _onReceive = onReceive;
 }
示例#3
0
 public PacketHandler(int packetID, int length, bool ingame, OnPacketReceive onReceive)
 {
     m_PacketID  = packetID;
     m_Length    = length;
     m_Ingame    = ingame;
     m_OnReceive = onReceive;
 }
		public PacketHandler(int packetID, int length, bool ingame, OnPacketReceive onReceive)
		{
			m_PacketID = packetID;
			m_Length = length;
			m_Ingame = ingame;
			m_OnReceive = onReceive;
		}
示例#5
0
 public Work(NetState ns, IMemoryOwner <byte> memOwner, int length, OnPacketReceive onReceive)
 {
     State       = ns;
     MemoryOwner = memOwner;
     OnReceive   = onReceive;
     Length      = length;
 }
示例#6
0
 public PacketHandler(int packetID, int length, bool ingame, OnPacketReceive onReceive)
 {
     PacketID  = packetID;
     Length    = length;
     Ingame    = ingame;
     OnReceive = onReceive;
 }
示例#7
0
 public PacketHandler( PacketType packetID, int length, int minimunLength, OnPacketReceive onReceive )
 {
     _PacketID = packetID;
     _Length = length;
     _MinimumLength = minimunLength;
     _OnReceive = onReceive;
 }
示例#8
0
 public PacketHandler(PacketType type, int length, int minimumLength, OnPacketReceive onReceive)
 {
     _PacketId      = type;
     _Length        = length;
     _MinimumLength = minimumLength;
     _OnReceive     = onReceive;
 }
示例#9
0
 public PacketHandler(PacketType type, int length, int minimumLength, OnPacketReceive onReceive)
 {
     _PacketId = type;
     _Length = length;
     _MinimumLength = minimumLength;
     _OnReceive = onReceive;
 }
示例#10
0
 public PacketHandler(int packetID, int length, bool registeredonly, OnPacketReceive onReceive)
 {
     this.m_PacketID = packetID;
     this.m_Length = length;
     this.m_RegisteredOnly = registeredonly;
     this.m_OnReceive = onReceive;
 }
示例#11
0
		/// <summary>
		/// Registers a Packet to Listen for
		/// </summary>
		/// <param name="name"> </param>
		/// <param name="packetID">PacketID</param>
		/// <param name="length">
		/// Length of the Incoming Data
		/// <para>NOTE: this must be EXACTLY the Length! Too much Data will be handled as a new Packet!</para>
		/// </param>
		/// <param name="onReceive">CallBack Function - will be called on Packet income</param>
		public static void Register(string name, short packetID, int length, OnPacketReceive onReceive) {
			if (Handlers.ContainsKey(packetID)) {
				throw new Exception(String.Format("Packet {0} already exists!", packetID));
			}

			Handlers.Add(packetID, new PacketHandler(name, packetID, length, onReceive));
		}
示例#12
0
 public CoreBase()
 {
     MainWindow.NetworkManager.PacketReceiveCallback += (b) => { OnPacketReceive?.Invoke(b); };
     MainWindow.AccountCreatedCallback += (a) =>
     {
         OnAccountCreated?.Invoke(GetAccountByModel(a));
     };
 }
示例#13
0
        /// <summary>
        /// Registers a Packet to Listen for
        /// </summary>
        /// <param name="packetID">PacketID</param>
        /// <param name="length">
        /// Length of the Incoming Data
        /// <para>NOTE: this must be EXACTLY the Length! Too much Data will be handled as a new Packet!</para>
        /// </param>
        /// <param name="type">Type of the Packet</param>
        /// <param name="onReceive">CallBack Function - will be called on Packet income</param>
        public static void Register(short packetID, int length, OnPacketReceive onReceive)
        {
            if (mHandlers.ContainsKey(packetID) == true)
            {
                throw new Exception(String.Format("Packet {0} already exists!", packetID));
            }

            mHandlers.Add(packetID, new PacketHandler(packetID, length, onReceive));
        }
示例#14
0
        /// <summary>
        /// Registers a Packet to Listen for
        /// </summary>
        /// <param name="name"> </param>
        /// <param name="packetId">PacketID</param>
        /// <param name="length">
        /// Length of the Incoming Data
        /// <para>NOTE: this must be EXACTLY the Length! Too much Data will be handled as a new Packet!</para>
        /// </param>
        /// <param name="onReceive">CallBack Function - will be called on Packet income</param>
        public static void Register(string name, short packetId, int length, OnPacketReceive onReceive)
        {
            if (Handlers.ContainsKey(packetId))
            {
                throw new Exception(String.Format("Packet {0} already exists!", packetId));
            }

            Handlers.Add(packetId, new PacketHandler(name, packetId, length, onReceive));
        }
示例#15
0
        public static void Configure()
        {
            PacketHandlers.RemoveExtendedHandler( 0x13 );
            PacketHandlers.RemoveExtendedHandler( 0x15 );

            OnPacketReceive handler = new OnPacketReceive( EmptyHandler );
            PacketHandlers.RegisterExtended( 0x13,  true, handler );
            PacketHandlers.RegisterExtended( 0x15,  true, handler );
        }
        public static void Register(int packetID, int length, bool ingame, OnPacketReceive onReceive)
        {
            m_Handlers[packetID] = new PacketHandler(packetID, length, ingame, onReceive);

            if (m_6017Handlers[packetID] == null)
            {
                m_6017Handlers[packetID] = new PacketHandler(packetID, length, ingame, onReceive);
            }
        }
示例#17
0
        private async Task MessageFraming_DataReceivedEvent(byte[] receivedData)
        {
            IPacket packet;

            using (var ms = new MemoryStream(await CryptEngine.DecompressAsync(receivedData)))
                packet = (IPacket)await LightRATUtils.Instance.packetSerializer.DeserializeAsync(ms);

            OnPacketReceive?.Invoke(this, new ReceivePacketArgs(packet));
        }
示例#18
0
 public void Init()
 {
     client = new UdpClient(SendPort);
       client.EnableBroadcast = true;
       dev = new IPEndPoint(IPAddress.Any, ListenPort);
       server = new UdpClient(dev);
       server.EnableBroadcast = true;
       server.Client.ReceiveTimeout = 100;
       packetReceived = Device.packet_received;
 }
示例#19
0
        public static void Configure()
        {
            PacketHandlers.RemoveExtendedHandler(0x13);
            PacketHandlers.RemoveExtendedHandler(0x15);

            OnPacketReceive handler = new OnPacketReceive(EmptyHandler);

            PacketHandlers.RegisterExtended(0x13, true, handler);
            PacketHandlers.RegisterExtended(0x15, true, handler);
        }
示例#20
0
 /// <summary>
 /// 注册一个消息处理器
 /// </summary>
 /// <param name="packetID">消息类型</param>
 /// <param name="length">消息长度</param>
 /// <param name="receive">接收处理委托</param>
 public void RegisterHandler(int packetID, OnPacketReceive receive)
 {
     if (packetID >= 0 && packetID < m_handlesLow.Length)
     {
         m_handlesLow[packetID] = new PacketHandler(packetID, receive);
     }
     else
     {
         m_handlesHigh[packetID] = new PacketHandler(packetID, receive);
     }
 }
示例#21
0
        public static void Register(byte id, int size, OnPacketReceive handler)
        {
            //2 bytes for header
            //Why is this here? This is f*****g things up!

            /*if (size != 0)
             * {
             *  size += 2;
             * }*/
            m_Handlers.Add(id, new PacketHandler(id, size, handler));
        }
示例#22
0
 public static void RegisterExtended(int packetID, OnPacketReceive onReceive)
 {
     if (packetID >= 0 && packetID < 0x100)
     {
         _extendedHandlersLow[packetID] = new PacketHandler(packetID, 0, onReceive);
     }
     else
     {
         _extendedHandlersHigh[packetID] = new PacketHandler(packetID, 0, onReceive);
     }
 }
示例#23
0
        /// <summary>
        /// Constructs a new PacketHandler instance.
        /// </summary>
        /// <param name="id">The ID of the ProcessedPacket instance to handle.</param>
        /// <param name="Encrypted">Is the ProcessedPacket instance encrypted?</param>
        /// <param name="size">The size of the ProcessedPacket instance. 0 if variable length.</param>
        /// <param name="handler">A OnPacketReceive instance.</param>
        public PacketHandler(byte id, bool Encrypted, ushort size, OnPacketReceive handler)
        {
            this.m_ID = id;
            this.m_Length = size;
            this.m_Handler = handler;
            this.m_Encrypted = Encrypted;

            if (size == 0)
                m_VarLength = true;
            else
                m_VarLength = false;
        }
 private static void Register(byte level, ushort opcode, OnPacketReceive <ClientConnection> e)
 {
     if (!levels.ContainsKey(level))
     {
         PacketHandler <ClientConnection>[] handlers = new PacketHandler <ClientConnection> [0xFFFF];
         handlers[opcode] = new PacketHandler <ClientConnection>(opcode, e);
         levels.Add(level, handlers);
     }
     else
     {
         levels[level][opcode] = new PacketHandler <ClientConnection>(opcode, e);
     }
 }
示例#25
0
        /// <summary>
        /// Constructs a new PacketHandler instance.
        /// </summary>
        /// <param name="id">The ID of the ProcessedPacket instance to handle.</param>
        /// <param name="Encrypted">Is the ProcessedPacket instance encrypted?</param>
        /// <param name="size">The size of the ProcessedPacket instance. 0 if variable length.</param>
        /// <param name="handler">A OnPacketReceive instance.</param>
        public PacketHandler(byte id, bool Encrypted, ushort size, OnPacketReceive handler)
        {
            this.m_ID        = id;
            this.m_Length    = size;
            this.m_Handler   = handler;
            this.m_Encrypted = Encrypted;

            if (size == 0)
            {
                m_VarLength = true;
            }
            else
            {
                m_VarLength = false;
            }
        }
示例#26
0
        public virtual void PacketReceive(ref PacketSpinel97 packet)
        {
            Debug.Print("Receive packet {0}", packet.INST);
            OnPacketReceive?.Invoke(packet);

            if (packet.INST < 0x10)
            {
                foreach (SpinelStackRec ssr in packets_to_receive)
                {
                    if (ssr.CheckReceivePacket(ref packet))
                    {
                        packets_to_receive.Remove(ssr);
                        return;
                    }
                }
            }
        }
		public static void Register( byte command, OnPacketReceive handler )
		{
			m_Handlers[command] = handler;
		}
示例#28
0
 public static void Register(int packetID, bool ingame, OnPacketReceive onReceive)
 {
     m_Handlers[packetID] = new PacketHandler(packetID, 0, ingame, onReceive);
 }
示例#29
0
		public static void Register6017( int packetID, int length, bool ingame, OnPacketReceive onReceive )
		{
			m_6017Handlers[packetID] = new PacketHandler( packetID, length, ingame, onReceive );
		}
示例#30
0
		/// <summary>
		/// Registers a new PacketHandler for a single Packet
		/// </summary>
		/// <param name="packetID"></param>
		/// <param name="length"></param>
		/// <param name="ingame"></param>
		/// <param name="onReceive"></param>
		public PacketHandler( short packetID, int length, OnPacketReceive onReceive ) {
			mPacketID = packetID;
			mLength = length;
			mOnReceive = onReceive;
		}
示例#31
0
 public PacketHandler(byte id, int size, OnPacketReceive handler)
 {
     this.m_ID = id;
     this.m_Length = size;
     this.m_Handler = handler;
 }
示例#32
0
        public static void Initialize()
        {
            m_OldWalkReq = Server.Network.PacketHandlers.GetHandler( 0x02 ).OnReceive;

            Server.Network.PacketHandlers.Register( 0x02,   7,  true, new OnPacketReceive( MovementHandler ) );

            Server.Network.PacketHandlers.Register( 0xAD,   0,  true, new OnPacketReceive( UnicodeSpeech ) );

            new MovementController().Start();

            Mobile.AsciiClickMessage = true;
            Mobile.GuildClickMessage = true;
            Mobile.DisableHiddenSelfClick = false;

            EventSink.Login += new LoginEventHandler( OnLogin );
            EventSink.Logout += new LogoutEventHandler( OnLogout );
            EventSink.Connected += new ConnectedEventHandler( EventSink_Connected );
            EventSink.Disconnected += new DisconnectedEventHandler( EventSink_Disconnected );
        }
 public void QueueWork(NetState ns, IMemoryOwner <byte> memOwner, OnPacketReceive onReceive)
 {
     m_WorkQueue.Enqueue(new Work(ns, memOwner, onReceive));
     Core.Set();
 }
示例#34
0
 public static void Register(int PacketID, int length, bool loggedin, OnPacketReceive onReceive)
 {
     Handlers[PacketID] = new PacketHandler(PacketID, length, loggedin, onReceive);
 }
示例#35
0
 public PacketHandler(byte id, int size, OnPacketReceive handler)
 {
     this.m_ID      = id;
     this.m_Length  = size;
     this.m_Handler = handler;
 }
示例#36
0
 public RecvPacketHandler(byte packID, OnPacketReceive onReceive)
 {
     packetID        = packID;
     receiveFunction = onReceive;
 }
示例#37
0
 public static void Register(int cmd, bool ingame, OnPacketReceive onReceive) =>
 _handlers[cmd] = new PacketHandler(cmd, 0, ingame, onReceive);
示例#38
0
		/// <summary>
		/// Registers a new PacketHandler for a single Packet
		/// </summary>
		/// <param name="packetID"></param>
		/// <param name="length"></param>
		/// <param name="ingame"></param>
		/// <param name="onReceive"></param>
		public PacketHandler(string name, short packetID, int length, OnPacketReceive onReceive) {
			mName = name;
			mPacketID = packetID;
			mLength = length;
			mOnReceive = onReceive;
		}
 public void Register(int packetID, int length, bool ingame, OnPacketReceive onReceive)
 {
     _handlers[packetID] = new PacketHandler(packetID, length, onReceive);
 }
 private static void RegisterExtended(int packetId, int length, OnPacketReceive onReceive)
 {
     m_ExtendedHandlers[packetId] = new PacketHandler(packetId, length, onReceive);
 }
示例#41
0
 private static void Register(short opcode, OnPacketReceive <ArcheAgeConnection> e)
 {
     m_LHandlers[opcode] = new PacketHandler <ArcheAgeConnection>(opcode, e);
     m_Maintained++;
 }
 public PacketHandler(int packetId, int length, OnPacketReceive onReceive)
 {
     _packetId = packetId;
     _length = length;
     _onReceive = onReceive;
 }
 public Work(NetState ns, IMemoryOwner <byte> memOwner, OnPacketReceive onReceive)
 {
     State       = ns;
     MemoryOwner = memOwner;
     OnReceive   = onReceive;
 }
示例#44
0
 public static void Register(PacketType packetID, int length, int minimumLength, OnPacketReceive onReceive)
 {
     _handlers[(byte)packetID] = new ClientPacketHandler(packetID, length, minimumLength, onReceive);
 }
示例#45
0
 public static void Register(byte id, int size, OnPacketReceive handler)
 {
     //2 bytes for header
     //Why is this here? This is f*****g things up!
     /*if (size != 0)
     {
         size += 2;
     }*/
     m_Handlers.Add(id, new PacketHandler(id, size, handler));
 }
示例#46
0
 public static void Register(int packetID, int length, OnPacketReceive onReceive)
 {
     _handlers[packetID] = new PacketHandler(packetID, length, onReceive);
 }
 public PacketHandler(int packetID, OnPacketReceive <T> onReceive)
 {
     m_PacketID  = packetID;
     m_OnReceive = onReceive;
 }
示例#48
0
 public PacketHandler(int packetID, int length, OnPacketReceive onReceieve)
 {
     m_packetID = packetID;
     m_length = length;
     m_OnReceive = onReceieve;
 }
示例#49
0
 public static void Register(int PacketID, int length, bool loggedin, OnPacketReceive onReceive)
 {
     Handlers[PacketID] = new PacketHandler(PacketID, length, loggedin, onReceive);
 }
示例#50
0
 public PacketHandler(int packetId, int length, OnPacketReceive onReceive)
 {
     m_PacketID = packetId;
     m_Length = length;
     m_OnReceive = onReceive;
 }
示例#51
0
 public PacketHandler(int packetId, int length, OnPacketReceive onReceive)
 {
     _packetId  = packetId;
     _length    = length;
     _onReceive = onReceive;
 }
示例#52
0
 private static void Register(short opcode, OnPacketReceive<LoginConnection> e)
 {
     m_LHandlers[opcode] = new PacketHandler<LoginConnection>(opcode, e);
     m_Maintained++;
 }
示例#53
0
 private static void Register(byte level, short opcode, OnPacketReceive<ClientConnection> e)
 {
     if (!levels.ContainsKey(level))
     {
         PacketHandler<ClientConnection>[] handlers = new PacketHandler<ClientConnection>[0xFFFF];
         handlers[opcode] = new PacketHandler<ClientConnection>(opcode, e);
         levels.Add(level, handlers);
     }
     else
     {
         levels[level][opcode] = new PacketHandler<ClientConnection>(opcode, e);
     }
 }
 private static void RegisterExtended(int packetId, int length, OnPacketReceive onReceive)
 {
     _handlers[packetId] = new PacketHandler(packetId, length, onReceive);
 }
示例#55
0
		public static void RegisterExtended( int packetID, bool ingame, OnPacketReceive onReceive )
		{
			if ( packetID >= 0 && packetID < 0x100 )
				m_ExtendedHandlersLow[packetID] = new PacketHandler( packetID, 0, ingame, onReceive );
			else
				m_ExtendedHandlersHigh[packetID] = new PacketHandler( packetID, 0, ingame, onReceive );
		}
示例#56
0
		public static void Register( int packetID, bool ingame, OnPacketReceive onReceive )
		{
			m_Handlers[packetID] = new PacketHandler( packetID, 0, ingame, onReceive );
		}
示例#57
0
 public static void Register(byte command, OnPacketReceive handler)
 {
     m_Handlers[command] = handler;
 }
示例#58
0
 public static void Register(PacketType packetId, int length, int minimumLength, OnPacketReceive onReceive)
 {
     MHandlers[(byte) packetId] = new PacketHandler(packetId, length, minimumLength, onReceive);
 }
 private static void Register(ushort opcode, OnPacketReceive <GameConnection> e)
 {
     m_GHandlers[opcode] = new PacketHandler <GameConnection>(opcode, e);
     m_Maintained++;
 }
 /// <summary>
 /// Registers a PacketHandler with GonzoNet.
 /// </summary>
 /// <param name="id">The ID of the packet.</param>
 /// <param name="size">The size of the packet.</param>
 /// <param name="handler">The handler for the packet.</param>
 public static void Register(byte id, bool Encrypted, ushort size, OnPacketReceive handler)
 {
     m_Handlers.Add(id, new PacketHandler(id, Encrypted, size, handler));
 }