//only use this one for Zoom files public void getZoomStartStopTime() { Logger.Logger log = new Logger.Logger(this.cutLog, "TeamNumber", "subjectID_A", "subjectID_B", "subjectID_C", "StartTimeIntoAud", "StopTimeIntoAud"); StreamReader masterRatingReader = new StreamReader(this.masterFile); masterRatingReader.ReadLine(); DateTime masterStartTime = Convert.ToDateTime(masterRatingReader.ReadLine().Split('\t')[4]); DateTime masterEndTime = DateTime.MinValue; string currentLine; while ((currentLine = masterRatingReader.ReadLine()) != null) { masterEndTime = Convert.ToDateTime(currentLine.Split('\t')[4]); } masterRatingReader.Close(); StreamReader interactionReader = new StreamReader(this.frameLog); bool secondStart = false; while ((currentLine = interactionReader.ReadLine()) != null) { string[] splitLine = currentLine.Split('\t'); if (splitLine[6] == "StartZoomRecord") { if (secondStart) { this.audStartTime = Convert.ToDateTime(splitLine[5]); break; } secondStart = true; } } this.startTimeIntoAud = masterStartTime.Subtract(this.audStartTime); this.stopTimeIntoAud = masterEndTime.Subtract(this.audStartTime); log.log(this.teamNum, this.subjectIDA, this.subjectIDB, this.subjectIDC, this.startTimeIntoAud.ToString(@"hh\:mm\:ss\.fff"), this.stopTimeIntoAud.ToString(@"hh\:mm\:ss\.fff")); log.close(); }
//only use this one for participant files, not Zoom files //gets the start and stop time of the Challenges from master-rating-positions //finds time into video to start and stop public void getStartStopTime() { Logger.Logger log = new Logger.Logger(this.cutLog, "TeamNumber", "subjectID_A", "subjectID_B", "subjectID_C", "MinDiffStart", "MinDiffStartTimeStamp", "StartTimeIntoVid", "MinDiffStop", "MinDiffStopTimeStamp", "StopTimeIntoVid"); StreamReader masterRatingReader = new StreamReader(this.masterFile); masterRatingReader.ReadLine(); DateTime masterStartTime = Convert.ToDateTime(masterRatingReader.ReadLine().Split('\t')[4]); DateTime masterEndTime = DateTime.MinValue; string currentLine; while ((currentLine = masterRatingReader.ReadLine()) != null) { masterEndTime = Convert.ToDateTime(currentLine.Split('\t')[4]); } masterRatingReader.Close(); StreamReader frameLogReader = new StreamReader(this.frameLog); bool header = true; bool first = true; double minDiffStart = Double.PositiveInfinity; DateTime minDiffStartTimeStamp = DateTime.MinValue; double minDiffStop = Double.PositiveInfinity; DateTime minDiffStopTimeStamp = DateTime.MinValue; while ((currentLine = frameLogReader.ReadLine()) != null) { if (header) { header = false; continue; } DateTime frameLogTimeStamp = Convert.ToDateTime(currentLine.Split('\t')[2]); if (first) { first = false; this.audStartTime = frameLogTimeStamp; } double currentDiff = Math.Abs(masterStartTime.Subtract(frameLogTimeStamp).TotalSeconds); if (currentDiff < minDiffStart) { minDiffStart = currentDiff; minDiffStartTimeStamp = frameLogTimeStamp; } currentDiff = Math.Abs(masterEndTime.Subtract(frameLogTimeStamp).TotalSeconds); if (currentDiff < minDiffStop) { minDiffStop = currentDiff; minDiffStopTimeStamp = frameLogTimeStamp; } } this.startTimeMinDiff = minDiffStart; this.startTimeStamp = minDiffStartTimeStamp; this.stopTimeMinDiff = minDiffStop; this.stopTimeStamp = minDiffStopTimeStamp; frameLogReader.Close(); this.startTimeIntoAud = this.startTimeStamp.Subtract(this.audStartTime); this.stopTimeIntoAud = this.stopTimeStamp.Subtract(this.audStartTime); log.log(this.teamNum, this.subjectIDA, this.subjectIDB, this.subjectIDC, Convert.ToString(this.startTimeMinDiff), this.startTimeStamp.ToString("MM/dd/yyyy hh:mm:ss.fff"), this.startTimeIntoAud.ToString(@"hh\:mm\:ss\.fff"), Convert.ToString(this.stopTimeMinDiff), this.stopTimeStamp.ToString("MM/dd/yyyy hh:mm:ss.fff"), this.stopTimeIntoAud.ToString(@"hh\:mm\:ss\.fff")); log.close(); }