Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 

23 rindas
823 B

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