public SessionDefinition LoadFromFile(string filepath) { using (var reader = new StreamReader(filepath)) { // deserialize var definition = SessionDefinition.Create(); _serializer.Populate(reader, definition); //definition.CreatedAt = file.LastWriteTime; return(definition); } }
private static SessionDefinition CreateDefaultDefinition(IEnumerable <DeviceType> deviceTypes) { var definition = SessionDefinition.Create(); definition.Devices = deviceTypes.Select(type => new SessionDeviceDefinition(type, null)).ToList(); definition.Project = "Default"; definition.Source = "Local"; definition.Name = "Recording"; definition.SerializationFormat = "JSON"; definition.StrictStart = true; definition.Welcome.Ignore = true; definition.Recorders.Add(new SessionRecorderDefinition("Local")); definition.Recorders.Add(new SessionRecorderDefinition("Buffer")); bool hasEyeTracker = definition.SelectedDeviceTypes.Any(device => device.Equals(DeviceType.Physiological.EYETRACKER)); if (hasEyeTracker) { definition.PreSessionSteps.Add(new SessionStep() { Action = new EyeTrackerCalibrationActionSettings() }); definition.SessionSteps.Add(new SessionStep() { Action = new EyeTrackerValidationActionSettings() { PointDuration = 2000 }, Completion = new SessionStepCompletionSettings() { Hotkeys = new List <Hotkey>() { Hotkey.F10 } } }); } definition.SessionSteps.Add(new SessionStep() { Action = new ShowDesktopActionSettings() { MinimizeAll = false }, Completion = new SessionStepCompletionSettings() { Hotkeys = new List <Hotkey>() { Hotkey.F10 } } }); if (hasEyeTracker) { definition.PostSessionSteps.Add(new SessionStep() { Action = new FixationFilterActionSettings() }); } return(definition); }