using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTS.SensorDB.TDCINI { /// /// helper class for IIHS export section of INI /// public class INIIIHSExport { /// /// whether to apply region of interest or not /// public bool ApplyROI { get; set; } /// /// start of ROI in seconds /// public double ROIStartSeconds { get; set; } /// /// end of ROI in seconds /// public double ROIEndSeconds { get; set; } public bool ReadFrom(string line, int curLine, ref List errors) { string[] tokens = line.Split(new char[] { ',' }); if (3 != tokens.Length) { errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_IIHSExport_INVALID, line, curLine)); return false; } switch (tokens[0]) { case "0": case "F": case "N": ApplyROI = false; break; case "1": case "T": case "Y": ApplyROI = true; break; default: { errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_IIHSExport_INVALID, tokens[0], curLine)); return false; } } double d; if (!double.TryParse(tokens[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d)) { errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_IIHSExport_INVALID, tokens[1], curLine)); return false; } else { ROIStartSeconds = d; } if (!double.TryParse(tokens[2], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d)) { errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_IIHSExport_INVALID, tokens[2], curLine)); return false; } else { ROIEndSeconds = d; } return true; } } }