示例#1
0
            public InterfaceStartup(IHostingEnvironment env, LOIBCBot bot)
            {
                var builder = new ConfigurationBuilder();

                Configuration = builder.Build();

                _bot = bot;
            }
示例#2
0
        public LOIBCInterface(string url, LOIBCBot bot)
        {
            _webhost = new WebHostBuilder()
                       .UseKestrel()
                       .UseContentRoot(Path.Combine(Directory.GetCurrentDirectory(), "WebInterface"))
#if DEBUG
                       .UseContentRoot(Path.Combine(Directory.GetCurrentDirectory(), "src", "WebInterface"))
#endif
                       .UseUrls(url)
                       .ConfigureServices(collection =>
            {
                collection.AddSingleton(bot);
            })
                       .UseStartup <InterfaceStartup>()
                       .Build();

            Log.Information("Started web interface on {url}", url);

            _webhost.Start();
        }