public App()
        {
            if (!string.IsNullOrEmpty(OverlordBot.Properties.Settings.Default.NewRelicApiKey))
            {
                Sdk.CreateTracerProviderBuilder()
                .AddSource($"OverlordBot {OverlordBot.Properties.Settings.Default.ServerShortName}")
                .AddHttpClientInstrumentation()
                .AddConsoleExporter()
                .AddNewRelicExporter(config =>
                {
                    config.ApiKey      = OverlordBot.Properties.Settings.Default.NewRelicApiKey;
                    config.ServiceName = $"OverlordBot {OverlordBot.Properties.Settings.Default.ServerShortName}";
                })
                .Build();
            }

            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;

            var location = AppDomain.CurrentDomain.BaseDirectory;

            //check for opus.dll
            if (!File.Exists(location + "\\opus.dll"))
            {
                MessageBox.Show(
                    "You are missing the opus.dll - Reinstall using the Installer and don't move the client from the installation directory!",
                    "Installation Error!", MessageBoxButton.OK,
                    MessageBoxImage.Error);

                Environment.Exit(1);
            }

            InitNotificationIcon();

            NpgsqlConnection.GlobalTypeMapper.UseNetTopologySuite(geographyAsDefault: true);
            NpgsqlLogManager.Provider = new NLogLoggingProvider();
            NpgsqlLogManager.IsParameterLoggingEnabled = true;
            _loggingReady = true;

            Task.Run(async() => await DiscordClient.Connect());

            SpeechAuthorizationToken.CancellationToken = TokenSource.Token;
            Task.Run(async() => await SpeechAuthorizationToken.StartTokenRenewTask());

            _airfieldUpdateTimer          = new System.Timers.Timer(60000);
            _airfieldUpdateTimer.Elapsed += (s, e) => AirfieldUpdater.UpdateAirfields();
            _airfieldUpdateTimer.Start();
        }
Beispiel #2
0
 private static void UpdateAirfields(object stateInfo)
 {
     AirfieldUpdater.UpdateAirfields();
 }