using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTS.SensorDB.TDCINI
{
///
/// helper class for ViewerROI section of ROI
///
public class INIViewerROI
{
///
/// x Min value
///
public double XMin { get; set; }
///
/// x Max value
///
public double XMax { get; set; }
///
/// reads section from a line
/// returns false if failed to read section, true if section was read.
///
///
///
///
///
public bool ReadFrom(string line, int curLine, ref List errors)
{
string[] tokens = line.Split(new char[] { ',' });
if (2 != tokens.Length)
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ViewerROI_INVALID, line, curLine));
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_ViewerROI_INVALID, tokens[0], curLine));
return false;
}
else { XMin = d; }
if (!double.TryParse(tokens[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ViewerROI_INVALID, tokens[1], curLine));
return false;
}
else { XMax = d; }
return true;
}
}
}