Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

25 wiersze
890 B

  1. using System;
  2. using MQTTnet.Client;
  3. using MQTTnet.Diagnostics;
  4. namespace MQTTnet.Extensions.ManagedClient
  5. {
  6. public static class MqttFactoryExtensions
  7. {
  8. public static IManagedMqttClient CreateManagedMqttClient(this IMqttClientFactory factory)
  9. {
  10. if (factory == null) throw new ArgumentNullException(nameof(factory));
  11. return new ManagedMqttClient(factory.CreateMqttClient(), new MqttNetLogger().CreateChildLogger());
  12. }
  13. public static IManagedMqttClient CreateManagedMqttClient(this IMqttClientFactory factory, IMqttNetLogger logger)
  14. {
  15. if (factory == null) throw new ArgumentNullException(nameof(factory));
  16. if (logger == null) throw new ArgumentNullException(nameof(logger));
  17. return new ManagedMqttClient(factory.CreateMqttClient(), logger.CreateChildLogger());
  18. }
  19. }
  20. }