Пример #1
0
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            base.OnClosing(e);
            RCONWindow.CloseAllWindows();
            PlayerListWindow.CloseAllWindows();
            ServerMonitorWindow.CloseAllWindows();
            this.versionChecker.DisposeAsync().DoNotWait();

            var installFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var backupFolder  = IOUtils.NormalizePath(string.IsNullOrWhiteSpace(Config.Default.BackupPath)
                ? Path.Combine(Config.Default.DataDir, Config.Default.BackupDir)
                : Path.Combine(Config.Default.BackupPath));

            SettingsUtils.BackupUserConfigSettings(Config.Default, "userconfig.json", installFolder, backupFolder);
            SettingsUtils.BackupUserConfigSettings(CommonConfig.Default, "commonconfig.json", installFolder, backupFolder);
        }
        public static PlayerListWindow GetWindowForServer(Server server)
        {
            if (!Windows.TryGetValue(server, out PlayerListWindow window) || !window.IsLoaded)
            {
                window = new PlayerListWindow(new PlayerListParameters()
                {
                    WindowTitle   = String.Format(GlobalizedApplication.Instance.GetResourceString("PlayerList_TitleLabel"), server.Runtime.ProfileSnapshot.ProfileName),
                    WindowExtents = server.Profile.PlayerListWindowExtents,

                    Server           = server,
                    ServerMap        = ServerProfile.GetProfileMapName(server?.Profile),
                    InstallDirectory = server.Runtime.ProfileSnapshot.InstallDirectory,
                    ProfileName      = server.Runtime.ProfileSnapshot.ProfileName,
                    ProfileId        = server.Runtime.ProfileSnapshot.ProfileId,
                });
                Windows[server] = window;
            }

            return(window);
        }