private void SaveButton_Click(object sender, EventArgs e)
{
// General
Settings.SetValue("serverName", ServerNameBox.Text);
Settings.SetValue("password", ServerPasswordBox.Text);
Settings.SetValue("serverIP", ServerIpBox.Text);
Settings.SetValue("serverPort", ServerPortBox.Value.ToString());
Settings.SetValue("gameSpyPort", GamespyPortBox.Value.ToString());
Settings.SetValue("welcomeMessage", ServerWelcomeBox.Text);
Settings.SetValue("sponsorText", ServerWelcomeBox.Text);
Settings.SetValue("autoBalanceTeam", (AutoBalanceBox.Checked) ? "1" : "0");
Settings.SetValue("punkBuster", (EnablePunkBuster.Checked) ? "1" : "0");
Settings.SetValue("internet", (EnablePublicServerBox.Checked) ? "1" : "0");
Settings.SetValue("roundsPerMap", RoundsPerMapBox.Value.ToString());
Settings.SetValue("numPlayersNeededToStart", PlayersToStartSlider.Value.ToString());
Settings.SetValue("maxPlayers", MaxPlayersBar.Value.ToString());
Settings.SetValue("ticketRatio", TicketRatioBar.Value.ToString());
Settings.SetValue("teamRatioPercent", TeamRatioBar.Value.ToString());
Settings.SetValue("scoreLimit", ScoreLimitBar.Value.ToString());
// Time limits
Settings.SetValue("timeLimit", TimeLimitBar.Value.ToString());
Settings.SetValue("spawnTime", SpawnTimeBar.Value.ToString());
Settings.SetValue("manDownTime", ManDownBar.Value.ToString());
Settings.SetValue("startDelay", StartDelayBar.Value.ToString());
Settings.SetValue("endDelay", EndDelayBar.Value.ToString());
Settings.SetValue("endOfRoundDelay", EORBar.Value.ToString());
Settings.SetValue("notEnoughPlayersRestartDelay", NotEnoughPlayersBar.Value.ToString());
Settings.SetValue("timeBeforeRestartMap", TimeB4RestartMapBar.Value.ToString());
// Friendly Fire
Settings.SetValue("tkPunishEnabled", (PunishTeamKillsBox.Checked) ? "1" : "0");
Settings.SetValue("friendlyFireWithMines", (FriendlyFireBox.Checked) ? "1" : "0");
Settings.SetValue("tkPunishByDefault", (PunishDefaultBox.Checked) ? "1" : "0");
Settings.SetValue("tkNumPunishToKick", TksBeforeKickBox.Value.ToString());
Settings.SetValue("soldierFriendlyFire", SoldierFFBar.Value.ToString());
Settings.SetValue("soldierSplashFriendlyFire", SoldierSplashFFBar.Value.ToString());
Settings.SetValue("vehicleFriendlyFire", VehicleFFBar.Value.ToString());
Settings.SetValue("vehicleSplashFriendlyFire", VehicleSplashFFBar.Value.ToString());
// Voip
Settings.SetValue("voipEnabled", (EnableVoip.Checked) ? "1" : "0");
Settings.SetValue("voipServerRemote", (EnableRemoteVoip.Checked) ? "1" : "0");
Settings.SetValue("voipBFClientPort", VoipBF2ClientPort.Value.ToString());
Settings.SetValue("voipBFServerPort", VoipBF2ServerPort.Value.ToString());
Settings.SetValue("voipServerPort", VoipServerPort.Value.ToString());
Settings.SetValue("voipQuality", VoipQualityBar.Value.ToString());
Settings.SetValue("voipServerRemoteIP", RemoteVoipIpBox.Text);
Settings.SetValue("voipSharedPassword", VoipPasswordBox.Text);
// Voting
Settings.SetValue("votingEnabled", (EnableVotingBox.Checked) ? "1" : "0");
Settings.SetValue("teamVoteOnly", (EnableTeamVotingBox.Checked) ? "1" : "0");
Settings.SetValue("voteTime", VoteTimeBar.Value.ToString());
Settings.SetValue("minPlayersForVoting", PlayersVotingBar.Value.ToString());
// Demo & Urls
Settings.SetValue("autoRecord", (EnableAutoRecord.Checked) ? "1" : "0");
Settings.SetValue("demoQuality", DemoQualityBar.Value.ToString());
Settings.SetValue("demoIndexURL", DemoIndexUrlBox.Text);
Settings.SetValue("demoDownloadURL", DemoDownloadBox.Text);
Settings.SetValue("autoDemoHook", DemoHookBox.Text);
Settings.SetValue("communityLogoURL", CLogoUrlBox.Text);
Settings.SetValue("sponsorLogoURL", SLogoUrlBox.Text);
// Misc
Settings.SetValue("allowNATNegotiation", (AllowNATNagotiation.Checked) ? "1" : "0");
Settings.SetValue("allowFreeCam", (AllowFreeCam.Checked) ? "1" : "0");
Settings.SetValue("allowNoseCam", (AllowNoseCam.Checked) ? "1" : "0");
Settings.SetValue("allowExternalViews", (AllowExtViews.Checked) ? "1" : "0");
Settings.SetValue("hitIndicator", (HitIndicatorEnabled.Checked) ? "1" : "0");
Settings.SetValue("radioSpamInterval", RadioSpamIntBox.Value.ToString());
Settings.SetValue("radioMaxSpamFlagCount", RadioMaxSpamBox.Value.ToString());
Settings.SetValue("radioBlockedDurationTime", RadioBlockTimeBar.Value.ToString());
// Save to the file
try
{
// Bot Settings
SetBotSettings();
Settings.Save();
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Server Settings File Save Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}