public static RCONWindow GetRCONForServer(Server server) { RCONWindow window; if (!RCONWindows.TryGetValue(server, out window) || !window.IsLoaded) { window = new RCONWindow(new RCONParameters() { WindowTitle = String.Format(GlobalizedApplication.Instance.GetResourceString("RCON_TitleLabel"), server.Runtime.ProfileSnapshot.ProfileName), WindowExtents = server.Profile.RCONWindowExtents, PlayerListWidth = server.Profile.RCONPlayerListWidth, Server = server, AdminPassword = server.Runtime.ProfileSnapshot.AdminPassword, InstallDirectory = server.Runtime.ProfileSnapshot.InstallDirectory, AltSaveDirectoryName = server.Runtime.ProfileSnapshot.AltSaveDirectoryName, ProfileId = server.Runtime.ProfileSnapshot.ProfileId, ProfileName = server.Runtime.ProfileSnapshot.ProfileName, MaxPlayers = server.Runtime.MaxPlayers, RCONHost = server.Runtime.ProfileSnapshot.ServerIP, RCONPort = server.Runtime.ProfileSnapshot.RCONPort, PGM_Enabled = server.Profile.PGM_Enabled, PGM_Name = server.Profile.PGM_Name, }); RCONWindows[server] = window; } return(window); }
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); }