private void UpdateComponents(AtlasServerData ServerData) { this.ServerData = ServerData; directoryPathTextBox.Text = ServerData.ServerPath; ServerPath = ServerData.ServerPath; AltSaveDirectoryTextBox.Text = ServerData.AltSaveDirectory; MaxPlayersNumericUpDown.Value = ServerData.MaxPlayers; QueryPortNumericUpDown.Value = ServerData.QueryPort; ServerPortNumericUpDown.Value = ServerData.ServerPort; AdminPassMaskedTextBox.Text = ServerData.Pass; checkBox1.Checked = ServerData.WildWipe; checkBox10.Checked = ServerData.PVP; checkBox11.Checked = ServerData.MapB; checkBox12.Checked = ServerData.Gamma; checkBox13.Checked = ServerData.Third; checkBox14.Checked = ServerData.Crosshair; checkBox15.Checked = ServerData.HitMarker; checkBox16.Checked = ServerData.Imprint; checkBox17.Checked = ServerData.FTD; BattleEyeCheck.Checked = ServerData.BattleEye; AdditionalArgsTextBox.Text = ServerData.CustomArgs; AdditionalAfterArgsTextBox.Text = ServerData.CustomAfterArgs; ServerXNumericUpDown.Value = ServerData.ServerX; ServerYNumericUpDown.Value = ServerData.ServerY; ReservedPlayersNumericUpDown.Value = ServerData.ReservedPlayers; ServerIPTextBox.Text = ServerData.ServerIp; ProcessPriotityCombo.SelectedIndex = ServerData.ProcessPriority; UPNPCheck.Checked = ServerData.Upnp; /*Process Affinity*/ if (ServerData.ProcessAffinity == null || ServerData.ProcessAffinity.Length == 0) { ServerData.ProcessAffinity = new bool[Environment.ProcessorCount]; } PA.UpdateCheckBoxs(ServerData.ProcessAffinity); /*Rcon*/ checkBox3.Checked = ServerData.Rcon; RconIP.Text = ServerData.RCONIP; RconNumericUpDown.Value = ServerData.RconPort; if (!Create) { Text = "Edit: ServerX: " + ServerData.ServerX + ", ServerY: " + ServerData.ServerX + ", Port: " + ServerData.ServerPort; AddServerButton.Text = "Save Settings"; } //Translate.TranslateComponents(Controls, "ru"); }
private void CopyServerData() { if (directoryPathTextBox.Text == string.Empty) { directoryPathTextBox.Text = @".\AtlasServerData"; } System.Diagnostics.Process OldProcess = ServerData?.ServerProcess; ServerData = new AtlasServerData() { ServerPath = directoryPathTextBox.Text, AltSaveDirectory = AltSaveDirectoryTextBox.Text, MaxPlayers = (int)MaxPlayersNumericUpDown.Value, QueryPort = (int)QueryPortNumericUpDown.Value, ServerPort = (int)ServerPortNumericUpDown.Value, Pass = AdminPassMaskedTextBox.Text, WildWipe = checkBox1.Checked, PVP = checkBox10.Checked, MapB = checkBox11.Checked, Gamma = checkBox12.Checked, Third = checkBox13.Checked, Crosshair = checkBox14.Checked, HitMarker = checkBox15.Checked, Imprint = checkBox16.Checked, FTD = checkBox17.Checked, BattleEye = BattleEyeCheck.Checked, CustomArgs = AdditionalArgsTextBox.Text, CustomAfterArgs = AdditionalAfterArgsTextBox.Text, /*Process Affinity*/ ProcessAffinity = PA.ProcessAffinity, /*Rcon*/ Rcon = checkBox3.Checked, RCONIP = RconIP.Text, RconPort = (int)RconNumericUpDown.Value, AutoStart = true, ServerX = (int)ServerXNumericUpDown.Value, ServerY = (int)ServerYNumericUpDown.Value, ReservedPlayers = (int)ReservedPlayersNumericUpDown.Value, ServerIp = ServerIPTextBox.Text, ProcessPriority = ProcessPriotityCombo.SelectedIndex, Upnp = UPNPCheck.Checked, ServerProcess = OldProcess, PID = OldProcess != null ? OldProcess.Id : 0 }; }
public AddServer(string ServerPath) { InitializeComponent(); Text = "Create Server"; Create = true; CopyServerData(); Registry.SaveRegServer(AtlasServerManager.GetInstance(), ServerData, 0, true); ServerData = Registry.LoadRegServer(AtlasServerManager.GetInstance(), "LastSaved"); if (ServerData.Loaded) { UpdateComponents(ServerData); } else if (ServerPath != string.Empty) { textBox4.Text = ServerPath; this.ServerPath = ServerPath; } }
public AddServer(string ServerPath) { InitializeComponent(); Text = "Create Server"; Create = true; CopyServerData(); Registry.SaveRegServer(ServerData, 0, true); ServerData = Registry.LoadRegServer("LastSaved"); if (ServerData.Loaded) { UpdateComponents(ServerData); } else if (ServerPath != string.Empty) { directoryPathTextBox.Text = ServerPath; this.ServerPath = ServerPath; } }
private void UpdateComponents(AtlasServerData ServerData) { this.ServerData = ServerData; textBox4.Text = ServerData.ServerPath; ServerPath = ServerData.ServerPath; textBox5.Text = ServerData.AltSaveDirectory; numericUpDown1.Value = ServerData.MaxPlayers; numericUpDown3.Value = ServerData.QueryPort; numericUpDown2.Value = ServerData.ServerPort; maskedTextBox1.Text = ServerData.Pass; checkBox1.Checked = ServerData.WildWipe; checkBox10.Checked = ServerData.PVP; checkBox11.Checked = ServerData.MapB; checkBox12.Checked = ServerData.Gamma; checkBox13.Checked = ServerData.Third; checkBox14.Checked = ServerData.Crosshair; checkBox15.Checked = ServerData.HitMarker; checkBox16.Checked = ServerData.Imprint; checkBox17.Checked = ServerData.FTD; textBox2.Text = ServerData.CustomArgs; numericUpDown5.Value = ServerData.ServerX; numericUpDown7.Value = ServerData.ServerY; numericUpDown6.Value = ServerData.ReservedPlayers; textBox1.Text = ServerData.ServerIp; comboBox1.SelectedIndex = ServerData.ProcessPriority; /*Process Affinity*/ if (ServerData.ProcessAffinity == null || ServerData.ProcessAffinity.Length == 0) { ServerData.ProcessAffinity = new bool[Environment.ProcessorCount]; } PA.UpdateCheckBoxs(ServerData.ProcessAffinity); /*Rcon*/ checkBox3.Checked = ServerData.Rcon; numericUpDown4.Value = ServerData.RconPort; if (!Create) { Text = "Edit: ServerX: " + ServerData.ServerX + ", ServerY: " + ServerData.ServerX + ", Port: " + ServerData.ServerPort; button1.Text = "Save Settings"; } }
private void CopyServerData() { if (textBox4.Text == string.Empty) { textBox4.Text = @".\AtlasServerData"; } ServerData = new AtlasServerData() { ServerPath = textBox4.Text, AltSaveDirectory = textBox5.Text, MaxPlayers = (int)numericUpDown1.Value, QueryPort = (int)numericUpDown3.Value, ServerPort = (int)numericUpDown2.Value, Pass = maskedTextBox1.Text, WildWipe = checkBox1.Checked, PVP = checkBox10.Checked, MapB = checkBox11.Checked, Gamma = checkBox12.Checked, Third = checkBox13.Checked, Crosshair = checkBox14.Checked, HitMarker = checkBox15.Checked, Imprint = checkBox16.Checked, FTD = checkBox17.Checked, CustomArgs = textBox2.Text, /*Process Affinity*/ ProcessAffinity = PA.ProcessAffinity, /*Rcon*/ Rcon = checkBox3.Checked, RconPort = (int)numericUpDown4.Value, AutoStart = true, ServerX = (int)numericUpDown5.Value, ServerY = (int)numericUpDown7.Value, ReservedPlayers = (int)numericUpDown6.Value, ServerIp = textBox1.Text, ProcessPriority = comboBox1.SelectedIndex }; }
public AddServer(AtlasServerData ServerData, string ServerPath) { InitializeComponent(); Create = false; UpdateComponents(ServerData); }
private void button3_Click(object sender, EventArgs e) { ServerData = Registry.LoadRegServer(AtlasServerManager.GetInstance(), "Default"); UpdateComponents(ServerData); Registry.SaveRegServer(AtlasServerManager.GetInstance(), ServerData, 0, true, true); }
private void button3_Click(object sender, EventArgs e) { ServerData = Registry.LoadRegServer("Default"); UpdateComponents(ServerData); Registry.SaveRegServer(ServerData, 0, true, true); }