<commit_before>﻿using System;
using System.IO;
using System.Windows;
using System.Windows.Threading;
using GBLive.Common;
using GBLive.GiantBomb;
using GBLive.GiantBomb.Interfaces;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace GBLive.Gui
{
    public partial class App : Application
    {
        private readonly IHost host;

        public App()
        {
            host = BuildGenericHost();

            InitializeComponent();
        }

        private static IHost BuildGenericHost()
        {
            return new HostBuilder()
                .ConfigureAppConfiguration((ctx, config) =>
                    {
                        config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: false);
                    }
                )
                .ConfigureServices((ctx, services) =>
                    {
                        services.Configure<Settings>(settings =>
                        {
                            settings.IsLiveMessage = Constants.IsLiveMessage;
                            settings.IsNotLiveMessage = Constants.IsNotLiveMessage;
                            settings.NameOfNoLiveShow = Constants.NameOfNoLiveShow;
                            settings.NameOfUntitledLiveShow = Constants.NameOfUntitledLiveShow;

                            settings.UserAgent = ctx.Configuration.GetValue<string>("GiantBomb:UserAgent");
                            settings.Home = ctx.Configuration.GetValue<Uri>("GiantBomb:Home");
                            settings.Chat = ctx.Configuration.GetValue<Uri>("GiantBomb:Chat");
                            settings.Upcoming = ctx.Configuration.GetValue<Uri>("GiantBomb:Upcoming");
                            settings.FallbackImage = ctx.Configuration.GetValue<Uri>("GiantBomb:FallbackImage");
                            settings.UpdateIntervalInSeconds = ctx.Configuration.GetValue<int>("GiantBomb:UpdateIntervalInSeconds");
                            settings.ShouldNotify = ctx.Configuration.GetValue<bool>("GiantBomb:ShouldNotify");
                        });

                        string logFilePath = ctx.Configuration.GetValue<string>("ILogClass:Path");

                        if (String.IsNullOrWhiteSpace(logFilePath))
                        {
                            logFilePath = DefaultLogFilePath();
                        }

                        Severity severity = ctx.Configuration.GetValue<Severity>("ILogClass:Severity");

                        ILogClass myLogger = new LogClass(logFilePath, severity);

                        services.AddSingleton(typeof(ILogClass), myLogger);

                        services.AddTransient<IGiantBombContext, GiantBombContext>();
                        services.AddTransient<IMainWindowViewModel, MainWindowViewModel>();

                        services.AddSingleton<MainWindow>();
                    }
                )
                .Build();
        }

        private async void Application_Startup(object sender, StartupEventArgs e)<commit_msg>Retrieve update interval setting as double<commit_after>﻿using System;
using System.IO;
using System.Windows;
using System.Windows.Threading;
using GBLive.Common;
using GBLive.GiantBomb;
using GBLive.GiantBomb.Interfaces;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace GBLive.Gui
{
    public partial class App : Application
    {
        private readonly IHost host;

        public App()
        {
            host = BuildGenericHost();

            InitializeComponent();
        }

        private static IHost BuildGenericHost()
        {
            return new HostBuilder()
                .ConfigureAppConfiguration((ctx, config) =>
                    {
                        config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: false);
                    }
                )
                .ConfigureServices((ctx, services) =>
                    {
                        services.Configure<Settings>(settings =>
                        {
                            settings.IsLiveMessage = Constants.IsLiveMessage;
                            settings.IsNotLiveMessage = Constants.IsNotLiveMessage;
                            settings.NameOfNoLiveShow = Constants.NameOfNoLiveShow;
                            settings.NameOfUntitledLiveShow = Constants.NameOfUntitledLiveShow;

                            settings.UserAgent = ctx.Configuration.GetValue<string>("GiantBomb:UserAgent");
                            settings.Home = ctx.Configuration.GetValue<Uri>("GiantBomb:Home");
                            settings.Chat = ctx.Configuration.GetValue<Uri>("GiantBomb:Chat");
                            settings.Upcoming = ctx.Configuration.GetValue<Uri>("GiantBomb:Upcoming");
                            settings.FallbackImage = ctx.Configuration.GetValue<Uri>("GiantBomb:FallbackImage");
                            settings.UpdateIntervalInSeconds = ctx.Configuration.GetValue<double>("GiantBomb:UpdateIntervalInSeconds");
                            settings.ShouldNotify = ctx.Configuration.GetValue<bool>("GiantBomb:ShouldNotify");
                        });

                        string logFilePath = ctx.Configuration.GetValue<string>("ILogClass:Path");

                        if (String.IsNullOrWhiteSpace(logFilePath))
                        {
                            logFilePath = DefaultLogFilePath();
                        }

                        Severity severity = ctx.Configuration.GetValue<Severity>("ILogClass:Severity");

                        ILogClass myLogger = new LogClass(logFilePath, severity);

                        services.AddSingleton(typeof(ILogClass), myLogger);

                        services.AddTransient<IGiantBombContext, GiantBombContext>();
                        services.AddTransient<IMainWindowViewModel, MainWindowViewModel>();

                        services.AddSingleton<MainWindow>();
                    }
                )
                .Build();
        }

        private async void Application_Startup(object sender, StartupEventArgs e)
{'fraction_non_alphanumeric': 0.08402555910543132, 'fraction_numerical': 0.0, 'mean_word_length': 1.7103896103896103, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5481841', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1403, 'n_words': 214}