public static absTerrariaServer newServer(enumTerrariaServer poServerType) { switch (poServerType) { case enumTerrariaServer.Classic: return new TerrariaServer(); default: throw new NotImplementedException(); } }
private void initializeServerObject(enumTerrariaServer toServerType) { // Get a new server object moTerrariaServer = TerrariaServerFactory.newServer(toServerType); // Setup server process callbacks moTerrariaServer.DataRecievedOutput += new TerrariaServerEventHandler(moTerrariaServer_DataRecievedOutput); moTerrariaServer.DataRecievedError += new TerrariaServerEventHandler(moTerrariaServer_DataRecievedError); moTerrariaServer.ServerCommandComplete += new TerrariaServerEventHandler(moTerrariaServer_ServerCommandComplete); // Setup form field callbacks checkBox_AutoSave.CheckedChanged += saveableOption_OnChange; numericUpDown_AutosaveDelay.ValueChanged += saveableOption_OnChange; comboBox_AutosaveDelayFactor.SelectedIndexChanged += saveableOption_OnChange; textBox_ServerPath.TextChanged += saveableOption_OnChange; comboBox_ServerType.SelectedIndexChanged += saveableOption_OnChange; textBox_LogFolder.TextChanged += saveableOption_OnChange; textBox_LogFilenamePrefix.TextChanged += saveableOption_OnChange; numericUpDown_LogFileSizeLimit.ValueChanged += saveableOption_OnChange; comboBox_LogProcedureWhenFull.SelectedIndexChanged += saveableOption_OnChange; checkBox_LogPercentageCollapsed.CheckedChanged += saveableOption_OnChange; textBox_ServerPath.TextChanged += saveableOption_OnChange; textBox_World.TextChanged += saveableOption_OnChange; textBox_MODT.TextChanged += saveableOption_OnChange; textBox_BanList.TextChanged += saveableOption_OnChange; comboBox_ServerType.SelectedIndexChanged += saveableOption_OnChange; textBox_Password.TextChanged += saveableOption_OnChange; numericUpDown_Players.ValueChanged += saveableOption_OnChange; numericUpDown_Port.ValueChanged += saveableOption_OnChange; checkBox_Secure.CheckStateChanged += saveableOption_OnChange; textBox_WorldName.TextChanged += saveableOption_OnChange; textBox_WorldPath.TextChanged += saveableOption_OnChange; comboBox_AutoCreateSize.SelectedIndexChanged += saveableOption_OnChange; comboBox_Lobby.SelectedIndexChanged += saveableOption_OnChange; checkBox_Difficulty.CheckedChanged += saveableOption_OnChange; checkBox_UPNP.CheckedChanged += saveableOption_OnChange; }