選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

23 行
863 B

  1. using System;
  2. using MQTTnet.Diagnostics;
  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.CreateChildLogger());
  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.CreateChildLogger());
  17. }
  18. }
  19. }