MQTTnet.Server startup cleanup.

This commit is contained in:
Christian Kratky
2019-04-20 20:59:28 +02:00
parent 519bb05aac
commit f60bbf7dd7
+4 -13
View File
@@ -1,6 +1,5 @@
using System; using System;
using System.Reflection; using System.Reflection;
using System.Threading;
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@@ -14,7 +13,8 @@ namespace MQTTnet.Server
{ {
PrintLogo(); PrintLogo();
CreateWebHostBuilder(args).Build().Run(); WebHost.CreateDefaultBuilder(args).UseStartup<Startup>().Build().Run();
return 0; return 0;
} }
catch (Exception exception) catch (Exception exception)
@@ -24,17 +24,12 @@ namespace MQTTnet.Server
} }
} }
private static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseKestrel()
.UseStartup<Startup>();
private static void PrintLogo() private static void PrintLogo()
{ {
Console.ResetColor(); Console.ResetColor();
Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.White;
Console.BackgroundColor = ConsoleColor.Red; Console.BackgroundColor = ConsoleColor.Red;
var logoText = const string LogoText =
@"| | @"| |
| __ __ ____ _______ _______ _ _____ | | __ __ ____ _______ _______ _ _____ |
| | \/ |/ __ \__ __|__ __| | | / ____| | | | \/ |/ __ \__ __|__ __| | | / ____| |
@@ -44,12 +39,8 @@ namespace MQTTnet.Server
| |_| |_|\___\_\ |_| |_|_| |_|\___|\__| |_____/ \___|_| \_/ \___|_| | | |_| |_|\___\_\ |_| |_|_| |_|\___|\__| |_____/ \___|_| \_/ \___|_| |
| | | |
| |"; | |";
foreach (var @char in logoText)
{
Console.Write(@char);
Thread.Sleep(1);
}
Console.WriteLine(LogoText);
Console.ResetColor(); Console.ResetColor();
Console.WriteLine(); Console.WriteLine();
Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.White;