16 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-17T15:26:29.501527+00:00 | zai-org/GLM-5-FP8 | 1 | fe2305d939ea2131 |
DTS.Serialization Module Documentation
1. Purpose
The DTS.Serialization namespace provides a framework for serializing and deserializing test data to various file formats (CSV, Diadem, etc.). It implements an abstract file-based architecture with reader/writer patterns, progress reporting via events, and support for converting domain objects to/from a canonical Test object model. The module handles data acquisition system (DAS) hardware configuration, sensor definitions, channel mappings, and filtered data representations for technical/scientific data exchange.
2. Public Interface
Core File Abstractions
File (abstract partial class)
- Signature:
public abstract partial class File : Exceptional - Purpose: Base class for all DTS export file types.
- Constructor:
File(string formatName)- Initializes with a format name. - Properties:
string FormatName- Gets the file format name (private setter).static string BaseExportDirectory- Gets/sets the base export directory path.int DefaultEncoding- Gets/sets the default encoding (defaults to UTF-8 code page).static bool UseLegacyTDCSoftwareFiltering- Controls filtered data sample adjustment behavior.Common.Enums.IsoViewMode ISOViewMode- Gets/sets ISO view mode.
- Methods:
string EnsureTrailingBackslashOnPathString(string path)- Ensures path ends with backslash.virtual void SetEUData(string channelID, FilteredData fd)- Stores EU data for linearized channels.virtual FilteredData GetEUData(string channelID)- Retrieves EU data for a channel.virtual int GetChannelNumberFromChannelFileName(string channelFileName)- Returns -1 by default; overridden in TDAS.File and SliceRaw.File.
File.Reader<T> (abstract class)
- Signature:
public abstract class Reader<T> : Exceptional, IReader where T : File - Purpose: Base class for file readers.
- Constructor:
protected Reader(T fileType)- Protected constructor; readers created by hosting File class. - Properties:
protected T FileType- The associated file type.protected ChannelFilenameComparer ChFileCompare- Comparer for channel filenames.
- Nested Class:
ChannelFilenameComparer- ImplementsIComparer<string>for sorting channel files by channel number.
File.Writer<T> (abstract partial class)
- Signature:
public abstract partial class Writer<T> : Exceptional, IWriter where T : File - Purpose: Base class for file writers.
- Constructor:
public Writer(T fileType, int encoding) - Properties:
protected T FileType- The associated file type.virtual int DefaultEncoding- Gets/sets the default encoding.
- Nested Class:
CharacterCountingStreamWriter- AStreamWriterthat counts characters written viaWriteLine(string).
Interfaces
IReadable / IReadable<T>
- Purpose: Marker interface and typed interface for readable files.
- Property:
IReader<T> Importer { get; }- Gets the deserializer.
IReader / IReader<T>
- Purpose: Defines requirements for file readers.
- Method:
void Read(string pathname, out T target)- Deserializes file into target object.
IWritable / IWritable<T>
- Purpose: Marker interface and typed interface for writable files.
- Property:
IWriter<T> Exporter { get; }- Gets the serializer.
IWriter / IWriter<T>
- Purpose: Defines requirements for file writers.
- Methods:
void Write(string pathname, string id, T target, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)void Write(string pathname, string id, string dataFolder, T target, bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd, Test.Module.Channel tmChannel, int channelNumber, BeginEventHandler onBeginEvent, CancelEventHandler onCancelEvent, EndEventHandler onEndEvent, TickEventHandler onTickEvent, ErrorEventHandler onErrorEvent, CancelRequested cancelRequested, double minStartTime, int dataCollectionLength)void Initialize(...)- Same parameters as Write minus minStartTime and dataCollectionLength.
IProgressAware
- Purpose: Interface for receiving progress updates from serialization objects.
- Events:
event BeginEventHandler OnBeginevent EndEventHandler OnEndevent TickEventHandler OnTickevent CancelEventHandler OnCancelevent ErrorEventHandler OnError
Delegates
BeginEventHandler
- Signature:
delegate void BeginEventHandler(object sender, uint numberOfTicks)
EndEventHandler
- Signature:
delegate void EndEventHandler(object sender)
TickEventHandler
- Signature:
delegate void TickEventHandler(object sender, double percentageComplete)
CancelEventHandler
- Signature:
delegate void CancelEventHandler(object sender)
ErrorEventHandler
- Signature:
delegate void ErrorEventHandler(object sender, Exception ex)
CancelRequested
- Signature:
delegate bool CancelRequested()
Utility Classes
StringWriterWithEncoding
- Signature:
public sealed class StringWriterWithEncoding : StringWriter - Constructor:
StringWriterWithEncoding(Encoding encoding) - Property:
override Encoding Encoding- Returns the encoding passed to constructor.
InvariantStreamWriter
- Signature:
public class InvariantStreamWriter : System.IO.StreamWriter - Constructors:
InvariantStreamWriter(string path)InvariantStreamWriter(string path, bool bAppend)
- Property:
override IFormatProvider FormatProvider- Always returnsCultureInfo.InvariantCulture.
FilteredData
- Signature:
public class FilteredData : Exceptional, IComparable<FilteredData> - Constructor:
FilteredData(string filterDescription, double filterFrequencyHz, double[] data, int absoluteDisplayOrder) - Properties:
string FilterDescriptiondouble FilterFrequencyHzdouble[] Dataint AbsoluteDisplayOrder(read-only)
- Method:
int CompareTo(FilteredData other)- Compares by AbsoluteDisplayOrder.
BadCRCBypass (Windows Form)
- Signature:
public partial class BadCRCBypass : Form - Properties:
string FileName- Gets/setstxtFileName.Text.bool RememberChoice- Gets/setscbRememberChoice.Checked.
- Events: OK and Cancel buttons set
DialogResultand close the form.
Domain Model Classes
Test (partial class)
- Nested Interface:
Test.IConvertable- Objects that can convert to/fromTest.Test ToDtsSerializationTest()void FromDtsSerializationTest(Test test, ReportErrors reportErrors)
- Nested Delegate:
delegate void ReportErrors(List<string> errors)
Test.Module (partial class)
- Nested Interface:
Test.Module.IConvertableTest.Module ToDtsSerializationTestModule(DTS.Serialization.Test parentTest)void FromDtsSerializationTestModule(Test.Module testModule, DTS.Serialization.Test.ReportErrors reportErrors)
Test.Module.Channel (partial class)
- Nested Interface:
Test.Module.Channel.IConvertableTest.Module.Channel ToDtsSerializationTestModuleChannel()void FromDtsSerializationTestModuleChannel(Test.Module.Channel channel)
TestSetup (partial class hierarchy)
- Base:
Exceptional - Nested Classes:
TestSetup.TestObject : ExceptionalTestSetup.TestObject.TOChannel : Exceptional- Properties:Name,SensorName,VersionTestSetup.TestObject.DASHardware : Exceptional- Properties:DASChannels,SampleRate,SerialNumber,VersionTestSetup.TestObject.DASHardware.DASChannel : Exceptional- Properties:Location,MeasurementUnits,Name,NumberOfSamples,SensorName,SerialNumber,Version
TestSetup.Sensor : Exceptional- Properties:FilterClass,Name,Polarity,Position,Range,VersionTestSetup.Graph : Exceptional- Properties:
Channels,Name,HardwareChannelName,DisplayName,Version,IsSingleChannelGraph,FirstChannel,FirstTestChannel,Identifier - Methods:
void UnSet(),override string ToString() - Nested Class:
TestSetup.Graph.Channel : Exceptional- Constructors:
Channel(DTS.Serialization.Test.Module.Channel channel),Channel(string channelId) - Properties:
ChannelId,ChannelGroupName,Name,SensorName,AxisUnit,SerialNumber - Fields:
ParentTestModule,TestChannel(both with[System.Xml.Serialization.XmlIgnoreAttribute])
- Constructors:
- Properties:
EventInfoAggregate
- Signature:
public class EventInfoAggregate - Constructor:
EventInfoAggregate(DownloadReport.EventInfo newEvent) - Properties:
EventId,EventDescription,DurationSeconds,GUID,HasBeenDownloaded,WasTriggered,NumberOfChannels,NumberOfSamples,NumberOfBytes,Faulted,EventNumber - Methods:
Slice.Control.Event GetEvent(bool bClear)Slice.Control.Event GetEvent()int GetEventIndex(IDASCommunication idas)List<IDASCommunication> GetDasList()void Add(DownloadReport.EventInfo newEvent)- Aggregates additional event info.
File Format Implementations
DTS.Serialization.ToyotaCsv.File
- Signature:
public partial class File : Serialization.File, IWritable<Test> - Constructor:
File()- Initializes with format name "Toyota CSV". - Properties:
static string Extension- Returns ".csv".IWriter<Test> Exporter- Lazy-initializedWriterinstance.
DTS.Serialization.Diadem.File
- Signature:
public partial class File : Serialization.File, IWritable<Test> - Constructor:
File(bool bUseEVG20, TestPlan plan) - Properties:
static string Extension- Returns ".dat".bool UseIsoCodeForDiadem200- Defaults totrue.bool UseZeroForUnfiltered- Defaults tofalse.DiademOptions ChannelName200OptionDiademOptions UserComment201OptionDiademOptionsReserved1 Reserved1_301OptionDiademOptionsReserved2 Reserved2_302OptionIWriter<Test> Exporter- Lazy-initialized, configuresWriterwith all options.
- Enums:
DiademOptions:NONE,ISO_CODE,SENSOR_SERIAL_NUMBER,CHANNEL_NAMEDiademOptionsReserved1:NONE,AAF_RATE,GROUP_NAMEDiademOptionsReserved2:NONE,CHANNEL_SENSITIVITY
3. Invariants
-
Reader/Writer Construction:
File.Reader<T>andFile.Writer<T>instances must be created by their hostingFileclass via factory properties (Importer,Exporter), not directly instantiated by consumers. -
Encoding Defaults: All file types default to UTF-8 encoding (
Encoding.UTF8.CodePage) unless explicitly overridden. -
Property Pattern: Domain model classes (e.g.,
TestSetup.Graph,TestSetup.Sensor) use aProperty<T>wrapper pattern with namespace-qualified property names for identification. -
Version Defaults: All version properties in
TestSetupnested classes default to"1.0.0.0". -
Channel Filename Comparison:
ChannelFilenameComparerrelies onGetChannelNumberFromChannelFileName()returning -1 for non-SLICE/TDAS file types, resulting in standard string comparison. -
Event Aggregation:
EventInfoAggregate.Add()logs warnings but does not throw when encountering mismatched event data (TestId, Description, Duration, GUID, etc.); it takes minimum values for samples/duration on mismatch. -
Character Counting:
CharacterCountingStreamWriter.CharactersCountedonly increments viaWriteLine(string)override; other write methods do not update the count.
4. Dependencies
This Module Depends On:
System(core .NET)System.IO(stream operations)System.Text(encoding)System.Collections.Generic(collections)System.Linq(LINQ operations)System.Globalization(CultureInfo.InvariantCulture)System.Windows.Forms(forBadCRCBypassform)System.Xml.Serialization(XmlIgnoreAttribute)DTS.Common.Utilities/DTS.Utilities-Exceptionalbase class,Property<T>DTS.Common.Utilities.DotNetProgrammingConstructs/DTS.Utilities.DotNetProgrammingConstructs-Property<T>DTS.Common.ISO- referenced inDiadem.FileDTS.Common.Utilities.Logging-APILoggerinEventInfoAggregateDTS.DASLib.Service-IDASCommunication,DownloadReportinEventInfoAggregateSlice.Control-Eventclass inEventInfoAggregateDTS.Common.Enums-IsoViewModeenum
What Depends On This Module:
- Not determinable from source alone; this appears to be a core library consumed by higher-level application modules.
5. Gotchas
-
Typo in XML Documentation:
IProgressAware.OnTickdocumentation referencesDTS.Seralization.EventHandler(misspelled namespace - missing second 'i'). -
CharacterCountingStreamWriter Incomplete Implementation: Only
WriteLine(string)updatesCharactersCounted. OtherWriteoverloads andWriteLinevariants do not count characters, which could lead to incorrect progress reporting. -
Lazy Exporter Initialization with Side Effects:
Diadem.File.Exportergetter has side effects - it casts and setsWriterParenton the cached exporter on every access, not just first initialization. -
Exception Swallowing in Comparer:
ChannelFilenameComparer.Comparewill throwNullReferenceExceptioniffileis null (whenfileTypepassed to constructor is not aFile), rather than handling gracefully. -
Hardcoded "EU" Fallback:
TestSetup.Graph.Channel.AxisUnitreturns"EU"for non-AnalogInputChannel types and null TestChannel, which may not be appropriate for all channel types. -
DisplayName Concatenation:
TestSetup.Graph.DisplayNameconcatenatesNameandHardwareChannelNamewith underscore, but if either is null, the result may be unexpected (e.g.,"_hardwareName"or"name_"). -
EventInfoAggregate Mismatch Handling: When aggregating events with mismatched properties, the class logs warnings but silently takes minimum values for
DurationSecondsandNumberOfSamples, potentially losing data without caller awareness. -
Partial Class Sprawl: Classes like
Test,TestSetup,File, and their nested classes are spread across many files withIConvertableinterfaces defined separately, making the complete type definition difficult to trace without IDE support.