Пример #1
0
 public ShardServer(IWhisperComposerFactory <ShardRequest> composerFactory, IRandomSource randomSource, IWhisperDatasource wauth, IWhisperDatasource wshard, World world, Game.World.Shard shard, ShardConfig configuration) : base(composerFactory)
 {
     AppConfig    = configuration;
     SecureRandom = randomSource;
     AuthDB       = wauth;
     ShardDB      = wshard;
     World        = world;
     Shard        = shard;
 }
Пример #2
0
        public static void Main(string[] args)
        {
            using (IWindsorContainer container = new WindsorContainer())
            {
                XmlConfigurator.Configure(new FileInfo(args.Length < 2 ? LogConfigurationFile : args[1]));

                ShardConfig config = new ShardConfig();
                config.Initialize(new ConfigurationFileConfigurationProvider <ShardConfig>()
                {
                    ConfigurationFile = args.Length < 1 ? ConfigurationFile : args[0], ConfigurationSection = ConfigurationSection
                });

                container.Register(Component.For <ShardConsole>());
                container.Register(Component.For <ShardConfig>().Instance(config));
                container.Register(Component.For <IRandomSource>().ImplementedBy <SecureRandom>());
                container.Register(Component.For <IWhisperComposerFactory <ShardRequest> >().ImplementedBy <ShardComposerFactory>());
                container.Register(Component.For <IWhisperRequestFactory <ShardRequest, ShardClientOpcode> >().ImplementedBy <ShardRequestFactory>());

                container.Register(Component.For <ShardServer>()
                                   .DependsOn(Dependency.OnValue("wauth", new Datasource(config.AuthDatabaseAddress, config.AuthDatabasePort, config.AuthDatabaseName, config.AuthDatabaseUser, config.AuthDatabasePassword)))
                                   .DependsOn(Dependency.OnValue("wshard", new Datasource(config.ShardDatabaseAddress, config.ShardDatabasePort, config.ShardDatabaseName, config.ShardDatabaseUser, config.ShardDatabasePassword)))
                                   );

                container.Register(Component.For <World>()
                                   .DependsOn(Dependency.OnValue("wworld", new Datasource(config.WorldDatabaseAddress, config.WorldDatabasePort, config.WorldDatabaseName, config.WorldDatabaseUser, config.WorldDatabasePassword)))
                                   );
                container.Register(Component.For <Game.World.Shard>());

                ServerConfig serverConfig = new ServerConfig();
                serverConfig.Ip                 = config.ShardDaemonBindAddress;
                serverConfig.Port               = config.ShardDaemonBindPort;
                serverConfig.MaxRequestLength   = 2048;
                serverConfig.Mode               = SocketMode.Tcp;
                serverConfig.IdleSessionTimeOut = 62;

                ShardConsole console = container.Resolve <ShardConsole>();
                console.Server.Setup(serverConfig);
                console.Server.Start();
                console.Run();
                console.Server.Stop();
            }
        }
Пример #3
0
 public ShardPinger(IWhisperDatasource wauth, ShardConfig config)
 {
     this.config    = config;
     authDatasource = wauth;
 }
Пример #4
0
 public ShardUpdater(ShardServer server, ShardConfig config)
 {
     this.server = server;
     this.config = config;
 }