11 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||
|---|---|---|---|---|---|---|---|---|
|
2026-04-17T15:54:30.728728+00:00 | zai-org/GLM-5-FP8 | 1 | 92a90606b341eecd |
DatabaseImport Module Documentation
Purpose
The DatabaseImport namespace provides infrastructure for managing custom channel definitions beyond the ISO13499 standard, graph configurations for test visualization, serialized application settings storage, and XML-based database import/migration functionality. This module serves as a bridge between the ISO13499-compliant database schema and user-defined extensions, enabling test configuration persistence and cross-version database migrations.
Public Interface
CustomChannel.cs
CustomChannel Class
A wrapper for MMEPossibleChannels that supports user-defined channels outside the ISO13499 standard.
Constructor:
public CustomChannel(MMEPossibleChannels channel, bool newChannel = true)
- Creates a new
CustomChannelwrapping anMMEPossibleChannelsinstance. IfnewChannelistrue, creates a copy of the channel; otherwise uses the provided reference directly. Initializes lookup values for direction, filter class, fine locations, main location, physical dimension, position, and test object from the ISO database.
Properties:
public MMEPossibleChannels Channel { get; private set; }
public string Text1 { get; set; } // Proxies to Channel.Text_L1 and Channel.SetText1()
Methods:
public int CompareTo(CustomChannel other)
- Implements
IComparable<CustomChannel>. Returns 0 if channels are equal, otherwise performs ordinal string comparison onText1properties.
CustomChannelList Class
A thread-safe singleton collection manager for CustomChannel instances.
Singleton Access:
public static CustomChannelList List { get; }
- Thread-safe lazy initialization using lock pattern on
LockObject.
Methods:
public void ReloadAll()
- Clears the cached channel list, refreshes all data from
IsoDb, and repopulates the channel collection.
public void DeleteAll()
- Clears all cached channels and deletes SQL records via
IsoDb.DeleteSQL().
Properties:
public ISO13499FileDb IsoDb { get; }
- Lazy-initialized
ISO13499FileDbinstance with auto-refresh on first access.
TestGraph.cs
TestGraph Class
Manages graph configuration including channels, thresholds, and axis domains.
Constructor:
public TestGraph(TestTemplate template)
- Initializes groups and added groups from the provided template.
Constants:
private const int MAX_CHANNELS_PER_GRAPH = 8;
private const string SEPARATOR = "§";
Properties:
public string GraphName { get; set; } = "";
public string GraphDescription { get; set; } = "";
public bool UseDomainMin { get; set; }
public double DomainMin { get; set; } = double.MinValue;
public bool UseDomainMax { get; set; }
public double DomainMax { get; set; } = double.MaxValue;
public bool UseRangeMin { get; set; }
public double RangeMin { get; set; } = double.MinValue;
public bool UseRangeMax { get; set; }
public double RangeMax { get; set; } = double.MaxValue;
public TestObjectChannel[] AvailableChannels { get; }
Methods:
public void SetThresholdsFromSQL(string sThresholds)
- Parses a string containing threshold values separated by
§with{and}delimiters. Parses tokens as doubles and adds to internal_thresholdslist.
public void SetChannelsFromSQL(string sChannels)
- Parses a string containing channel graph IDs separated by
§with{,},(, and)delimiters. Looks up channels by graph ID and adds them viaAddChannel().
SerializedSettings.cs
SerializedSettings Class (Sealed)
Provides typed access to application-wide settings stored in SettingsDB.
Nested Enums:
public enum Keys { /* 100+ setting keys including IgnorePowerMode, UseUserCodes, etc. */ }
public enum ISOSupportLevels { ISO_ONLY, TRANSITORY, NO_ISO }
Properties:
public static string ExportINIFile { get; set; }
public static IsoChannelSensorCompatibilityLevels IsoChannelSensorCompatibilityLevel { get; set; }
public static ISOSupportLevels ISOSupportLevel { get; set; }
public static bool TestSetupDefaultDontAllowOutOfCalSensors { get; set; }
public static SensorTypeToDimension[] AllSensorTypeToDimensions { get; set; }
Methods:
public static Dictionary<string, string> GetAllSensorTypeToDimensionMappings()
- Returns a dictionary mapping sensor type codes to ISO physical dimensions.
SerializedSettings.SensorTypeToDimension Class
Nested class extending Tuple<string, string, string> representing sensor type mappings.
Constructor:
public SensorTypeToDimension(string sensorType, string name, string dimension)
Properties:
public string Code => Item1; // Sensor type code
public string Name => Item2; // Sensor type name
public string Dimension => Item3; // ISO physical dimension
DbImporter.cs
DbImporter Class
Handles XML-based database import and schema migrations.
Constructors:
public DbImporter()
public DbImporter(int dbType, string dbName, string server, bool useNTLMAuthentication, string localDbUser, string localDbPassword)
- Parameterized constructor configures
DbOperationsfor local (dbType=1) or centralized database connections.
Nested Types:
public enum TopLevelFields { CustomerDetails, TestEngineerDetails, LabDetails, DASList, SensorModels, Sensors, Calibrations, CustomDirections, CustomFilterClasses, CustomTestObjects, CustomFinLoc1s, CustomFinLoc2s, CustomFinLoc3s, CustomMainLocs, CustomPhysicalDimensions, CustomPositions, CustomChannels, GroupTemplates, Groups, TestSetups, Users, GlobalSettings }
public delegate void SetStatusDelegate(string status, bool output = false);
Methods:
public void ImportXML(string ImportFile, SetStatusDelegate SetStatus)
- Imports an XML file into the database. Clears all tables via
ImportSensorsImportControl.ClearAllTables(true), then processes each XML element type throughImportTestSetup.ProcessRootNode(). Post-import, callsAssignSettingsToAllUsers(),MigrateG5ChannelSupportedBridges(), andMigrateSPSChannelSupportedBridges().
public bool MigrateG5ChannelSupportedBridges()
- Updates
DASChannels.SupportedBridgesfrom 12 to 140 for DAS Type=12 (TDAS G5 VDS). Addresses issue #12431 for 1.4 to 1.10 migrations.
public void MigrateSPSChannelSupportedBridges()
- Updates
DASChannels.SupportedBridgesfrom 15 to 143 for DAS Type=19 with ProtocolVersion >= 154. Addresses issue #12850 for SPS channel count mismatch.
public bool IsServerConnected()
- Returns result of
DbOperations.IsServerConnected().
Invariants
-
CustomChannelList Singleton: The
Listproperty always returns the same instance;_listis only created once under lock. -
Channel Uniqueness: In
CustomChannelList.PopulateChannelsIfNecessary(), channels are keyed by ISO code; duplicate ISO codes are silently skipped viaif (_dictChannels.ContainsKey(iso)) continue;. -
Max Channels Per Graph:
TestGraphenforcesMAX_CHANNELS_PER_GRAPH = 8. When_channels.Count >= MAX_CHANNELS_PER_GRAPH,AvailableChannelsreturns an empty array. -
Sensor Type Mapping Default Count:
AllSensorTypeToDimensionsdefaults to 7 mappings ifNUM_SENSORTYPE_MAPPINGSis not set or unparseable. -
ISO Support Level Default:
ISOSupportLeveldefaults toISOSupportLevels.ISO_ONLYif parsing fails. -
Thread Safety:
CustomChannelListusesLockObjectfor all state mutations (ReloadAll,DeleteAll,PopulateChannelsIfNecessary).
Dependencies
Imports (This module depends on):
System,System.Collections.Generic,System.LinqSystem.Windows(CustomChannel.cs -Application.Currentcast toApp)System.Data,System.Data.SqlClient(DbImporter.cs)System.Xml(DbImporter.cs)System.Text(DbImporter.cs)
External Types Referenced (not defined in source):
MMEPossibleChannels,MMETestObjects,MMEPositions,MMETransducerMainLocation,MMEFineLocations1/2/3,MMEPhysicalDimensions,MMEDirections,MMEFilterClassesISO13499FileDb,ISO13499FileDb.ExpiredISOFieldExceptionISO.IsoCodeApp(WPF application class)TestObjectChannel,TestTestObject,TestTemplate,TestObjectTemplateSensorsCollection.SensorsListSettingsDBDbOperations,DbOperations.Connection,DbOperationsEnumImportSensorsImportControl,ImportTestSetupIsoChannelSensorCompatibilityLevels(enum)
Likely Dependents (inferred):
- Test configuration modules (using
TestGraph,CustomChannel) - Database migration tools (using
DbImporter) - Settings management UI (using
SerializedSettings)
Gotchas
-
Expired ISO Field Exceptions Silently Collected: In
CustomChannelconstructor,ExpiredISOFieldExceptionfor main location lookup is caught and added to_expiredErrorslist, but this list is never exposed or used elsewhere in the provided source. The exception is effectively swallowed. -
Commented-Out Base Class Inheritance: Both
CustomChannelandCustomChannelListhave commented-out inheritance fromBasePropertyChanged, suggesting a refactoring or removal of change notification infrastructure.TestGraphsimilarly has this pattern. -
Hardcoded Default Sensor Mappings:
GetSensorTypeMapping(int index)contains hardcoded default mappings for indices 0-6 (Acceleration, Force, Momentum, Displacement, Angular Acceleration, Angle, Voltage). Index 7+ returns empty strings. -
Magic Character in Sensor Mapping Serialization:
SetSensorTypeMappinguses(char)149as a delimiter, which is the "bullet" character (•). This could cause encoding issues. -
G5/SPS Migration Hardcoded Values:
MigrateG5ChannelSupportedBridges()andMigrateSPSChannelSupportedBridges()use hardcoded magic numbers (140, 143, 154) without constants, tied to specific bug IDs (#12431, #12850). -
AvailableChannels Clears Lookup on Every Access: The
AvailableChannelsgetter calls_lookup.Clear()at the start, which may have side effects if_lookupis used elsewhere between accesses. -
Squib Channel Mutation Side Effect: In
AddChannels(), when handling voltage channels for squib sensors, the originalchannelobject has itsSquibChannelTypeandNameOfTheChannelmodified before being added to the list, while current channels create a new instance. -
Exception Re-throw Loses Stack Trace: In
ImportXML(),throw ex;re-throws the caught exception, losing the original stack trace. Should bethrow;. -
Empty Catch Blocks:
AssignSettingsToAllUsers()andSetUserProperty()have empty catch blocks, silently swallowing exceptions.