<commit_before>﻿using System;
using Hadouken.Framework;
using Hadouken.Framework.Plugins;
using InjectMe;
using InjectMe.Registration;

namespace Hadouken.Plugins.Events
{
    public class EventsBootstrapper : Bootstrapper
    {
        public override Plugin Load(IBootConfig config)
        {
            var container = BuildContainer(config);
            return container.ServiceLocator.Resolve<Plugin>();
        }

        private static IContainer BuildContainer(IBootConfig config)
        {
            return
                Container.Create(
                    containerConfiguration => BuildContainerConfiguration(containerConfiguration, config));
        }

        private static void BuildContainerConfiguration(IContainerConfiguration cfg, IBootConfig config)
        {
            string baseUri = String.Concat("http://", config.HostBinding, ":", config.Port);

            cfg.Register<IEventServer>().AsSingleton().UsingFactory(() => new EventServer(baseUri));

            cfg.Register<Plugin>().AsTransient().UsingConcreteType<EventsPlugin>();
        }
    }
}<commit_msg>Until SignalR supports virtual roots, we need to listen to port+1 to avoid confusion.<commit_after>﻿using System;
using Hadouken.Framework;
using Hadouken.Framework.Plugins;
using InjectMe;
using InjectMe.Registration;

namespace Hadouken.Plugins.Events
{
    public class EventsBootstrapper : Bootstrapper
    {
        public override Plugin Load(IBootConfig config)
        {
            var container = BuildContainer(config);
            return container.ServiceLocator.Resolve<Plugin>();
        }

        private static IContainer BuildContainer(IBootConfig config)
        {
            return
                Container.Create(
                    containerConfiguration => BuildContainerConfiguration(containerConfiguration, config));
        }

        private static void BuildContainerConfiguration(IContainerConfiguration cfg, IBootConfig config)
        {
            int port = config.Port + 1;

            string baseUri = String.Concat("http://", config.HostBinding, ":", port + "/events");

            cfg.Register<IEventServer>().AsSingleton().UsingFactory(() => new EventServer(baseUri));

            cfg.Register<Plugin>().AsTransient().UsingConcreteType<EventsPlugin>();
        }
    }
}
{'fraction_non_alphanumeric': 0.09350649350649351, 'fraction_numerical': 0.0008658008658008658, 'mean_word_length': 2.8198347107438018, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 15, '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': '6540350', 'n_tokens_mistral': 565, 'n_tokens_neox': 550, 'n_words': 122}