Esempio n. 1
0
 public Runmode(ILoggerFactory loggerFactory, BaseConfig baseConfig, RunmodeConfig runmodeConfig)
 {
     _runmodeConfig = runmodeConfig;
     _logger        = loggerFactory.CreateLogger <Runmode>();
     _stopToken     = new StopToken();
     _modeBase      = new ModeBase(loggerFactory, baseConfig, _stopToken);
 }
Esempio n. 2
0
        public Runmode(ILoggerFactory loggerFactory, BaseConfig baseConfig, Func <RunmodeConfig> configLoader)
        {
            RunmodeConfig runmodeConfig = configLoader();

            _logger    = loggerFactory.CreateLogger <Runmode>();
            _stopToken = new StopToken();
            Setups.Databases repos = Setups.SetUpRepositories(_logger, baseConfig);
            (_broadcastServer, _overlayConnection) = Setups.SetUpOverlayServer(loggerFactory);
            _modeBase = new ModeBase(loggerFactory, repos, baseConfig, _stopToken, _overlayConnection, ProcessMessage);
            _modeBase.InstallAdditionalCommand(new Command("reloadinputconfig", _ =>
            {
                ReloadConfig(configLoader().InputConfig);
                return(Task.FromResult(new CommandResult {
                    Response = "input config reloaded"
                }));
            }));

            // TODO felk: this feels a bit messy the way it is done right now,
            //            but I am unsure yet how I'd integrate the individual parts in a cleaner way.
            InputConfig inputConfig = runmodeConfig.InputConfig;

            _inputParser      = inputConfig.ButtonsProfile.ToInputParser();
            _inputBufferQueue = new InputBufferQueue <QueuedInput>(CreateBufferConfig(inputConfig));
            _anarchyInputFeed = CreateInputFeedFromConfig(inputConfig);
            _inputServer      = new InputServer(loggerFactory.CreateLogger <InputServer>(),
                                                runmodeConfig.InputServerHost, runmodeConfig.InputServerPort,
                                                _anarchyInputFeed);
        }
Esempio n. 3
0
        public DualcoreMode(ILoggerFactory loggerFactory, BaseConfig baseConfig)
        {
            _logger    = loggerFactory.CreateLogger <DualcoreMode>();
            _stopToken = new StopToken();
            Setups.Databases  repos = Setups.SetUpRepositories(_logger, baseConfig);
            OverlayConnection overlayConnection;

            (_broadcastServer, overlayConnection) = Setups.SetUpOverlayServer(loggerFactory);
            _modeBase = new ModeBase(loggerFactory, repos, baseConfig, _stopToken, overlayConnection);
        }
Esempio n. 4
0
        public Matchmode(ILoggerFactory loggerFactory, BaseConfig baseConfig, MatchmodeConfig matchmodeConfig)
        {
            _matchmodeConfig = matchmodeConfig;
            _loggerFactory   = loggerFactory;
            _logger          = loggerFactory.CreateLogger <Matchmode>();
            _stopToken       = new StopToken();
            _modeBase        = new ModeBase(loggerFactory, baseConfig, _stopToken);

            _broadcastServer = new WebsocketBroadcastServer(
                loggerFactory.CreateLogger <WebsocketBroadcastServer>(), "localhost", 5001);
            _overlayConnection =
                new OverlayConnection(loggerFactory.CreateLogger <OverlayConnection>(), _broadcastServer);
        }
Esempio n. 5
0
 public Matchmode(ILoggerFactory loggerFactory, BaseConfig baseConfig, MatchmodeConfig matchmodeConfig)
 {
     _matchmodeConfig = matchmodeConfig;
     _loggerFactory = loggerFactory;
     _logger = loggerFactory.CreateLogger<Matchmode>();
     _stopToken = new StopToken();
     Setups.Databases repos = Setups.SetUpRepositories(_logger, baseConfig);
     _pokeyenBank = repos.PokeyenBank;
     _userRepo = repos.UserRepo;
     (_broadcastServer, _overlayConnection) = Setups.SetUpOverlayServer(loggerFactory);
     _modeBase = new ModeBase(loggerFactory, repos, baseConfig, _stopToken, _overlayConnection);
     var bettingCommands = new BettingCommands(() => _bettingPeriod);
     foreach (Command command in bettingCommands.Commands)
         _modeBase.InstallAdditionalCommand(command);
 }
Esempio n. 6
0
 public DualcoreMode(ILoggerFactory loggerFactory, BaseConfig baseConfig)
 {
     _logger    = loggerFactory.CreateLogger <DualcoreMode>();
     _stopToken = new StopToken();
     _modeBase  = new ModeBase(loggerFactory, baseConfig, _stopToken);
 }