25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 

25 satır
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. }