184 lines
6.4 KiB
C#
184 lines
6.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace DTS.SensorDB.TDCINI
|
|
{
|
|
/// <summary>
|
|
/// helper class for ISO Export section of INI
|
|
/// </summary>
|
|
public class INIISOExportParameters
|
|
{
|
|
/// <summary>
|
|
/// whether to automatically export ISO on download
|
|
/// </summary>
|
|
public bool AutomaticISOExportOnDownload { get; set; }
|
|
/// <summary>
|
|
/// the MME header template (empty if none)
|
|
/// </summary>
|
|
public string MMEHeaderTemplateFilename { get; set; }
|
|
/// <summary>
|
|
/// whether to prompt the user for MME header template file or not
|
|
/// </summary>
|
|
public bool PromptUserForMMETemplateFilename { get; set; }
|
|
/// <summary>
|
|
/// channel header template (empty if none)
|
|
/// </summary>
|
|
public string ChannelHeaderTemplateFilename { get; set; }
|
|
/// <summary>
|
|
/// whether to prompt the user for a channel header template file
|
|
/// </summary>
|
|
public bool PromptUserForChannelHeaderFilename { get; set; }
|
|
public enum FilterOutputOptions
|
|
{
|
|
UnFiltered = 0,
|
|
Filtered = 1,
|
|
PromptUser = 2
|
|
}
|
|
/// <summary>
|
|
/// what type of output is desired
|
|
/// </summary>
|
|
public FilterOutputOptions FilterOutput { get; set; }
|
|
/// <summary>
|
|
/// whether to supress the export completion dialog
|
|
/// </summary>
|
|
public bool SuppressExportCompletionDialog { get; set; }
|
|
/// <summary>
|
|
/// dummy template file (empty if none)
|
|
/// </summary>
|
|
public string DummyTemplateFilename { get; set; }
|
|
/// <summary>
|
|
/// whether to prompt the user for dummy template file or not
|
|
/// </summary>
|
|
public bool PromptUserForDummyTemplateFilename { get; set; }
|
|
/// <summary>
|
|
/// reads settings from a line
|
|
/// returns true if successful or false if not
|
|
/// </summary>
|
|
/// <param name="line"></param>
|
|
/// <param name="curLine"></param>
|
|
/// <param name="errors"></param>
|
|
/// <returns></returns>
|
|
public bool ReadFrom(string line, int curLine, ref List<TDCINIError> errors)
|
|
{
|
|
string[] tokens = line.Split(new char[] { ',' });
|
|
if (tokens.Length != 9)
|
|
{
|
|
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ISOEXPORTPARAMETERS_INVALID, line, curLine));
|
|
return false;
|
|
}
|
|
switch (tokens[0])
|
|
{
|
|
case "0":
|
|
case "F":
|
|
case "N":
|
|
AutomaticISOExportOnDownload = false;
|
|
break;
|
|
case "1":
|
|
case "T":
|
|
case "Y":
|
|
AutomaticISOExportOnDownload = true;
|
|
break;
|
|
default:
|
|
{
|
|
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ISOEXPORTPARAMETERS_INVALID, tokens[0], curLine));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
MMEHeaderTemplateFilename = tokens[1];
|
|
|
|
switch (tokens[2])
|
|
{
|
|
case "0":
|
|
case "F":
|
|
case "N":
|
|
PromptUserForMMETemplateFilename = false;
|
|
break;
|
|
case "1":
|
|
case "T":
|
|
case "Y":
|
|
PromptUserForMMETemplateFilename = true;
|
|
break;
|
|
default:
|
|
{
|
|
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ISOEXPORTPARAMETERS_INVALID, tokens[2], curLine));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
ChannelHeaderTemplateFilename = tokens[3];
|
|
|
|
switch (tokens[4])
|
|
{
|
|
case "0":
|
|
case "F":
|
|
case "N":
|
|
PromptUserForChannelHeaderFilename = false;
|
|
break;
|
|
case "1":
|
|
case "T":
|
|
case "Y":
|
|
PromptUserForChannelHeaderFilename = true;
|
|
break;
|
|
default:
|
|
{
|
|
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ISOEXPORTPARAMETERS_INVALID, tokens[4], curLine));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
switch (tokens[5])
|
|
{
|
|
case "0": FilterOutput = FilterOutputOptions.UnFiltered; break;
|
|
case "1": FilterOutput = FilterOutputOptions.Filtered; break;
|
|
case "2": FilterOutput = FilterOutputOptions.PromptUser; break;
|
|
default:
|
|
{
|
|
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ISOEXPORTPARAMETERS_INVALID, tokens[5], curLine));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
switch (tokens[6])
|
|
{
|
|
case "0":
|
|
case "F":
|
|
case "N":
|
|
SuppressExportCompletionDialog = false; break;
|
|
case "1":
|
|
case "T":
|
|
case "Y":
|
|
SuppressExportCompletionDialog = true; break;
|
|
default:
|
|
{
|
|
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ISOEXPORTPARAMETERS_INVALID, tokens[6], curLine));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
DummyTemplateFilename = tokens[7];
|
|
|
|
switch (tokens[8])
|
|
{
|
|
case "0":
|
|
case "F":
|
|
case "N":
|
|
PromptUserForDummyTemplateFilename = false; break;
|
|
case "1":
|
|
case "T":
|
|
case "Y":
|
|
PromptUserForDummyTemplateFilename = true; break;
|
|
default:
|
|
{
|
|
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ISOEXPORTPARAMETERS_INVALID, tokens[8], curLine));
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
|
|
}
|
|
}
|
|
}
|