Exemplo n.º 1
0
        protected NetworkerServerBase(ServerConfiguration configuration,
                                      INetworkerLogger logger,
                                      IList <INetworkerPacketHandlerModule> modules,
                                      IContainerIoc container)
        {
            this.configuration           = configuration;
            this.Logger                  = logger;
            this.container               = container;
            this.Connections             = new List <TcpConnection>();
            this.packetSerializer        = new PacketSerializer();
            this.packetDeserializer      = new PacketDeserializer();
            this.packetHandlers          = new Dictionary <string, Type>();
            this.packetHandlerSingletons = new Dictionary <string, IServerPacketHandler>();

            foreach (var module in modules)
            {
                this.RegisterTypesFromModule(module);
            }

            this.container.RegisterSingleton <ITcpConnectionsProvider>(
                new TcpConnectionsProvider(this.Connections));
            this.container.RegisterSingleton(logger);

            this.RegisterPacketHandler <PingRequestPacket, PingRequestPacketHandler>();
        }
Exemplo n.º 2
0
 public ExampleServer(ServerConfiguration configuration,
                      INetworkerLogger logger,
                      IList <INetworkerPacketHandlerModule> modules, IContainerIoc container)
     : base(configuration, logger, modules, container)
 {
     this.ClientConnected += this.ClientConnectedEvent;
 }
Exemplo n.º 3
0
 public DefaultServer(ServerConfiguration configuration,
                      INetworkerLogger logger,
                      IList <INetworkerPacketHandlerModule> modules,
                      IContainerIoc container)
     : base(configuration, logger, modules, container)
 {
 }
Exemplo n.º 4
0
 public NetworkerClientBuilder()
 {
     this.configuration       = new ClientConfiguration();
     this.logger              = new NetworkerLogger();
     this.packerHandlerModule = new DefaultPacketHandlerModule();
     this.modules             = new List <INetworkerPacketHandlerModule>();
     this.modules.Add(this.packerHandlerModule);
 }
Exemplo n.º 5
0
 public NetworkerServerBuilder()
 {
     this.container           = new ServiceCollectionContainer(new ServiceCollection());
     this.configuration       = new ServerConfiguration();
     this.logger              = new NetworkerLogger();
     this.packetHandlerModule = new DefaultPacketHandlerModule();
     this.modules             = new List <INetworkerPacketHandlerModule>();
     this.modules.Add(this.packetHandlerModule);
 }
Exemplo n.º 6
0
        protected NetworkerClientBase(ClientConfiguration clientConfiguration,
                                      INetworkerLogger logger,
                                      IList <INetworkerPacketHandlerModule> packetHandlerModules)
        {
            this.clientConfiguration = clientConfiguration;
            this.logger             = logger;
            this.Container          = new ServiceCollectionContainer(new ServiceCollection());
            this.packetDeserializer = new PacketDeserializer();
            this.Container.RegisterSingleton(logger);
            this.packetHandlers      = new Dictionary <string, Type>();
            this.clientResponseStore = new ClientResponseStore();

            foreach (var packetHandlerModule in packetHandlerModules)
            {
                this.RegisterTypesFromModule(packetHandlerModule);
            }
        }
Exemplo n.º 7
0
 public DefaultClient(ClientConfiguration clientConfiguration,
                      INetworkerLogger logger,
                      IList <INetworkerPacketHandlerModule> packetHandlerModules)
     : base(clientConfiguration, logger, packetHandlerModules)
 {
 }
Exemplo n.º 8
0
 public ChatMessageDispatchPacketHandler(INetworkerLogger logger)
 {
     this._logger = logger;
 }
Exemplo n.º 9
0
 public ServerInformationResponsePacketHandler(INetworkerLogger logger)
 {
     this._logger = logger;
 }
 public ChatMessageReceivedPacketHandler(INetworkerLogger logger)
 {
     this._logger = logger;
 }