using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTS.SensorDB.TDCINI
{
///
/// helper class for SmartBatteryThreshold section in ini
///
public class INISmartBatteryThresholds
{
///
/// time in minutes for Yellow battery warning
///
public int Yellow { get; set; }
///
/// time in minutes for Red battery warning
///
public int Red { get; set; }
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_SmartBatteryStatusThresholds, line, curLine));
return false;
}
int temp;
if (!int.TryParse(tokens[0], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_SmartBatteryStatusThresholds, line, curLine));
return false;
}
else { Yellow = temp; }
if (!int.TryParse(tokens[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_SmartBatteryStatusThresholds, line, curLine));
return false;
}
else { Red = temp; }
return true;
}
}
}