<commit_before>﻿using System;
using System.Linq;
using AldursLab.Essentials.Eventing;
using AldursLab.PersistentObjects;
using AldursLab.WurmApi;
using AldursLab.WurmAssistant3.Core.Areas.Calendar;
using AldursLab.WurmAssistant3.Core.Areas.CombatStats;
using AldursLab.WurmAssistant3.Core.Areas.Config;
using AldursLab.WurmAssistant3.Core.Areas.Config.Contracts;
using AldursLab.WurmAssistant3.Core.Areas.Config.Modules;
using AldursLab.WurmAssistant3.Core.Areas.CraftingAssistant;
using AldursLab.WurmAssistant3.Core.Areas.Features;
using AldursLab.WurmAssistant3.Core.Areas.Features.Contracts;
using AldursLab.WurmAssistant3.Core.Areas.Granger;
using AldursLab.WurmAssistant3.Core.Areas.Logging;
using AldursLab.WurmAssistant3.Core.Areas.Logging.Contracts;
using AldursLab.WurmAssistant3.Core.Areas.Logging.Views;
using AldursLab.WurmAssistant3.Core.Areas.LogSearcher;
using AldursLab.WurmAssistant3.Core.Areas.MainMenu;
using AldursLab.WurmAssistant3.Core.Areas.MainMenu.Views;
using AldursLab.WurmAssistant3.Core.Areas.Native;
using AldursLab.WurmAssistant3.Core.Areas.Persistence;
using AldursLab.WurmAssistant3.Core.Areas.RevealCreatures;
using AldursLab.WurmAssistant3.Core.Areas.SkillStats;
using AldursLab.WurmAssistant3.Core.Areas.SoundEngine;
using AldursLab.WurmAssistant3.Core.Areas.Timers;
using AldursLab.WurmAssistant3.Core.Areas.TrayPopups;
using AldursLab.WurmAssistant3.Core.Areas.Triggers;
using AldursLab.WurmAssistant3.Core.Areas.Wa2DataImport;
using AldursLab.WurmAssistant3.Core.Areas.WurmApi;
using AldursLab.WurmAssistant3.Core.IoC;
using AldursLab.WurmAssistant3.Core.Root.Components;
using AldursLab.WurmAssistant3.Core.Root.Contracts;
using AldursLab.WurmAssistant3.Core.Root.Views;
using JetBrains.Annotations;
using Ninject;
using Ninject.Activation.Strategies;
using Ninject.Extensions.Factory;

namespace AldursLab.WurmAssistant3.Core.Root
{
    public class CoreBootstrapper : IDisposable
    {
        readonly IKernel kernel = new StandardKernel();

        readonly MainForm mainForm;
        readonly ConsoleArgsManager consoleArgs;

        WurmAssistantDataDirectory dataDirectory;

        public CoreBootstrapper([NotNull] MainForm mainForm, [NotNull] ConsoleArgsManager consoleArgs)
        {
            if (mainForm == null) throw new ArgumentNullException("mainForm");
            if (consoleArgs == null) throw new ArgumentNullException("consoleArgs");
            this.mainForm = mainForm;
            this.consoleArgs = consoleArgs;
        }

        public void PreBootstrap()
        {
            SetupActivationStrategyComponents();

            dataDirectory = new WurmAssistantDataDirectory(consoleArgs);
            dataDirectory.Lock();<commit_msg>Optimization for text matching.<commit_after>﻿using System;
using System.Linq;
using System.Text.RegularExpressions;
using AldursLab.Essentials.Eventing;
using AldursLab.PersistentObjects;
using AldursLab.WurmApi;
using AldursLab.WurmAssistant3.Core.Areas.Calendar;
using AldursLab.WurmAssistant3.Core.Areas.CombatStats;
using AldursLab.WurmAssistant3.Core.Areas.Config;
using AldursLab.WurmAssistant3.Core.Areas.Config.Contracts;
using AldursLab.WurmAssistant3.Core.Areas.Config.Modules;
using AldursLab.WurmAssistant3.Core.Areas.CraftingAssistant;
using AldursLab.WurmAssistant3.Core.Areas.Features;
using AldursLab.WurmAssistant3.Core.Areas.Features.Contracts;
using AldursLab.WurmAssistant3.Core.Areas.Granger;
using AldursLab.WurmAssistant3.Core.Areas.Logging;
using AldursLab.WurmAssistant3.Core.Areas.Logging.Contracts;
using AldursLab.WurmAssistant3.Core.Areas.Logging.Views;
using AldursLab.WurmAssistant3.Core.Areas.LogSearcher;
using AldursLab.WurmAssistant3.Core.Areas.MainMenu;
using AldursLab.WurmAssistant3.Core.Areas.MainMenu.Views;
using AldursLab.WurmAssistant3.Core.Areas.Native;
using AldursLab.WurmAssistant3.Core.Areas.Persistence;
using AldursLab.WurmAssistant3.Core.Areas.RevealCreatures;
using AldursLab.WurmAssistant3.Core.Areas.SkillStats;
using AldursLab.WurmAssistant3.Core.Areas.SoundEngine;
using AldursLab.WurmAssistant3.Core.Areas.Timers;
using AldursLab.WurmAssistant3.Core.Areas.TrayPopups;
using AldursLab.WurmAssistant3.Core.Areas.Triggers;
using AldursLab.WurmAssistant3.Core.Areas.Wa2DataImport;
using AldursLab.WurmAssistant3.Core.Areas.WurmApi;
using AldursLab.WurmAssistant3.Core.IoC;
using AldursLab.WurmAssistant3.Core.Root.Components;
using AldursLab.WurmAssistant3.Core.Root.Contracts;
using AldursLab.WurmAssistant3.Core.Root.Views;
using JetBrains.Annotations;
using Ninject;
using Ninject.Activation.Strategies;
using Ninject.Extensions.Factory;

namespace AldursLab.WurmAssistant3.Core.Root
{
    public class CoreBootstrapper : IDisposable
    {
        readonly IKernel kernel = new StandardKernel();

        readonly MainForm mainForm;
        readonly ConsoleArgsManager consoleArgs;

        WurmAssistantDataDirectory dataDirectory;

        public CoreBootstrapper([NotNull] MainForm mainForm, [NotNull] ConsoleArgsManager consoleArgs)
        {
            if (mainForm == null) throw new ArgumentNullException("mainForm");
            if (consoleArgs == null) throw new ArgumentNullException("consoleArgs");
            this.mainForm = mainForm;
            this.consoleArgs = consoleArgs;
        }

        public void PreBootstrap()
        {
            SetupActivationStrategyComponents();

            Regex.CacheSize = 1000;

            dataDirectory = new WurmAssistantDataDirectory(consoleArgs);
            dataDirectory.Lock();
{'fraction_non_alphanumeric': 0.08592188919164397, 'fraction_numerical': 0.011989100817438692, 'mean_word_length': 5.024070021881838, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7579221', 'n_tokens_mistral': 1872, 'n_tokens_neox': 1857, 'n_words': 258}