<commit_before>﻿using System.Threading;
using Awesomium.Core;
using HTML_WPF.Component;

namespace HTMLEngine.Awesomium
{
    public  class AwesomiumWPFWebWindowFactory : IWPFWebWindowFactory
    {
        private static WebConfig _WebConfig = new WebConfig() { RemoteDebuggingPort = 8001, RemoteDebuggingHost = "127.0.0.1" };

        private static WebSession _Session = null;

        static AwesomiumWPFWebWindowFactory()
        {
            WebCore.Started += (o, e) => { WebCoreThread = Thread.CurrentThread; };

            if (!WebCore.IsInitialized)
                WebCore.Initialize(_WebConfig);
        }<commit_msg>Add tracing to awesomium closing on exception<commit_after>﻿using System.Diagnostics;
using System.Threading;
using Awesomium.Core;
using HTML_WPF.Component;

namespace HTMLEngine.Awesomium
{
    public class AwesomiumWPFWebWindowFactory : IWPFWebWindowFactory
    {
        private static WebConfig _WebConfig = new WebConfig() { RemoteDebuggingPort = 8001, RemoteDebuggingHost = "127.0.0.1" };

        private static WebSession _Session = null;

        static AwesomiumWPFWebWindowFactory()
        {
            WebCore.Started += (o, e) => { WebCoreThread = Thread.CurrentThread; };

            if (!WebCore.IsInitialized) 
            {
                WebCore.Initialize(_WebConfig);
                WebCore.ShuttingDown += WebCore_ShuttingDown;
            }
        }

        private static void WebCore_ShuttingDown(object sender, CoreShutdownEventArgs e) 
        {
            if (e.Exception == null)
                return; 

            Trace.WriteLine(string.Format("HTMLEngine.Awesomium : WebCoreShutting Down, due to exception: {0}", e.Exception));
        }
{'fraction_non_alphanumeric': 0.08660035108250438, 'fraction_numerical': 0.012287887653598596, 'mean_word_length': 2.685344827586207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6037331', 'n_tokens_mistral': 513, 'n_tokens_neox': 489, 'n_words': 103}