private void dropdownServerSelection_SelectedValueChanged(object sender, EventArgs e) { txtServerGivenName.Text = dropdownServerSelection.Text; //Query specific appID for Steam Guard requirement check var dataChecker = (GameserverType)dropdownServerSelection.SelectedItem; GameServerObject gameServer = ServerAPI.QUERY_DATA(dataChecker.Id); if (gameServer.STEAM_authrequired) { panelSteamGuard.Visible = true; } else { panelSteamGuard.Visible = false; } //Check if existing server was already deployed with the given type, and allow the user to update it instead. foreach (GameServerObject gameserver in GameServerManagement.ServerCollection) { if (gameserver.SERVER_type == dropdownServerSelection.Text) { deploymentAnimator.ShowSync(btnUpdateServer); } else { deploymentAnimator.HideSync(btnUpdateServer); } } btnDeployGameserver.Enabled = true; panelStep2.Visible = true; panelStep3.Visible = true; panelProgress.Visible = true; }
private void serverStoreInMemory() { //Create the GameServerObject GameServerObject deployConfiguredServer = new GameServerObject(); //Assign Data to the GameServerObject //Server-based Properties deployConfiguredServer.SERVER_name_friendly = txtServerGivenName.Text; deployConfiguredServer.SERVER_type = _currentDeploymentValues.SERVER_type; deployConfiguredServer.SERVER_launch_arguments = _currentDeploymentValues.SERVER_launch_arguments; deployConfiguredServer.SERVER_executable = _currentDeploymentValues.SERVER_executable; deployConfiguredServer.SERVER_port = ""; //Game-based properties deployConfiguredServer.GAME_maxplayers = 6; //Defalt middle value deployConfiguredServer.GAME_map = "NONE"; //Directory-based Properties deployConfiguredServer.DIR_install_location = _currentDeploymentValues.DIR_install_location; deployConfiguredServer.DIR_root = _currentDeploymentValues.DIR_root; deployConfiguredServer.DIR_maps = _currentDeploymentValues.DIR_maps; deployConfiguredServer.DIR_maps_file_extension = _currentDeploymentValues.DIR_maps_file_extension; deployConfiguredServer.DIR_mods = _currentDeploymentValues.DIR_mods; deployConfiguredServer.DIR_config = _currentDeploymentValues.DIR_config; //Steam-based Properties deployConfiguredServer.STEAM_authrequired = _currentDeploymentValues.STEAM_authrequired; deployConfiguredServer.STEAM_steamcmd_required = _currentDeploymentValues.STEAM_steamcmd_required; deployConfiguredServer.STEAM_workshop_enabled = _currentDeploymentValues.STEAM_workshop_enabled; //Miscellanious Properties deployConfiguredServer.ENGINE_type = _currentDeploymentValues.ENGINE_type; deployConfiguredServer.bsm_integration = _currentDeploymentValues.bsm_integration; deployConfiguredServer.bsm_custominstallfolder = _currentDeploymentValues.bsm_custominstallfolder; //Store that newly assigned and JSON-filled server into the GameServerObject Collection GameServerManagement.ServerCollection.Add(deployConfiguredServer); //Redundantly write the data to disk in the event of a crash. GameServerManagement.ConfigWrite(); btnCancelDeployGameserver.Visible = false; btnDeployGameserver.Enabled = true; _currentDeploymentValues = null; }
private void btnDeployGameserver_Click(object sender, EventArgs e) { //Pull all gameserver data from gameservers.json, split all json strings into a list, iterate through that list for specific data. if (GameServerManagement.ServerCollection != null) { foreach (GameServerObject gameserver in GameServerManagement.ServerCollection) { if (txtServerGivenName.Text == gameserver.SERVER_name_friendly) { MetroMessageBox.Show(ActiveForm, "Unfortunately, you must give unique names to every server you deploy, using the exact same name would cause several issues.", "Identical gameserver name already exists.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; //Break gracefully out of the entire void function. } } } //Query specific appID for all required data. var gameserverType = (GameserverType)dropdownServerSelection.SelectedItem; GameServerObject gameServer = ServerAPI.QUERY_DATA(gameserverType.Id); //Retrieve the data that was just stored into the deployment server list. var deploymentValues = new DeploymentValues { SERVER_type = gameServer.SERVER_type, SERVER_launch_arguments = gameServer.SERVER_launch_arguments, SERVER_executable = gameServer.SERVER_executable, DIR_root = gameServer.DIR_root, DIR_maps = gameServer.DIR_maps, DIR_maps_file_extension = gameServer.DIR_maps_file_extension, DIR_mods = gameServer.DIR_mods, DIR_config = gameServer.DIR_config, STEAM_authrequired = gameServer.STEAM_authrequired, STEAM_steamcmd_required = gameServer.STEAM_steamcmd_required, STEAM_workshop_enabled = gameServer.STEAM_workshop_enabled, ENGINE_type = gameServer.ENGINE_type, bsm_integration = gameServer.bsm_integration, bsm_custominstallfolder = gameServer.bsm_custominstallfolder }; //Determine where to deploy the server based on user input. if (txtboxDestinationFolder.Text == "") { deploymentValues.DIR_install_location = Environment.CurrentDirectory; deploymentValues.bsm_custominstallfolder = false; } else { deploymentValues.DIR_install_location = txtboxDestinationFolder.Text; deploymentValues.bsm_custominstallfolder = true; } //Determine whether or not to verify integrity of the installation. if (chkVerifyIntegrity.Value) { deploymentValues.verify_integrity = " +validate"; } else { deploymentValues.verify_integrity = ""; } DialogResult result; switch (deploymentValues.bsm_integration) { case "none": result = MetroMessageBox.Show(ActiveForm, "Type of GameServer: [" + dropdownServerSelection.Text + "]\n" + "Deploy to: [" + deploymentValues.DIR_install_location + "]" + "\n\nWARNING: This gameserver currently has NO BSM support.\nYou can deploy it, and launch it, but BSM cannot configure it at this time.", "Deploy GameServer?", MessageBoxButtons.YesNo, MessageBoxIcon.Stop); break; case "partial": result = MetroMessageBox.Show(ActiveForm, "Type of GameServer: [" + dropdownServerSelection.Text + "]\n" + "Deploy to: [" + deploymentValues.DIR_install_location + "]" + "\n\nWARNING: This gameserver currently has PARTIAL BSM support.\nYou can deploy it, and launch it, and have experimental control over it directly through BSM.", "Deploy GameServer?", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); break; case "full": result = MetroMessageBox.Show(ActiveForm, "Type of GameServer: [" + dropdownServerSelection.Text + "]\n" + "Deploy to: [" + deploymentValues.DIR_install_location + "]", "Deploy GameServer?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); break; default: result = DialogResult.Yes; break; } if (result == DialogResult.Yes) { btnCancelDeployGameserver.Visible = true; btnDeployGameserver.Enabled = false; serverDeploy(deploymentValues); lblDownloadProgress.Text = "Download / Installation Progress:"; lblVerifyIntegrity.Visible = false; chkVerifyIntegrity.Visible = false; } }
public static List <GameServerObject> ServerCollection = new List <GameServerObject>(); //Master collection of deployed gameservers //=====================================================================================// // Method to add a gameserver JObject to the collection // //=====================================================================================// public static void GameserverAdd(GameServerObject gameserver) { ServerCollection.Add(gameserver); }