using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTS.SensorDB.TSF
{
///
/// handles the TCF section of the TSF
/// note that the TCF is not used in Datapro yet.
///
public class TSFTCFSection
{
private const string SECTION_START_HEADER = "---- TCF Info Begin ----";
private const string SECTION_END_HEADER = "---- TCF Info End ----";
private string _tcfPath = "";
public string TCFPath
{
get { return _tcfPath; }
set { _tcfPath = value; }
}
///
/// reads the section from the TSF
/// assumes currentline points to the start of the section
///
///
///
///
public void ReadFrom(List lines, ref int currentLine, ref List errors)
{
if (currentLine == lines.Count)
{
//errors.Add(new ReadTSFError(ReadTSFError.TSF_ERRORS.TSF_UNEXPECTED_EOF, currentLine));
return;
}
string sectionStart = lines[currentLine++];
if (sectionStart != SECTION_START_HEADER)
{
errors.Add(new ReadTSFError(ReadTSFError.TSF_ERRORS.TCF_INVALID_STARTSECTIONHEADER, currentLine, sectionStart));
return;
}
if (currentLine == lines.Count)
{
errors.Add(new ReadTSFError(ReadTSFError.TSF_ERRORS.TSF_UNEXPECTED_EOF, currentLine));
return;
}
TCFPath = lines[currentLine++];
if (currentLine == lines.Count)
{
errors.Add(new ReadTSFError(ReadTSFError.TSF_ERRORS.TSF_UNEXPECTED_EOF, currentLine));
return;
}
string sectionEnd = lines[currentLine++];
if (sectionEnd != SECTION_END_HEADER)
{
errors.Add(new ReadTSFError(ReadTSFError.TSF_ERRORS.TSF_TCF_INVALID_SECTIONENDHEADER, currentLine, sectionEnd));
}
}
}
}