Program.cs 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using Microsoft.AspNetCore.Hosting;
  2. using Microsoft.Extensions.Hosting;
  3. using MQTTnet.Server.Web;
  4. using System;
  5. using System.Diagnostics;
  6. using System.Reflection;
  7. namespace MQTTnet.Server
  8. {
  9. public static class Program
  10. {
  11. public static int Main(string[] args)
  12. {
  13. try
  14. {
  15. PrintLogo();
  16. Host.CreateDefaultBuilder(args)
  17. .ConfigureWebHostDefaults(webBuilder =>
  18. {
  19. webBuilder.ConfigureKestrel(serverOptions =>
  20. {
  21. })
  22. .UseStartup<Startup>();
  23. }).Build().Run();
  24. return 0;
  25. }
  26. catch (Exception exception)
  27. {
  28. Console.WriteLine(exception);
  29. return -1;
  30. }
  31. }
  32. static void PrintLogo()
  33. {
  34. Console.ResetColor();
  35. Console.ForegroundColor = ConsoleColor.Red;
  36. const string LogoText =
  37. @"
  38. ███╗ ███╗ ██████╗ ████████╗████████╗███╗ ██╗███████╗████████╗ ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗
  39. ████╗ ████║██╔═══██╗╚══██╔══╝╚══██╔══╝████╗ ██║██╔════╝╚══██╔══╝ ██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗
  40. ██╔████╔██║██║ ██║ ██║ ██║ ██╔██╗ ██║█████╗ ██║ ███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝
  41. ██║╚██╔╝██║██║▄▄ ██║ ██║ ██║ ██║╚██╗██║██╔══╝ ██║ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗
  42. ██║ ╚═╝ ██║╚██████╔╝ ██║ ██║ ██║ ╚████║███████╗ ██║ ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║
  43. ╚═╝ ╚═╝ ╚══▀▀═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
  44. ";
  45. Console.WriteLine(LogoText);
  46. Console.ResetColor();
  47. Console.WriteLine();
  48. Console.ForegroundColor = ConsoleColor.White;
  49. Console.WriteLine("The official MQTT server implementation of MQTTnet");
  50. Console.WriteLine("Copyright (c) 2017-2020 The MQTTnet Team");
  51. Console.WriteLine(@"https://github.com/chkr1011/MQTTnet");
  52. Console.ForegroundColor = ConsoleColor.White;
  53. var fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
  54. Console.WriteLine($@"
  55. Version: {fileVersion.ProductVersion}
  56. License: MIT (read LICENSE file)
  57. Sponsoring: https://opencollective.com/mqttnet
  58. Support: https://github.com/chkr1011/MQTTnet/issues
  59. Docs: https://github.com/chkr1011/MQTTnet/wiki/MQTTnetServer
  60. ");
  61. Console.ForegroundColor = ConsoleColor.Red;
  62. Console.WriteLine(" ! THIS IS AN ALPHA VERSION! IT IS NOT RECOMMENDED TO USE IT FOR ANY DIFFERENT PURPOSE THAN TESTING OR EVALUATING!");
  63. Console.ResetColor();
  64. Console.WriteLine();
  65. }
  66. }
  67. }