示例#1
0
        /// <summary>
        /// Sends commands to Quake Live to verify that a server connection exists.
        /// </summary>
        public async Task CheckQlServerConnectionExists()
        {
            QlCommands.ClearQlWinConsole();
            await QlCommands.CheckMainMenuStatus();

            await QlCommands.CheckCmdStatus();

            QlCommands.QlCmdClear();
        }
示例#2
0
        /// <summary>
        /// Performs the delayed initialization steps.
        /// </summary>
        /// <param name="secondsToWait">The number of seconds the timer should wait before executing.</param>
        private void PerformDelayedInitTasks(double secondsToWait)
        {
            _delayedInitTaskTimer = new Timer(secondsToWait * 1000)
            {
                AutoReset = false, Enabled = true
            };

            // Finalize the delayed initilization tasks
            _delayedInitTaskTimer.Elapsed += async(sender, args) =>
            {
                Log.Write("Performing delayed initilization tasks.", _logClassType, _logPrefix);

                QlCommands.ClearQlWinConsole();

                // Initiate modules such as MOTD and others that can't be started until after we're live
                Mod.Motd.Init();

                // Get IP
                CheckServerAddress();

                // Send configstrings request in order to get an accurate listing of the teams.
                // Strangely, this appears to not register w/ QL at various times, so send it a few
                // different times.
                for (var i = 1; i < 4; i++)
                {
                    await QlCommands.SendToQlDelayedAsync("configstrings", true, (i * 3));
                }

                // Update UI status bar with IP
                await Task.Delay(2000);

                UserInterface.UpdateMonitoringStatusUi(true, ServerInfo.CurrentServerAddress);
                QlCommands.QlCmdClear();

                // Done
                QlCommands.ClearBothQlConsoles();
                QlCommands.SendToQl("echo ^4***^5SST is now ^2LOADED^4***", false);
                QlCommands.SendToQl("print ^4***^5SST is now ^2LOADED^4***", false);
                Log.Write("SST is now loaded on the server.", _logClassType, _logPrefix);
                IsInitComplete                = true;
                MonitoringStartedTime         = DateTime.Now;
                _delayedInitTaskTimer.Enabled = false;
                _delayedInitTaskTimer         = null;
            };
        }
示例#3
0
 /// <summary>
 /// Gets the server address.
 /// </summary>
 private void CheckServerAddress()
 {
     QlCommands.RequestServerAddress();
     QlCommands.QlCmdClear();
 }