/// <summary> /// Creates a server process based on the supplied configuration data, and adds /// it to the Process Manager. /// </summary> /// <param name="processConfig">A valid ProcessConfigurationData object.</param> /// <returns>The process's unique identifier.</returns> public static int CreateProcess(ProcessConfigurationData processConfig) { ServerProcess proc = new ServerProcess(processConfig); proc.StartProcess(); processes.Add(proc); return(proc.Identifier); }
//TODO: Create a "ConfigurationManager" so that process and server info can be queried and provided seperately. //This will remove the need to pass references to Process and Server configs to each object. /// <summary> /// Creates a server based on the supplied configuration data, and adds /// it to the Server Manager. /// </summary> public static void RegisterServer(ProcessConfigurationData processConfig, ServerConfigurationData serverConfig) { //TODO: Decide how best to determine which type of server to create. //For now, we will use the if/then approach. if (serverConfig.ServerType == ServerType.Game) { if (serverConfig.SubType == "HaloCombatEvolved") { try { Server s = new GenericServer(processConfig, serverConfig); servers.Add(s); } catch (Exception ex) { throw new Exception("Unable to create server object: " + ex.Message); } } else { throw new Exception("Unable to create server object: " + serverConfig.SubType + " is not a supported game server type."); } } }
public ServerProcess(ProcessConfigurationData configuration) { this.configuration = configuration; this.watchdog = new ServerProcessWatchdog(this); }