/// <summary> /// Der Haupteinstiegspunkt für die Anwendung. /// </summary> static void Main(String[] args) { _ = GlobalConfiguration.Configuration .UseColouredConsoleLogProvider() .UseMemoryStorage(); MemoryStorageOptions options = new MemoryStorageOptions(); // options.JobExpirationCheckInterval = TimeSpan.FromSeconds(30); // options.FetchNextJobTimeout = TimeSpan.FromSeconds(30); JobStorage.Current = new MemoryStorage(options); string baseAddress = "http://localhost:9000/"; WebApp.Start <Startup>(url: baseAddress); try { SettingsFileReader reader = new SettingsFileReader(); var settingsFile = reader.ReadSettingsFile(); Validator.ValidateJsonModel(ref settingsFile); var armaServer = ArmaServer.GetInstance(); armaServer.SetSettingsFile(settingsFile.settings); armaServer.SetupServer(); var rcon = RconConnector.GetRconConnector(); rcon.SetSettingsFile(settingsFile.settings); rcon.OpenConnection(); rcon.StartQueueWorker(); TaskCreator.CreateTasks(settingsFile); armaServer.StartAll(); while (true) { Console.ReadKey(); } } catch (SettingsFileReadException e) { Console.WriteLine("Error reading the settings file..."); Console.ReadKey(); } catch (Exception e) { Console.WriteLine(e); Console.ReadKey(); } }
private async void btnServerGo_Click(object sender, EventArgs e) { try { _currentServer = new ArmaServer(txtServerAdress.Text, Convert.ToInt32(numServerGamePort.Value), Convert.ToInt32(numServerSteamPort.Value)); } catch (ArgumentException ex) { MessageBox.Show(@"Error: " + ex.Message); return; } var b = (Button)sender; try { ServerInfo serverInfo; List <PlayerInfo> playerInfo; if (b.Text.Contains("Async")) { serverInfo = await _currentServer.GetServerInfoAsync(); playerInfo = await _currentServer.GetPlayerListAsync(); } else { serverInfo = _currentServer.GetServerInfo(); playerInfo = _currentServer.GetPlayerList(); } lblServerName.Text = serverInfo.Name; lblServerGamePort.Text = _currentServer.GamePort.ToString(); lblServerPing.Text = serverInfo.Ping.ToString(); lblServerMap.Text = serverInfo.Map; lblServerSlots.Text = serverInfo.PlayerCount; lblServerMaxSlots.Text = serverInfo.MaxPlayers; listServerPlayers.Items.Clear(); foreach (PlayerInfo p in playerInfo) { listServerPlayers.Items.Add(p.Name); } } catch (SourceServerException ex) { MessageBox.Show(@"Error: " + ex.Message); } }
static void Main(string[] args) { if (args.Length < 0) { Console.WriteLine("No Arguments found! You need to specify a path to your settings.json"); Environment.Exit(1); } var settingsFilePath = args.FirstOrDefault(x => x.Contains("-settingsfile=")).Replace("-settingsfile=", ""); if (settingsFilePath == null) { Console.WriteLine("You need to specify a path to your settings.json"); Environment.Exit(1); } if (!File.Exists(settingsFilePath)) { if (args.FirstOrDefault(x => x.Contains("-generateConfig")) != null) { SettingsFileReader reader = new SettingsFileReader(); var settingsFile = reader.ReadSettingsFile(settingsFilePath, true); Console.WriteLine("Config example has been generated to your specified path.\n Terminating..."); Environment.Exit(0); } Console.WriteLine("No settingsfile found please double check your path"); Environment.Exit(1); } _ = GlobalConfiguration.Configuration .UseColouredConsoleLogProvider() .UseMemoryStorage(); MemoryStorageOptions options = new MemoryStorageOptions(); // options.JobExpirationCheckInterval = TimeSpan.FromSeconds(30); // options.FetchNextJobTimeout = TimeSpan.FromSeconds(30); JobStorage.Current = new MemoryStorage(options); string baseAddress = "http://localhost:9000/"; //WebApp.Start<Startup>(url: baseAddress); try { SettingsFileReader reader = new SettingsFileReader(); var settingsFile = reader.ReadSettingsFile(settingsFilePath); Validator.ValidateJsonModel(ref settingsFile); var armaServer = ArmaServer.GetInstance(); armaServer.SetSettingsFile(settingsFile.settings); armaServer.SetupServer(); var rcon = RconConnector.GetRconConnector(); rcon.SetSettingsFile(settingsFile.settings); rcon.OpenConnection(); rcon.StartQueueWorker(); TaskCreator.CreateTasks(settingsFile); armaServer.StartAll(); while (true) { Console.ReadKey(); } } catch (SettingsFileReadException e) { Console.WriteLine("Error reading the settings file..."); Console.ReadKey(); } catch (Exception e) { Console.WriteLine(e); Console.ReadKey(); } }