Ejemplo n.º 1
0
        private static void checkActiveServerConnection()
        {
            var answer = RCONLogic.rconClient.sendMessage(RCONMessageType.Command, @"help");

            if (answer == string.Empty)
            {
                try
                {
                    RCONLogic.rconClient.Dispose();
                }
                catch
                {
                }

                RCONLogic.connect2RCONServer();
            }
        }
Ejemplo n.º 2
0
        public static void startLogic()
        {
            if (RCONLogic.isRunning)
            {
                return;
            }

            RCONLogic.isRunning = true;
            DebugWindow.writeLine(string.Format("Starting the RCONLogic now.\n"));
            RCONLogic.currentRunningTask = Task.Factory.StartNew(() =>
            {
                RCONLogic.connect2RCONServer();
                while (RCONLogic.isRunning)
                {
                    checkActiveServerConnection();
                    checkActivePlayers();
                    Thread.Sleep(TimeSpan.FromMilliseconds(100));
                }
                DebugWindow.writeLine(string.Format("The RCONLogic is stopped now.\n"));
            }, TaskCreationOptions.LongRunning);
        }