public IDisposable Connect(IObservableDevice device) { string extension = _writerFactory.FileExtension; IDisposable data = Disposable.Empty; if (device.DataType.IsSubclassOf(typeof(DeviceData))) { string deviceDataPath = _paths.BuildDeviceFilePath(device.DeviceType, "data", extension); data = RecordForSessionWithWriter(device.Data, deviceDataPath); //.TakeUntilOtherCompletes(_sessionRecordingEvents) //.AttachWriter(deviceDataPath, _writerFactory, device.RecordingDataType, DATA_BUFFER_SIZE) //.ObserveOn(scheduler: _scheduler) //.Subscribe(); _result.Paths.Add(deviceDataPath); } string deviceStatesPath = _paths.BuildDeviceFilePath(device.DeviceType, "states", extension); IDisposable states = RecordForSessionWithWriter(device.States, deviceStatesPath); //.TakeUntilOtherCompletes(_sessionRecordingEvents) //.AttachWriter(deviceStatesPath, _writerFactory) //.ObserveOn(scheduler: _scheduler) //.Subscribe(); _result.Paths.Add(deviceStatesPath); string deviceLogsPath = _paths.BuildDeviceFilePath(device.DeviceType, "log", extension); IDisposable logs = RecordForSessionWithWriter(device.Logs, deviceLogsPath); //.TakeUntilOtherCompletes(_sessionRecordingEvents) //.AttachWriter(deviceLogsPath, _writerFactory) //.ObserveOn(scheduler: _scheduler) //.Subscribe(); _result.Paths.Add(deviceLogsPath); return(new CompositeDisposable(data, states, logs)); }
private static void AddConfigurations(SessionRecording recording, SessionRecordingPathsBuilder paths) { var selectedStreamingDevices = recording.DeviceConfigurations.Keys.Where(d => DeviceType.StreamingDevices.Contains(d)).ToList(); foreach (var streamingDevice in selectedStreamingDevices) { string key = "TargetPath"; string value = paths.BuildDeviceFilePath(streamingDevice, "data", "bin"); recording.DeviceConfigurations.AddOrUpdate ( key: streamingDevice, addValueFactory: d => new Dictionary <string, object>() { { key, value } }, updateValueFactory: (_, configurations) => { configurations.AddOrUpdate(key, value, (__, ___) => value); return(configurations); } ); } }