public NoobotHost(IContainerFactory containerFactory, IMemoryLog memoryLog)
 {
     _containerFactory = containerFactory;
     _memoryLog        = memoryLog;
 }
Exemple #2
0
 public NoobotHost(IContainerFactory containerFactory, IMemoryLog memoryLog)
 {
     _containerFactory = containerFactory;
     _memoryLog = memoryLog;
 }
Exemple #3
0
 public LogModule(IMemoryLog log)
 {
     Get["/log"] = _ => Response.AsJson(log.Messages);
 }
Exemple #4
0
 public LogModule(IMemoryLog log)
 {
     Get["/log"] = _ => Response.AsJson(log.Messages);
 }
Exemple #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IApplicationLifetime applicationLifetime, IHostingEnvironment env, IMemoryLog log)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var noobHost = new NoobotHost(new DotnetCoreConfigReader(Configuration.GetSection("bot")));

            applicationLifetime.ApplicationStarted.Register(() => noobHost.Start(log));
            applicationLifetime.ApplicationStopping.Register(noobHost.Stop);

            app.UseMvc();
            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"js")),
                RequestPath = new PathString("/js")
            });

            app.Run(async context =>
            {
                await context.Response.WriteAsync(string.Empty);
            });
        }
Exemple #6
0
        public void Configure(IApplicationBuilder app, IApplicationLifetime applicationLifetime, IHostingEnvironment env, IMemoryLog log)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var noobHost = new NoobotHost(new DotnetCoreConfigReader(Configuration.GetSection("Bot")));

            applicationLifetime.ApplicationStarted.Register(() => noobHost.Start(log));
            applicationLifetime.ApplicationStopping.Register(noobHost.Stop);

            app.Run(async context =>
            {
                await context.Response.WriteAsync(string.Join(Environment.NewLine, log.FullLog()));
            });
        }