Beispiel #1
0
        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);
        }
        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(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>();
        }