Ejemplo n.º 1
0
        public void RegisterAssembly(Assembly assembly)
        {
            foreach (var packet in ScanAssemblyPackets(assembly))
            {
                var identifier = new MessageDispatcherStorage.PacketIdentifier(packet.Key.ProtocolId, packet.Key.PackedId);


                _storage.StorePacketType(identifier, packet.Value);
            }
        }
Ejemplo n.º 2
0
        private Type GetGenericPacketType(GenericPacket packet)
        {
            var identifier = new MessageDispatcherStorage.PacketIdentifier(packet);

            if (!_storage.HasPacketType(identifier))
            {
                LogUtils.Log($"Could not found packet associated with Protocol ID: {packet.ProtocolId} and Packet ID: {packet.PackedId}");
                return(null);
            }

            var baseGenericPacket = _storage.RetrievePacketType(identifier);
            var type = _serializer.GenericTypesProvider.GetType(packet.GenericTypeId);

            return(baseGenericPacket.MakeGenericType(type));
        }