private void Connect() { m_server = GameServerFactory.Create(GameServerType.WebClient, TeamName, IpAddress, Port); m_server.StopRunningGame(); var games = m_server.RetrieveGameList(); foreach (var game in games) { Games.Add(game); } }
static void Main(string[] args) { // Create a client to server interface string teamName = "sqrtdos"; var serverType = GameServerType.Mock; serverType = GameServerType.WebClient; // if you want the real server ... otherwise this will do // make sure you have a way to specify the IP address and port dynamically at run time, e.g. through a GUI var gameServer = GameServerFactory.Create(serverType, teamName, "192.168.1.3", 3000); var data = gameServer.RetrieveGameList(); // kill anything that is running...make sure you handle WebExceptions gameServer.StopRunningGame(); // Display the games retrieved from the server Console.WriteLine("Available Games:"); foreach (var game in data) { Console.WriteLine("\t" + game); } // Starts a game Console.WriteLine("Start Game [Enter Name]?"); var gameName = Console.ReadLine(); var targets = gameServer.RetrieveTargetList(gameName); gameServer.StartGame(gameName); // Make sure the user can stop the stupid game.... Console.WriteLine("Type stop to stop [stop] other for target list"); var input = Console.ReadLine(); while (input != "stop") { // Then print out the target data as it was "hit" Console.WriteLine("Printing target data..."); targets = gameServer.RetrieveTargetList(gameName); foreach (var target in targets) { PrintTarget(target); } input = Console.ReadLine(); } // Then call to stop the game Console.WriteLine("Stopping Game"); gameServer.StopRunningGame(); // and let the user gaulk Console.WriteLine("Any key to exit..."); Console.ReadLine(); }
/// <summary>The server entry point.</summary> public static void Main() { var repository = LogManager.GetRepository(Assembly.GetEntryAssembly()); log4net.Config.BasicConfigurator.Configure(repository); var config = new ProgramConfiguration(); using (var persistenceContextProvider = new PersistenceContextProvider(config.PersistenceConfiguration)) using (var gameServerRegistrar = new GameServerRegistrarProxy(config.ConnectServer)) using (var accountLoginService = new AccountLoginServiceProxy(config.LoginServer)) using (var gameServer = GameServerFactory.Create(config, persistenceContextProvider, gameServerRegistrar, accountLoginService)) { gameServer.Start(); Task.WaitAny(gameServer.ShutdownTask, InterruptSignal()); gameServer.Stop(); } }
public void GetVariablesFromGameServerShould() { var gameServer = new GameServerFactory().GetGameServer(); var expected = new Dictionary <string, string>() { { "![GameId]", "0" }, { "![IpAddress]", "192.168.1.50" }, { "![GamePort]", "29365" }, { "![QueryPort]", "0" }, { "![ServerName]", "Test Server" }, { "![IsEnabled]", "True" }, { "![HomeDirectory]", @"C:\dev\Server1" }, { "![CommandLine]", "-game csgo -console -usercon" }, { "![Slots]", "0" }, { "![RconPassword]", "password" }, { "![TestVar1]", "thing1" }, { "![TestVar2]", "thing2" }, { "![TestVar3]", "thing3" } }; var result = ConfigFileUtils.GetVariablesFromGameServer(gameServer); Assert.Equal(expected, result); }
public ServerMatchController(Match match) { m_match = match; m_gameServer = GameServerFactory.Create(); m_gameServer.StartServer(); }