Beispiel #1
0
        // Can be used to force a processor to handle packets it officially shouldn't handle
        // Might need this in the future idk
        public void RegisterPacketProcessor(Type packetType, PacketProcessor processor)
        {
            if (processor == null)
            {
                throw new ArgumentNullException(nameof(processor));
            }

            if (registeredProcessors.ContainsKey(packetType))
            {
                throw new Exception("A packet processor for this packet type is already registered");
            }

#if DEBUG
            Console.WriteLine($"Registered processor {processor.GetType().FullName} for packet {packetType.Name}");
#endif

            registeredProcessors.Add(packetType, processor);
        }