/// <summary> /// Initialises a Session /// </summary> /// <param name="experimentName">A name for the experiment</param> /// <param name="participantId">A unique ID associated with a participant</param> /// <param name="baseFolder">Location where data should be stored</param> /// <param name="sessionNumber">A number for the session (optional: default 1)</param> /// <param name="participantDetails">Dictionary of information about the participant to be used within the experiment (optional: default null)</param> /// <param name="settings">A Settings instance (optional: default empty settings)</param> public void Begin(string experimentName, string participantId, string baseFolder, int sessionNumber = 1, Dictionary <string, object> participantDetails = null, Settings settings = null) { baseFolder = Path.IsPathRooted(baseFolder) ? baseFolder : Path.Combine(Directory.GetCurrentDirectory(), baseFolder); if (!Directory.Exists(baseFolder)) { throw new DirectoryNotFoundException(string.Format("Initialising session failed, cannot find {0}", baseFolder)); } this.experimentName = experimentName; ppid = participantId; number = sessionNumber; basePath = baseFolder; this.participantDetails = participantDetails; if (settings == null) { settings = Settings.empty; } else { this.settings = settings; } // setup folders InitFolder(); // Initialise logger if (logger != null) { logger.Initialise(); } _hasInitialised = true; onSessionBegin.Invoke(this); // copy Settings to session folder WriteDictToSessionFolder( new Dictionary <string, object>(settings.baseDict), // makes a copy "settings"); }