You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

80 lines
4.1 KiB

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