public void Register(RconModel rconModel)
 {
     _rconModel            = rconModel;
     _rconModel.NewClient +=
         (sender, client) =>
     { client.ReceivedUnhandledLine += RconClientOnReceivedUnhandledLine; };
 }
        public void Register(RconModel rconModel)
        {
            _rconModel = rconModel;

            _nLogListener = new NLogListener();
            _nLogListener.LogWrite += NLogListenerOnLogWrite;

            _cancellationTokenSource = new CancellationTokenSource();

            _logWriteTimerTask = PeriodicTaskFactory.Start(
                () =>
                {
                    ProcessQueue();
                },
                intervalInMilliseconds: _LogWriteFlushTimeMs,
                delayInMilliseconds: 1000,
                duration: -1,
                maxIterations: -1,
                synchronous: false,
                cancelToken: _cancellationTokenSource.Token,
                periodicTaskCreationOptions: TaskCreationOptions.None);

            //// Repeat every 1 second
            //_logWriteTimerAction = ignored1 =>
            //                           {
            //                               if (ignored1.IsCompleted)
            //                                   return;
            //                               FlushBuffer();
            //                               //Task.Delay(_LogWriteFlushTimeMs, _cancellationTokenSource.Token).ContinueWith(ignored2 => _logWriteTimerAction(ignored2), _cancellationTokenSource.Token);
            //                               _logWriteTimerTask = Task.Delay(_LogWriteFlushTimeMs, _cancellationTokenSource.Token).ContinueWith(_logWriteTimerAction, _cancellationTokenSource.Token);
            //                           };

            //// Wait 1 sec, then start above repeating task
            //_logWriteTimerTask = Task.Delay(1000, _cancellationTokenSource.Token).ContinueWith(_logWriteTimerAction, _cancellationTokenSource.Token);
        }
Exemple #3
0
        public void Register(RconModel rconModel)
        {
            _rconModel = rconModel;

            _nLogListener           = new NLogListener();
            _nLogListener.LogWrite += NLogListenerOnLogWrite;

            _cancellationTokenSource = new CancellationTokenSource();

            _logWriteTimerTask = PeriodicTaskFactory.Start(
                () =>
            {
                ProcessQueue();
            },
                intervalInMilliseconds: _LogWriteFlushTimeMs,
                delayInMilliseconds: 1000,
                duration: -1,
                maxIterations: -1,
                synchronous: false,
                cancelToken: _cancellationTokenSource.Token,
                periodicTaskCreationOptions: TaskCreationOptions.None);

            //// Repeat every 1 second
            //_logWriteTimerAction = ignored1 =>
            //                           {
            //                               if (ignored1.IsCompleted)
            //                                   return;
            //                               FlushBuffer();
            //                               //Task.Delay(_LogWriteFlushTimeMs, _cancellationTokenSource.Token).ContinueWith(ignored2 => _logWriteTimerAction(ignored2), _cancellationTokenSource.Token);
            //                               _logWriteTimerTask = Task.Delay(_LogWriteFlushTimeMs, _cancellationTokenSource.Token).ContinueWith(_logWriteTimerAction, _cancellationTokenSource.Token);
            //                           };

            //// Wait 1 sec, then start above repeating task
            //_logWriteTimerTask = Task.Delay(1000, _cancellationTokenSource.Token).ContinueWith(_logWriteTimerAction, _cancellationTokenSource.Token);
        }
 public void Register(RconModel rconModel)
 {
     _rconModel            = rconModel;
     _rconModel.NewClient +=
         (sender, client) =>
     { client.ClientChatBufferCommand.ChatLineReceived += ClientChatBufferCommandOnChatLineReceived; };
 }
 public void Register(RconModel rconModel)
 {
     _rconModel = rconModel;
     _rconModel.NewClient +=
         (sender, client) =>
             { client.ClientChatBufferCommand.ChatLineReceived += ClientChatBufferCommandOnChatLineReceived; };
 }
 public void Register(RconModel rconModel)
 {
     _rconModel = rconModel;
     _rconModel.NewClient +=
         (sender, client) =>
         { client.ReceivedUnhandledLine += RconClientOnReceivedUnhandledLine; };
     
 }
        public static void Initialize(RconModel auth)
        {
            Ip           = auth.Ip;
            Port         = auth.Port;
            RconPassword = auth.RconPassword;

            server = ServerQuery.GetServerInstance(QueryMaster.EngineType.Source, new IPEndPoint(IPAddress.Parse(Ip), Port), false, 3000, 4000, 1, ThrowExceptions);
            server.GetControl(RconPassword);

            Task.Run(() => Initialize());
        }
        public App()
        {
            Mongo.Initialize(MongoDBHelper.JsonConfigurator.GetConnectionStringByConfigFile("config/db.json"));

            var auth = RconModel.GetOne("zRage");

            ServerManager.Initialize(auth);

            var settings = new JSettings();

            Variables.Settings = settings.Load <Settings>();
        }
 public void Register(RconModel rconModel)
 {
     _rconModel = rconModel;
 }
 public void Register(RconModel rconModel)
 {
     _rconModel = rconModel;
 }