Пример #1
0
        internal LocalSessionDeviceRecorder
        (
            SessionRecording recording,
            IDataSerializationFactory writerFactory,
            SessionRecordingPathsBuilder paths,
            LocalSessionRecordingResult result,
            IScheduler scheduler
        )
        {
            _sessionEvents = recording.Events;
            _devices       = recording.SelectedDevices.ToList();
            _writerFactory = writerFactory;
            _paths         = paths;
            _result        = result;
            _scheduler     = scheduler;

            _sessionRecordingEvents = _sessionEvents.FirstOrDefaultAsync(e => e.State == SessionState.Processing || e.State == SessionState.Completed);
        }
Пример #2
0
        public void Record()
        {
            if (_configuration.CreateSessionFolder)
            {
                _paths = new SessionRecordingPathsBuilder(_configuration.TargetPath, _recording);
            }
            else
            {
                _paths = new SessionRecordingPathsBuilder(_configuration.TargetPath);
            }

            _result = new LocalSessionRecordingResult(_recording, _paths.RootPath);

            _paths.Setup();

            AddConfigurations(_recording, _paths);

            var scheduler      = new EventLoopScheduler();
            var deviceObserver = new LocalSessionDeviceRecorder(_recording, _writerFactory, _paths, _result, scheduler);

            _observers.Connect(deviceObserver);
            _dataObserverSubscriber.Disposable = Disposable.Create(() =>
            {
                _observers.Disconnect(deviceObserver);
            });

            string sessionEventsPath = _paths.BuildFilePath("session", _writerFactory.FileExtension);

            _sessionEventsSubscriber.Disposable = _recording.Events
                                                  .AttachWriter(sessionEventsPath, _writerFactory)
                                                  .Finally(Close)
                                                  .ObserveOn(scheduler: scheduler).Subscribe();
            _schedulerDisposable.Disposable = scheduler;

            _result.Paths.Add(sessionEventsPath);
            _recording.Results.Add(_result);

            _isRecording = true;
        }