using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTS.SensorDB.TDCINI { /// /// helper class for region of interest section of INI /// public class TSFINIRegionOfInterest { /// /// Start in seconds of ROI relative to T0 /// public double StartSeconds { get; set; } /// /// end in seconds of ROI relative to T0 /// public double EndSeconds { get; set; } /// /// reads section from a line, /// returns true if read successfully /// false if there were errors /// /// /// /// /// public bool ReadFrom(string line, int currentLine, ref List errors) { string[] tokens = line.Split(new char[] { ',' }); if (2 != tokens.Length) { errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ROI_INVALID, line, currentLine)); return false; } double d; if (!double.TryParse(tokens[0], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d)) { errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ROI_INVALID, line, currentLine)); return false; } else { StartSeconds = d; } if (!double.TryParse(tokens[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d)) { errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ROI_INVALID, line, currentLine)); return false; } else { EndSeconds = d; } return true; } } }