public ServerRCON(RCONParameters parameters)
        {
            //this.runtimeChangedNotifier = new PropertyChangeNotifier(server.Runtime, ServerRuntime.ProfileSnapshotProperty, (s, d) =>
            //{
            //    var oldSnapshot = this.rconParams;
            //    if (d == null || d.NewValue == null) return;

            //    var newSnapshot = (ServerRuntime.RuntimeProfileSnapshot)d.NewValue;
            //    this.rconParams = (ServerRuntime.RuntimeProfileSnapshot)d.NewValue;

            //    bool reinitLoggers = !String.Equals(this.rconParams.ProfileName, newSnapshot.ProfileName);
            //    if (reinitLoggers)
            //    {
            //        ReinitializeLoggers();
            //    }
            //});

            this.commandProcessor = new ActionQueue(TaskScheduler.Default);

            // This is on the UI thread so we can do things like update dependency properties and whatnot.
            this.outputProcessor = new ActionQueue(TaskScheduler.FromCurrentSynchronizationContext());

            this.Players = new SortableObservableCollection <PlayerInfo>();

            this.rconParams = parameters;
            ReinitializeLoggers();
            commandProcessor.PostAction(AutoPlayerList);
            commandProcessor.PostAction(AutoGetChat);
        }
 private Task AutoPlayerList()
 {
     return(this.commandProcessor.PostAction(() =>
     {
         ProcessInput(new ConsoleCommand()
         {
             rawCommand = "listplayers", suppressCommand = true, suppressOutput = true
         });
         Task.Delay(ListPlayersPeriod).ContinueWith(t => commandProcessor.PostAction(AutoPlayerList)).DoNotWait();
     }));
 }
Ejemplo n.º 3
0
        public ServerRCON(RCONParameters parameters)
        {
            this.commandProcessor = new ActionQueue(TaskScheduler.Default);

            // This is on the UI thread so we can do things like update dependency properties and whatnot.
            this.outputProcessor = new ActionQueue(TaskScheduler.FromCurrentSynchronizationContext());

            this.Players = new SortableObservableCollection <PlayerInfo>();

            this.rconParams = parameters;
            ReinitializeLoggers();
            commandProcessor.PostAction(AutoPlayerList);
            commandProcessor.PostAction(AutoGetChat);
        }
        public ServerRCON(RCONParameters parameters)
        {
            this.rconParams = parameters;
            this.Players    = new SortableObservableCollection <PlayerInfo>();

            this.allLogger   = App.GetProfileLogger(this.rconParams.ProfileName, "RCON_All", LogLevel.Info, LogLevel.Info);
            this.chatLogger  = App.GetProfileLogger(this.rconParams.ProfileName, "RCON_Chat", LogLevel.Info, LogLevel.Info);
            this.eventLogger = App.GetProfileLogger(this.rconParams.ProfileName, "RCON_Event", LogLevel.Info, LogLevel.Info);
            this.debugLogger = App.GetProfileLogger(this.rconParams.ProfileName, "RCON_Debug", LogLevel.Trace, LogLevel.Debug);
            this.errorLogger = App.GetProfileLogger(this.rconParams.ProfileName, "RCON_Error", LogLevel.Error, LogLevel.Fatal);

            commandProcessor.PostAction(AutoPlayerList);
            commandProcessor.PostAction(AutoGetChat);
        }
        public ServerRCON(Server server)
        {
            this.runtimeChangedNotifier = new PropertyChangeNotifier(server.Runtime, ServerRuntime.ProfileSnapshotProperty, (s, d) =>
            {
                this.snapshot = (ServerRuntime.RuntimeProfileSnapshot)d.NewValue;
                commandProcessor.PostAction(() => Reconnect());
            });

            this.commandProcessor = new ActionQueue();

            // This is on the UI thread so we can do things like update dependency properties and whatnot.
            this.outputProcessor = new ActionBlock <ConsoleCommand>(new Func <ConsoleCommand, Task>(ProcessOutput),
                                                                    new ExecutionDataflowBlockOptions
            {
                MaxDegreeOfParallelism = 1,
                TaskScheduler          = TaskScheduler.FromCurrentSynchronizationContext()
            });

            this.Players = new SortableObservableCollection <PlayerInfo>();
        }