Beispiel #1
0
        private void BorealisServerManager_FormClosed(object sender, FormClosedEventArgs e)
        {
            //Write data in memory to disk into gameservers.json
            if (GameServerManagement.ServerCollection != null)
            {
                //Delete existing gameservers.json
                if (File.Exists(Environment.CurrentDirectory + @"\gameservers.json"))
                {
                    File.Delete(Environment.CurrentDirectory + @"\gameservers.json");
                }

                GameServerManagement.ConfigWrite();
            }
        }
        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;
        }