init
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DTS.SensorDB.TSF
|
||||
{
|
||||
/// <summary>
|
||||
/// handles the TCF section of the TSF
|
||||
/// note that the TCF is not used in Datapro yet.
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
/// <summary>
|
||||
/// reads the section from the TSF
|
||||
/// assumes currentline points to the start of the section
|
||||
/// </summary>
|
||||
/// <param name="lines"></param>
|
||||
/// <param name="currentLine"></param>
|
||||
/// <param name="errors"></param>
|
||||
public void ReadFrom(List<string> lines, ref int currentLine, ref List<ReadTSFError> 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user