Exemplo n.º 1
0
        private void saveArgumentsToObject(absTerrariaServerArguments poArgs)
        {
            // GUI options
            poArgs.TSG_AutoSave = (checkBox_AutoSave.Checked ? 1 : 0);
            poArgs.TSG_AutoSaveDelay = Convert.ToInt32(numericUpDown_AutosaveDelay.Value);
            poArgs.TSG_AutoSaveFactor = comboBox_AutosaveDelayFactor.SelectedIndex + 1;
            poArgs.TSG_ServerPath = textBox_ServerPath.Text;
            poArgs.TSG_ServerType = comboBox_ServerType.SelectedIndex + 1;
            poArgs.TSG_LogFolder = textBox_LogFolder.Text;
            poArgs.TSG_LogFilePrefix = textBox_LogFilenamePrefix.Text;
            poArgs.TSG_LogFileSizeLimit = Convert.ToInt32(numericUpDown_LogFileSizeLimit.Value);
            poArgs.TSG_LogFileFullProcedure = comboBox_LogProcedureWhenFull.SelectedIndex + 1;
            poArgs.TSG_LogPercentagesCollapsed = (checkBox_LogPercentageCollapsed.Checked ? 1 : 0);

            // Server options
            poArgs.Players = Convert.ToInt32(numericUpDown_Players.Value);
            poArgs.World = textBox_World.Text;
            poArgs.Port = Convert.ToInt32(numericUpDown_Port.Value);
            poArgs.Password = textBox_Password.Text;
            poArgs.MOTD = textBox_MODT.Text;
            poArgs.WorldPath = textBox_WorldPath.Text;
            poArgs.AutoCreate = comboBox_AutoCreateSize.SelectedIndex + 1;
            poArgs.WorldName = textBox_WorldName.Text;
            poArgs.BanList = textBox_BanList.Text;
            poArgs.Secure = (checkBox_Secure.Checked ? 1 : 0);
            poArgs.Difficulty = (checkBox_Difficulty.Checked ? 1 : 0);
            poArgs.NoUPNP = checkBox_UPNP.Checked;
            poArgs.Lobby = comboBox_Lobby.SelectedValue.ToString();

            // The steam value is based on the lobby choice
            enumSteamLobby lobbyEnum = (enumSteamLobby)
                Enum.Parse(typeof(enumSteamLobby), comboBox_Lobby.SelectedValue.ToString());
            poArgs.Steam = (lobbyEnum == enumSteamLobby.NoSteamSupport ? false : true);
        }
 public override void doCommand_StartServer(ref absTerrariaServerArguments poArgs)
 {
     // Starting the process manually, but setup the listener by issues doCommand with the fake flag set to true
     doCommand("start", true);
 }
Exemplo n.º 3
0
        private void loadArgumentsToForm(absTerrariaServerArguments poArgs)
        {
            // GUI options
            checkBox_AutoSave.Checked = (poArgs.TSG_AutoSave == 0 ? false : true);
            numericUpDown_AutosaveDelay.Value = poArgs.TSG_AutoSaveDelay;
            comboBox_AutosaveDelayFactor.SelectedIndex = poArgs.TSG_AutoSaveFactor - 1;
            textBox_ServerPath.Text = poArgs.TSG_ServerPath;
            comboBox_ServerType.SelectedIndex = poArgs.TSG_ServerType - 1;
            textBox_LogFolder.Text = poArgs.TSG_LogFolder;
            textBox_LogFilenamePrefix.Text = poArgs.TSG_LogFilePrefix;
            numericUpDown_LogFileSizeLimit.Value = poArgs.TSG_LogFileSizeLimit;
            comboBox_LogProcedureWhenFull.SelectedIndex = poArgs.TSG_LogFileFullProcedure - 1;
            checkBox_LogPercentageCollapsed.Checked = (poArgs.TSG_LogPercentagesCollapsed == 0 ? false : true);

            // Server options
            numericUpDown_Players.Value = poArgs.Players;
            textBox_World.Text = poArgs.World;
            numericUpDown_Port.Value = poArgs.Port;
            textBox_Password.Text = poArgs.Password;
            textBox_MODT.Text = poArgs.MOTD;
            textBox_WorldPath.Text = poArgs.WorldPath;
            comboBox_AutoCreateSize.SelectedIndex = poArgs.AutoCreate - 1;
            textBox_WorldName.Text = poArgs.WorldName;
            textBox_BanList.Text = poArgs.BanList;
            checkBox_Secure.Checked = (poArgs.Secure == 0 ? false : true);
            checkBox_Difficulty.Checked = (poArgs.Difficulty == 0 ? false : true);
            checkBox_UPNP.Checked = poArgs.NoUPNP;
            comboBox_Lobby.SelectedIndex = comboBox_Lobby.FindString(poArgs.Lobby);

            // Disable the save button as the most recent file info is now displayed in the form
            toolStripButton_ConfigFileSave.Enabled = false;

            // Move the cursor for serveral text fields to the right (so you can see the filename)
            textBox_ServerPath.SelectionStart = textBox_ServerPath.Text.Length;
            textBox_World.SelectionStart = textBox_World.Text.Length;
            textBox_WorldPath.SelectionStart = textBox_WorldPath.Text.Length;
            textBox_LogFolder.SelectionStart = textBox_LogFolder.Text.Length;
        }