Example #1
0
 public void Setup()
 {
     Options = new OpenRGBSourceOptions
     {
         Server          = "wayne-foundation.com",
         Port            = 1863,
         PollingInterval = 10
     };
 }
 public ISource[] GetSources()
 {
     Logger.Info($"Configuring {Configuration.Sources.Count()} sources");
     return(Configuration.Sources.Select <SourceOptions, ISource>(sourceOptions => sourceOptions switch
     {
         MqttSourceOptions options => new MqttSource(options, new MqttFactory().CreateManagedMqttClient()),
         OpenRGBSourceOptions options => new OpenRGBSource(
             options,
             GetOpenRGBClientInstance(options.Server, options.Port),
             Observable.Interval(TimeSpan.FromMilliseconds(options.PollingInterval ?? 1000))
             ),
         _ => throw new NotImplementedException($"Source for type {sourceOptions.Type} not implemented")
     }).ToArray());