public MainWindow() { GCSettings.LatencyMode = GCLatencyMode.SustainedLowLatency; InitializeComponent(); WindowStartupLocation = WindowStartupLocation.Manual; Left = _settings.GetPositionSetting(SettingsKeys.ClientX).DoubleValue; Top = _settings.GetPositionSetting(SettingsKeys.ClientY).DoubleValue; Title += " - 1.12.0.0 - "; Title += Properties.Settings.Default.ServerShortName; _logger.Debug("Connecting on Startup"); var resolvedAddresses = Dns.GetHostAddresses(Properties.Settings.Default.SRSHost); _resolvedIp = resolvedAddresses.FirstOrDefault(xa => xa.AddressFamily == AddressFamily.InterNetwork); // Ensure we get an IPv4 address in case the host resolves to both IPv6 and IPv4 if (_resolvedIp == null) { throw new Exception($"Could not determine IPv4 address for {Properties.Settings.Default.SRSHost}"); } _port = Properties.Settings.Default.SRSPort; ServerName.Text = Properties.Settings.Default.ServerName; ServerEndpoint.Text = Properties.Settings.Default.SRSHost + ":" + _port; var radioJson = File.ReadAllText(AwacsRadiosFile); var awacsRadios = JsonConvert.DeserializeObject <List <RadioInformation> >(radioJson); var speechAuthenticated = false; // Wait until we have authorization with Azure before continuing. No point connecting to // SRS if we cannot process anything. var t = Task.Run(() => { while (speechAuthenticated == false) { var authorizationToken = SpeechAuthorizationToken.AuthorizationToken; if (authorizationToken == null) { Thread.Sleep(10000); } else { speechAuthenticated = true; } } }); t.Wait(); foreach (var radio in awacsRadios) { var playerRadioInfo = new DCSPlayerRadioInfo { LastUpdate = DateTime.Now.Ticks, name = radio.name, ptt = false, radios = new List <RadioInformation> { radio }, selected = 1, latLng = new DCSLatLngPosition { lat = 0, lng = 0, alt = 0 }, simultaneousTransmission = false, simultaneousTransmissionControl = DCSPlayerRadioInfo.SimultaneousTransmissionControl.ENABLED_INTERNAL_SRS_CONTROLS, unit = "External AWACS", unitId = 100000001, inAircraft = false, iff = new Transponder() }; var audioManager = new AudioManager(playerRadioInfo); audioManager.ConnectToSrs(new IPEndPoint(_resolvedIp, _port)); AudioManagers.Add(audioManager); } if (!string.IsNullOrEmpty(OverlordBot.Properties.Settings.Default.NewRelicApiKey)) { MetricsManager.Start(); } }