示例#1
0
 public Server(string _serverName, string _serverDirectory, bool _autoUpdate)
 {
     serverName      = _serverName;
     serverDirectory = _serverDirectory;
     autoUpdate      = _autoUpdate;
     serverProcess   = new Process();
     serverLog       = new string[logSize];
     _serverConfig   = new TerrariaConfig(serverDirectory + "\\serverconfig.txt");
     for (int i = 0; i < logSize; i++)
     {
         serverLog[i] = "";
     }
 }
示例#2
0
 void OnDeseralized(StreamingContext context)
 {
     _serverConfig = new TerrariaConfig(serverDirectory + "\\serverconfig.txt");
 }
示例#3
0
        public SettingsDialogue(string serverName, TerrariaConfig _terrariaConfig, AppConfig _appConfig)
        {
            InitializeComponent();
            ServerName            = serverName;
            txtBoxServerName.Text = serverName;
            terrariaConfig        = _terrariaConfig;
            appConfig             = _appConfig;
            if (serverName == null)
            {
                ServerName = "";
            }
            if (terrariaConfig == null)
            {
                terrariaConfig = new TerrariaConfig();
            }
            if (appConfig == null)
            {
                appConfig = new AppConfig();
            }
            txtBoxPort.Text       = terrariaConfig.config["port"];
            txtBoxMaxPlayers.Text = terrariaConfig.config["maxplayers"];
            txtBoxWorld.Text      = terrariaConfig.config["world"];
            txtBoxWorldPath.Text  = terrariaConfig.config["worldpath"];
            int comboBoxTemp;

            if (!int.TryParse(terrariaConfig.config["autocreate"], out comboBoxTemp))
            {
                comboBoxTemp = 0;
            }
            comboBoxAutoCreate.SelectedIndex = comboBoxTemp == 3 ? 2 : comboBoxTemp - 1;
            txtBoxBanList.Text           = terrariaConfig.config["banlist"];
            txtBoxWorldName.Text         = terrariaConfig.config["worldname"];
            comboBoxSecure.SelectedIndex = int.TryParse(terrariaConfig.config["secure"], out comboBoxTemp) ? comboBoxTemp : 0;
            comboBoxUPNP.SelectedIndex   = int.TryParse(terrariaConfig.config["upnp"], out comboBoxTemp) ? comboBoxTemp : 0;
            txtBoxIP.Text   = terrariaConfig.config["ip"];
            txtBoxSeed.Text = terrariaConfig.config["seed"];
            comboBoxDifficulty.SelectedIndex = int.TryParse(terrariaConfig.config["difficulty"], out comboBoxTemp) ? comboBoxTemp : 0;
            txtBoxMOTD.Text = terrariaConfig.config["motd"];
            comboBoxLanguage.SelectedIndex = int.TryParse(terrariaConfig.config["language"], out comboBoxTemp) ? comboBoxTemp : 0;
            //the default priority we want for the user is normal
            comboBoxPriority.SelectedIndex            = int.TryParse(terrariaConfig.config["priority"], out comboBoxTemp) ? comboBoxTemp : 3;
            txtBoxNpcStream.Text                      = terrariaConfig.config["npcstream"];
            txtBoxPassword.Text                       = terrariaConfig.config["password"];
            checkBoxCrossServerChat.Checked           = appConfig.allowCrossServerChat;
            checkBoxCrossServerPlayingCommand.Checked = appConfig.doCrossServerPlayingCommand;
            checkBoxAllowMobileAppControl.Checked     = appConfig.allowMobileAppControl;
            checkBoxAutoUpdateServer.Checked          = appConfig.autoUpdateServer;
            checkBoxExit.Checked                      = appConfig.config["exit"];
            checkBoxExitNoSave.Checked                = appConfig.config["exit-nosave"];
            checkBoxSave.Checked                      = appConfig.config["save"];
            checkBoxKick.Checked                      = appConfig.config["kick"];
            checkBoxBan.Checked                       = appConfig.config["ban"];
            checkBoxPassword.Checked                  = appConfig.config["password"];
            checkBoxPasswordSet.Checked               = appConfig.config["setpassword"];
            checkBoxVersion.Checked                   = appConfig.config["version"];
            checkBoxTime.Checked                      = appConfig.config["time"];
            checkBoxPort.Checked                      = appConfig.config["port"];
            checkBoxMaxPlayers.Checked                = appConfig.config["maxplayers"];
            checkBoxMotd.Checked                      = appConfig.config["motd"];
            checkBoxMotdSet.Checked                   = appConfig.config["setmotd"];
            checkBoxDawn.Checked                      = appConfig.config["dawn"];
            checkBoxNoon.Checked                      = appConfig.config["noon"];
            checkBoxDusk.Checked                      = appConfig.config["dusk"];
            checkBoxMidnight.Checked                  = appConfig.config["midnight"];
            checkBoxSettle.Checked                    = appConfig.config["settle"];
            checkBoxSeed.Checked                      = appConfig.config["seed"];
            checkBoxPlaying.Checked                   = appConfig.config["playing"];
        }