Files
DP44/DataPRO/SensorDB/TDCINI/TDCINIFile.cs
2026-04-17 14:55:32 -04:00

2316 lines
125 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTS.SensorDB.TDCINI;
namespace DTS.SensorDB
{
/// <summary>
/// handles reading the TDC INI file, which is required to read a TSF
/// </summary>
public class TDCINIFile
{
/// <summary>
/// these are all the possible "fields" or header lines in the tdas.ini file
/// </summary>
public enum Tags
{
ProgramVersion,
CustomerName,
MemorySize,
LastDataSet,
ExcitationVoltage,
PROGainOptions,
G5GainOptions,
CurrentRS232,
ValidProcessTypes,
ShuntValueOptions,
SignaltoNoiseRatioMinimum,
CalPulseTolerance,
PlotFileTypeDefault,
ShuntCheckOption,
DefaultSoftwareZeroReference,
DataZeroCalculationTime,
CurrentFirmwareVersions,
GraphBackgroundColorandOScopeTraceSize,
PROFixedAntiAliasFilter,
UserAccesstoQuickModify,
ValidSamplingRates,
CorrespondingVariableFilterCutoffs,
CalibrationIntervalinMonths,
RackInventory,
DefaultComPortMode,
DuplicateSensorsAllowed,
EnableSensorID,
PostCalWaitTime,
TSFReadSIFsProtocol,
ValidCustomerDataCollectionModes,
DefaultDataCollectionMode,
DefaultRealTimeMode,
GotoRealTimeModebeforeCollectData,
ExporttoASCIIOptions,
SensorWarmupTime,
SIMConnectorType,
TOMEvent,
TOMRecording,
TOMACFrequency,
TOMFireTypeDefault,
TOMCurrentDefault,
ROI,
MakeallDataChannelNumbersSequential,
PercentOverrangeWhenCalculatingBestGain,
DefaultAndBackupSIFDirectories,
DefaultAndBackupTSFDirectories,
DefaultAndBackupDataDirectories,
PerformAutomaticRackDiscovery,
ChannelDescriptionFilters,
ComPortforSoftwareExportofDASReadySignal,
CheckHardwareTriggerduringDataCollection,
FireintoTOMDummyLoadsduringstandardDataCollection,
CreateDIAdemheaderautomaticallywithdatadownload,
DIAdemExportChannelName,
DIAdemExportChannelComment,
MinimizeTOMSafetySwitchmessages,
EnableSoftwareTriggerStartRecord,
EnablelowpowerarmmodeforG5,
InMeterModeorderchannelsbyDatachannelnumber,
Automaticallystartdownloadsequencercomplete,
Automaticallydownloadtestcomplete,
G5DockingStationconnectorpaneloption,
MultipleTestMode,
MultipleTestModeDelaybetweentests,
MultipleTestCalibrationInterval,
EnableACmodeforsquibchannels,
OperatingMode,
ViewerROI,
SmartBatteryStatusThresholdsinminutes,
Sensordatabasedatasourcename,
Maximumgainforcedexcitation,
automaticISOexportondownload,
Checkforundownloadeddatabeforerealtime,
IIHSExportApplyROI,
Realtimelogging,
ForceOldTestTrigger,
DefaultExportFolder,
EndINIFile,
UNKNOWN //reserved for unexpected blank lines
}
/// <summary>
/// returns a tag given a string
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
private Tags GetTagForString(string s)
{
switch (s)
{
case "---- Program Version ----": return Tags.ProgramVersion;
case "---- Customer Name ----": return Tags.CustomerName;
case "---- Memory Size (PRO: 75000, 750000, 4000000 (25s@10KHz), 16000000 (100s@10KHz) / G5: 48000000 (70s@10KHz) 68000000 (100s@10KHz) 102000000 (150s@10KHz)) ----": return Tags.MemorySize;
case "---- Last Data Set ----": return Tags.LastDataSet;
case "---- Excitation Voltage (V) ----": return Tags.ExcitationVoltage;
case "---- PRO Gain Options ----": return Tags.PROGainOptions;
case "---- G5 Gain Options ----": return Tags.G5GainOptions;
case "---- Current RS232/422 Com Port Number, Max Com Speed, Max Com Ports ----": return Tags.CurrentRS232;
case "---- Valid Process Types ----": return Tags.ValidProcessTypes;
case "---- Shunt Value Options ----": return Tags.ShuntValueOptions;
case "---- Signal to Noise Ratio Minimum ----": return Tags.SignaltoNoiseRatioMinimum;
case "---- Cal Pulse Tolerance +/- % ----": return Tags.CalPulseTolerance;
case "---- Plot File Type Default (0=unfil, 1=fil, 2=mv, 3=cnts) ----": return Tags.PlotFileTypeDefault;
case "---- Shunt Check Option (0=use EU, 1=use volt. ins.) ----": return Tags.ShuntCheckOption;
case "---- Default Software Zero Reference for Sensor Channels (0=INI Zero, 1=PreCal Zero, 2=Equals 0 mV) ----": return Tags.DefaultSoftwareZeroReference;
case "---- Data Zero Calculation Time Window in sec (Time1, Time2) ----": return Tags.DataZeroCalculationTime;
case "---- Current Firmware Versions (SIM, TOM, DIM, Rack, G5) ----": return Tags.CurrentFirmwareVersions;
case "---- Graph Background Color and OScope Trace Size Default ----": return Tags.GraphBackgroundColorandOScopeTraceSize;
case "---- PRO Fixed AntiAlias Filter, G5 Max Adj Filter Setting ----": return Tags.PROFixedAntiAliasFilter;
case "---- User Access to Quick Modify (0=No, 1=Yes) ----": return Tags.UserAccesstoQuickModify;
case "---- Valid Sampling Rates ----": return Tags.ValidSamplingRates;
case "---- Corresponding Variable Filter Cutoffs (0 = PRO: No Adj Filter, G5: Max Adj Filter) ----": return Tags.CorrespondingVariableFilterCutoffs;
case "---- Calibration Interval in Months (Sensor, DAS Hardware) ----": return Tags.CalibrationIntervalinMonths;
case "---- Rack Inventory (Number, S/N No., Size, IP Address) ----": return Tags.RackInventory;
case "---- Default Com Port Mode (Ethernet=0, RS232=1) ----": return Tags.DefaultComPortMode;
case "---- Duplicate Sensors Allowed? (No=0, Yes=1) ----": return Tags.DuplicateSensorsAllowed;
case "---- Enable Sensor ID? (No=0, Yes=1, WorldSID=2, iDummy=3) ----": return Tags.EnableSensorID;
case "---- Post Cal Wait Time (sec) ----": return Tags.PostCalWaitTime;
case "---- TSF Read SIF's Protocol - Options are: READ NONE, READ ALL, or READ MINIMUM ----": return Tags.TSFReadSIFsProtocol;
case "---- Valid Customer Data Collection Modes - (CIRCULAR-BUFFER, RECORDER, or MULTIPLE-EVENT) ----": return Tags.ValidCustomerDataCollectionModes;
case "---- Default Data Collection Mode - (CIRCULAR-BUFFER=0, RECORDER=1, or MULTIPLE-EVENT=2) ----": return Tags.DefaultDataCollectionMode;
case "---- Default RealTime Mode - Options are: OSCOPE, METER, or ASK ----": return Tags.DefaultRealTimeMode;
case "---- Go to RealTime Mode before Collect Data - (NO=0, YES=1) ----": return Tags.GotoRealTimeModebeforeCollectData;
case "---- Export to ASCII Options (DataType, Time Column, ASCII_Excel, OneorMoreFiles, HeaderOption, Items Checked) ----": return Tags.ExporttoASCIIOptions;
case "---- Sensor Warmup Time (in seconds) ----": return Tags.SensorWarmupTime;
case "---- SIM Connector Type (0 = 0B or 1B Lemos, 1 = 2B Lemos) ----": return Tags.SIMConnectorType;
case "---- TOM Event (0 = Rack Bus Only, 1 = TOM Only, 2 = TOM and Rack Bus) ----": return Tags.TOMEvent;
case "---- TOM Recording (0 = Voltage, 1 = Initiation) ----": return Tags.TOMRecording;
case "---- TOM AC Frequency (must be number between 12 and 120 KHz) ----": return Tags.TOMACFrequency;
case "---- TOM Fire Type Default (1=DC Cap Discharge, 2=DC Constant Current, 3=AC Cap Discharge) ----": return Tags.TOMFireTypeDefault;
case "---- TOM Current Default (must be number between 0.1 and 4.0, valid for Constant Current Mode) ----": return Tags.TOMCurrentDefault;
case "---- ROI - Region of Interest (Example -1.000, 2.500) Enter -9999.0, 9999.0 to default to time in TSF) ----": return Tags.ROI;
case "---- When Saving TSF, Make all Data Channel Numbers Sequential (No=0, Yes=1) ----": return Tags.MakeallDataChannelNumbersSequential;
case "---- Percent Overrange When Calculating Best Gain, Adds Headroom to Measurement (0.0 to 20.0) ----": return Tags.PercentOverrangeWhenCalculatingBestGain;
case "---- Default & Backup SIF Directories (TDASDIR = TDAS software initial setting) ----": return Tags.DefaultAndBackupSIFDirectories;
case "---- Default & Backup TSF Directories (TDASDIR = TDAS software initial setting) ----": return Tags.DefaultAndBackupTSFDirectories;
case "---- Default & Backup Data Directories (TDASDIR = TDAS software initial setting) ----": return Tags.DefaultAndBackupDataDirectories;
case "---- Perform Automatic Rack Discovery (1 = Yes, 0 = No)----": return Tags.PerformAutomaticRackDiscovery;
case "---- Channel Description Filters (substring match) ----": return Tags.ChannelDescriptionFilters;
case "---- Com Port for Software Export of DAS Ready Signal (0 = Do not use this feature) ----": return Tags.ComPortforSoftwareExportofDASReadySignal;
case "---- Check Hardware Trigger during Data Collection? (0 = No, 1 = Yes, 2 = Give option to bypass) ----": return Tags.CheckHardwareTriggerduringDataCollection;
case "---- Fire into TOM Dummy Loads during standard Data Collection (0 = No, 1 = Yes - Highly recommend Yes) ----": return Tags.FireintoTOMDummyLoadsduringstandardDataCollection;
case "---- DIAdem Export: Create DIAdem header automatically with data download (0 = No, 1 = Yes) ----": return Tags.CreateDIAdemheaderautomaticallywithdatadownload;
case "---- DIAdem Export: Channel Name (0 = None, 1 = Channel Description, 2 = ISO Code, 3 = Sensor SN, 4 = Channel Comment) ----": return Tags.DIAdemExportChannelName;
case "---- DIAdem Export: Channel Comment (0 = None, 1 = Channel Description, 2 = ISO Code, 3 = Sensor SN, 4 = Channel Comment) ----": return Tags.DIAdemExportChannelComment;
case "---- Minimize TOM Safety Switch messages (1 = No, 2 = Yes. **** Note these values are different than most other options ****)": return Tags.MinimizeTOMSafetySwitchmessages;
case "---- Enable Software Trigger/Start Record (0 = No, 1 = Yes)": return Tags.EnableSoftwareTriggerStartRecord;
case "---- Enable low power arm mode for G5 in Recorder mode (0 = No, 1 = Yes)": return Tags.EnablelowpowerarmmodeforG5;
case "---- In Meter Mode order channels by Data channel number (0 = No use hardware channel order, 1 = Yes use data channel order)": return Tags.InMeterModeorderchannelsbyDatachannelnumber;
case "---- Automatically start the download when the sequencer is complete (0 = No, 1 = Yes)": return Tags.Automaticallystartdownloadsequencercomplete;
case "---- Automatically download data when a test is complete (0 = No, 1 = Yes)": return Tags.Automaticallydownloadtestcomplete;
case "---- G5 Docking Station connector panel option (0 = staggered layout with numbers printed next to each connector, 1 = linear layout with only 1,16,17,32 printed)": return Tags.G5DockingStationconnectorpaneloption;
case "---- Multiple Test Mode (0 = disable, 1 = enable). Be sure to set Automatic download and ROI": return Tags.MultipleTestMode;
case "---- Multiple Test Mode Delay between tests": return Tags.MultipleTestModeDelaybetweentests;
case "---- Multiple Test Calibration Interval": return Tags.MultipleTestCalibrationInterval;
case "---- Enable AC mode for squib channels": return Tags.EnableACmodeforsquibchannels;
case "---- Operating Mode (0 = Data Collection, 1 = Calibration)": return Tags.OperatingMode;
case "---- Viewer ROI (X Min, X Max)": return Tags.ViewerROI;
case "---- Smart Battery Status Thresholds in minutes (Yellow, Red)": return Tags.SmartBatteryStatusThresholdsinminutes;
case "---- Sensor database data source name (for example DSN=Wincarat;uid=WINCARAT;pwd=WINCARAT)": return Tags.Sensordatabasedatasourcename;
case "---- Maximum gain for forced excitation mode (0 = disable, 4 = suggested enable value)": return Tags.Maximumgainforcedexcitation;
case "---- ISO Export: automatic ISO export on download (0 = disabled, 1 = enabled), MME header template filename, prompt user for template filename (0 = use INI-specified template, 1 = prompt user for filename), Channel header template filename, prompt user for template filename (0 = use INI-specified template, l = prompt users for filename), Filter output (0 = unfiltered, 1 = filtered, 2 = prompt_user), suppress export completion dialog (0 = do not suppress, 1 = suppress), Dummy template filename, prompt user for template filename (0 = use INI-specified template, l = prompt users for filename)": return Tags.automaticISOexportondownload;
case "---- Check for undownloaded data before realtime (0 = disabled, 1 = enabled )": return Tags.Checkforundownloadeddatabeforerealtime;
case "---- IIHS Export: Apply ROI (0 = disabled, 1 = enabled ), Begin ROI (s), End ROI (s)": return Tags.IIHSExportApplyROI;
case "---- Realtime logging (0 = disabled, 1 = enabled)": return Tags.Realtimelogging;
case "---- Force Old Test Trigger(0 = use new fast test trigger, 1 = use conventional arming technique, 2 = Set digital outputs)": return Tags.ForceOldTestTrigger;
case "---- Default export folder (blank == sub folder of test folder). Implementation may vary by export type": return Tags.DefaultExportFolder;
case "---- End INI File ----": return Tags.EndINIFile;
default: return Tags.UNKNOWN;
}
}
/// <summary>
/// returns the string header for a given tag
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
private string GetStringForTag(Tags tag)
{
switch (tag)
{
case Tags.ProgramVersion: return "---- Program Version ----";
case Tags.CustomerName: return "---- Customer Name ----";
case Tags.MemorySize: return "---- Memory Size (PRO: 75000, 750000, 4000000 (25s@10KHz), 16000000 (100s@10KHz) / G5: 48000000 (70s@10KHz) 68000000 (100s@10KHz) 102000000 (150s@10KHz)) ----";
case Tags.LastDataSet: return "---- Last Data Set ----";
case Tags.ExcitationVoltage: return "---- Excitation Voltage (V) ----";
case Tags.PROGainOptions: return "---- PRO Gain Options ----";
case Tags.G5GainOptions: return "---- G5 Gain Options ----";
case Tags.CurrentRS232: return "---- Current RS232/422 Com Port Number, Max Com Speed, Max Com Ports ----";
case Tags.ValidProcessTypes: return "---- Valid Process Types ----";
case Tags.ShuntValueOptions: return "---- Shunt Value Options ----";
case Tags.SignaltoNoiseRatioMinimum: return "---- Signal to Noise Ratio Minimum ----";
case Tags.CalPulseTolerance: return "---- Cal Pulse Tolerance +/- % ----";
case Tags.PlotFileTypeDefault: return "---- Plot File Type Default (0=unfil, 1=fil, 2=mv, 3=cnts) ----";
case Tags.ShuntCheckOption: return "---- Shunt Check Option (0=use EU, 1=use volt. ins.) ----";
case Tags.DefaultSoftwareZeroReference: return "---- Default Software Zero Reference for Sensor Channels (0=INI Zero, 1=PreCal Zero, 2=Equals 0 mV) ----";
case Tags.DataZeroCalculationTime: return "---- Data Zero Calculation Time Window in sec (Time1, Time2) ----";
case Tags.CurrentFirmwareVersions: return "---- Current Firmware Versions (SIM, TOM, DIM, Rack, G5) ----";
case Tags.GraphBackgroundColorandOScopeTraceSize: return "---- Graph Background Color and OScope Trace Size Default ----";
case Tags.PROFixedAntiAliasFilter: return "---- PRO Fixed AntiAlias Filter, G5 Max Adj Filter Setting ----";
case Tags.UserAccesstoQuickModify: return "---- User Access to Quick Modify (0=No, 1=Yes) ----";
case Tags.ValidSamplingRates: return "---- Valid Sampling Rates ----";
case Tags.CorrespondingVariableFilterCutoffs: return "---- Corresponding Variable Filter Cutoffs (0 = PRO: No Adj Filter, G5: Max Adj Filter) ----";
case Tags.CalibrationIntervalinMonths: return "---- Calibration Interval in Months (Sensor, DAS Hardware) ----";
case Tags.RackInventory: return "---- Rack Inventory (Number, S/N No., Size, IP Address) ----";
case Tags.DefaultComPortMode: return "---- Default Com Port Mode (Ethernet=0, RS232=1) ----";
case Tags.DuplicateSensorsAllowed: return "---- Duplicate Sensors Allowed? (No=0, Yes=1) ----";
case Tags.EnableSensorID: return "---- Enable Sensor ID? (No=0, Yes=1, WorldSID=2, iDummy=3) ----";
case Tags.PostCalWaitTime: return "---- Post Cal Wait Time (sec) ----";
case Tags.TSFReadSIFsProtocol: return "---- TSF Read SIF's Protocol - Options are: READ NONE, READ ALL, or READ MINIMUM ----";
case Tags.ValidCustomerDataCollectionModes: return "---- Valid Customer Data Collection Modes - (CIRCULAR-BUFFER, RECORDER, or MULTIPLE-EVENT) ----";
case Tags.DefaultDataCollectionMode: return "---- Default Data Collection Mode - (CIRCULAR-BUFFER=0, RECORDER=1, or MULTIPLE-EVENT=2) ----";
case Tags.DefaultRealTimeMode: return "---- Default RealTime Mode - Options are: OSCOPE, METER, or ASK ----";
case Tags.GotoRealTimeModebeforeCollectData: return "---- Go to RealTime Mode before Collect Data - (NO=0, YES=1) ----";
case Tags.ExporttoASCIIOptions: return "---- Export to ASCII Options (DataType, Time Column, ASCII_Excel, OneorMoreFiles, HeaderOption, Items Checked) ----";
case Tags.SensorWarmupTime: return "---- Sensor Warmup Time (in seconds) ----";
case Tags.SIMConnectorType: return "---- SIM Connector Type (0 = 0B or 1B Lemos, 1 = 2B Lemos) ----";
case Tags.TOMEvent: return "---- TOM Event (0 = Rack Bus Only, 1 = TOM Only, 2 = TOM and Rack Bus) ----";
case Tags.TOMRecording: return "---- TOM Recording (0 = Voltage, 1 = Initiation) ----";
case Tags.TOMACFrequency: return "---- TOM AC Frequency (must be number between 12 and 120 KHz) ----";
case Tags.TOMFireTypeDefault: return "---- TOM Fire Type Default (1=DC Cap Discharge, 2=DC Constant Current, 3=AC Cap Discharge) ----";
case Tags.TOMCurrentDefault: return "---- TOM Current Default (must be number between 0.1 and 4.0, valid for Constant Current Mode) ----";
case Tags.ROI: return "---- ROI - Region of Interest (Example -1.000, 2.500) Enter -9999.0, 9999.0 to default to time in TSF) ----";
case Tags.MakeallDataChannelNumbersSequential: return "---- When Saving TSF, Make all Data Channel Numbers Sequential (No=0, Yes=1) ----";
case Tags.PercentOverrangeWhenCalculatingBestGain: return "---- Percent Overrange When Calculating Best Gain, Adds Headroom to Measurement (0.0 to 20.0) ----";
case Tags.DefaultAndBackupSIFDirectories: return "---- Default & Backup SIF Directories (TDASDIR = TDAS software initial setting) ----";
case Tags.DefaultAndBackupTSFDirectories: return "---- Default & Backup TSF Directories (TDASDIR = TDAS software initial setting) ----";
case Tags.DefaultAndBackupDataDirectories: return "---- Default & Backup Data Directories (TDASDIR = TDAS software initial setting) ----";
case Tags.PerformAutomaticRackDiscovery: return "---- Perform Automatic Rack Discovery (1 = Yes, 0 = No)----";
case Tags.ChannelDescriptionFilters: return "---- Channel Description Filters (substring match) ----";
case Tags.ComPortforSoftwareExportofDASReadySignal: return "---- Com Port for Software Export of DAS Ready Signal (0 = Do not use this feature) ----";
case Tags.CheckHardwareTriggerduringDataCollection: return "---- Check Hardware Trigger during Data Collection? (0 = No, 1 = Yes, 2 = Give option to bypass) ----";
case Tags.FireintoTOMDummyLoadsduringstandardDataCollection: return "---- Fire into TOM Dummy Loads during standard Data Collection (0 = No, 1 = Yes - Highly recommend Yes) ----";
case Tags.CreateDIAdemheaderautomaticallywithdatadownload: return "---- DIAdem Export: Create DIAdem header automatically with data download (0 = No, 1 = Yes) ----";
case Tags.DIAdemExportChannelName: return "---- DIAdem Export: Channel Name (0 = None, 1 = Channel Description, 2 = ISO Code, 3 = Sensor SN, 4 = Channel Comment) ----";
case Tags.DIAdemExportChannelComment: return "---- DIAdem Export: Channel Comment (0 = None, 1 = Channel Description, 2 = ISO Code, 3 = Sensor SN, 4 = Channel Comment) ----";
case Tags.MinimizeTOMSafetySwitchmessages: return "---- Minimize TOM Safety Switch messages (1 = No, 2 = Yes. **** Note these values are different than most other options ****)";
case Tags.EnableSoftwareTriggerStartRecord: return "---- Enable Software Trigger/Start Record (0 = No, 1 = Yes)";
case Tags.EnablelowpowerarmmodeforG5: return "---- Enable low power arm mode for G5 in Recorder mode (0 = No, 1 = Yes)";
case Tags.InMeterModeorderchannelsbyDatachannelnumber: return "---- In Meter Mode order channels by Data channel number (0 = No use hardware channel order, 1 = Yes use data channel order)";
case Tags.Automaticallystartdownloadsequencercomplete: return "---- Automatically start the download when the sequencer is complete (0 = No, 1 = Yes)";
case Tags.Automaticallydownloadtestcomplete: return "---- Automatically download data when a test is complete (0 = No, 1 = Yes)";
case Tags.G5DockingStationconnectorpaneloption: return "---- G5 Docking Station connector panel option (0 = staggered layout with numbers printed next to each connector, 1 = linear layout with only 1,16,17,32 printed)";
case Tags.MultipleTestMode: return "---- Multiple Test Mode (0 = disable, 1 = enable). Be sure to set Automatic download and ROI";
case Tags.MultipleTestModeDelaybetweentests: return "---- Multiple Test Mode Delay between tests";
case Tags.MultipleTestCalibrationInterval: return "---- Multiple Test Calibration Interval";
case Tags.EnableACmodeforsquibchannels: return "---- Enable AC mode for squib channels";
case Tags.OperatingMode: return "---- Operating Mode (0 = Data Collection, 1 = Calibration)";
case Tags.ViewerROI: return "---- Viewer ROI (X Min, X Max)";
case Tags.SmartBatteryStatusThresholdsinminutes: return "---- Smart Battery Status Thresholds in minutes (Yellow, Red)";
case Tags.Sensordatabasedatasourcename: return "---- Sensor database data source name (for example DSN=Wincarat;uid=WINCARAT;pwd=WINCARAT)";
case Tags.Maximumgainforcedexcitation: return "---- Maximum gain for forced excitation mode (0 = disable, 4 = suggested enable value)";
case Tags.automaticISOexportondownload: return "---- ISO Export: automatic ISO export on download (0 = disabled, 1 = enabled), MME header template filename, prompt user for template filename (0 = use INI-specified template, 1 = prompt user for filename), Channel header template filename, prompt user for template filename (0 = use INI-specified template, l = prompt users for filename), Filter output (0 = unfiltered, 1 = filtered, 2 = prompt_user), suppress export completion dialog (0 = do not suppress, 1 = suppress), Dummy template filename, prompt user for template filename (0 = use INI-specified template, l = prompt users for filename)";
case Tags.Checkforundownloadeddatabeforerealtime: return "---- Check for undownloaded data before realtime (0 = disabled, 1 = enabled )";
case Tags.IIHSExportApplyROI: return "---- IIHS Export: Apply ROI (0 = disabled, 1 = enabled ), Begin ROI (s), End ROI (s)";
case Tags.ForceOldTestTrigger: return "---- Force Old Test Trigger(0 = use new fast test trigger, 1 = use conventional arming technique, 2 = Set digital outputs)";
case Tags.DefaultExportFolder: return "---- Default export folder (blank == sub folder of test folder). Implementation may vary by export type";
case Tags.Realtimelogging: return "---- Realtime logging (0 = disabled, 1 = enabled)";
case Tags.EndINIFile: return "---- End INI File ----";
default: return "";
}
}
/// <summary>
/// version of TDAS owning the .ini file
/// </summary>
private string _programVersion = "";
public string ProgramVersion
{
get { return _programVersion; }
set { _programVersion = value; }
}
/// <summary>
/// this is used in TDC to control some behaviors, for now
/// we just read it in and do nothing with it
/// </summary>
private string _customerName = "";
public string CustomerName
{
get { return _customerName; }
set { _customerName = value; }
}
/// <summary>
/// it wasn't immediately clear how this setting was peing used, so it's just
/// imported without examination
/// </summary>
private string _memorySize = "";
public string MemorySize
{
get { return _memorySize; }
set { _memorySize = value; }
}
/// <summary>
/// last change to the .ini
/// </summary>
private string _lastDataSet = "";
public string LastDataSet
{
get { return _lastDataSet; }
set { _lastDataSet = value; }
}
/// <summary>
/// valid excitation voltages
/// note: -1 appears to be a valid excitation voltage by default ...
/// </summary>
private List<double> _excitationVoltages = new List<double>();
public double[] ExcitationVoltages
{
get { return _excitationVoltages.ToArray(); ; }
set { _excitationVoltages = new List<double>(value); }
}
/// <summary>
/// valid gains for TDAS PRO SIM
/// </summary>
private List<double> _proGainOptions = new List<double>();
public double[] PROGainOptions
{
get { return _proGainOptions.ToArray(); }
set { _proGainOptions = new List<double>(value); }
}
/// <summary>
/// Valid gains for TDAS G5
/// </summary>
private List<double> _g5GainOptions = new List<double>();
public double[] G5GainOptions
{
get { return _g5GainOptions.ToArray(); }
set { _g5GainOptions = new List<double>(value); }
}
/// <summary>
/// holds the RS232/Serial connection info
/// </summary>
private TDCINIRS232Info _rs232Info = new TDCINIRS232Info();
public TDCINIRS232Info RS232Info
{
get { return _rs232Info; }
set { _rs232Info = value; }
}
/// <summary>
/// not clear what this controls, so am leaving this field unparsed
/// </summary>
private string _processTypes;
public string ProcessTypes
{
get { return _processTypes; }
set { _processTypes = value; }
}
/// <summary>
/// shunt values from ini file
/// </summary>
private List<double> _shuntValueOptions = new List<double>();
public double[] ShuntValueOptions
{
get { return _shuntValueOptions.ToArray(); }
set { _shuntValueOptions = new List<double>(value); }
}
/// <summary>
/// Signal to noise ratio
/// </summary>
private double _signalToNoiseRatioMinimum;
public double SignalToNoiseRatioMinimum
{
get { return _signalToNoiseRatioMinimum; }
set { _signalToNoiseRatioMinimum = value; }
}
/// <summary>
/// cal pulse tolerance
/// </summary>
private double _calPulseTolerance;
public double CalPulseTolerance
{
get { return _calPulseTolerance; }
set { _calPulseTolerance = value; }
}
/// <summary>
/// returns the next line in a list of lines referenced to the currentline.
/// if there is no next line, an error is recorded and null is returned
/// </summary>
/// <param name="lines"></param>
/// <param name="iCurLine"></param>
/// <param name="errors"></param>
/// <param name="error">what was being processed when we tried to get the next line</param>
/// <returns>string next line or null if already at EOF</returns>
public static string GetNextLine(string[] lines, ref int iCurLine, ref List<TDCINIError> errors, TDCINIError.INIErrors error)
{
iCurLine++;
if (iCurLine >= lines.Length)
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_FILE_INCOMPLETE, error.ToString()));
return null;
}
return lines[iCurLine];
}
/// <summary>
/// different type of information that can go into graphs
/// </summary>
public enum PlotFillTypes
{
UnfilteredEU = 0,
FilteredEU = 1,
mV = 2,
ADC = 3
}
/// <summary>
/// default plot/graph fill type
/// </summary>
private PlotFillTypes _plotFillType = PlotFillTypes.UnfilteredEU;
public PlotFillTypes PlotFillType
{
get { return _plotFillType; }
set { _plotFillType = value; }
}
public enum ShuntCheckOptions
{
USE_EU = 0,
USE_VOLTAGE_INSERTION = 1
}
private ShuntCheckOptions _shuntCheckOption = ShuntCheckOptions.USE_EU;
public ShuntCheckOptions ShuntCheckOption
{
get { return _shuntCheckOption; }
set { _shuntCheckOption = value; }
}
public enum SoftwareZeroReferences
{
INI_Zero = 0,
PreCal_Zero = 1,
Equals0mV = 2
}
private SoftwareZeroReferences _softwareZeroReference = SoftwareZeroReferences.PreCal_Zero;
public SoftwareZeroReferences SoftwareZeroReference
{
get { return _softwareZeroReference; }
set { _softwareZeroReference = value; }
}
private INIDataZeroTimeWindowSeconds _DataZeroTimeWindowSeconds = new INIDataZeroTimeWindowSeconds();
public INIDataZeroTimeWindowSeconds DataZeroTimeWindowSeconds
{
get { return _DataZeroTimeWindowSeconds; }
set { _DataZeroTimeWindowSeconds = value; }
}
public enum DASType
{
SIM,
TOM,
DIM,
Rack,
G5
}
private Dictionary<DASType, string> _dasToCurrentFirmwareVersion = new Dictionary<DASType, string>();
/// <summary>
/// gets the current firmware version for a given das type in the .ini file
/// </summary>
/// <param name="das"></param>
/// <returns></returns>
public string GetCurrentFirmware(DASType das)
{
if (_dasToCurrentFirmwareVersion.ContainsKey(das)) { return _dasToCurrentFirmwareVersion[das]; }
else { return ""; }
}
/// <summary>
/// sets the current firmware version for a given das type in the .ini file (does not write to file)
/// </summary>
/// <param name="das"></param>
/// <param name="version"></param>
public void SetCurrentFirmware(DASType das, string version)
{
_dasToCurrentFirmwareVersion[das] = version;
}
/// <summary>
/// background color and oscope trace size
/// this field is not parsed out and left as it is in the .ini file
/// </summary>
private string _graphBackgroundColorAndOScopeTraceSize;
public string GraphBackgroundColorAndOScopeTraceSize
{
get { return _graphBackgroundColorAndOScopeTraceSize; }
set { _graphBackgroundColorAndOScopeTraceSize = value; }
}
/// <summary>
/// the fixed AAF for the TDAS PRO SIM
/// </summary>
private int _proFixedAntiAliasFilter = 2900;
public int ProFixedAntiAliasFilter
{
get { return _proFixedAntiAliasFilter; }
set { _proFixedAntiAliasFilter = value; }
}
/// <summary>
/// g5 max adjustable filter
/// </summary>
private int _g5MaxAdjFilter = 3000;
public int G5MaxAdjFilter
{
get { return _g5MaxAdjFilter; }
set { _g5MaxAdjFilter = value; }
}
private bool _userAccessToQuickModify = true;
public bool UserAccessToQuickModify
{
get { return _userAccessToQuickModify; }
set { _userAccessToQuickModify = value; }
}
private List<double> _sampleRates = new List<double>();
public double[] SampleRates
{
get { return _sampleRates.ToArray(); }
set { _sampleRates = new List<double>(value); }
}
/// <summary>
/// the AAF cutoffs corresponding to SampleRates property
/// </summary>
private List<int> _correspondingAAFRates = new List<int>();
public int[] CorrespondingAAFRates
{
get { return _correspondingAAFRates.ToArray(); }
set { _correspondingAAFRates = new List<int>(value); }
}
/// <summary>
/// calibration interval for DAS in months
/// </summary>
private int _calibrationIntervalMonthsDAS = 12;
public int CalibrationIntervalMonthsDAS
{
get { return _calibrationIntervalMonthsDAS; }
set { _calibrationIntervalMonthsDAS = value; }
}
/// <summary>
/// calibration interval for sensors in months
/// </summary>
private int _calibrationIntervalMonthsSensor = 12;
public int CalibrationIntervalMonthsSensor
{
get { return _calibrationIntervalMonthsSensor; }
set { _calibrationIntervalMonthsSensor = value; }
}
/// <summary>
/// the rack inventory in the .ini
/// </summary>
private INIRackInventory _rackInventory = new INIRackInventory();
public INIRackInventory RackInventory
{
get { return _rackInventory; }
set { _rackInventory = value; }
}
/// <summary>
/// supported TDAS communication port types
/// </summary>
public enum ComPortModes
{
Ethernet = 0,
RS232 = 1
}
/// <summary>
/// default communication port type
/// </summary>
private ComPortModes _comPortMode = ComPortModes.Ethernet;
public ComPortModes COMPortMode
{
get { return _comPortMode; }
set { _comPortMode = value; }
}
/// <summary>
/// whether duplicate sensors are allowed
/// </summary>
private bool _bDuplicateSensorsAllowed = true;
public bool DuplicateSensorsAllowed
{
get { return _bDuplicateSensorsAllowed; }
set { _bDuplicateSensorsAllowed = value; }
}
public enum SensorIDOptions
{
Disabled = 0,
Enabled = 1,
WorldSID = 2,
iDummy = 3
}
/// <summary>
/// sensor id type option
/// </summary>
private SensorIDOptions _sensorIDOption = SensorIDOptions.Enabled;
public SensorIDOptions SensorIDOption
{
get { return _sensorIDOption; }
set { _sensorIDOption = value; }
}
private double _postCalWaitSeconds = 5D;
public double PostCalWaitTimeSeconds
{
get { return _postCalWaitSeconds; }
set { _postCalWaitSeconds = value; }
}
public enum TSFSIFReadProtocols
{
READ_NONE,
READ_ALL,
READ_MINIMUM
}
private TSFSIFReadProtocols _TSFSIFReadProtocol = TSFSIFReadProtocols.READ_NONE;
public TSFSIFReadProtocols TSFSIFReadProtocol
{
get { return _TSFSIFReadProtocol; }
set { _TSFSIFReadProtocol = value; }
}
public enum TSFRecordingModes
{
CircularBuffer = 0,
Recorder = 1,
MultipleEvents = 2
}
private List<TSFRecordingModes> _validRecordingModes = new List<TSFRecordingModes>();
public TSFRecordingModes[] ValidRecordingModes
{
get { return _validRecordingModes.ToArray(); }
set { _validRecordingModes = new List<TSFRecordingModes>(value); }
}
private TSFRecordingModes _recordingMode = TSFRecordingModes.Recorder;
public TSFRecordingModes DefaultRecordingMode
{
get { return _recordingMode; }
set { _recordingMode = value; }
}
public enum TSFRealtimeModes
{
OSCOPE,
METER,
ASK
}
private TSFRealtimeModes _DefaultRealtimeMode = TSFRealtimeModes.METER;
public TSFRealtimeModes DefaultRealtimeMode
{
get { return _DefaultRealtimeMode; }
set { _DefaultRealtimeMode = value; }
}
private bool _RealtimeBeforeCollectData = true;
public bool RealtimeModeBeforeCollectData
{
get { return _RealtimeBeforeCollectData; }
set { _RealtimeBeforeCollectData = value; }
}
private string _ExportToASCIIOptions = "";
public string ExportToASCIIOptions
{
get { return _ExportToASCIIOptions; }
set { _ExportToASCIIOptions = value; }
}
private int _sensorWarmupTimeSeconds = 120;
public int SensorWarmupTimeSeconds
{
get { return _sensorWarmupTimeSeconds; }
set { _sensorWarmupTimeSeconds = value; }
}
public enum SIMConnectorTypes
{
ZeroOrOneBLemo = 0,
TwoBLemo = 1
}
private SIMConnectorTypes _simConnectorType = SIMConnectorTypes.TwoBLemo;
public SIMConnectorTypes SIMConnectorType
{
get { return _simConnectorType; }
set { _simConnectorType = value; }
}
public enum TOMEventTypes
{
RackBusOnly,
TOMOnly,
TOMAndRackBus
}
private TOMEventTypes _TOMEventType = TOMEventTypes.RackBusOnly;
public TOMEventTypes TOMEventType
{
get { return _TOMEventType; }
set { _TOMEventType = value; }
}
public enum TOMRecordingSettings
{
Voltage = 0,
Initiation = 1
}
private TOMRecordingSettings _tomRecordingSetting = TOMRecordingSettings.Voltage;
public TOMRecordingSettings TOMRecordingSetting
{
get { return _tomRecordingSetting; }
set { _tomRecordingSetting = value; }
}
private int _tomACFrequency = 12;
public int TOMACFrequency
{
get { return _tomACFrequency; }
set { _tomACFrequency = value; }
}
public enum TSFTOMFireTypes
{
DCCapDischarge = 1,
DCConstantCurrent = 2,
ACCapDischarge = 3
}
private TSFTOMFireTypes _TOMFireType = TSFTOMFireTypes.DCCapDischarge;
public TSFTOMFireTypes TOMFireType
{
get { return _TOMFireType; }
set { _TOMFireType = value; }
}
private double _tomCurrentDefault = 2D;
public double TOMCurrentDefault
{
get { return _tomCurrentDefault; }
set { _tomCurrentDefault = value; }
}
private TSFINIRegionOfInterest _roi = new TSFINIRegionOfInterest();
public TSFINIRegionOfInterest ROI
{
get { return _roi; }
set { _roi = value; }
}
private bool _MakeAllChannelNumbersSequentialWhenSavingTSF = false;
public bool MakeAllChannelNumbersSequentialWhenSavingTSF
{
get { return _MakeAllChannelNumbersSequentialWhenSavingTSF; }
set { _MakeAllChannelNumbersSequentialWhenSavingTSF = value; }
}
/// <summary>
/// percentage of overhead to include over user desired sensor range
/// </summary>
private double _percentOverRange = 20D;
public double PercentOverRange
{
get { return _percentOverRange; }
set { _percentOverRange = value; }
}
/// <summary>
/// default SIF directory TDASDIR refers to default TDAS directory
/// </summary>
private string _defaultSIFDirectory = TDAS_SOFTWARE_INITIAL_SETTINGS;
public string DefaultSIFDirectory
{
get { return _defaultSIFDirectory; }
set { _defaultSIFDirectory = value; }
}
/// <summary>
/// default SIF backup directory TDASDIR refers to default TDAS directory
/// </summary>
private string _defaultBackupSIFDirectory = TDAS_SOFTWARE_INITIAL_SETTINGS;
public string DefaultBackupSIFDirectory
{
get { return _defaultBackupSIFDirectory; }
set { _defaultBackupSIFDirectory = value; }
}
/// <summary>
/// default TSF directory TDASDIR refers to default TDAS directory
/// </summary>
private string _defaultTSFDirectory = TDAS_SOFTWARE_INITIAL_SETTINGS;
public string DefaultTSFDirectory
{
get { return _defaultTSFDirectory; }
set { _defaultTSFDirectory = value; }
}
/// <summary>
/// default TSF backup directory TDASDIR refers to default TDAS directory
/// </summary>
private string _defaultBackupTSFDirectory = TDAS_SOFTWARE_INITIAL_SETTINGS;
public string DefaultBackupTSFDirectory
{
get { return _defaultBackupTSFDirectory; }
set { _defaultBackupTSFDirectory = value; }
}
/// <summary>
/// default data directory. TDASDIR refers to default TDAS directory
/// </summary>
private string _defaultDataDirectory = TDAS_SOFTWARE_INITIAL_SETTINGS;
public string DefaultDataDirectory
{
get { return _defaultDataDirectory; }
set { _defaultDataDirectory = value; }
}
/// <summary>
/// backup data directory TDASDIR refers to default TDAS directory
/// </summary>
private string _backupDataDirectory = TDAS_SOFTWARE_INITIAL_SETTINGS;
public string BackupDataDirectory
{
get { return _backupDataDirectory; }
set { _backupDataDirectory = value; }
}
public const string TDAS_SOFTWARE_INITIAL_SETTINGS = "TDASDIR";
/// <summary>
/// whether to enable and use automatic rack discovery or not
/// </summary>
private bool _AutomaticRackDiscovery = false;
public bool AutomaticRackDiscovery
{
get { return _AutomaticRackDiscovery; }
set { _AutomaticRackDiscovery = value; }
}
private List<string> _channelDescriptionFilters = new List<string>();
public string[] ChannelDescriptionFilters
{
get { return _channelDescriptionFilters.ToArray(); }
set { _channelDescriptionFilters = new List<string>(value); }
}
private int _COMPortForSoftwareExportOfDASReadySignal = 1;
public int COMPortForSoftwareExportOfDASReadySignal
{
get { return _COMPortForSoftwareExportOfDASReadySignal; }
set { _COMPortForSoftwareExportOfDASReadySignal = value; }
}
public enum HardwareTriggerCheckOptions
{
No,
Yes,
GiveOptionToBypass
}
private HardwareTriggerCheckOptions _hardwareTriggerCheckOption = HardwareTriggerCheckOptions.Yes;
public HardwareTriggerCheckOptions HardwareTriggerCheckOption
{
get { return _hardwareTriggerCheckOption; }
set { _hardwareTriggerCheckOption = value; }
}
private bool _FireIntoTOMDummyLoadsDuringStandardDataCollection = true;
public bool FireIntoTOMDummyLoadsDuringStandardDataCollection
{
get { return _FireIntoTOMDummyLoadsDuringStandardDataCollection; }
set { _FireIntoTOMDummyLoadsDuringStandardDataCollection = value; }
}
private bool _CreateDIAdemHeaderAutomaticallyWithDownload = false;
public bool CreateDIAdemHeaderAutomaticallyWithDownload
{
get { return _CreateDIAdemHeaderAutomaticallyWithDownload; }
set { _CreateDIAdemHeaderAutomaticallyWithDownload = value; }
}
public enum DIAdemExportOptions
{
NONE = 0,
ChannelDescription = 1,
ISOCode = 2,
SensorSerialNumber = 3,
ChannelComment = 4
}
private DIAdemExportOptions _diademChannelNameOption = DIAdemExportOptions.ChannelDescription;
public DIAdemExportOptions DIAdemChannelNameOption
{
get { return _diademChannelNameOption; }
set { _diademChannelNameOption = value; }
}
private DIAdemExportOptions _diademChannelCommentOption = DIAdemExportOptions.ISOCode;
public DIAdemExportOptions DIAdemChannelCommentOption
{
get { return _diademChannelCommentOption; }
set { _diademChannelCommentOption = value; }
}
private bool _MinimizeTOMSafetySwitchMessages = false;
public bool MinimizeTOMSafetySwitchMessages
{
get { return _MinimizeTOMSafetySwitchMessages; }
set { _MinimizeTOMSafetySwitchMessages = value; }
}
private bool _enableSoftwareStartTrigger = false;
public bool EnableSoftwareStartTrigger
{
get { return _enableSoftwareStartTrigger; }
set { _enableSoftwareStartTrigger = value; }
}
private bool _enableLowPowerArmModeG5 = false;
public bool EnableLowPowerArmModeG5
{
get { return _enableLowPowerArmModeG5; }
set { _enableLowPowerArmModeG5 = value; }
}
public enum MeterModeOrderOptions
{
OrderByHardwareChannel,
OrderByDataChannel
}
private MeterModeOrderOptions _meterModeOrderOption = MeterModeOrderOptions.OrderByHardwareChannel;
public MeterModeOrderOptions MeterModeOrderOption
{
get { return _meterModeOrderOption; }
set { _meterModeOrderOption = value; }
}
private bool _AutomaticallyStartDownloadWhenSequencerComplete = false;
public bool AutomaticallyStartDownloadWhenSequencerComplete
{
get { return _AutomaticallyStartDownloadWhenSequencerComplete; }
set { _AutomaticallyStartDownloadWhenSequencerComplete = value; }
}
private bool _AutomaticallyDownloadDataWhenTestComplete = false;
public bool AutomaticallyDownloadDataWhenTestComplete
{
get { return _AutomaticallyDownloadDataWhenTestComplete; }
set { _AutomaticallyDownloadDataWhenTestComplete = value; }
}
public enum G5DockingStationConnectionPanelOptions
{
StaggeredLayout = 0,
LinearLayout = 1
}
private G5DockingStationConnectionPanelOptions _g5DockingPanelOption = G5DockingStationConnectionPanelOptions.StaggeredLayout;
public G5DockingStationConnectionPanelOptions G5DockingPanelOption
{
get { return _g5DockingPanelOption; }
set { _g5DockingPanelOption = value; }
}
private bool _multipleTestModeEnabled = false;
public bool MultipleTestModeEnabled
{
get { return _multipleTestModeEnabled; }
set { _multipleTestModeEnabled = value; }
}
private int _multipleTestModeDelayBetweenTests = 0;
public int MultipleTestModeDelayBetweenTests
{
get { return _multipleTestModeDelayBetweenTests; }
set { _multipleTestModeDelayBetweenTests = value; }
}
private int _multipleTestCalibrationInterval = 0;
public int MultipleTestCalibrationInterval
{
get { return _multipleTestCalibrationInterval; }
set { _multipleTestCalibrationInterval = value; }
}
private bool _enableACModeForSquibChannels = false;
public bool EnableACModeForSquibChannels
{
get { return _enableACModeForSquibChannels; }
set { _enableACModeForSquibChannels = value; }
}
public enum OperatingModes
{
DataCollection = 0,
Calibration = 1
}
private OperatingModes _operatingMode = OperatingModes.DataCollection;
public OperatingModes OperatingMode
{
get { return _operatingMode; }
set { _operatingMode = value; }
}
private INIViewerROI _viewerROI = new INIViewerROI();
public INIViewerROI ViewerROI
{
get { return _viewerROI; }
set { _viewerROI = value; }
}
private INISmartBatteryThresholds _smartBatteryThreshold = new INISmartBatteryThresholds();
public INISmartBatteryThresholds SmartBatteryThreshold
{
get { return _smartBatteryThreshold; }
set { _smartBatteryThreshold = value; }
}
private string _sensorDatabaseDataSourceName = "";
public string SensorDatabaseDataSourceName
{
get { return _sensorDatabaseDataSourceName; }
set { _sensorDatabaseDataSourceName = value; }
}
private int _maximumGainForForcedExcitationMode = 0;
public int MaximumGainForForcedExcitationMode
{
get { return _maximumGainForForcedExcitationMode; }
set { _maximumGainForForcedExcitationMode = value; }
}
private INIISOExportParameters _isoExportParameters = new INIISOExportParameters();
public INIISOExportParameters ISOExportParameters
{
get { return _isoExportParameters; }
set { _isoExportParameters = value; }
}
private bool _checkForUndownloadedDataBeforeRealtime = false;
public bool CheckForUndownloadedDataBeforeRealtime
{
get { return _checkForUndownloadedDataBeforeRealtime; }
set { _checkForUndownloadedDataBeforeRealtime = value; }
}
public enum INITriggerCheckOptions
{
FastTestTrigger = 0,
UseConventionalArm = 1,
SetDigitalOutputs = 2
}
private INITriggerCheckOptions _triggerCheckOption = INITriggerCheckOptions.FastTestTrigger;
public INITriggerCheckOptions TriggerCheckOption
{
get { return _triggerCheckOption; }
set { _triggerCheckOption = value; }
}
private INIIIHSExport _IIHSExport = new INIIIHSExport();
public INIIIHSExport IIHSExport
{
get { return _IIHSExport; }
set { _IIHSExport = value; }
}
private bool _realtimeLoggingEnabled = true;
public bool RealtimeLoggingEnabled
{
get { return _realtimeLoggingEnabled; }
set { _realtimeLoggingEnabled = value; }
}
private string _defaultExportFolder = "";
public string DefaultExportFolder
{
get { return _defaultExportFolder; }
set { _defaultExportFolder = value; }
}
/// <summary>
/// create a System Description built from HLAPI structures
/// we are stealing this class from HLAPI, but not fully filling it out ...
/// just enough to make use of other stolen code that used said descriptions
/// </summary>
/// <returns></returns>
public TSFSystemDescription GetSystemDescription()
{
var system = new TSFSystemDescription();
List<TSFRackDescription> racks = new List<TSFRackDescription>();
foreach (var h in RackInventory.Racks)
{
var rack = h.ToTSFRackDescription();
racks.Add(rack);
}
system.HWRack = racks.ToArray();
return system;
}
/// <summary>
/// reads and populates properties from INI file
/// will return immediately when there are errors
/// </summary>
/// <param name="pathname"></param>
/// <param name="errors"></param>
public void ReadINIFile(string pathname, out List<TDCINIError> errors)
{
errors = new List<TDCINIError>();
TDCINIFile iniFile = new TDCINIFile();
if (!System.IO.File.Exists(pathname)) { errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_FILE_NOT_FOUND)); }
string[] lines = System.IO.File.ReadAllLines(pathname);
//go linearly through the data, when we have extra lines the handler below can automatically increment the line pointer
//otherwise we go line by line
for (int iCurLine = 0; iCurLine < lines.Length; iCurLine++)
{
string s = lines[iCurLine];
var tag = GetTagForString(s);
switch (tag)
{
case Tags.Automaticallydownloadtestcomplete:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_AutomaticallyStartDownloadAfterTestComplete_INVALID);
if (null == line) { return; }
switch (line)
{
case "F":
case "0":
case "N":
AutomaticallyDownloadDataWhenTestComplete = false; break;
case "T":
case "1":
case "Y":
AutomaticallyDownloadDataWhenTestComplete = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_AutomaticallyStartDownloadAfterTestComplete_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.Automaticallystartdownloadsequencercomplete:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_AutomaticallyStartDownloadAfterSequencerComplete_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "F":
case "N":
AutomaticallyStartDownloadWhenSequencerComplete = false; break;
case "1":
case "T":
case "Y":
AutomaticallyStartDownloadWhenSequencerComplete = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_AutomaticallyStartDownloadAfterSequencerComplete_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.automaticISOexportondownload:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_ISOEXPORTPARAMETERS_INVALID);
if (null == line) { return; }
if (!ISOExportParameters.ReadFrom(line, iCurLine, ref errors)) { return; }
}
break;
case Tags.CalibrationIntervalinMonths:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_CALIBRATION_INTERVALINMONTHS_INVALID);
if (null == line) { return; }
string[] tokens = line.Split(new char[] { ',' });
if (2 != tokens.Length)
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_CALIBRATION_INTERVALINMONTHS_INVALID, line, iCurLine));
return;
}
int temp;
if (!int.TryParse(tokens[0], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_CALIBRATION_INTERVALINMONTHS_INVALID, tokens[0], iCurLine));
return;
}
else { CalibrationIntervalMonthsSensor = temp; }
if (!int.TryParse(tokens[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_CALIBRATION_INTERVALINMONTHS_INVALID, tokens[1], iCurLine));
return;
}
else { CalibrationIntervalMonthsDAS = temp; }
}
break;
case Tags.CalPulseTolerance:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_FILE_CALPULSETOLERANCE_INVALID);
if (null == line) { return; }
double d;
if (!double.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_FILE_CALPULSETOLERANCE_INVALID, line, iCurLine));
return;
}
else { CalPulseTolerance = d; }
}
break;
case Tags.ChannelDescriptionFilters:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_ChannelDescriptionFilters);
if (null == line) { return; }
string[] tokens = line.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
ChannelDescriptionFilters = tokens;
}
break;
case Tags.Checkforundownloadeddatabeforerealtime:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_CheckForUndownloadedDataBeforeRealtime_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "N":
case "F":
CheckForUndownloadedDataBeforeRealtime = false; break;
case "1":
case "T":
case "Y":
CheckForUndownloadedDataBeforeRealtime = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_CheckForUndownloadedDataBeforeRealtime_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.CheckHardwareTriggerduringDataCollection:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_CheckHardwareTriggerDuringDataCollection_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": HardwareTriggerCheckOption = HardwareTriggerCheckOptions.No; break;
case "1": HardwareTriggerCheckOption = HardwareTriggerCheckOptions.Yes; break;
case "2": HardwareTriggerCheckOption = HardwareTriggerCheckOptions.GiveOptionToBypass; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_CheckHardwareTriggerDuringDataCollection_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.ComPortforSoftwareExportofDASReadySignal:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_FILE_COMPORTForSoftwareExportTODAS_INVALID);
if (null == line) { return; }
int temp;
if (!int.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_FILE_COMPORTForSoftwareExportTODAS_INVALID, line, iCurLine));
return;
}
else { COMPortForSoftwareExportOfDASReadySignal = temp; }
}
break;
case Tags.CorrespondingVariableFilterCutoffs:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_CORRESPONDING_VARIABLE_FCS_INVALID);
if (null == line) { return; }
List<int> cutoffs = new List<int>();
string[] tokens = line.Split(new char[] { ',' });
foreach (string token in tokens)
{
int temp;
if (!int.TryParse(token, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_CORRESPONDING_VARIABLE_FCS_INVALID, token, iCurLine));
return;
}
else { cutoffs.Add(temp); }
}
CorrespondingAAFRates = cutoffs.ToArray();
}
break;
case Tags.CreateDIAdemheaderautomaticallywithdatadownload:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_CreateDIAdemHeaderOnDownload_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": CreateDIAdemHeaderAutomaticallyWithDownload = false; break;
case "1": CreateDIAdemHeaderAutomaticallyWithDownload = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_CreateDIAdemHeaderOnDownload_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.CurrentFirmwareVersions:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_CurrentFirmwareVersion);
if (null == line) { return; }
string[] tokens = line.Split(new char[] { ',' });
if (5 != tokens.Length)
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_CurrentFirmwareVersion, line, iCurLine));
return;
}
SetCurrentFirmware(DASType.SIM, tokens[0]);
SetCurrentFirmware(DASType.TOM, tokens[1]);
SetCurrentFirmware(DASType.DIM, tokens[2]);
SetCurrentFirmware(DASType.Rack, tokens[3]);
SetCurrentFirmware(DASType.G5, tokens[4]);
}
break;
case Tags.CurrentRS232:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_CurrentRS232);
if (null == line) { return; }
if (!RS232Info.ReadFrom(line, ref errors)) { return; }
}
break;
case Tags.CustomerName: CustomerName = lines[++iCurLine]; break;
case Tags.DataZeroCalculationTime:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DataZeroTimeWindow_INVALID);
if (null == line) { return; }
if (!DataZeroTimeWindowSeconds.ReadFrom(line, ref errors, iCurLine)) { return; }
}
break;
case Tags.DefaultAndBackupDataDirectories:
{
string line1 = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DefaultAndBackupDataDirectories_INVALID);
if (null == line1) { return; }
string line2 = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DefaultAndBackupDataDirectories_INVALID);
if (null == line2) { return; }
DefaultDataDirectory = line1;
BackupDataDirectory = line2;
}
break;
case Tags.DefaultAndBackupSIFDirectories:
{
string line1 = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DefaultAndBackupSIFDirectories_INVALID);
if (null == line1) { return; }
string line2 = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DefaultAndBackupSIFDirectories_INVALID);
if (null == line2) { return; }
DefaultSIFDirectory = line1;
DefaultBackupSIFDirectory = line2;
}
break;
case Tags.DefaultAndBackupTSFDirectories:
{
string line1 = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DefaultAndBackupTSFDirectories_INVALID);
if (null == line1) { return; }
string line2 = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DefaultAndBackupTSFDirectories_INVALID);
if (null == line2) { return; }
DefaultTSFDirectory = line1;
DefaultBackupTSFDirectory = line2;
}
break;
case Tags.DefaultComPortMode:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_COMPORTMODE_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": COMPortMode = ComPortModes.Ethernet; break;
case "1": COMPortMode = ComPortModes.RS232; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_COMPORTMODE_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.DefaultDataCollectionMode:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DefaultDataCollectionMode);
if (null == line) { return; }
switch (line)
{
case "0": DefaultRecordingMode = TSFRecordingModes.CircularBuffer; break;
case "1": DefaultRecordingMode = TSFRecordingModes.Recorder; break;
case "2": DefaultRecordingMode = TSFRecordingModes.MultipleEvents; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_DefaultDataCollectionMode, line, iCurLine));
return;
}
}
}
break;
case Tags.DefaultRealTimeMode:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DefaultRealtimeMode);
if (null == line) { return; }
switch (line)
{
case "OSCOPE": DefaultRealtimeMode = TSFRealtimeModes.OSCOPE; break;
case "METER": DefaultRealtimeMode = TSFRealtimeModes.METER; break;
case "ASK": DefaultRealtimeMode = TSFRealtimeModes.ASK; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_DefaultRealtimeMode, line, iCurLine));
return;
}
}
}
break;
case Tags.DefaultSoftwareZeroReference:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DefaultSoftwareZeroReference_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": SoftwareZeroReference = SoftwareZeroReferences.INI_Zero; break;
case "1": SoftwareZeroReference = SoftwareZeroReferences.PreCal_Zero; break;
case "2": SoftwareZeroReference = SoftwareZeroReferences.Equals0mV; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_DefaultSoftwareZeroReference_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.DIAdemExportChannelComment:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DIAdemChannelCommentOption);
if (null == line) { return; }
switch (line)
{
case "0": DIAdemChannelCommentOption = DIAdemExportOptions.NONE; break;
case "1": DIAdemChannelCommentOption = DIAdemExportOptions.ChannelDescription; break;
case "2": DIAdemChannelCommentOption = DIAdemExportOptions.ISOCode; break;
case "3": DIAdemChannelCommentOption = DIAdemExportOptions.SensorSerialNumber; break;
case "4": DIAdemChannelCommentOption = DIAdemExportOptions.ChannelComment; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_DIAdemChannelCommentOption, line, iCurLine));
return;
}
}
}
break;
case Tags.DIAdemExportChannelName:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DIAdemChannelNameOption);
if (null == line) { return; }
switch (line)
{
case "0": DIAdemChannelNameOption = DIAdemExportOptions.NONE; break;
case "1": DIAdemChannelNameOption = DIAdemExportOptions.ChannelDescription; break;
case "2": DIAdemChannelNameOption = DIAdemExportOptions.ISOCode; break;
case "3": DIAdemChannelNameOption = DIAdemExportOptions.SensorSerialNumber; break;
case "4": DIAdemChannelNameOption = DIAdemExportOptions.ChannelComment; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_DIAdemChannelNameOption, line, iCurLine));
return;
}
}
}
break;
case Tags.DuplicateSensorsAllowed:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DUPLICATESENSORSALLOWED_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "F":
case "N":
DuplicateSensorsAllowed = false; break;
case "1":
case "T":
case "Y":
DuplicateSensorsAllowed = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_DUPLICATESENSORSALLOWED_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.EnableACmodeforsquibchannels:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_EnableACModeForSquibChannels_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "N":
case "F":
EnableACModeForSquibChannels = false;
break;
case "1":
case "T":
case "Y":
EnableACModeForSquibChannels = true;
break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_EnableACModeForSquibChannels_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.EnablelowpowerarmmodeforG5:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_EnableLowPowerModeForG5_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "F":
case "N":
EnableLowPowerArmModeG5 = false; break;
case "1":
case "T":
case "Y":
EnableLowPowerArmModeG5 = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_EnableLowPowerModeForG5_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.EnableSensorID:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_ENABLESENSORID_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": SensorIDOption = SensorIDOptions.Disabled; break;
case "1": SensorIDOption = SensorIDOptions.Enabled; break;
case "2": SensorIDOption = SensorIDOptions.WorldSID; break;
case "3": SensorIDOption = SensorIDOptions.iDummy; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ENABLESENSORID_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.EnableSoftwareTriggerStartRecord:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_EnableSoftwareStartTrigger_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "N":
case "F":
EnableSoftwareStartTrigger = false; break;
case "1":
case "T":
case "Y":
EnableSoftwareStartTrigger = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_EnableSoftwareStartTrigger_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.EndINIFile: break;
case Tags.ExcitationVoltage:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_ExcitationVoltage_INVALID);
if (null == line) { return; }
string[] tokens = line.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
List<double> volts = new List<double>();
foreach (string token in tokens)
{
double d;
if (!double.TryParse(token, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ExcitationVoltage_INVALID, token, iCurLine));
return;
}
else { volts.Add(d); }
}
ExcitationVoltages = volts.ToArray();
}
break;
case Tags.ExporttoASCIIOptions:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_ExportToASCIIOptions);
if (null == line) { return; }
ExportToASCIIOptions = line;
}
break;
case Tags.FireintoTOMDummyLoadsduringstandardDataCollection:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_FIREINTOTOMDUMMYLOADS_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "F":
case "N":
FireIntoTOMDummyLoadsDuringStandardDataCollection = false; break;
case "1":
case "T":
case "Y":
FireIntoTOMDummyLoadsDuringStandardDataCollection = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_FIREINTOTOMDUMMYLOADS_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.G5DockingStationconnectorpaneloption:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_G5DockingStationConnectorPanelOption_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": G5DockingPanelOption = G5DockingStationConnectionPanelOptions.StaggeredLayout; break;
case "1": G5DockingPanelOption = G5DockingStationConnectionPanelOptions.LinearLayout; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_G5DockingStationConnectorPanelOption_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.G5GainOptions:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_G5GainOptions_INVALID);
if (null == line) { return; }
string[] tokens = line.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
List<double> gains = new List<double>();
foreach (var token in tokens)
{
double d;
if (!double.TryParse(token, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_G5GainOptions_INVALID, token, iCurLine));
return;
}
else { gains.Add(d); }
}
G5GainOptions = gains.ToArray();
}
break;
case Tags.GotoRealTimeModebeforeCollectData:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_RealtimeBeforeDataCollection);
if (null == line) { return; }
switch (line)
{
case "0":
case "F":
case "N":
RealtimeModeBeforeCollectData = false; break;
case "1":
case "Y":
case "T":
RealtimeModeBeforeCollectData = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_RealtimeBeforeDataCollection, line, iCurLine));
return;
}
}
}
break;
case Tags.GraphBackgroundColorandOScopeTraceSize:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_GRAPHBACKGROUNDANDTRACE_INVALID);
if (null == line) { return; }
GraphBackgroundColorAndOScopeTraceSize = line;
}
break;
case Tags.IIHSExportApplyROI:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_IIHSExport_INVALID);
if (null == line) { return; }
IIHSExport.ReadFrom(line, iCurLine, ref errors);
}
break;
case Tags.InMeterModeorderchannelsbyDatachannelnumber:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_MeterModeChannelOrder_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": MeterModeOrderOption = MeterModeOrderOptions.OrderByHardwareChannel; break;
case "1": MeterModeOrderOption = MeterModeOrderOptions.OrderByDataChannel; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_MeterModeChannelOrder_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.LastDataSet:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_LastDataSet_INVALID);
if (null == line) { return; }
LastDataSet = line;
}
break;
case Tags.MakeallDataChannelNumbersSequential:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_MakeAllDataChannelNumbersSequential_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "N":
case "F":
MakeAllChannelNumbersSequentialWhenSavingTSF = false; break;
case "1":
case "T":
case "Y":
MakeAllChannelNumbersSequentialWhenSavingTSF = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_MakeAllDataChannelNumbersSequential_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.Maximumgainforcedexcitation:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_MaximumGainForForcedExcitationMode_INVALID);
if (null == line) { return; }
int temp;
if (!int.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_MaximumGainForForcedExcitationMode_INVALID, line, iCurLine));
return;
}
else { MaximumGainForForcedExcitationMode = temp; }
}
break;
case Tags.MemorySize:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_MemorySize_INVALID);
if (null == line) { return; }
MemorySize = line;
}
break;
case Tags.MinimizeTOMSafetySwitchmessages:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_MinimizeTOMSafetySwitchMessages_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": MinimizeTOMSafetySwitchMessages = false; break;
case "1": MinimizeTOMSafetySwitchMessages = false; break;
case "2": MinimizeTOMSafetySwitchMessages = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_MinimizeTOMSafetySwitchMessages_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.MultipleTestCalibrationInterval:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_MultipleTestCalibrationInterval_INVALID);
if (null == line) { return; }
int temp;
if (!int.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_MultipleTestCalibrationInterval_INVALID, line, iCurLine));
return;
}
else { MultipleTestCalibrationInterval = temp; }
}
break;
case Tags.MultipleTestMode:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_MultipleTestMode_Invalid);
if (null == line) { return; }
switch (line)
{
case "0":
case "F":
case "N":
MultipleTestModeEnabled = false; break;
case "1":
case "T":
case "Y":
MultipleTestModeEnabled = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_MultipleTestMode_Invalid, line, iCurLine));
return;
}
}
}
break;
case Tags.MultipleTestModeDelaybetweentests:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_MultipleTestModeDelayBetweenTests_INVALID);
if (null == line) { return; }
int temp;
if (!int.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_MultipleTestModeDelayBetweenTests_INVALID, line, iCurLine));
return;
}
else { MultipleTestModeDelayBetweenTests = temp; }
}
break;
case Tags.OperatingMode:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_OperatingMode);
if (null == line) { return; }
switch (line)
{
case "0": OperatingMode = OperatingModes.DataCollection; break;
case "1": OperatingMode = OperatingModes.Calibration; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_OperatingMode, line, iCurLine));
return;
}
}
}
break;
case Tags.PercentOverrangeWhenCalculatingBestGain:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_PercentOverRange_INVALID);
if (null == line) { return; }
double d;
if (!double.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_PercentOverRange_INVALID, line, iCurLine));
return;
}
else { PercentOverRange = d; }
}
break;
case Tags.PerformAutomaticRackDiscovery:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_PerformAutomaticRackDiscovery_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "F":
case "N":
AutomaticRackDiscovery = false; break;
case "1":
case "T":
case "Y":
AutomaticRackDiscovery = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_PerformAutomaticRackDiscovery_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.PlotFileTypeDefault:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_PLOTFILLTYPE_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": PlotFillType = PlotFillTypes.UnfilteredEU; break;
case "1": PlotFillType = PlotFillTypes.FilteredEU; break;
case "2": PlotFillType = PlotFillTypes.mV; break;
case "3": PlotFillType = PlotFillTypes.ADC; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_PLOTFILLTYPE_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.PostCalWaitTime:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_POSTCALWAITTIME_INVALID);
if (null == line) { return; }
double d;
if (!double.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_POSTCALWAITTIME_INVALID, line, iCurLine));
return;
}
else { PostCalWaitTimeSeconds = d; }
}
break;
case Tags.PROFixedAntiAliasFilter:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_PROANDG5AAF_INVALID);
if (null == line) { return; }
string[] tokens = line.Split(new char[] { ',' });
if (2 != tokens.Length)
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_PROANDG5AAF_INVALID, line, iCurLine));
return;
}
int temp;
if (!int.TryParse(tokens[0], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_PROANDG5AAF_INVALID, line, iCurLine));
return;
}
else { ProFixedAntiAliasFilter = temp; }
if (!int.TryParse(tokens[1], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_PROANDG5AAF_INVALID, line, iCurLine));
return;
}
else { G5MaxAdjFilter = temp; }
}
break;
case Tags.PROGainOptions:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_PROGainOptions);
if (null == line) { return; }
List<double> gains = new List<double>();
string[] tokens = line.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
foreach (string token in tokens)
{
double d;
if (!double.TryParse(token, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_PROGainOptions, token, iCurLine));
return;
}
else { gains.Add(d); }
}
PROGainOptions = gains.ToArray();
}
break;
case Tags.ProgramVersion: ProgramVersion = lines[++iCurLine]; break;
case Tags.RackInventory:
{
if (!RackInventory.ReadFrom(lines, ref iCurLine, ref errors))
{
return;
}
}
break;
case Tags.Realtimelogging:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_RealtimeLoggingEnabled_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "F":
case "N":
RealtimeLoggingEnabled = false; break;
case "1":
case "T":
case "Y":
RealtimeLoggingEnabled = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_RealtimeLoggingEnabled_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.ROI:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_ROI_INVALID);
if (null == line) { return; }
if (!_roi.ReadFrom(line, iCurLine, ref errors)) { return; }
}
break;
case Tags.Sensordatabasedatasourcename:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_SensorDatabaseDataSourceName_INVALID);
if (null == line) { return; }
SensorDatabaseDataSourceName = line;
}
break;
case Tags.SensorWarmupTime:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_SensorWarmupTimeSeconds_INVALID);
if (null == line) { return; }
int temp;
if (!int.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_SensorWarmupTimeSeconds_INVALID, line, iCurLine));
return;
}
else { SensorWarmupTimeSeconds = temp; }
}
break;
case Tags.ShuntCheckOption:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_SHUNTCHECKOPTIONS_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": ShuntCheckOption = ShuntCheckOptions.USE_EU; break;
case "1": ShuntCheckOption = ShuntCheckOptions.USE_VOLTAGE_INSERTION; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_SHUNTCHECKOPTIONS_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.ShuntValueOptions:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_ShuntValueOptions_INVALID);
if (null == line) { return; }
string[] tokens = line.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
List<double> values = new List<double>();
foreach (var token in tokens)
{
double d;
if (!double.TryParse(token, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ShuntValueOptions_INVALID, token, iCurLine));
return;
}
else { values.Add(d); }
}
ShuntValueOptions = values.ToArray();
}
break;
case Tags.SignaltoNoiseRatioMinimum:
{
double d;
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_FILE_SIGNALTONOISERATIO_INVALID);
if (null == line) { return; }
if (!double.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_FILE_SIGNALTONOISERATIO_INVALID, line, iCurLine));
return;
}
else { SignalToNoiseRatioMinimum = d; }
}
break;
case Tags.SIMConnectorType:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_SIMConnectorType_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": SIMConnectorType = SIMConnectorTypes.ZeroOrOneBLemo; break;
case "1": SIMConnectorType = SIMConnectorTypes.TwoBLemo; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_SIMConnectorType_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.SmartBatteryStatusThresholdsinminutes:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_SmartBatteryStatusThresholds);
if (null == line) { return; }
if (!SmartBatteryThreshold.ReadFrom(line, iCurLine, ref errors)) { return; }
}
break;
case Tags.TOMACFrequency:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_TOMACFrequency);
if (null == line) { return; }
int temp;
if (!int.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out temp))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_TOMACFrequency, line, iCurLine));
return;
}
else { TOMACFrequency = temp; }
}
break;
case Tags.TOMCurrentDefault:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_TOMCurrentDefault_INVALID);
if (null == line) { return; }
double d;
if (!double.TryParse(line, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_TOMCurrentDefault_INVALID, line, iCurLine));
return;
}
else { TOMCurrentDefault = d; }
}
break;
case Tags.TOMEvent:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_TOMEVENT_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": TOMEventType = TOMEventTypes.RackBusOnly; break;
case "1": TOMEventType = TOMEventTypes.TOMOnly; break;
case "2": TOMEventType = TOMEventTypes.TOMAndRackBus; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_TOMEVENT_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.TOMFireTypeDefault:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_TOMFireTypeDefault_INVALID);
if (null == line) { return; }
switch (line)
{
case "1": TOMFireType = TSFTOMFireTypes.DCCapDischarge; break;
case "2": TOMFireType = TSFTOMFireTypes.DCConstantCurrent; break;
case "3": TOMFireType = TSFTOMFireTypes.ACCapDischarge; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_TOMFireTypeDefault_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.TOMRecording:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_TOMRecording_INVALID);
if (null == line) { return; }
switch (line)
{
case "0": TOMRecordingSetting = TOMRecordingSettings.Voltage; break;
case "1": TOMRecordingSetting = TOMRecordingSettings.Initiation; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_TOMRecording_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.TSFReadSIFsProtocol:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_TSFReadSIFProtocol);
switch (line)
{
case "READ NONE": TSFSIFReadProtocol = TSFSIFReadProtocols.READ_NONE; break;
case "READ ALL": TSFSIFReadProtocol = TSFSIFReadProtocols.READ_ALL; break;
case "READ MINIMUM": TSFSIFReadProtocol = TSFSIFReadProtocols.READ_MINIMUM; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_TSFReadSIFProtocol, line, iCurLine));
return;
}
}
}
break;
case Tags.UNKNOWN: break;
case Tags.UserAccesstoQuickModify:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_USERACCESSTOQUICKMODIFY_INVALID);
if (null == line) { return; }
switch (line)
{
case "0":
case "F":
case "N":
UserAccessToQuickModify = false; break;
case "1":
case "Y":
case "T":
UserAccessToQuickModify = true; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_USERACCESSTOQUICKMODIFY_INVALID, line, iCurLine));
return;
}
}
}
break;
case Tags.ValidCustomerDataCollectionModes:
{
List<TSFRecordingModes> modes = new List<TSFRecordingModes>();
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_VALIDCUSTOMERDATACOLLECTIONS);
string[] tokens = line.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
foreach (var token in tokens)
{
switch (token.Trim())
{
case "CIRCULAR-BUFFER": modes.Add(TSFRecordingModes.CircularBuffer); break;
case "RECORDER": modes.Add(TSFRecordingModes.Recorder); break;
case "MULTIPLE-EVENT": modes.Add(TSFRecordingModes.MultipleEvents); break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_VALIDCUSTOMERDATACOLLECTIONS, token, iCurLine));
return;
}
}
}
ValidRecordingModes = modes.ToArray();
}
break;
case Tags.ValidProcessTypes: ProcessTypes = lines[++iCurLine]; break;
case Tags.ValidSamplingRates:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_SAMPLERATES_INVALID);
if (null == line) { return; }
string[] tokens = line.Split(new char[] { ',' });
List<double> samplerates = new List<double>();
foreach (string token in tokens)
{
double d;
if (!double.TryParse(token, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out d))
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_SAMPLERATES_INVALID, token, iCurLine));
return;
}
else { samplerates.Add(d); }
}
SampleRates = samplerates.ToArray();
}
break;
case Tags.ViewerROI:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_ViewerROI_INVALID);
if (null == line) { return; }
if (!_viewerROI.ReadFrom(line, iCurLine, ref errors)) { return; }
}
break;
case Tags.ForceOldTestTrigger:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_ForceOldTestTrigger);
if (null == line) { return; }
switch (line)
{
case "0": TriggerCheckOption = INITriggerCheckOptions.FastTestTrigger; break;
case "1": TriggerCheckOption = INITriggerCheckOptions.UseConventionalArm; break;
case "2": TriggerCheckOption = INITriggerCheckOptions.SetDigitalOutputs; break;
default:
{
errors.Add(new TDCINIError(TDCINIError.INIErrors.INI_ForceOldTestTrigger, line, iCurLine));
return;
}
}
}
break;
case Tags.DefaultExportFolder:
{
string line = GetNextLine(lines, ref iCurLine, ref errors, TDCINIError.INIErrors.INI_DefaultExportFolder_INVALID);
if (null == line) { return; }
DefaultExportFolder = line;
}
break;
default: break;
}
}
}
}
}