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.
 
 
 

24 line
930 B

  1. using JT1078.Gateway.Codecs;
  2. using JT1078.Gateway.Interfaces;
  3. using JT1078.Gateway.Session;
  4. using JT1078.Gateway.Udp;
  5. using JT1078.Gateway.Udp.Handlers;
  6. using Microsoft.Extensions.DependencyInjection;
  7. using Microsoft.Extensions.DependencyInjection.Extensions;
  8. using System.Runtime.CompilerServices;
  9. namespace JT1078.Gateway
  10. {
  11. public static class JT1078UdpExtensions
  12. {
  13. public static IJT1078UdpBuilder AddUdpHost(this IJT1078Builder builder)
  14. {
  15. builder.Services.TryAddSingleton<JT1078UdpSessionManager>();
  16. builder.Services.TryAddSingleton<IJT1078UdpMessageHandlers, JT1078UdpMessageProcessorEmptyImpl>();
  17. builder.Services.TryAddScoped<JT1078UdpDecoder>();
  18. builder.Services.TryAddScoped<JT1078UdpServerHandler>();
  19. builder.Services.AddHostedService<JT1078UdpServerHost>();
  20. return new JT1078UdpBuilderDefault(builder);
  21. }
  22. }
  23. }