using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTS.SensorDB.TDCINI
{
///
/// helper class for DataZeroTimeWindow section of INI
///
public class INIDataZeroTimeWindowSeconds
{
///
/// start of datazero window
///
public double Start { get; set; }
///
/// end of data zero window
///
public double End { get; set; }
public bool ReadFrom(string line, ref List errors, int iCurrentLine)
{
string[] tokens = line.Split(new char[] { ',' });
if (2 != tokens.Length)
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_DataZeroTimeWindow_INVALID, line, iCurrentLine));
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_DataZeroTimeWindow_INVALID, line, iCurrentLine));
return false;
}
else { Start = d; }
if (!double.TryParse(tokens[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_DataZeroTimeWindow_INVALID, line, iCurrentLine));
return false;
}
else { End = d; }
return true;
}
}
}