init
This commit is contained in:
45
DataPRO/SensorDB/TDCINI/INIDataZeroTimeWindowSeconds.cs
Normal file
45
DataPRO/SensorDB/TDCINI/INIDataZeroTimeWindowSeconds.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user