/// <summary> /// Constructor /// </summary> /// <param name="UseGlobalSettings"> /// If true, the global settings file will be used /// instead of the Selected mods settings file /// </param> public ServerSettingsForm(bool UseGlobalSettings) { InitializeComponent(); this.UseGlobalSettings = UseGlobalSettings; // Parse settings file, and fill in form values try { // Load Settings, and set for title if (UseGlobalSettings) { this.Settings = new ServerSettings(Path.Combine(Program.RootPath, "Python", "GlobalServerSettings.con")); this.Text = "Global Server Settings"; } else { this.Settings = MainForm.SelectedMod.ServerSettings; this.Text = MainForm.SelectedMod.Title + " Server Settings"; } // General ServerNameBox.Text = Settings.GetValue("serverName", "Default Server Name"); ServerPasswordBox.Text = Settings.GetValue("password", ""); ServerIpBox.Text = Settings.GetValue("serverIP", ""); ServerPortBox.Value = Int32.Parse(Settings.GetValue("serverPort", "16567")); GamespyPortBox.Value = Int32.Parse(Settings.GetValue("gameSpyPort", "29900")); ServerWelcomeBox.Text = Settings.GetValue("welcomeMessage", ""); AutoBalanceBox.Checked = (Int32.Parse(Settings.GetValue("autoBalanceTeam", "0")) == 1); EnablePublicServerBox.Checked = (Int32.Parse(Settings.GetValue("internet", "0")) == 1); EnablePunkBuster.Checked = (Int32.Parse(Settings.GetValue("punkBuster", "0")) == 1); RoundsPerMapBox.Value = Int32.Parse(Settings.GetValue("roundsPerMap", "3")); PlayersToStartSlider.Value = Int32.Parse(Settings.GetValue("numPlayersNeededToStart", "2")); MaxPlayersBar.Value = Int32.Parse(Settings.GetValue("maxPlayers", "16")); TicketRatioBar.Value = Int32.Parse(Settings.GetValue("ticketRatio", "200")); ScoreLimitBar.Value = Int32.Parse(Settings.GetValue("scoreLimit", "0")); TeamRatioBar.Value = Int32.Parse(Settings.GetValue("teamRatioPercent", "50")); // Time settings TimeLimitBar.Value = Int32.Parse(Settings.GetValue("timeLimit", "0")); SpawnTimeBar.Value = Int32.Parse(Settings.GetValue("spawnTime", "15")); ManDownBar.Value = Int32.Parse(Settings.GetValue("manDownTime", "15")); StartDelayBar.Value = Int32.Parse(Settings.GetValue("startDelay", "15")); EndDelayBar.Value = Int32.Parse(Settings.GetValue("endDelay", "15")); EORBar.Value = Int32.Parse(Settings.GetValue("endOfRoundDelay", "15")); NotEnoughPlayersBar.Value = Int32.Parse(Settings.GetValue("notEnoughPlayersRestartDelay", "15")); TimeB4RestartMapBar.Value = Int32.Parse(Settings.GetValue("timeBeforeRestartMap", "45")); // Friendly Fire Settings PunishTeamKillsBox.Checked = (Int32.Parse(Settings.GetValue("tkPunishEnabled", "1")) == 1); FriendlyFireBox.Checked = (Int32.Parse(Settings.GetValue("friendlyFireWithMines", "0")) == 1); PunishDefaultBox.Checked = (Int32.Parse(Settings.GetValue("tkPunishByDefault", "0")) == 1); TksBeforeKickBox.Value = Int32.Parse(Settings.GetValue("tkNumPunishToKick", "3")); SoldierFFBar.Value = Int32.Parse(Settings.GetValue("soldierFriendlyFire", "100")); VehicleFFBar.Value = Int32.Parse(Settings.GetValue("vehicleFriendlyFire", "100")); SoldierSplashFFBar.Value = Int32.Parse(Settings.GetValue("soldierSplashFriendlyFire", "100")); VehicleSplashFFBar.Value = Int32.Parse(Settings.GetValue("vehicleSplashFriendlyFire", "100")); // Voip EnableVoip.Checked = (Int32.Parse(Settings.GetValue("voipEnabled", "1")) == 1); EnableRemoteVoip.Checked = (Int32.Parse(Settings.GetValue("voipServerRemote", "0")) == 1); VoipBF2ClientPort.Value = Int32.Parse(Settings.GetValue("voipBFClientPort", "55123")); VoipBF2ServerPort.Value = Int32.Parse(Settings.GetValue("voipBFServerPort", "55124")); VoipServerPort.Value = Int32.Parse(Settings.GetValue("voipServerPort", "55125")); RemoteVoipIpBox.Text = Settings.GetValue("voipServerRemoteIP", ""); VoipPasswordBox.Text = Settings.GetValue("voipSharedPassword", ""); VoipQualityBar.Value = Int32.Parse(Settings.GetValue("voipQuality", "3")); // Voting Settings EnableVotingBox.Checked = (Int32.Parse(Settings.GetValue("votingEnabled", "1")) == 1); EnableTeamVotingBox.Checked = (Int32.Parse(Settings.GetValue("teamVoteOnly", "1")) == 1); VoteTimeBar.Value = Int32.Parse(Settings.GetValue("voteTime", "90")); PlayersVotingBar.Value = Int32.Parse(Settings.GetValue("minPlayersForVoting", "2")); // Demo & Urls EnableAutoRecord.Checked = (Int32.Parse(Settings.GetValue("autoRecord", "0")) == 1); DemoQualityBar.Value = Int32.Parse(Settings.GetValue("demoQuality", "5")); DemoIndexUrlBox.Text = Settings.GetValue("demoIndexURL", "http://"); DemoDownloadBox.Text = Settings.GetValue("demoDownloadURL", "http://"); DemoHookBox.Text = Settings.GetValue("autoDemoHook", "adminutils/demo/rotate_demo.exe"); CLogoUrlBox.Text = Settings.GetValue("communityLogoURL", ""); SLogoUrlBox.Text = Settings.GetValue("sponsorLogoURL", ""); // Misc Settings AllowNATNagotiation.Checked = (Int32.Parse(Settings.GetValue("allowNATNegotiation", "0")) == 1); AllowFreeCam.Checked = (Int32.Parse(Settings.GetValue("allowFreeCam", "0")) == 1); AllowNoseCam.Checked = (Int32.Parse(Settings.GetValue("allowNoseCam", "1")) == 1); AllowExtViews.Checked = (Int32.Parse(Settings.GetValue("allowExternalViews", "1")) == 1); HitIndicatorEnabled.Checked = (Int32.Parse(Settings.GetValue("hitIndicator", "1")) == 1); RadioSpamIntBox.Value = Int32.Parse(Settings.GetValue("radioSpamInterval", "6")); RadioMaxSpamBox.Value = Int32.Parse(Settings.GetValue("radioMaxSpamFlagCount", "6")); RadioBlockTimeBar.Value = Int32.Parse(Settings.GetValue("radioBlockedDurationTime", "30")); // Bot Settings GetBotSettings(); } catch (Exception e) { this.Load += (s, ea) => this.Close(); MessageBox.Show(e.Message, "Server Settings File Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Opens the Edit Server Settings Form /// </summary> private void EditServerSettingsBtn_Click(object sender, EventArgs e) { string file; if (GlobalServerSettings.Checked) file = Path.Combine(MainForm.Root, "Python", "GlobalServerSettings.con"); else file = Path.Combine(SettingsPath, "ServerSettings.con"); try { ServerSettings SS = new ServerSettings(file); SS.ShowDialog(); } catch { } }
/// <summary> /// Constructor /// </summary> /// <param name="UseGlobalSettings"> /// If true, the global settings file will be used /// instead of the Selected mods settings file /// </param> public ServerSettingsForm(bool UseGlobalSettings) { InitializeComponent(); this.UseGlobalSettings = UseGlobalSettings; // Parse settings file, and fill in form values try { // Load Settings, and set for title if (UseGlobalSettings) { this.Settings = new ServerSettings(Path.Combine(Program.RootPath, "Python", "GlobalServerSettings.con")); this.Text = "Global Server Settings"; } else { this.Settings = MainForm.SelectedMod.ServerSettings; this.Text = MainForm.SelectedMod.Title + " Server Settings"; } // General ServerNameBox.Text = Settings.GetValue("serverName"); ServerPasswordBox.Text = Settings.GetValue("password"); ServerIpBox.Text = Settings.GetValue("serverIP"); ServerPortBox.Value = Int32.Parse(Settings.GetValue("serverPort")); GamespyPortBox.Value = Int32.Parse(Settings.GetValue("gameSpyPort")); ServerWelcomeBox.Text = Settings.GetValue("welcomeMessage"); AutoBalanceBox.Checked = (Int32.Parse(Settings.GetValue("autoBalanceTeam")) == 1); EnablePublicServerBox.Checked = (Int32.Parse(Settings.GetValue("internet")) == 1); EnablePunkBuster.Checked = (Int32.Parse(Settings.GetValue("punkBuster")) == 1); RoundsPerMapBox.Value = Int32.Parse(Settings.GetValue("roundsPerMap")); PlayersToStartSlider.Value = Int32.Parse(Settings.GetValue("numPlayersNeededToStart")); MaxPlayersBar.Value = Int32.Parse(Settings.GetValue("maxPlayers")); TicketRatioBar.Value = Int32.Parse(Settings.GetValue("ticketRatio")); ScoreLimitBar.Value = Int32.Parse(Settings.GetValue("scoreLimit")); TeamRatioBar.Value = Int32.Parse(Settings.GetValue("teamRatioPercent")); // Time settings TimeLimitBar.Value = Int32.Parse(Settings.GetValue("timeLimit")); SpawnTimeBar.Value = Int32.Parse(Settings.GetValue("spawnTime")); ManDownBar.Value = Int32.Parse(Settings.GetValue("manDownTime")); StartDelayBar.Value = Int32.Parse(Settings.GetValue("startDelay")); EndDelayBar.Value = Int32.Parse(Settings.GetValue("endDelay")); EORBar.Value = Int32.Parse(Settings.GetValue("endOfRoundDelay")); NotEnoughPlayersBar.Value = Int32.Parse(Settings.GetValue("notEnoughPlayersRestartDelay")); TimeB4RestartMapBar.Value = Int32.Parse(Settings.GetValue("timeBeforeRestartMap")); // Friendly Fire Settings PunishTeamKillsBox.Checked = (Int32.Parse(Settings.GetValue("tkPunishEnabled")) == 1); FriendlyFireBox.Checked = (Int32.Parse(Settings.GetValue("friendlyFireWithMines")) == 1); PunishDefaultBox.Checked = (Int32.Parse(Settings.GetValue("tkPunishByDefault")) == 1); TksBeforeKickBox.Value = Int32.Parse(Settings.GetValue("tkNumPunishToKick")); SoldierFFBar.Value = Int32.Parse(Settings.GetValue("soldierFriendlyFire")); VehicleFFBar.Value = Int32.Parse(Settings.GetValue("vehicleFriendlyFire")); SoldierSplashFFBar.Value = Int32.Parse(Settings.GetValue("soldierSplashFriendlyFire")); VehicleSplashFFBar.Value = Int32.Parse(Settings.GetValue("vehicleSplashFriendlyFire")); // Voip EnableVoip.Checked = (Int32.Parse(Settings.GetValue("voipEnabled")) == 1); EnableRemoteVoip.Checked = (Int32.Parse(Settings.GetValue("voipServerRemote")) == 1); VoipBF2ClientPort.Value = Int32.Parse(Settings.GetValue("voipBFClientPort")); VoipBF2ServerPort.Value = Int32.Parse(Settings.GetValue("voipBFServerPort")); VoipServerPort.Value = Int32.Parse(Settings.GetValue("voipServerPort")); RemoteVoipIpBox.Text = Settings.GetValue("voipServerRemoteIP"); VoipPasswordBox.Text = Settings.GetValue("voipSharedPassword"); VoipQualityBar.Value = Int32.Parse(Settings.GetValue("voipQuality")); // Voting Settings EnableVotingBox.Checked = (Int32.Parse(Settings.GetValue("votingEnabled")) == 1); EnableTeamVotingBox.Checked = (Int32.Parse(Settings.GetValue("teamVoteOnly")) == 1); VoteTimeBar.Value = Int32.Parse(Settings.GetValue("voteTime")); PlayersVotingBar.Value = Int32.Parse(Settings.GetValue("minPlayersForVoting")); // Demo & Urls EnableAutoRecord.Checked = (Int32.Parse(Settings.GetValue("autoRecord", "0")) == 1); DemoQualityBar.Value = Int32.Parse(Settings.GetValue("demoQuality", "5")); DemoIndexUrlBox.Text = Settings.GetValue("demoIndexURL", "http://"); DemoDownloadBox.Text = Settings.GetValue("demoDownloadURL", "http://"); DemoHookBox.Text = Settings.GetValue("autoDemoHook", ""); CLogoUrlBox.Text = Settings.GetValue("communityLogoURL", ""); SLogoUrlBox.Text = Settings.GetValue("sponsorLogoURL", ""); // Misc Settings AllowNATNagotiation.Checked = (Int32.Parse(Settings.GetValue("allowNATNegotiation", "0")) == 1); AllowFreeCam.Checked = (Int32.Parse(Settings.GetValue("allowFreeCam", "0")) == 1); AllowNoseCam.Checked = (Int32.Parse(Settings.GetValue("allowNoseCam", "1")) == 1); AllowExtViews.Checked = (Int32.Parse(Settings.GetValue("allowExternalViews", "1")) == 1); HitIndicatorEnabled.Checked = (Int32.Parse(Settings.GetValue("hitIndicator", "1")) == 1); RadioSpamIntBox.Value = Int32.Parse(Settings.GetValue("radioSpamInterval", "6")); RadioMaxSpamBox.Value = Int32.Parse(Settings.GetValue("radioMaxSpamFlagCount", "6")); RadioBlockTimeBar.Value = Int32.Parse(Settings.GetValue("radioBlockedDurationTime", "30")); // Bot Settings GetBotSettings(); } catch(Exception e) { this.Load += new EventHandler(CloseOnStart); MessageBox.Show(e.Message, "Server Settings File Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }