46 lines
1.7 KiB
C#
46 lines
1.7 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
|
|||
|
|
namespace DTS.SensorDB.TDCINI
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// helper class for DataZeroTimeWindow section of INI
|
|||
|
|
/// </summary>
|
|||
|
|
public class INIDataZeroTimeWindowSeconds
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// start of datazero window
|
|||
|
|
/// </summary>
|
|||
|
|
public double Start { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// end of data zero window
|
|||
|
|
/// </summary>
|
|||
|
|
public double End { get; set; }
|
|||
|
|
public bool ReadFrom(string line, ref List<TDCINIError> 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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|