This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
---
source_files:
- DataPRO/Modules/Channels/ChannelCodes/ChannelCodesModule.cs
generated_at: "2026-04-17T16:47:17.153049+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "7676c98280386b11"
---
# ChannelCodesModule Documentation
## 1. Purpose
The `ChannelCodesModule` is a Prism module that provides Channel Codes functionality within the DTS application framework. It exists to modularize channel code management features, registering its views and view models with the Unity dependency injection container. The module is categorized under the "Prepare" assembly group and exposes metadata (name and image) for display in the main application's module summary screen.
## 2. Public Interface
### ChannelCodesModule
**Signature:** `public class ChannelCodesModule : IModule`
The main module class responsible for DI registration.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ChannelCodesModule(IUnityContainer unityContainer)` | Accepts a Unity container via constructor injection and stores it in `_unityContainer`. |
| Initialize | `void Initialize()` | Registers `IChannelCodesListViewModel``ChannelCodesListViewModel` and `IChannelCodesListView``ChannelCodesListView` with Unity. |
| OnInitialized | `void OnInitialized(IContainerProvider containerProvider)` | Empty implementation (no post-initialization logic). |
| RegisterTypes | `void RegisterTypes(IContainerRegistry containerRegistry)` | Delegates to `Initialize()`. |
### ChannelCodesModuleNameAttribute
**Signature:** `public class ChannelCodesModuleNameAttribute : TextAttribute`
Assembly-level attribute providing the module's display name.
| Member | Return Type | Description |
|--------|-------------|-------------|
| Constructor | `ChannelCodesModuleNameAttribute()` | Default constructor. |
| Constructor | `ChannelCodesModuleNameAttribute(string s)` | Overloaded constructor accepting a string (unused). |
| AssemblyName | `string` | Returns `AssemblyNames.ChannelCodes.ToString()`. |
| GetAttributeType | `Type` | Returns `typeof(TextAttribute)`. |
| GetAssemblyName | `string` | Returns the `AssemblyName` property value. |
### ChannelCodesModuleImageAttribute
**Signature:** `public class ChannelCodesModuleImageAttribute : ImageAttribute`
Assembly-level

View File

@@ -0,0 +1,38 @@
---
source_files:
- DataPRO/Modules/Channels/ChannelCodes/Model/ChannelCodeType.cs
- DataPRO/Modules/Channels/ChannelCodes/Model/ChannelCode.cs
generated_at: "2026-04-17T15:58:37.735103+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d11e5910dac91aaa"
---
# Documentation: ChannelCodes.Model Namespace
## 1. Purpose
This module provides the domain model for managing channel codes within the DataPRO system. It consists of two classes: `ChannelCodeType`, an abstract class that retrieves channel code type lookups from the database, and `ChannelCode`, a concrete entity class that represents individual channel codes with CRUD operations. The module supports both database-backed channel codes and ISO channel codes loaded from a static file, merging them into a unified collection for application use.
---
## 2. Public Interface
### ChannelCodeType (abstract class)
| Member | Signature | Description |
|--------|-----------|-------------|
| `GetChannelCodeTypeLookup` | `public static IDictionary<short, string> GetChannelCodeTypeLookup()` | Retrieves all channel code types from the database via stored procedure `sp_ChannelCodeTypeGet`. Returns a dictionary mapping a short integer ID to a code type string. |
### ChannelCode
| Member | Signature | Description |
|--------|-----------|-------------|
| `HasValidId` | `public bool HasValidId()` | Returns `true` if `Id >= 0`. |
| `IsBlank` | `public bool IsBlank()` | Returns `true` if both `Name` and `Code` are null or empty. |
| `SelectedChannelType` | `public int SelectedChannelType { get; set; }` | Converts between `ChannelEnumsAndConstants.ChannelCodeType` enum and integer index (0 = ISO, 1 = User). Setter silently ignores values other than 0 or 1. |
| `PossibleChannels` | `public Dictionary<string, string> PossibleChannels { get; private set; }` | Property for storing possible channels. Not initialized in constructors visible in source. |
| `ChannelCode()` | `public ChannelCode()` | Default constructor. Sets `CodeType` to `ISO` and registers commands. |
| `ChannelCode(IChannelCode)` | `public ChannelCode(IChannelCode channelCode)` | Copy constructor that delegates to base class and registers commands. |
| `ChannelCode(IDataRecord, IDictionary<short, string>)` | `public ChannelCode(IDataRecord sqlReader, IDictionary<short, string> channelCodeLookup)` | Constructs instance from a database record. Maps `CodeTypeInt` to enum via the provided lookup dictionary. |
| `GetExistingChannelCodes` | `public static ChannelCode[] GetExistingChannelCodes(IDictionary<short, string> lookup)` | Retrieves all channel codes from the database via stored procedure

View File

@@ -0,0 +1,21 @@
---
source_files:
- DataPRO/Modules/Channels/ChannelCodes/Properties/Settings.Designer.cs
- DataPRO/Modules/Channels/ChannelCodes/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:12:31.642089+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d58492d70941aed0"
---
# Properties
### Purpose
This module contains auto-generated infrastructure code for the `ChannelCodes` assembly, providing application settings management and assembly metadata. It serves as the build-generated properties layer for the ChannelCodes component, which appears to handle channel coding/identification functionality within the DTS product line.
### Public Interface
- **`Settings` class** (internal sealed partial) - Inherits from `global::System.Configuration.ApplicationSettingsBase`. Provides thread-safe singleton access to application settings.
- `static Settings Default { get; }` - Returns the synchronized singleton instance of the settings class via `defaultInstance` field.
### Invariants
- The `Settings` class is generated by `Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator` version `17.10.0.0` targeting .NET Framework 4.0 runtime (`4.

View File

@@ -0,0 +1,15 @@
---
source_files:
- DataPRO/Modules/Channels/ChannelCodes/Resources/TranslateExtension.cs
- DataPRO/Modules/Channels/ChannelCodes/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T15:58:30.134380+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "74b6a6a3d15aa294"
---
# Documentation: ChannelCodes Resources Module
## 1. Purpose
This module provides localization infrastructure for the

View File

@@ -0,0 +1,40 @@
---
source_files:
- DataPRO/Modules/Channels/ChannelCodes/View/ChannelCodesListView.xaml.cs
generated_at: "2026-04-17T16:01:12.024561+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "765fffde6c4125b2"
---
# ChannelCodesListView Documentation
## 1. Purpose
This module is a WPF code-behind view component for managing channel codes within the system. It provides the interaction logic for `ChannelCodesListView.xaml`, handling user interactions for two distinct lists: ISO channel codes and User-defined channel codes. The view supports filtering, sorting, selection tracking, and modification marking, delegating all business logic to an `IChannelCodesListViewModel` via data binding.
---
## 2. Public Interface
### Class: `ChannelCodesListView`
**Implements:** `IChannelCodesListViewModel`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public ChannelCodesListView()` | Initializes the view component via `InitializeComponent()`. |
### Private Event Handlers (wired to XAML)
| Method | Event Context | Behavior |
|--------|---------------|----------|
| `GridViewColumnHeaderSearchable_OnSearch` | Search event on `GridViewColumnHeaderSearchable` | Extracts search term from `e.OriginalSource` and column tag from sender, calls `viewModel.Filter(columnTag, searchTerm)`. |
| `GridViewColumnHeader_OnClick` | Click on column header | Extracts column tag and calls `vm.Sort(columnTag, true)`. Uses `Utils.FindChild<T>` as fallback for tag resolution. |
| `ChannelCodeTextBox_KeyDown` | Key down on channel code text box | Extracts `IChannelCode` from `e.Source` DataContext, calls `vm.MarkModified(channelCode)`. |
| `ChannelCodeTextBoxUser_TextChanged` | Text changed on user channel code | Calls `vm.MarkModified(channelCode)` and `vm.ValidateUser(ref notUsed1, ref notUsed2)`. |
| `ChannelCodeTextBoxIso_TextChanged` | Text changed on ISO channel code | Calls `vm.MarkModified(channelCode)` and `vm.ValidateISO(ref notUsed1, ref notUsed2)`. |
| `DisplayNameTextBox_KeyDown` | Key down on display name | Calls `vm.MarkModified(channelCode)`. |
| `DisplayNameTextBoxUser_TextChanged` | Text changed on user display name | Calls `vm.MarkModified(channelCode)` and `vm.ValidateUser(ref notUsed1, ref notUsed2)`. |
| `DisplayNameTextBoxIso_TextChanged` | Text changed on ISO display name | Calls `vm.MarkModified(channelCode)` and `vm.ValidateISO(ref notUsed1, ref notUsed2)`. |
| `ISO_Checked` | ISO radio button checked | Sets `vm.ViewMode = ChannelCodesListViewModel.ViewModes.ISO`. |
| `User_Checked` | User radio button checked | Sets `vm.ViewMode = Channel

View File

@@ -0,0 +1,148 @@
---
source_files:
- DataPRO/Modules/Channels/ChannelCodes/ViewModel/ChannelCodesListViewModel.cs
generated_at: "2026-04-17T16:02:02.258497+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "4a52e53369e1f84f"
---
# ChannelCodesListViewModel Documentation
## 1. Purpose
`ChannelCodesListViewModel` is a Prism-based ViewModel that manages the display, editing, validation, and persistence of Channel Codes in a WPF application. It handles two distinct categories of channel codes—ISO and User—providing separate views for each via a `ViewMode` toggle. The ViewModel supports CRUD operations, multi-selection, copy/paste functionality, sorting, filtering, and event-driven communication with other application components. It implements `IChannelCodesListViewModel` and follows the MVVM pattern with `INotifyPropertyChanged` support.
---
## 2. Public Interface
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `View` | `IChannelCodesListView` | The associated view instance; DataContext is set to this ViewModel in constructor. |
| `NotificationRequest` | `InteractionRequest<Notification>` | Used to raise notification dialogs. |
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Used to raise confirmation dialogs. |
| `AllISOChannelCodes` | `List<IChannelCode>` | Complete list of ISO channel codes (unfiltered). |
| `AllUserChannelCodes` | `List<IChannelCode>` | Complete list of User channel codes (unfiltered). |
| `ISOChannelCodes` | `ObservableCollection<IChannelCode>` | Filtered ISO channel codes bound to the view. |
| `UserChannelCodes` | `ObservableCollection<IChannelCode>` | Filtered User channel codes bound to the view. |
| `SelectedCodes` | `IChannelCode[]` | Returns selected codes based on current `ViewMode`. |
| `Page` | `object` | Page identifier used in event payloads. |
| `IsDirty` | `bool` | Indicates unsaved changes. |
| `IsBusy` | `bool` | Controls busy indicator state. |
| `IsMenuIncluded` | `bool` | Controls menu inclusion. |
| `IsNavigationIncluded` | `bool` | Controls navigation inclusion. |
| `IsReadOnly` | `bool` | When `true`, disables editing (FB14098). |
| `ViewMode` | `ViewModes` | Current view mode (`ISO` or `User`). |
| `ISOVisibility` | `Visibility` | Returns `Visible` when `ViewMode.ISO`, else `Collapsed`. |
| `UserVisibility` | `Visibility` | Returns `Visible` when `ViewMode.User`, else `Collapsed`. |
| `ChannelCodesFunc` | `Func<IList<IChannelCode>>` | Returns `ChannelCode.ChannelCodes`. |
| `ShowISOStringBuilder` | `bool` | Controls ISO string builder visibility. |
| `UniqueISOCodesRequired` | `bool` | Indicates whether unique ISO codes are required. |
| `ShowChannelCodeLookupHelper` | `bool` | Controls channel code lookup helper visibility. |
### Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `OnPropertyChanged` | `void OnPropertyChanged(string propertyName)` | Raises `PropertyChanged` event. |
| `Remove` | `void Remove(IChannelCode channel)` | Removes a channel code; routes to `RemoveISOChannel` or `RemoveUserChannel` based on `CodeType`. Publishes `PageModifiedEvent`. |
| `MarkModified` | `void MarkModified(IChannelCode channel)` | Marks a channel as modified; adds a new blank row if modifying the last item. Publishes `PageModifiedEvent`. |
| `Unset` | `void Unset()` | Clears all channel code collections. |
| `SetPage` | `void SetPage(object page)` | Sets the `Page` identifier for event routing. |
| `OnSetActive` | `void OnSetActive()` | Loads existing channel codes from database, populates collections, sorts and filters. |
| `Cleanup` | `void Cleanup()` | Empty cleanup method. |
| `CleanupAsync` | `Task CleanupAsync()` | Returns `Task.CompletedTask`. |
| `Initialize` | `void Initialize()` / `void Initialize(object parameter)` / `void Initialize(object parameter, object model)` | Empty initialization methods. |
| `InitializeAsync` | `Task InitializeAsync()` / `Task InitializeAsync(object parameter)` | Return `Task.CompletedTask`. |
| `Activated` | `void Activated()` | Empty activation method. |
| `ReportErrors` | `void ReportErrors(string[] errors)` | Publishes `PageErrorEvent` with errors and `Page`. |
| `Save` | `bool Save()` | Persists all changes using a 4-step process: delete removed codes, update existing, insert new, update IDs. Returns `true` on success. |
| `ValidateISO` | `void ValidateISO(ref List<string> errors, ref List<string> warnings)` | Validates ISO channel codes. |
| `ValidateUser` | `void ValidateUser(ref List<string> errors, ref List<string> warnings)` | Validates User channel codes. |
| `Validate` | `bool Validate(bool bDisplayWindow)` | Validates all codes; optionally displays errors/warnings. Returns `true` if no errors. |
| `CopySelected` | `void CopySelected()` | Copies selected codes; inserts copies before the last (blank) row. |
| `DeleteSelected` | `void DeleteSelected()` | Deletes selected codes; ensures a blank row remains at the end. |
| `SetISOSelection` | `void SetISOSelection(IChannelCode[] channelCodes)` | Sets ISO selection; publishes `PageSelectionChanged` if `ViewMode.ISO`. |
| `SetUserSelection` | `void SetUserSelection(IChannelCode[] channelCodes)` | Sets User selection; publishes `PageSelectionChanged` if `ViewMode.User`. |
| `Filter` | `void Filter(object columnTag, string searchTerm)` | Filters codes based on column tag (`"ISOCode"`, `"ISOChannelName"`, `"UserCode"`, `"UserChannelName"`). |
| `Sort` | `void Sort(object columnTag, bool bColumnClick)` | Sorts codes by column; toggles direction on repeated clicks. |
### Nested Types
| Type | Description |
|------|-------------|
| `enum Fields` | `IsoCode`, `IsoChannelName`, `UserCode`, `UserChannelName` — used for sorting/filtering. |
| `enum ViewModes` | `ISO`, `User` — toggles between channel code types. |
| `class ChannelComparer : IComparer<IChannelCode>` | Custom comparer using `NaturalStringComparer`; handles null/blank items by sorting them last. |
---
## 3. Invariants
1. **Blank Row Guarantee**: The last item in both `AllISOChannelCodes` and `AllUserChannelCodes` is always a blank `ChannelCode` instance (both `Code` and `Name` are empty). This serves as the "new row" for data entry.
2. **ISO Code Length**: ISO codes are silently truncated to 16 characters maximum in `ParseText()`.
3. **Blank Item Sorting**: Items with both `Code` and `Name` empty are always sorted to the end of the list (see `ChannelComparer.Compare`).
4. **Selection Handling**: Empty selection arrays are ignored and not assigned (FB 18906 guard in `SetISOSelection` and `SetUserSelection`).
5. **Save Operation Ordering**: The `Save()` method executes in strict order: (1) delete removed codes, (2) update existing codes, (3) insert new codes. This prevents primary key conflicts.
6. **Event Subscription Pattern**: The static `_bAddListeners` flag ensures event listeners are only registered on the second constructor invocation (see Gotchas).
---
## 4. Dependencies
### External Dependencies (Imports)
| Namespace | Purpose |
|-----------|---------|
| `ChannelCodes.Model` | `ChannelCode` model, `ChannelCodeType` lookup |
| `DTS.Common.Enums` | General enumerations |
| `DTS.Common.Enums.Channels` | `ChannelEnumsAndConstants` |
| `DTS.Common.Events` | `PageModifiedEvent`, `PageErrorEvent`, `PageSelectionChanged` |
| `DTS.Common.Events.ChannelCodes` | `RaiseNotification`, `BusyIndicatorChangeNotification`, `TextPastedEvent`, `ChannelCodeCommittedEvent` |
| `DTS.Common.Interface.Channels.ChannelCodes` | `IChannelCode`, `IChannelCodesListView`, `IChannelCodesListViewModel` |
| `DTS.Common.Utilities.Logging` | `APILogger` |
| `DTS.Common.Interactivity` | `InteractionRequest<T>`, `Notification`, `Confirmation` |
| `Prism.Events` | `IEventAggregator`, `ThreadOption` |
| `Prism.Regions` | `IRegionManager` |
| `Unity` | `IUnityContainer` |
### Event Subscriptions
| Event | Thread Option | Keep Subscriber Reference |
|-------|---------------|---------------------------|
| `RaiseNotification` | Default | Default |
| `BusyIndicatorChangeNotification` | `PublisherThread` | `true` |
| `TextPastedEvent` | Default | Default |
| `ChannelCodeCommittedEvent` | `PublisherThread` | `true` |
### Event Publications
| Event | Payload |
|-------|---------|
| `PageModifiedEvent` | `PageModifiedArg` with status (`Modified`/`Saved`) and `Page` |
| `PageErrorEvent` | `PageErrorArg` with error messages and `Page` |
| `PageSelectionChanged` | `PageSelectionChangedArg` with selection count and `Page` |
---
## 5. Gotchas
1. **Static Listener Flag Hack**: The constructor uses a static `_bAddListeners` field to prevent duplicate event subscriptions. The comment explicitly states: *"this is a hack, the app startup is calling this, then the app itself, we only want the app itself to be handling the listeners."* This implies the constructor is invoked twice during application lifecycle, and only the second invocation should register `TextPastedEvent` and `ChannelCodeCommittedEvent` handlers.
2. **Silent ISO Code Truncation**: In `ParseText()`, ISO codes exceeding 16 characters are silently truncated without warning or error. Users are not notified of this modification.
3. **Paste Behavior Depends on Tag**: The `PasteIso` and `PasteUser` methods interpret the `tag` parameter to determine whether pasted text should populate the `Code` or `Name` field when single-column data is pasted. The tag must equal `"ISOCode"` or `"UserCode"` (string comparison) to populate the code field.
4. **Filter Uses Case-Insensitive Contains**: Filtering uses `IndexOf(term, StringComparison.CurrentCultureIgnoreCase)` which performs a substring match, not an exact or startswith match.
5. **Save Returns False Only on Exception**: The `Save()` method returns `false` only if an exception is caught. Validation errors do not prevent save; callers should call `Validate()` before `Save()`.
6. **Remove vs DeleteSelected Behavior Difference**: `Remove()` does not automatically add a blank row if removing a non-last item, but `DeleteSelected()` and `RemoveISOChannel`/`RemoveUserChannel` do add a blank row when removing the last item. This ensures the blank row invariant is maintained.

View File

@@ -0,0 +1,60 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseInitializationScripts/EmbeddedResource.cs
generated_at: "2026-04-17T16:46:25.600912+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "95b12383e1ed5dba"
---
# Documentation: EmbeddedResource
## 1. Purpose
`EmbeddedResource` is a static utility class that provides methods for loading embedded resources from .NET assemblies. It exists to abstract the complexity of locating and extracting manifest resources by name, supporting partial name matching. This class is part of the `DatabaseInitializationScripts` namespace, indicating its primary role is loading embedded database scripts (likely SQL files) that are packaged within the assembly at compile time.
## 2. Public Interface
### `public static StreamReader GetStream(System.Reflection.Assembly assembly, string name)`
**Signature:** `(Assembly, string) -> StreamReader`
Locates an embedded resource within the specified assembly by performing a partial name match (using `EndsWith`). Returns a `StreamReader` wrapping the resource stream if found, or `null` if no matching resource name exists.
### `public static string GetString(System.Reflection.Assembly assembly, string name)`
**Signature:** `(Assembly, string) -> string`
Retrieves the full text content of an embedded resource from the specified assembly. Internally calls `GetStream`, reads the entire content via `ReadToEnd()`, closes the stream, and returns the string.
### `public static string GetString(string name)`
**Signature:** `string -> string`
Convenience overload that retrieves an embedded resource from the assembly containing the `EmbeddedResource` class itself (via `typeof(EmbeddedResource).Assembly`). Delegates to `GetString(Assembly, string)`.
## 3. Invariants
- The class cannot be instantiated; the private constructor enforces static-only usage.
- Resource name matching is always a suffix match (`EndsWith`), not an exact match.
- The `GetString` methods assume the resource exists; behavior is undefined (likely `NullReferenceException`) if the resource is not found.
- The `GetString(Assembly, string)` method always closes the `StreamReader` before returning.
## 4. Dependencies
**This module depends on:**
- `System.IO` — for `StreamReader`
- `System.Reflection` — for `Assembly` and manifest resource APIs
**What depends on this module:**
- Not determinable from source alone. However, given the namespace `DatabaseInitializationScripts`, consumers are likely database initialization logic that needs to load SQL scripts or configuration files embedded in the assembly.
## 5. Gotchas
1. **Null return not handled in `GetString`:** `GetStream` returns `null` when no resource matches, but `GetString(Assembly, string)` immediately calls `sr.ReadToEnd()` without null-checking `sr`. This will throw a `NullReferenceException` if the resource name is not found.
2. **Partial name matching ambiguity:** The use of `EndsWith(name)` means requesting `"schema.sql"` could match multiple resources (e.g., `"folderA.schema.sql"` and `"folderB.schema.sql"`). The method returns the first match found, which depends on `GetManifestResourceNames()` ordering—this ordering is not guaranteed to be deterministic.
3. **No `using`/dispose pattern:** `GetString(Assembly, string)` uses `sr.Close()` rather than a `using` statement. If `ReadToEnd()` throws an exception, the stream will not be closed.
4. **Assembly coupling

View File

@@ -0,0 +1,77 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseInitializationScripts/Properties/Settings.Designer.cs
- DataPRO/Modules/Database/DatabaseInitializationScripts/Properties/AssemblyInfo.cs
- DataPRO/Modules/Database/DatabaseInitializationScripts/Properties/Resources.Designer.cs
generated_at: "2026-04-17T16:44:43.081982+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "772a1dcffd01e6da"
---
# Documentation: DatabaseInitializationScripts Properties
## 1. Purpose
This module contains the auto-generated Properties layer for the `DatabaseInitializationScripts` assembly within the DataPRO system. The files provided are standard Visual Studio tooling outputs that manage application settings and localized resources. **Note: The actual database initialization logic is not present in these files**—only the infrastructure for settings and resource management is visible. The assembly appears to be a WPF-aware component (indicated by `ThemeInfo` attribute) targeting .NET Framework 4.0+.
---
## 2. Public Interface
### `Settings` (class) — `Settings.Designer.cs`
```csharp
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
```
| Member | Signature | Description |
|--------|-----------|-------------|
| `Default` | `public static Settings Default { get; }` | Returns the synchronized singleton instance of the settings class. Internally casts the result of `ApplicationSettingsBase.Synchronized(new Settings())`. |
**Visibility:** `internal` — only accessible within the `DatabaseInitializationScripts` assembly.
---
### `Resources` (class) — `Resources.Designer.cs`
```csharp
internal class Resources
```
| Member | Signature | Description |
|--------|-----------|-------------|
| `ResourceManager` | `internal static global::System.Resources.ResourceManager ResourceManager { get; }` | Lazily initializes and returns a cached `ResourceManager` for the resource bundle `"DatabaseInitializationScripts.Properties.Resources"`. |
| `Culture` | `internal static global::System.Globalization.CultureInfo Culture { get; set; }` | Gets or sets the current thread's UI culture for resource lookups. Defaults to `null` if not explicitly set. |
**Visibility:** `internal` — only accessible within the `DatabaseInitializationScripts` assembly.
**Constructor:** `internal Resources()` — marked with `SuppressMessageAttribute` for `CA1811:AvoidUncalledPrivateCode`.
---
### Assembly Metadata — `AssemblyInfo.cs`
The following assembly-level attributes are defined:
| Attribute | Value |
|-----------|-------|
| `AssemblyTitle` | `"DatabaseInitializationScripts"` |
| `AssemblyDescription` | `""` (empty) |
| `AssemblyCompany` | `""` (empty) |
| `AssemblyProduct` | `"DatabaseInitializationScripts"` |
| `AssemblyCopyright` | `"Copyright © 2021"` |
| `ComVisible` | `false` |
| `AssemblyVersion` | `"1.0.0.0"` |
| `AssemblyFileVersion` | `"1.0.0.0"` |
| `ThemeInfo` | `ResourceDictionaryLocation.None` (theme-specific), `ResourceDictionaryLocation.SourceAssembly` (generic) |
---
## 3. Invariants
1. **Singleton Pattern for Settings:** The `Settings.Default` property always returns the same synchronized instance created at class initialization time via `ApplicationSettingsBase.Synchronized()`.
2. **Thread Safety for Settings:** The settings instance is explicitly synchronized via `ApplicationSettingsBase.Synchronized()`, indicating thread-safe access guarantees.
3. **Lazy Initialization for Resources:** The `ResourceManager` property uses lazy initialization with a null-check pattern; the `ResourceManager` is only instantiated on first access.
4. **

View File

@@ -0,0 +1,20 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseMigrationScripts/EmbeddedResource.cs
generated_at: "2026-04-17T16:29:51.550416+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "5e7d1318be4e002b"
---
# DatabaseMigrationScripts
### Purpose
This module provides a static utility class for extracting embedded resources from .NET assemblies. It is designed to retrieve migration scripts that have been embedded within the assembly as resources, returning them as either `StreamReader` objects or raw strings for consumption by database migration logic.
### Public Interface
**Class:** `EmbeddedResource` (static utility class, enforced via private constructor)
| Method | Signature | Description |
|--------|-----------

View File

@@ -0,0 +1,47 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseMigrationScripts/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:29:51.552199+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "cdc10acf4ecfbe8e"
---
# Properties
### Purpose
This module contains the assembly metadata configuration for the `RegionOfInterestChannels` assembly. It is a standard .NET Properties folder that defines assembly identity, versioning information, and COM visibility settings through assembly-level attributes. This module exists to provide build-time configuration and does not contain executable logic.
### Public Interface
No public types or functions are exposed. This module consists entirely of assembly-level attributes:
- `AssemblyTitle` - Set to "RegionOfInterestChannels"
- `AssemblyDescription` - Empty
- `AssemblyConfiguration` - Empty
- `AssemblyCompany` - Empty
- `AssemblyProduct` - Set to "RegionOfInterestChannels"
- `AssemblyCopyright` - Set to "Copyright © 2018"
- `AssemblyTrademark` - Empty
- `AssemblyCulture` - Empty
- `ComVisible` - Set to `false`
- `Guid` - "bdb25406-3e28-4e62-ae2a-622120f933da"
- `AssemblyVersion` - "1.0.0.0"
- `AssemblyFileVersion` - "1.0.0.0"
### Invariants
- The assembly version and file version are synchronized at "1.0.0.0".
- COM visibility is disabled for all types in this assembly by default.
- The GUID "bdb25406-3e28-4e62-ae2a-622120f933da" uniquely identifies this assembly's type library.
### Dependencies
**Imports:**
- `System.Reflection`
- `System.Runtime.CompilerServices`
- `System.Runtime.InteropServices`
**Dependents:** Unclear from source alone - this is a properties module that would be referenced by any project consuming the RegionOfInterestChannels assembly.
### Gotchas
None identified from source alone. This is standard boilerplate assembly metadata.
---

View File

@@ -0,0 +1,115 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseMigrator/MigrateDatabase.cs
- DataPRO/Modules/Database/DatabaseMigrator/MigrationForm.Designer.cs
- DataPRO/Modules/Database/DatabaseMigrator/MigrationForm.cs
generated_at: "2026-04-17T15:55:24.798276+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "0f84be859c5d0bf5"
---
# DatabaseMigrator Module Documentation
## 1. Purpose
The `DatabaseMigrator` module is a Windows Forms application that provides a GUI utility for migrating DataPRO databases between versions. It handles SQL Server Express LocalDB instance management, database backup creation, and version upgrades by orchestrating calls to `DbOperations.Connection.UpgradeVersionsIfNeeded`. The module exists to allow developers or administrators to upgrade database schemas from older versions (minimum version 61) to the current database version.
---
## 2. Public Interface
### MigrateDatabase (static class)
**`static void Main(string[] args)`**
- Entry point for the application. Marked with `[STAThread]`.
- Currently ignores command-line arguments (parsing logic is commented out).
- Sets `targetDir` to `Environment.CurrentDirectory`.
- Initializes visual styles and launches `MigrationForm`.
### MigrationForm (class, inherits from `Form`)
**`public MigrationForm(string targetDir)`**
- Constructor accepting the target directory path where database files reside.
- Initializes the form components and stores `targetDir` in a private readonly field.
**Event Handlers (private, wired to UI controls):**
- **`void buttonOK_Click(object sender, EventArgs e)`** - Initiates the migration process. Queries current database version, validates against desired version, creates a backup via `CopyLocalDB()`, and calls `DbOperations.Connection.UpgradeVersionsIfNeeded()`. Displays appropriate warnings if versions match or current version exceeds desired.
- **`void buttonCancel_Click(object sender, EventArgs e)`** - Closes the form without performing migration.
- **`void MigrationForm_Load(object sender, EventArgs e)`** - Initializes `numericUpDownDesiredVersion` with minimum 61, maximum `DbOperations.CURRENT_DB_VERSION`, and default value of current version. Checks for existing local database and populates `TbDatabasePath`.
- **`void numericUpDownDesiredVersion_ValueChanged(object sender, EventArgs e)`** - Updates `_desiredDatabaseVersion` field from the numeric control.
**Helper Methods (private):**
- **`int GetDatabaseVersion(bool usingLocalDatabase)`** - Retrieves current database version by calling stored procedure `sp_DbVersionGet`. Returns 0 on failure.
- **`bool CopyLocalDB()`** - Creates timestamped backup copies of `.mdf` and `_log.ldf` files.
- **`string InstallDatabase()`** - Configures SQL LocalDB instance by stopping, deleting, creating, and starting `DataPROInstance`, then attaches both DataPRO and ISO databases.
- **`static string ProcessSqlLocalDbCommand(string command)`** - Executes SQL LocalDB utility commands.
- **`static string AttachDatabase(string targetDir, string dbName, string sqlDbFileName, string sqlLogFileName)`** - Attaches a database using `sqlcmd.exe` via batch file.
- **`static string GetSqlServerLocalDBPath()`** - Queries Windows Registry to find the highest installed SQL Server LocalDB version path.
- **`static string SqlCommandProcessor(string sqlLocalDbExeFileName, string command)`** - Executes a SQL command-line utility and captures output.
- **`static string BatchCommandProcessor(string batchFileName, string dbName, string sqlDbFileName, string sqlLogFileName, string fullSqlcmdPath)`** - Executes a batch file for database operations.
- **`bool LocalDataExists()`** - Checks for existence of `DataPRO.mdf` (SQL LocalDB) or `datapro.db` (SQLite) files.
---
## 3. Invariants
- **Version bounds**: `numericUpDownDesiredVersion.Minimum` is always 61; `numericUpDownDesiredVersion.Maximum` is always `DbOperations.CURRENT_DB_VERSION`.
- **Database name**: The database name is hardcoded as `"DataPRO"` throughout the module.
- **Form behavior**: The form is always `TopMost = true` and centered on screen (`StartPosition = CenterScreen`).
- **Backup naming**: Backup files are named with timestamp format `YYYY_MM_DD HH_MM` appended before the file extension.
- **SQL LocalDB instance name**: The instance name is `DataPROInstance` (from `Settings.Default.LocalDbDataPROInstance`).
- **Migration direction**: Migration only proceeds if `currentDatabaseVersion < _desiredDatabaseVersion`. Equal or greater versions result in user warnings and no migration.
---
## 4. Dependencies
### This module depends on:
- `System.Windows.Forms` - Windows Forms UI framework
- `System.Data.SqlClient` - SQL Server database connectivity
- `Microsoft.Win32` - Registry access for SQL LocalDB path detection
- `DTS.Common.Storage` - Contains `DbOperations` and `DbOperationsEnum`
- `DTS.Common.Enums` - Contains `MigrationResult` enum
- `DTS.Common.Utils.Database` - Contains `GetODBCToolsPath()` method
- `DatabaseMigrator.Properties.Settings` - Application settings for paths, instance names, and message strings
### External dependencies (inferred from usage):
- `DbOperations.Connection` - Must provide `UpgradeVersionsIfNeeded()`, `Server`, `DBName`, `DbVersion` properties
- `DbOperations.CURRENT_DB_VERSION` - Constant defining maximum supported version
- `DbOperations.GetSQLCommand()` - Factory method for SQL commands
- `MigrationResult` enum with values: `OK`, `ExceptionThrown`, `WarningAllowStreamingModesWasNotMigrated`
---
## 5. Gotchas
1. **Dead code**: Command-line argument parsing in `Main()` is fully commented out. The application always uses `Environment.CurrentDirectory` regardless of arguments passed.
2. **Hardcoded values with "fix this" comments**: Multiple locations contain hardcoded values that were intended to be configurable:
- `GetDatabaseVersion(true)` - parameter is ignored; `true` is hardcoded
- Database name `"DataPRO"` is hardcoded instead of using `tbDBName.Text` (commented out)
- `UpgradeVersionsIfNeeded` receives hardcoded strings `"previousdir"`, `"targetdir"`, `"applicationSettings"` with a "fix this" comment
3. **SQLite support is incomplete**: The code contains commented-out SQLite handling in `GetDatabaseVersion()` and `LocalDataExists()`. The `localSQLiteDataExists` flag is set but never acted upon.
4. **Silent failures**: `GetDatabaseVersion()` catches all exceptions and returns 0 without logging or rethrowing. This could mask connectivity or schema issues.
5. **Static mutable state**: The `StringBuilder sb` field is static and reused across `SqlCommandProcessor` and `BatchCommandProcessor`. While it's cleared before each use, this could cause issues if methods are called concurrently.
6. **Commented-out exit codes**: Multiple `Environment.Exit()` calls are commented out after error conditions, meaning errors display a message box but allow the application to continue.
7. **Process output handling asymmetry**: `SqlCommandProcessor` and `BatchCommandProcessor` redirect both stdout and stderr, but only stderr is read asynchronously via `OutputHandler`, while stdout is read synchronously with `ReadToEnd()`.

View File

@@ -0,0 +1,52 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseMigrator/Properties/AssemblyInfo.cs
- DataPRO/Modules/Database/DatabaseMigrator/Properties/Settings.Designer.cs
generated_at: "2026-04-17T15:57:31.462614+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "006745ce9f0b7f0a"
---
# DatabaseMigrator Properties Module Documentation
## 1. Purpose
This module provides assembly metadata and strongly-typed configuration settings for the `DatabaseMigrator` component within the DataPRO system. It exists to centralize configuration values related to SQL Server LocalDB instance management, database file paths, migration status messages, and registry locations. The settings defined here support the creation, deletion, starting, and stopping of a LocalDB instance named `DataPROInstance`, as well as handling database version migrations and user-facing status messages.
## 2. Public Interface
### AssemblyInfo.cs
This file contains only assembly-level attributes; it exposes no public types or methods.
**Assembly Attributes:**
- `AssemblyTitle`: `"DatabaseMigrator"`
- `AssemblyDescription`: Empty
- `AssemblyVersion`: `"1.0.0.0"`
- `AssemblyFileVersion`: `"1.0.0.0"`
- `Guid`: `"14d2b644-ac7a-4d21-a826-198ee1bc25f7"`
- `ComVisible`: `false`
---
### Settings.Designer.cs
**Namespace:** `DatabaseMigrator.Properties`
**Class:** `Settings` (internal sealed partial, inherits from `System.Configuration.ApplicationSettingsBase`)
#### Static Property
| Signature | Description |
|-----------|-------------|
| `public static Settings Default { get; }` | Returns a synchronized singleton instance of the `Settings` class. |
#### Application-Scoped Settings (Read-Only)
| Property Name | Type | Default Value | Purpose |
|---------------|------|---------------|---------|
| `LocalDbDataPROInstance` | `string` | `"(localdb)\\DataPROInstance"` | Connection string fragment for the LocalDB instance. |
| `StopDataProInstance` | `string` | `"stop DataPROInstance"` | Command argument to stop the LocalDB instance. |
| `Warning` | `string` | `"Warning"` | Generic warning label. |
| `DeleteDataProInstance` | `string` | `"delete DataPROInstance"` | Command argument to delete the LocalDB instance

View File

@@ -0,0 +1,39 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseServices/DatabaseServicesModule.cs
generated_at: "2026-04-17T16:43:59.359198+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "8adb3f6fd91327f3"
---
# DatabaseServicesModule Documentation
## 1. Purpose
The `DatabaseServicesModule` is a Prism module that registers database-related views and view models with the Unity dependency injection container. It serves as the composition root for database services UI components within the larger DTS application, specifically belonging to the "Prepare" assembly group. The module also provides assembly-level metadata (name, image, group, region) via custom attributes for use by the main application shell.
## 2. Public Interface
### `DatabaseServicesModule` Class
Implements `Prism.Modularity.IModule`.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DatabaseServicesModule(IUnityContainer unityContainer)` | Accepts an injected Unity container instance and stores it in `_unityContainer`. |
| `Initialize` | `void Initialize()` | Registers six type mappings: `IDatabaseCopyView``DatabaseCopyView`, `IDatabaseCopyViewModel``DatabaseCopyViewModel`, `IDatabaseStatusBarView``DatabaseStatusBarView`, `IDatabaseStatusBarViewModel``DatabaseStatusBarViewModel`, `IDatabaseSwitchView``DatabaseSwitchView`, `IDatabaseSwitchViewModel``DatabaseSwitchViewModel`. |
| `OnInitialized` | `void OnInitialized(IContainerProvider containerProvider)` | Empty implementation. |
| `RegisterTypes` | `void RegisterTypes(IContainerRegistry containerRegistry)` | Calls `Initialize()`. |
### `DatabaseServicesModuleNameAttribute` Class
Extends `TextAttribute`. Assembly-level attribute for providing the module name.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DatabaseServicesModuleNameAttribute()` | Default constructor. |
| Constructor | `DatabaseServicesModuleNameAttribute(string s)` | Overloaded constructor; parameter `s` is unused. |
| `AssemblyName` | `override string AssemblyName { get; }` | Returns `AssemblyNames.DatabaseServices.ToString()`. |
| `GetAttributeType` | `override Type GetAttributeType()` | Returns `typeof(TextAttribute)`. |
| `GetAssemblyName`

View File

@@ -0,0 +1,45 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseServices/Converters/DbTypeToVisibilityConverter.cs
generated_at: "2026-04-17T16:44:02.991131+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f33cb579dbf56959"
---
# Documentation: DbTypeToVisibilityConverter
## 1. Purpose
`DbTypeToVisibilityConverter` is a WPF `IMultiValueConverter` that determines the visibility of UI elements based on database connection type state. It bridges the view layer (`DatabaseStatusBarView`) and view model layer (`DatabaseStatusBarViewModel`) to conditionally show or hide elements depending on the current `DbType` configuration and connection status. This converter is specifically designed for the database status bar component in the application.
## 2. Public Interface
### `DbTypeToVisibilityConverter` (class)
Implements: `IMultiValueConverter`
#### `Convert(object[] values, Type targetType, object parameter, CultureInfo culture)`
**Signature:**
```csharp
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
```
**Behavior:** Converts database type information to a `Visibility` value.
- **`values[0]`**: Expected to be an integer value castable to `DbType` enum (the target database type being evaluated for visibility).
- **`values[1]`**: Expected to be a `DatabaseStatusBarView` instance.
- **Returns:** `Visibility.Visible` or `Visibility.Collapsed` based on the following logic:
- If `view.DataContext` is `null`, returns `Visibility.Collapsed`.
- If `vm.DatabaseType` is `DbType.RemoteOnly`: Visible only when `dbType == DbType.RemoteOnly`.
- If `vm.DatabaseType` is `DbType.LocalOnly`: Visible only when `dbType == DbType.LocalOnly`.
- If `vm.DatabaseType` is `DbType.RemoteLocalHybrid`:
- When `vm.RemoteConnected` is `true`: Visible only when `dbType == DbType.RemoteOnly`.
- When `vm.RemoteConnected` is `false`: Visible only when `dbType == DbType.RemoteLocalHybrid`.
- All other cases: Returns `Visibility.Collapsed`.
#### `ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)`
**Signature:**
```csharp

View File

@@ -0,0 +1,35 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseServices/Properties/Settings.Designer.cs
- DataPRO/Modules/Database/DatabaseServices/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:25:38.816580+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "9c93cde3415ea476"
---
# Properties
### Purpose
This module provides assembly metadata and application settings infrastructure for the `DatabaseServices` assembly. It is a standard .NET properties folder containing auto-generated settings and assembly-level attributes. The settings class is currently minimal, suggesting either a placeholder or that configuration is managed elsewhere in the solution.
### Public Interface
**`DatabaseServices.Properties.Settings`** (internal sealed partial class)
- Inherits from `global::System.Configuration.ApplicationSettingsBase`
- `public static Settings Default { get; }` - Returns a synchronized singleton instance of the settings class. This is the entry point for accessing any application-scoped or user-scoped settings defined for this assembly.
### Invariants
- The `Settings` class is marked `internal sealed`, meaning it cannot be inherited and is only accessible within the `DatabaseServices` assembly.
- The `defaultInstance` field is synchronized via `ApplicationSettingsBase.Synchronized()`, ensuring thread-safe access to the singleton.
- The settings class is auto-generated (via `SettingsSingleFileGenerator`); manual changes will be overwritten on regeneration.
### Dependencies
- **Depends on**: `System.Configuration.ApplicationSettingsBase` (from `System.Configuration` assembly)
- **Depended on by**: Cannot be determined from source alone (internal class, likely used by other classes within DatabaseServices assembly)
### Gotchas
- The `Settings` class contains no actual setting properties beyond the `Default` accessor. This is unusual for a settings file—either settings are defined in an external `.config` file not shown here, or this assembly does not require persistent configuration.
- The file is auto-generated by Visual Studio tooling (version 17.10.0.0); do not edit manually.
---

View File

@@ -0,0 +1,48 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseServices/Resources/TranslateExtension.cs
- DataPRO/Modules/Database/DatabaseServices/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T16:07:59.007705+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "63cd62f694267ff8"
---
# Resources
### Purpose
This module provides localization resources and a XAML markup extension for the `DatabaseServices` assembly. It enables the resolution of user-facing strings (such as status messages regarding database operations) within the UI layer, supporting both direct code access via a resource manager and declarative access within XAML files.
### Public Interface
**Class: `TranslateExtension`**
* **Signature:** `public class TranslateExtension : MarkupExtension`
* **Constructor:** `TranslateExtension(string key)` - Initializes the extension with the resource key to be looked up.
* **Method:** `public override object ProvideValue(IServiceProvider serviceProvider)` - Resolves the `_key` to a localized string. Returns `#stringnotfound#` if the key is null/empty, or `#stringnotfound# <key>` if the lookup fails.
**Class: `StringResources` (Internal)**
* **Signature:** `internal class StringResources`
* **Property:** `static ResourceManager ResourceManager` - Provides access to the resource cache.
* **Property:** `static CultureInfo Culture` - Gets or sets the current UI culture for resource lookups.
* **Static Properties (Localized Strings):**
* `string ClearingLocalDb` ("Clearing local db")
* `string ConnectedTo` ("Connected to: ")
* `string CopyFromRemoteServer` ("Copy from remote server to local")
* `string CopyingTable` ("Copying")
* `string EnablingConstraints` ("Finishing up")
* `string Local` ("Local")
* `string Remote` ("Remote")
* `string SwitchFileNotFound` ("Could not switch to local - File not found:")
* `string SwitchToLocal` ("Switch to local")
* `string SwitchToRemote` ("Switch to remote")
### Invariants
* `TranslateExtension` never returns `null`. It guarantees a string return, falling back to error indicators (`#stringnotfound#`) if the resource key is missing.
* `StringResources` is an auto-generated class; manual modifications will be overwritten by tooling (Visual Studio/ResGen).
### Dependencies
* **Depends on:** `System`, `System.Windows.Markup`, `System.Resources`, `System.Globalization`.
* **Dependents:** Any XAML UI components within the `DatabaseServices` scope that require localized text.
### Gotchas
* The `StringResources` class is marked `internal`, making it inaccessible outside the `DatabaseServices` assembly.
* The `Translate

View File

@@ -0,0 +1,72 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseServices/View/DatabaseStatusBarView.xaml.cs
- DataPRO/Modules/Database/DatabaseServices/View/DatabaseCopyView.xaml.cs
- DataPRO/Modules/Database/DatabaseServices/View/DatabaseSwitchView.xaml.cs
generated_at: "2026-04-17T16:36:18.725754+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "9b3e32201b851fc1"
---
# Documentation: Database View Components
## 1. Purpose
This module provides WPF view components for database-related UI operations within the DatabaseServices namespace. It contains three code-behind classes—`DatabaseStatusBarView`, `DatabaseCopyView`, and `DatabaseSwitchView`—that serve as the visual layer for displaying database status, copying databases, and switching between local/remote database connections respectively. These views implement interfaces from `DTS.Common.Interface.Database` and delegate business logic to associated ViewModels via WPF data binding.
---
## 2. Public Interface
### `DatabaseStatusBarView`
**Namespace:** `DatabaseServices`
**Implements:** `IDatabaseStatusBarView`
```csharp
public DatabaseStatusBarView()
```
Default constructor. Calls `InitializeComponent()` to load the associated XAML layout. No additional public members are exposed beyond the interface implementation.
---
### `DatabaseCopyView`
**Namespace:** `DatabaseServices`
**Implements:** `IDatabaseCopyView`
```csharp
public DatabaseCopyView()
```
Default constructor. Calls `InitializeComponent()` to load the associated XAML layout.
```csharp
private void Copy_Click(object sender, RoutedEventArgs e)
```
Event handler for the copy button click. Casts `sender` to `Control`, retrieves the `DataContext` as `IDatabaseCopyViewModel`, and invokes `vm.CopyDatabase()`.
---
### `DatabaseSwitchView`
**Namespace:** `DatabaseServices`
**Implements:** `IDatabaseSwitchView`
```csharp
public DatabaseSwitchView()
```
Default constructor. Calls `InitializeComponent()` to load the associated XAML layout.
```csharp
private void SwitchToLocal_Click(object sender, RoutedEventArgs e)
```
Event handler for switching to local database. Casts `sender` to `Control`, retrieves the `DataContext` as `IDatabaseSwitchViewModel`, and invokes `vm.SwitchLocal()`.
```csharp
private void SwitchToRemote_Click(object sender, RoutedEventArgs e)
```
Event handler for switching to remote database. Casts `sender` to `Control`, retrieves the `DataContext` as `IDatabaseSwitchViewModel`, and invokes `vm.SwitchRemote()`.
---
## 3. Invariants
- **DataContext Contract:** `DatabaseCopyView` requires its `DataContext` to be an instance of `IDatabaseCopyViewModel`. `DatabaseSwitchView` requires its `DataContext` to be an instance of `IDatabaseSwitchViewModel`. Event handlers will fail with invalid

View File

@@ -0,0 +1,193 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseServices/ViewModel/DatabaseStatusBarViewModel.cs
- DataPRO/Modules/Database/DatabaseServices/ViewModel/DatabaseSwitchViewModel.cs
- DataPRO/Modules/Database/DatabaseServices/ViewModel/DatabaseCopyViewModel.cs
generated_at: "2026-04-17T15:41:29.202299+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f011aeacca70c45c"
---
# Database ViewModels Documentation
## 1. Purpose
This module provides three MVVM ViewModels for database management within the `DatabaseServices` namespace:
- **DatabaseStatusBarViewModel**: Manages the database status bar UI, displaying the active database connection (Local vs Remote) and providing visual feedback (red background when disconnected from remote in hybrid mode).
- **DatabaseSwitchViewModel**: Handles switching between local and remote database connections, including connection testing, authentication setup, and forcing user re-login after database switches.
- **DatabaseCopyViewModel**: Implements database copy functionality to synchronize a remote database to a local database, including table-by-table copying with identity column handling and constraint management.
All three ViewModels follow the Prism MVVM pattern, use MEF for dependency injection with shared creation policy, and integrate with the application's event aggregation system.
---
## 2. Public Interface
### DatabaseStatusBarViewModel
**Implements:** `IDatabaseStatusBarViewModel`
| Member | Signature | Description |
|--------|-----------|-------------|
| `View` | `public IDatabaseStatusBarView View { get; set; }` | The associated view instance; DataContext is set to `this` in constructor. |
| `DatabaseType` | `public DbType DatabaseType { get; private set; }` | The configured database type (LocalOnly, RemoteOnly, RemoteLocalHybrid). |
| `ServerName` | `public string ServerName { get; private set; }` | Name of the database server; "Local" when not remote connected. |
| `RemoteConnected` | `public bool RemoteConnected => DbOperations._usingCentralizedDB;` | Indicates if currently connected to centralized/remote database. |
| `ActiveDbName` | `public string ActiveDbName { get; }` | Computed display name based on DatabaseType and connection state. Returns localized "Local" string or server name. |
| `BackgroundBrush` | `public Brush BackgroundBrush { get; }` | Returns `Brushes.Red` when hybrid mode is disconnected from remote; otherwise `Brushes.Transparent`. |
| `InitializeValues` | `public void InitializeValues(DbType dbType, string serverName, bool remoteConnected)` | Initializes the ViewModel's state and triggers PropertyChanged for `ActiveDbName` and `BackgroundBrush`. |
| `OnPropertyChanged` | `public void OnPropertyChanged(string propertyName)` | Raises the `PropertyChanged` event. |
| `NotificationRequest` | `public InteractionRequest<Notification> NotificationRequest { get; }` | Prism interaction request for notifications. |
| `ConfirmationRequest` | `public InteractionRequest<Confirmation> ConfirmationRequest { get; }` | Prism interaction request for confirmations. |
| `IsBusy` | `public bool IsBusy { get; set; }` | Bound to busy indicator state. |
| `IsMenuIncluded` | `public bool IsMenuIncluded { get; set; }` | Controls menu visibility. |
| `IsNavigationIncluded` | `public bool IsNavigationIncluded { get; set; }` | Controls navigation visibility. |
| `IsDirty` | `public bool IsDirty { get; private set; }` | Tracks unsaved changes state. |
| `Cleanup` / `CleanupAsync` | `public void Cleanup()` / `public Task CleanupAsync()` | No-op cleanup methods. |
| `Initialize` overloads | `void Initialize()`, `void Initialize(object)`, `void Initialize(object, object)` | No-op initialization methods. |
| `InitializeAsync` overloads | `Task InitializeAsync()`, `Task InitializeAsync(object)` | Return `Task.CompletedTask`. |
| `Activated` | `public void Activated()` | No-op activation method. |
| `Unset` | `public void Unset()` | No-op unset method. |
**Constructor:**
```csharp
public DatabaseStatusBarViewModel(
IDatabaseStatusBarView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
---
### DatabaseSwitchViewModel
**Implements:** `IDatabaseSwitchViewModel`
| Member | Signature | Description |
|--------|-----------|-------------|
| `View` | `public IDatabaseSwitchView View { get; set; }` | The associated view instance. |
| `DefaultDbName` | `public string DefaultDbName { get; private set; }` | Default database name for connections. |
| `DbHost` | `public string DbHost { get; private set; }` | Remote database host address. |
| `NTLMAuthentication` | `public bool NTLMAuthentication { get; private set; }` | Whether NTLM authentication is enabled. |
| `DbUser` | `public string DbUser { get; private set; }` | Database username for SQL authentication. |
| `DbPassword` | `public string DbPassword { get; private set; }` | Database password for SQL authentication. |
| `RemoteIsActive` | `public bool RemoteIsActive => DbOperations._usingCentralizedDB;` | Indicates if remote database is currently active. |
| `SwitchRemote` | `public void SwitchRemote()` | Switches to remote database connection. Tests connection, falls back to local on failure, publishes `DbStatusEvent` and `LogoutUserEvent`. |
| `SwitchLocal` | `public void SwitchLocal()` | Switches to local database. Validates local files exist, publishes status events and forces logout. |
| `InitializeDbSettings` | `public void InitializeDbSettings(string defaultDbName, string dbHost, bool ntlmAuthentication, string dbUser, string dbPassword)` | Stores database connection settings for use by switch methods. |
| `IsBusy`, `IsMenuIncluded`, `IsNavigationIncluded`, `IsDirty` | Same as DatabaseStatusBarViewModel | Standard ViewModel properties. |
| `NotificationRequest`, `ConfirmationRequest` | Same as DatabaseStatusBarViewModel | Prism interaction requests. |
| Lifecycle methods | Same pattern as DatabaseStatusBarViewModel | `Cleanup`, `CleanupAsync`, `Initialize*`, `Activated`, `Unset` are no-ops or return completed tasks. |
**Constructor:**
```csharp
public DatabaseSwitchViewModel(
IDatabaseSwitchView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
---
### DatabaseCopyViewModel
**Implements:** `IDatabaseCopyViewModel`
| Member | Signature | Description |
|--------|-----------|-------------|
| `View` | `public IDatabaseCopyView View { get; set; }` | The associated view instance. |
| `DatabaseType` | `public DTS.Common.Enums.Database.DbType DatabaseType { get; private set; }` | Current database type configuration. |
| `DbName` | `public string DbName { get; private set; }` | Name of the database being copied. |
| `CopyEnabled` | `public bool CopyEnabled => DatabaseType == DbType.RemoteLocalHybrid && DbOperations._usingCentralizedDB;` | Copy is only enabled in hybrid mode when connected to remote. |
| `IsCopyVisible` | `public bool IsCopyVisible { get; set; }` | Controls visibility of copy UI; defaults to `true`. |
| `OverallProgressBarView` | `public IStatusAndProgressBarView OverallProgressBarView { get; private set; }` | Progress bar view for overall copy progress. |
| `CurrentTaskProgressBarView` | `public IStatusAndProgressBarView CurrentTaskProgressBarView { get; private set; }` | Progress bar view for current table copy progress. |
| `CopyDatabase` | `public void CopyDatabase()` | Initiates async database copy via `Task.Run(() => CopyFunc())`. Publishes `AppStatusEvent.Busy`. |
| `InitializeState` | `public void InitializeState(DTS.Common.Enums.Database.DbType dbType, string dbName)` | Sets up initial state, resets progress bars, triggers `OnPropertyChanged("CopyEnabled")`. |
| `InitializeAsync` | `public Task InitializeAsync()` | Resolves and initializes progress bar views via Unity container. |
| `_allDBTables` | `private static readonly List<string>` | Hardcoded list of 73 database table names to copy. |
| `_tablesWithIdentities` | `private static readonly HashSet<string>` | Hardcoded set of 48 table names that have identity columns. |
| `MAX_BATCH_SIZE` | `private const int MAX_BATCH_SIZE = 20;` | Maximum rows per batch insert to avoid SQL Server's 2100 parameter limit. |
| `CurrentTaskBar` | `private const string CurrentTaskBar = "CurrentTaskStatus";` | Identifier for current task progress bar. |
| `OverallTaskBar` | `private const string OverallTaskBar = "OverallStatus";` | Identifier for overall progress bar. |
| Lifecycle methods | Same pattern as other ViewModels | Standard no-op implementations except `InitializeAsync`. |
**Constructor:**
```csharp
public DatabaseCopyViewModel(
IDatabaseCopyView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
---
## 3. Invariants
### DatabaseStatusBarViewModel
- `ActiveDbName` returns empty string for unhandled `DbType` values (not LocalOnly, RemoteOnly, or RemoteLocalHybrid).
- `BackgroundBrush` only returns `Brushes.Red` for `DbType.RemoteLocalHybrid` when `RemoteConnected` is false; all other cases return `Brushes.Transparent`.
- `RemoteConnected` is directly coupled to `DbOperations._usingCentralizedDB` static field.
### DatabaseSwitchViewModel
- `SwitchRemote` always publishes `LogoutUserEvent` with reason `DatabaseSwitch` on success.
- `SwitchRemote` calls `SwitchLocal()` as fallback if connection test fails.
- `SwitchLocal` checks for local database file existence before proceeding; returns early with error if files not found.
- `SwitchLocal` always publishes `LogoutUserEvent` with reason `DatabaseSwitch` on success.
### DatabaseCopyViewModel
- `CopyEnabled` is only true when `DatabaseType == DbType.RemoteLocalHybrid` AND `DbOperations._usingCentralizedDB` is true.
- Copy operation disables constraints before copying and re-enables them after.
- If copy fails, attempts to restore from backup via `DTS.Common.Storage.DatabaseServices.RestoreLocalDatabase(DbName)`.
- Batch inserts are limited to `MAX_BATCH_SIZE` (20 rows) or when parameter count would exceed 2100.
- Identity insert is enabled/disabled per batch for tables in `_tablesWithIdentities`.
- `DASId` columns with value 0 are explicitly set to NULL in the Channels table after copy.
---
## 4. Dependencies
### External Dependencies (from imports)
- **Prism Framework:** `Prism.Events`, `Prism.Regions`, `Prism.Commands` - Event aggregation, region management, commanding
- **Unity Container:** `Unity` - Dependency injection container
- **MEF:** `System.ComponentModel.Composition` - Part creation policy
- **WPF:** `System.Windows.Media`, `System.ComponentModel` - UI types, INotifyPropertyChanged
- **DTS.Common.Enums.Database:** `DbType` enum
- **DTS.Common.Events:** `RaiseNotification`, `BusyIndicatorChangeNotification`, `AppStatusEvent`, `AppStatusArg`, `ProgressBarEvent`, `ProgressBarEventArg`, `PageErrorEvent`, `PageErrorArg`
- **DTS.Common.Events.Database:** `DbStatusEvent`, `DbStatusArg`, `LogoutUserEvent`, `LogoutUserArg`
- **DTS.Common.Interactivity:** `InteractionRequest<T>`, `Notification`, `Confirmation`, `NotificationContentEventArgs`
- **DTS.Common.Interface.Database:** `IDatabaseStatusBarView`, `IDatabaseSwitchView`, `IDatabaseCopyView`, `IDatabaseStatusBarViewModel`, `IDatabaseSwitchViewModel`, `IDatabaseCopyViewModel`
- **DTS.Common.Interface:** `IStatusAndProgressBarView`, `IStatusAndProgressBarViewModel`
- **DTS.Common.Storage:** `DbOperations`, `LocalOnlyOperations`, `DatabaseServices` (static class)
- **DTS.Common.Utilities.Logging:** `APILogger`
- **DTS.Common.Utils.Database:** `CheckLocalDatabaseFilesExist`
- **Resources.StringResources:** Localized strings
### Static Couplings
- `DbOperations._usingCentralizedDB` - Static field accessed directly by all three ViewModels
- `DbOperations.Connection.Server` - Server name accessed directly
- `DbOperations.GetSQLCommand()` - SQL command creation for remote DB
- `LocalOnlyOperations.GetSQLCommand()` - SQL command creation for local DB
- `LocalOnlyOperations.BeginStatement`, `LocalOnlyOperations.CommitStatement` - Transaction statements
- `LocalOnlyOperations.CreateParam()` - Parameter creation helper
---
## 5. Gotchas
### XML Documentation Mismatch
- `DatabaseStatusBarViewModel` and `DatabaseSwitchViewModel` XML summary comments state "this class handles DatabaseCopy functionality" which is incorrect (copy-paste error from `DatabaseCopyViewModel`).
### Parameterless Constructors
- All three ViewModels have public parameterless constructors in addition to the DI constructor. The parameterless constructors perform no initialization, which could lead to null reference exceptions if used incorrectly.
### Static Table Lists
- `DatabaseCopyViewModel._allDBTables` and `_tablesWithIdentities` are hardcoded lists. Any database schema changes require code updates. Comment in source states: "I'd like to do this through SQL, but ran into problems".
### Thread Safety Concerns
- `DatabaseCopyViewModel.CopyDatabase()` uses `Task.Run()` to execute `CopyFunc()` on a background thread, but `SetStatus()` publishes UI events directly. The `BusyIndicatorChangeNotification` subscription in `DatabaseStatusBarViewModel` uses `ThreadOption.PublisherThread` with `keepSubscriberReferenceAlive: true

View File

@@ -0,0 +1,107 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/ConfigToDb/ConfigToDbMigrator.cs
generated_at: "2026-04-17T15:59:59.091141+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "43b9fec3ece4689d"
---
# Documentation: ConfigToDbMigrator
## 1. Purpose
The `ConfigToDbMigrator` class is a migration utility responsible for transferring user and application settings from legacy DataPRO configuration files into a database. It reads settings from an older version's config file (located via a provided path), maps specific named settings to corresponding database property IDs, and persists them for all users in the system. This module exists to support version upgrades where settings storage was migrated from file-based configuration to database-backed storage.
---
## 2. Public Interface
### `migrateConfigToDb(string nextLowerPath, out string result)` → `bool`
**Signature:** `public bool migrateConfigToDb(string nextLowerPath, out string result)`
Orchestrates the full migration process. Loads both user and application settings from the config file at `nextLowerPath`, then inserts them into the database. Returns `true` on successful migration, `false` otherwise. The `result` output parameter contains a success/failure message.
---
### `ExportDesired(SupportedExportFormatBitFlags exportType, int settingValue)` → `bool`
**Signature:** `public bool ExportDesired(SupportedExportFormatBitFlags exportType, int settingValue)`
Determines whether a specific export format is enabled within a bitmask value. Uses bitwise AND comparison to check if the `exportType` flag is present in `settingValue`.
---
### `SupportedExportFormatBitFlags` (public enum)
Defines bit flags for various export formats. Values include:
- `none = 0x0`
- `csvunfiltered = 0x1`
- `diademadc = 0x2`
- `isounfiltered = 0x4`
- `somatunfiltered = 0x8`
- `tdmsadc = 0x10`
- `toyotaunfiltered = 0x20`
- `tsvunfiltered = 0x40`
- `csvfiltered = 0x80`
- `isofiltered = 0x200`
- `somatfiltered = 0x400`
- `tdasadc = 0x800`
- `toyotafiltered = 0x1000`
- `tsvfiltered = 0x2000`
- `rdfadc = 0x4000`
- `ChryslerDDAS = 0x8000`
- `HDFUnfiltered = 0x10000`
- `HDFFiltered = 0x20000`
- `HDFMV = 0x40000`
- `HDFADC = 0x80000`
- `xlsxfiltered = 0x100000`
- `xlsxunfiltered = 0x200000`
---
## 3. Invariants
- **Config file location:** The old config file path is constructed as `nextLowerPath + Resources.RegistryDataPROExe`.
- **Settings source:** Only settings named `"UserSettings"` and `"ApplicationSettings"` section groups are processed.
- **Database storage:** All settings are stored per-user; `StoreInDb` iterates over all user IDs returned by `GetAllUserIds()`.
- **Stored procedures:** Database operations use `sp_UserPropertiesUpdateInsert` for inserts/updates and `sp_UserGetIdsAll` for retrieving user IDs.
- **Error handling:** If `result` contains either `Resources.OldSettingsCouldNotBeFound` or `Resources.OldSettingsCouldNotBeProcessed`, migration halts and returns `false`.
- **Unit conversion:** `DefaultTestExcitationWarmupMS` is converted from milliseconds to seconds before storage.
---
## 4. Dependencies
### This module depends on:
- **`System.Configuration`** — For `ConfigurationManager`, `Configuration`, `ClientSettingsSection`, and configuration section group handling.
- **`System.Data.SqlClient`** — For `SqlConnection`, `SqlCommand`, `SqlParameter` database operations.
- **`ConfigToDb.Properties.Resources`** — For localized string resources (`UserSettings`, `ApplicationSettings`, `OldSettingsCouldNotBeFound`, `OldSettingsCouldNotBeProcessed`, `RegistryDataPROExe`).
- **`DTS.Common.Storage`** — Inferred; likely contains `DbOperations` infrastructure.
- **`DTS.Slice.Users.UserSettings`** — For `SettingElementCollection` and `SettingElement` types.
- **`DatabaseImport.DbOperations`** — For `GetSQLCommand()`, `Connection.QueryDataSet()`.
- **`PropertyEnums.PropertyIds`** — Enum defining property IDs for database storage.
- **`DbOperationsEnum.StoredProcedure`** — Enum for stored procedure names.
- **`DbOperations.Users.UserFields`** — For user field name constants.
### What depends on this module:
- **Unclear from source alone.** No consumers are shown in this file.
---
## 5. Gotchas
1. **Silent failure in `GetAllUserIds()`:** Exceptions are caught and swallowed; an empty list is returned, which would result in no settings being stored for any user without any indication of failure.
2. **Empty error handling block:** In `StoreInDb()`, the condition `if (int.Parse(errorNumberParam.Value.ToString()) != 0)` has an empty body — database errors from the stored procedure are ignored.
3. **Hardcoded assumption about install location:** The comment in `GetOldConfigSettings()` states: *"this assumes that it was installed in the default folder!!!"*
4. **Duplicate case handling:** The setting key `"DefaultTestTriggerCheckStep"` appears twice in the switch statement, mapping to two different property IDs (`DefaultTriggerCheckStep` and `DefaultTriggerCheckStep`). The second case will never execute.
5. **Semantic name mismatch:** `DefaultTestAllowSensorIdToBlankChannel` maps to `DefaultRequireSensorIdFound` — the inverted naming suggests possible logic inversion, but this is unclear from source alone.
6. **Unit conversion for one setting only:** `DefaultTestExcitationWarmupMS` is explicitly converted from ms to seconds, but `DefaultTestExcitationTOMWarmupDelayMS` and `DefaultTestExcitationIEPEWarmupDelayMS` are stored as-is without conversion. Whether this is intentional is unclear from source alone.
7. **Export format expansion:** The single `DefaultTestExportFormat` integer setting is expanded into 22 separate boolean database properties via bit flag checking.

View File

@@ -0,0 +1,41 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/ConfigToDb/Properties/AssemblyInfo.cs
- DataPRO/Modules/DatabaseImporter/ConfigToDb/Properties/Resources.Designer.cs
generated_at: "2026-04-17T16:28:42.806473+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "fafa25726a92898b"
---
# Properties
### Purpose
This module provides assembly-level metadata for the ConfigToDb assembly and localized resource strings for configuration migration operations. It handles messaging related to settings transfer between versions of DataPRO, including warnings for missing or unprocessable configuration data.
### Public Interface
**`Resources` (internal sealed class)**
- `internal static global::System.Resources.ResourceManager ResourceManager { get; }` — Returns cached ResourceManager for the assembly.
- `internal static global::System.Globalization.CultureInfo Culture { get; set; }` — Gets/sets the current culture for resource lookups.
- `internal static string ApplicationSettings { get; }` — Returns localized string "applicationSettings".
- `internal static string UserSettings { get; }` — Returns localized string "userSettings".
- `internal static string RegistryDataPROExe { get; }` — Returns localized string "DataPRO.exe".
- `internal static string OldSettingsCouldNotBeFound { get; }` — Returns warning message template: "Warning: DataPRO.exe.config was not updated because config settings from previously-installed version of DataPRO could not be found: {0}; {1}".
- `internal static string OldSettingsCouldNotBeProcessed { get; }` — Returns warning message: "Warning: DataPRO.exe.config was not updated because config settings from previously-installed version of DataPRO could not be processed.".
### Invariants
- The class is auto-generated by `StronglyTypedResourceBuilder`; manual edits will be lost on regeneration.
- Resource lookups fall back to neutral culture resources if `Culture` is not set or the specific culture resource is unavailable.
- The ResourceManager is lazily initialized on first access.
### Dependencies
- **Depends on**: `System.Resources.ResourceManager`, `System.Globalization.CultureInfo`, `System.CodeDom.Compiler`, `System.Diagnostics`.
- **Depended on by**: Unclear from source alone; likely consumed by configuration migration logic in the ConfigToDb assembly.
### Gotchas
- The resource strings suggest this assembly handles migration of user/application settings between DataPRO versions.
- `OldSettingsCouldNotBeFound` expects two format arguments (`{0}`, `{1}`), but what these represent is unclear from source alone.
- The `RegistryDataPROExe` resource suggests registry-based configuration lookup may be involved.
---

View File

@@ -0,0 +1,265 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/CustomChannel.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/TestGraph.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SerializedSettings.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/DbImporter.cs
generated_at: "2026-04-17T15:54:30.728728+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "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:**
```csharp
public CustomChannel(MMEPossibleChannels channel, bool newChannel = true)
```
- Creates a new `CustomChannel` wrapping an `MMEPossibleChannels` instance. If `newChannel` is `true`, 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:**
```csharp
public MMEPossibleChannels Channel { get; private set; }
public string Text1 { get; set; } // Proxies to Channel.Text_L1 and Channel.SetText1()
```
**Methods:**
```csharp
public int CompareTo(CustomChannel other)
```
- Implements `IComparable<CustomChannel>`. Returns 0 if channels are equal, otherwise performs ordinal string comparison on `Text1` properties.
#### `CustomChannelList` Class
A thread-safe singleton collection manager for `CustomChannel` instances.
**Singleton Access:**
```csharp
public static CustomChannelList List { get; }
```
- Thread-safe lazy initialization using lock pattern on `LockObject`.
**Methods:**
```csharp
public void ReloadAll()
```
- Clears the cached channel list, refreshes all data from `IsoDb`, and repopulates the channel collection.
```csharp
public void DeleteAll()
```
- Clears all cached channels and deletes SQL records via `IsoDb.DeleteSQL()`.
**Properties:**
```csharp
public ISO13499FileDb IsoDb { get; }
```
- Lazy-initialized `ISO13499FileDb` instance with auto-refresh on first access.
---
### TestGraph.cs
#### `TestGraph` Class
Manages graph configuration including channels, thresholds, and axis domains.
**Constructor:**
```csharp
public TestGraph(TestTemplate template)
```
- Initializes groups and added groups from the provided template.
**Constants:**
```csharp
private const int MAX_CHANNELS_PER_GRAPH = 8;
private const string SEPARATOR = "§";
```
**Properties:**
```csharp
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:**
```csharp
public void SetThresholdsFromSQL(string sThresholds)
```
- Parses a string containing threshold values separated by `§` with `{` and `}` delimiters. Parses tokens as doubles and adds to internal `_thresholds` list.
```csharp
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 via `AddChannel()`.
---
### SerializedSettings.cs
#### `SerializedSettings` Class (Sealed)
Provides typed access to application-wide settings stored in `SettingsDB`.
**Nested Enums:**
```csharp
public enum Keys { /* 100+ setting keys including IgnorePowerMode, UseUserCodes, etc. */ }
public enum ISOSupportLevels { ISO_ONLY, TRANSITORY, NO_ISO }
```
**Properties:**
```csharp
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:**
```csharp
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:**
```csharp
public SensorTypeToDimension(string sensorType, string name, string dimension)
```
**Properties:**
```csharp
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:**
```csharp
public DbImporter()
public DbImporter(int dbType, string dbName, string server, bool useNTLMAuthentication, string localDbUser, string localDbPassword)
```
- Parameterized constructor configures `DbOperations` for local (`dbType=1`) or centralized database connections.
**Nested Types:**
```csharp
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:**
```csharp
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 through `ImportTestSetup.ProcessRootNode()`. Post-import, calls `AssignSettingsToAllUsers()`, `MigrateG5ChannelSupportedBridges()`, and `MigrateSPSChannelSupportedBridges()`.
```csharp
public bool MigrateG5ChannelSupportedBridges()
```
- Updates `DASChannels.SupportedBridges` from 12 to 140 for DAS Type=12 (TDAS G5 VDS). Addresses issue #12431 for 1.4 to 1.10 migrations.
```csharp
public void MigrateSPSChannelSupportedBridges()
```
- Updates `DASChannels.SupportedBridges` from 15 to 143 for DAS Type=19 with ProtocolVersion >= 154. Addresses issue #12850 for SPS channel count mismatch.
```csharp
public bool IsServerConnected()
```
- Returns result of `DbOperations.IsServerConnected()`.
---
## Invariants
1. **CustomChannelList Singleton**: The `List` property always returns the same instance; `_list` is only created once under lock.
2. **Channel Uniqueness**: In `CustomChannelList.PopulateChannelsIfNecessary()`, channels are keyed by ISO code; duplicate ISO codes are silently skipped via `if (_dictChannels.ContainsKey(iso)) continue;`.
3. **Max Channels Per Graph**: `TestGraph` enforces `MAX_CHANNELS_PER_GRAPH = 8`. When `_channels.Count >= MAX_CHANNELS_PER_GRAPH`, `AvailableChannels` returns an empty array.
4. **Sensor Type Mapping Default Count**: `AllSensorTypeToDimensions` defaults to 7 mappings if `NUM_SENSORTYPE_MAPPINGS` is not set or unparseable.
5. **ISO Support Level Default**: `ISOSupportLevel` defaults to `ISOSupportLevels.ISO_ONLY` if parsing fails.
6. **Thread Safety**: `CustomChannelList` uses `LockObject` for all state mutations (`ReloadAll`, `DeleteAll`, `PopulateChannelsIfNecessary`).
---
## Dependencies
### Imports (This module depends on):
- `System`, `System.Collections.Generic`, `System.Linq`
- `System.Windows` (CustomChannel.cs - `Application.Current` cast to `App`)
- `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`, `MMEFilterClasses`
- `ISO13499FileDb`, `ISO13499FileDb.ExpiredISOFieldException`
- `ISO.IsoCode`
- `App` (WPF application class)
- `TestObjectChannel`, `TestTestObject`, `TestTemplate`, `TestObjectTemplate`
- `SensorsCollection.SensorsList`
- `SettingsDB`
- `DbOperations`, `DbOperations.Connection`, `DbOperationsEnum`
- `ImportSensorsImportControl`, `ImportTestSetup`
- `IsoChannelSensorCompatibilityLevels` (enum)
### Likely Dependents (inferred):
- Test configuration modules (using `TestGraph`, `CustomChannel`)
- Database migration tools (using `DbImporter`)
- Settings management UI (using `SerializedSettings`)
---
## Gotchas
1. **Expired ISO Field Exceptions Silently Collected**: In `CustomChannel` constructor, `ExpiredISOFieldException` for main location lookup is caught and added to `_expiredErrors` list, but this list is never exposed or used elsewhere in the provided source. The exception is effectively swallowed.
2. **Commented-Out Base Class Inheritance**: Both `CustomChannel` and `CustomChannelList` have commented-out inheritance from `BasePropertyChanged`, suggesting a refactoring or removal of change notification infrastructure. `TestGraph` similarly has this pattern.
3. **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.
4. **Magic Character in Sensor Mapping Serialization**: `SetSensorTypeMapping` uses `(char)149` as a delimiter, which is the "bullet" character (•). This could cause encoding issues.
5. **G5/SPS Migration Hardcoded Values**: `MigrateG5ChannelSupportedBridges()` and `MigrateSPSChannelSupportedBridges()` use hardcoded magic numbers (140, 143, 154) without constants, tied to specific bug IDs (#12431, #12850).
6. **AvailableChannels Clears Lookup on Every Access**: The `AvailableChannels` getter calls `_lookup.Clear()` at the start, which may have side effects if `_lookup` is used elsewhere between accesses.
7. **Squib Channel Mutation Side Effect**: In `AddChannels()`, when handling voltage channels for squib sensors, the original `channel` object has its `SquibChannelType` and `NameOfTheChannel` modified before being added to the list, while current channels create a new instance.
8. **Exception Re-throw Loses Stack Trace**: In `ImportXML()`, `throw ex;` re-throws the caught exception, losing the original stack trace. Should be `throw;`.
9. **Empty Catch Blocks**: `AssignSettingsToAllUsers()` and `SetUserProperty()` have empty catch blocks, silently swallowing exceptions.

View File

@@ -0,0 +1,32 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/App/WaitCursor.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/App/App.cs
generated_at: "2026-04-17T16:44:58.377701+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "fa7ba64696e65370"
---
# Documentation: DatabaseImport Application Module
## 1. Purpose
This module provides UI state management utilities for a WPF-based database import application. It consists of two components: `WaitCursor`, a disposable utility class for temporarily displaying a wait cursor with automatic restoration, and `App`, the main application class that manages application-wide busy states, provides lazy-initialized access to an `ISO13499FileDb` instance, and handles thread-safe UI manipulation through dispatcher-aware methods.
---
## 2. Public Interface
### `WaitCursor` Class
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public WaitCursor()` | Saves the current `Mouse.OverrideCursor` value to `_previousCursor`, then sets `Mouse.OverrideCursor` to `Cursors.Wait`. |
| `Dispose` | `public void Dispose()` | Restores the cursor by setting `Mouse.OverrideCursor` back to the saved `_previousCursor` value. |
### `App` Class (partial)
| Member | Signature | Description |
|--------|-----------|-------------|
| `IsoDb` | `public ISO13499FileDb IsoDb { get;

View File

@@ -0,0 +1,54 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Constants.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Enums.cs
generated_at: "2026-04-17T16:28:42.803827+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "9657b5b95f022b50"
---
# Classes
### Purpose
This module provides core constant and enumeration definitions for the DatabaseImport subsystem. It defines sentinel values for non-ISO test object handling, recording mode configurations, sensor compatibility levels, and an extensive taxonomy of test template tags used throughout the test configuration and execution pipeline.
### Public Interface
**`Constants` (static class)**
- `public const string NON_ISO_TESTOBJECT_CHANNEL_TYPE = "x_NonISOTestObjectType_x"` — Sentinel string value identifying non-ISO test object channel types.
- `public const string NON_ISO_TESTOBJECT_NAME = "x_NonISOTestObjectName_x"` — Sentinel string value identifying non-ISO test object names.
**`RecordingModes` (enum)**
- `CircularBuffer` — Recording mode using circular buffer, description "RecordingModes_CircularBuffer".
- `Recorder` — Standard recorder mode, description "RecordingModes_Recorder".
- `HybridRecorder` — Hybrid recorder mode, description "RecordingModes_HybridRecorder".
- Decorated with `[TypeConverter(typeof(EnumDescriptionTypeConverter))]` for description-based conversion.
**`IsoChannelSensorCompatibilityLevels` (enum)**
- `DontWarn` — No warning for compatibility issues.
- `Warn` — Warn on compatibility issues.
- `DontAllow` — Block on compatibility issues.
**`TestTemplateTags` (enum)**
- Extensive enumeration with 100+ values including: `UploadData`, `UploadExportsOnly`, `UploadFolder`, `CommonLine`, `AllCustomers`, `AllTestEngineers`, `AllLabs`, `Test`, `AllowMissingSensors`, `AllowSensorIdToBlankChannel`, `AutomaticProgression`, `AutomaticProgressionDelayMS`, `InvertTriggerCompletion`, `TriggerCheckStep`, `PostTestDiagnostics`, `TriggerCheckRealtime`, `InvertStartRecordCompletion`, `ViewDiagnostics`, `VerifyChannels`, `AutoVerifyProgress`, `AutoVerifyDelaySeconds`, `TestGraphs`, `GraphCount`, `Name`, `TestId`, `SetupFile`, `Description`, `AvailableTestObjects`, `SamplesPerSecond`, `SampleRateText`, `PreTriggerSeconds`, `PostTriggerSeconds`, `RecordingMode`, `RecordingModeText`, `StrictDiagnostics`, `TestObjects`, `AllTestObjects`, `SysBuiltTestObjects`, `RequireUserConfirmationOnErrors`, `DoROIDownload`, `ROIButtonVisibility`, `ViewROIDownload`, `ViewROIDownloadButtonVisibility`, `DownloadAll`, `DownloadAllButtonVisibility`, `ViewRealtime`, `ViewRealtimeButtonVisibility`, `RegionsOfInterest`, `ROIStart`, `ROIEnd`, `ViewDownloadAll`, `ViewDownloadAllButtonVisibility`, `ViewExport`, `ViewExportButtonVisibility`, `ExportFormats`, `DownloadFolder`, `ExportFolder`, `SameAsDownloadFolder`, `TestTime`, `LabDetails`, `CustomerDetails`, `TestEngineerDetails`, `DefaultNumberRealtimeGraphs`, `GraphDetailsVisibility`, `CurrentGraph`, `UseCustomerDetails`, `UseTestEngineerDetails`, `TurnOffExcitation`, `UseLabratoryDetails`, `TestDirectory`, `OriginalTestDirectory`, `LocalOnly`, `LastModified`, `LastMmodifiedBy`, `ExpressTestSetup`, `EW`, `ExcitationWarmupTimeMS`, `ArmCheckListStep`, `CheckListBatteryVoltageCheck`, `CheckListInputVoltageCheck`, `CheckListSquibResistanceCheck`, `CheckListSensorIDCheck`, `CheckListTriggerStartCheck`, `CheckListMustPass`, `WarnOnFailedBattery`, `HardwareOverrides`, `DoAutoArm`, `SysBuiltTestObjectTypes`, `AddedGroupRemoved`, `CheckoutMode`, `QuitTestWithoutWarning`, `SuppressMissingSensorsWarning`, `ISFFile`, `TestObjectsAndAddedGroups`, `NotAllChannelsRealTime`, `NotAllChannelsViewer`, `GroupsStepValid`.
**`StrictLevel` (enum)**
- `Strict` — Strict validation mode.
- `UpdateTable` — Update table mode.
### Invariants
- The sentinel constants `NON_ISO_TESTOBJECT_CHANNEL_TYPE` and `NON_ISO_TESTOBJECT_NAME` use distinctive `x_..._x` delimiters to avoid collision with legitimate values.
- `RecordingModes` values are paired with description strings via `[Description]` attributes; the `EnumDescriptionTypeConverter` must be available at runtime for proper conversion.
- `TestTemplateTags` enum values map to configuration keys/tags; the enum serves as a type-safe accessor for template properties.
### Dependencies
- **Depends on**: `System`, `System.ComponentModel` (for `TypeConverter` and `DescriptionAttribute`).
- **Depended on by**: Unclear from source alone; likely consumed by test configuration, validation, and database import logic throughout the DatabaseImporter module.
### Gotchas
- The `TestTemplateTags` enum contains a typo: `UseLabratoryDetails` (should be "Laboratory"). This typo may be persisted in configuration files or databases.
- The `LastMmodifiedBy` tag has a typo (double 'm'). This may affect configuration key lookups.
- The sentinel values in `Constants` use `x_` prefix and `_x` suffix pattern; code matching these values must use exact string comparison.
---

View File

@@ -0,0 +1,85 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Hardware/DASSettings.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Hardware/HardwareChannel.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Hardware/DASHardwareList.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Hardware/DASHardware.cs
generated_at: "2026-04-17T15:53:46.839159+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ab5877b874f4b126"
---
# Documentation: DatabaseImport Hardware Classes
## 1. Purpose
This module provides data structures for representing Data Acquisition System (DAS) hardware configuration within the DatabaseImport subsystem. It models the hierarchical relationship between DAS hardware units, their individual channels, and associated settings. These classes serve as in-memory representations of hardware state, supporting serialization to database tables (e.g., `tblTestSetupDASSettings`) and facilitating hardware comparison, caching, and lookup operations during database import processes.
---
## 2. Public Interface
### DASSettings
A POCO class for storing DAS-specific test configuration settings.
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `DASSerialNumber` | `string` | Serial number identifier for the DAS unit |
| `SampleRate` | `double` | Sampling rate configuration |
| `ExcitationWarmupTimeMS` | `int` | Excitation warmup time in milliseconds |
| `HardwareAAF` | `double` | Hardware Anti-Aliasing Filter setting |
| `PreTriggerSeconds` | `double` | Pre-trigger duration in seconds |
| `PostTriggerSeconds` | `double` | Post-trigger duration in seconds |
| `StatusLineCheck` | `bool` | Whether status line checking is enabled |
| `BatteryCheck` | `bool` | Whether battery checking is enabled |
| `InputVoltageMin` | `double` | Minimum input voltage threshold |
| `InputVoltageMax` | `double` | Maximum input voltage threshold |
| `BatteryVoltageMin` | `double` | Minimum battery voltage threshold |
| `BatteryVoltageMax` | `double` | Maximum battery voltage threshold |
---
### HardwareChannel
Represents a single channel on a DAS hardware unit. Implements `IComparable<HardwareChannel>` and `IHardwareChannel`.
**Constructors:**
```csharp
public HardwareChannel(HardwareChannel copy) // Copy constructor
public HardwareChannel(ISO.HardwareChannel channel, DASHardware hardware)
```
**Properties:**
| Property | Type | Access |
|----------|------|--------|
| `Hardware` | `DASHardware` | Read-only |
| `ChannelNumber` | `int` | Read-only (default: 0) |
| `Sensor` | `SensorData` | Read/write (nullable) |
**Methods:**
```csharp
public ISO.HardwareChannel GetISOChannel() // Returns the underlying ISO channel
public string GetId() // Returns composite ID: "{hardwareId}x{channelNumber+1}"
public int CompareTo(HardwareChannel right) // Compares by DASDisplayOrder, then ChannelIdx
public bool IsSupportedBridgeType(Test.Module.Channel.Sensor.BridgeType bridgeType)
```
---
### DASHardwareList
Singleton class providing hardware lookup and caching functionality.
**Static Methods:**
```csharp
public static DASHardwareList GetList() // Returns singleton instance
```
**Instance Methods:**
```csharp
public void ReloadAll() // Currently a no-op (implementation commented out)
public DASHardware GetHardware(string id, bool bUseCache = true)
public DASHardware GetHardware(string id,

View File

@@ -0,0 +1,180 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/RegionsAndZones/Zone.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/RegionsAndZones/RegionAdorner.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/RegionsAndZones/Region.cs
generated_at: "2026-04-17T15:55:45.702453+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "7030e77345a741e1"
---
# Documentation: RegionsAndZones Module
## 1. Purpose
This module provides the data structures and visual components for defining geographical regions within zones for test object templates in a database import system. It enables users to draw, configure, and persist rectangular regions on zone images, associating each region with ISO-standardized metadata (directions, filter classes, locations, positions) and filtering channels based on those properties. The module bridges the gap between visual region selection (via WPF adorners) and the underlying ISO database representation.
---
## 2. Public Interface
### Zone Class (`Zone.cs`)
**Constructors:**
- `Zone(Zone copy, TestObjectTemplate template)` — Copy constructor that clones regions from an existing Zone and initializes from `ISODllZone` properties.
- `Zone(TemplateZone z, TestObjectTemplate template)` — Primary constructor that initializes a Zone from a `TemplateZone`, loads the associated picture from disk, and creates `Region` instances from `TemplateRegion` children.
**Properties:**
- `string Name { get; set; }` — Zone name, sourced from `ISODllZone.ZoneName`.
- `string Description { get; set; }` — Zone description.
- `string Image { get; set; }` — Image filename (not full path).
- `TemplateZone ISODllZone { get; }` — Read-only reference to the underlying ISO template zone.
- `string[] AllPictures { get; }` — Returns sorted list of all available picture filenames from the `ZonePictures` directory. Thread-safe via locking.
- `int PictureIndex { get; set; }` — Index into `AllPictures`; setting this loads the corresponding image into `PictureSource`. Setting to a negative value clears `PictureSource`.
- `System.Windows.Media.ImageSource PictureSource { get; set; }` — The loaded bitmap image for display.
- `Region[] Regions { get; set; }` — Array of regions belonging to this zone.
**Methods:**
- `void PopulateFilenamesIfNeeded()` — Thread-safe lazy initialization of the picture file list.
- `string GetPictureName()` — Returns the filename of the currently selected picture, or empty string if `PictureIndex < 0`.
**Nested Types:**
- `FileInfoComparer : IComparer<System.IO.FileInfo>` — Ordinal comparison of file paths for sorting.
---
### RegionAdorner Class (`RegionAdorner.cs`)
Inherits from `Adorner`, implements `INotifyPropertyChanged`.
**Constructors:**
- `RegionAdorner(UIElement adornedElement, TestObjectTemplate template, Contexts context)` — Creates an adorner bound to the specified element, initializes a new `Region`, and attaches mouse event handlers.
**Properties:**
- `Region MyRegion { get; set; }` — The region data model associated with this adorner.
- `Rect SelectRect { get; set; }` — The selection rectangle in adorned element coordinates. Setting this updates `MyRegion.RegionUpperLeft` and `MyRegion.RegionBottomRight` via coordinate transformation.
- `bool IsNew { get; set; }` — Indicates whether this is a new region being drawn. Toggles visibility of add/delete controls on `MyRegion`.
- `Point AnchorPoint { get; set; }` — Starting point for drawing operations.
- `Contexts Context { get; set; }` — Editing context (EditTestObject or EditTestObjectTemplate).
**Events:**
- `event RegionSelectedHandler OnRegionSelected` — Raised on left mouse button down.
- `event EndSelectionHandler OnEndSelection` — Raised when mouse capture is released.
**Methods:**
- `Point GetUpperLeft()` — Transforms `SelectRect.TopLeft` from measured coordinates to actual image coordinates.
- `Point GetLowerRight()` — Transforms `SelectRect.BottomRight` from measured coordinates to actual image coordinates.
- `void DrawSelection(object sender, MouseEventArgs e, UIElement adornedElement)` — Updates `SelectRect` based on mouse drag from `AnchorPoint`.
- `void MoveSelection(object sender, MouseEventArgs e, UIElement adornedElement)` — Moves an existing `SelectRect` by mouse delta.
- `void EndSelection(object sender, MouseButtonEventArgs e)` — Releases mouse capture and raises `OnEndSelection`.
**Nested Types:**
- `enum Contexts { EditTestObject, EditTestObjectTemplate }` — Editing mode enumeration.
---
### Region Class (`Region.cs`)
**Constructors:**
- `Region(RegionAdorner adorner, TestObjectTemplate template)` — Creates a new region with default name/description, bound to an adorner.
- `Region(TestObjectTemplate template, TemplateRegion r)` — Reconstructs a region from a persisted `TemplateRegion`, loading all ISO metadata references.
**Properties (Identity):**
- `string RegionName { get; set; }`
- `string RegionDescription { get; set; }`
- `TestObjectTemplate Template { get; set; }`
**Properties (Coordinates):**
- `Point RegionUpperLeft { get; set; }`
- `Point RegionBottomRight { get; set; }`
**Properties (ISO Metadata):**
- `MMEDirections RegionDirection { get; set; }`
- `MMEFilterClasses RegionFilterClass { get; set; }`
- `MMEFineLocations1 RegionFineLocation1 { get; set; }`
- `MMEFineLocations2 RegionFineLocation2 { get; set; }`
- `MMEFineLocations3 RegionFineLocation3 { get; set; }`
- `MMETransducerMainLocation RegionMainLocation { get; set; }`
- `MMEPhysicalDimensions RegionPhysicalDimension { get; set; }`
- `MMEPositions RegionPosition { get; set; }`
- `MMETestObjects RegionTestObject { get; set; }`
- `string ISOCode { get; set; }` — Computed ISO code string (16 characters).
**Properties (Available Options):**
Each ISO metadata type has corresponding `All*` and `All*Strings` properties for UI binding:
- `MMEDirections[] AllDirections`, `string[] AllDirectionsStrings`
- `MMEFilterClasses[] AllFilterClasses`, `string[] AllFilterClassStrings`
- `MMEFineLocations1[] AllFineLocations1`, `string[] AllFineLocations1Strings`
- `MMEFineLocations2[] AllFineLocations2`, `string[] AllFineLocations2Strings`
- `MMEFineLocations3[] AllFineLocations3`, `string[] AllFineLocations3Strings`
- `MMETransducerMainLocation[] AllMainLocations`, `string[] AllMainLocationsStrings`
- `MMEPhysicalDimensions[] AllPhysicalDimensions`, `string[] AllPhysicalDimensionStrings`
- `MMEPositions[] AllPositions`, `string[] AllPositionStrings`
**Properties (Channels):**
- `TestObjectTemplateChannel[] RegionChannels { get; set; }` — Filtered channel list based on region ISO settings.
- `TemplateChannelUI[] RegionUIChannels { get; set; }` — Corresponding UI channel wrappers.
**Properties (UI State):**
- `Visibility RegionAddVisibility { get; set; }` — Defaults to `Visible`.
- `Visibility RegionDeleteVisibility { get; set; }` — Defaults to `Hidden`.
**Methods:**
- `TemplateRegion ToISORegion(TestObjectTemplate template, Zone zone, int number)` — Serializes this region to a `TemplateRegion` for persistence.
---
## 3. Invariants
1. **Picture Index Validity**: `PictureIndex` is always in the range `[-1, AllPictures.Length - 1]`. A value of `-1` indicates no picture is selected and `PictureSource` is `null`.
2. **Thread Safety on Picture Loading**: All access to `_fileNames` in `Zone` is protected by `lock(MyLock)`. The static lock object ensures consistency across all `Zone` instances.
3. **Region-Adorner Binding**: When a `Region` is created via `Region(RegionAdorner, TestObjectTemplate)`, the `_adorner` field is set and used for `InvalidateVisual()` calls. When created via `Region(TestObjectTemplate, TemplateRegion)`, `_adorner` remains `null`.
4. **ISO Code Format**: `ISOCode` is always a 16-character string constructed via `ISO.IsoCode.GetString()` with fallback values ("?", "??", "????") for null properties.
5. **Coordinate Transformation**: `RegionAdorner.GetUpperLeft()` and `GetLowerRight()` return `(0,0)` if the adorned element is not an `Image` or has no `Source`.
6. **Channel Filtering Consistency**: `FilterRegionChannels()` removes channels that do not match the current ISO metadata selections. Channels are filtered in reverse order to safely remove while iterating.
---
## 4. Dependencies
### This module depends on:
- **WPF Assemblies**: `System.Windows`, `System.Windows.Controls`, `System.Windows.Documents`, `System.Windows.Input`, `System.Windows.Media`, `System.Windows.Shapes`
- **System I/O**: `System.IO.File`, `System.IO.Directory`, `System.IO.FileInfo`, `System.IO.Path`
- **External Types** (defined elsewhere in the codebase):
- `TestObjectTemplate` — Template container for test objects
- `TestObjectTemplateChannel` — Channel definition within templates
- `TemplateChannelUI` — UI wrapper for channels
- `TemplateZone` — ISO DLL zone representation
- `TemplateRegion` — Persisted region data
- `MMEDirections`, `MMEFilterClasses`, `MMEFineLocations1/2/3`, `MMETransducerMainLocation`, `MMEPhysicalDimensions`, `MMEPositions`, `MMETestObjects` — ISO metadata types
- `ISO.IsoCode` — ISO code string builder
- `App` (Application subclass) — Provides `IsoDb` property for database lookups
### What depends on this module:
- Cannot be determined from source alone; likely consumed by UI components for zone/region editing workflows.
---
## 5. Gotchas
1. **Hardcoded Picture Directory**: The `ZonePictures` directory path is constructed using `AppDomain.CurrentDomain.BaseDirectory`. This assumes the directory exists and is writable. No error handling for missing directory in `PopulateFilenames()`.
2. **BitmapImage Initialization in Constructor**: The `Zone(TemplateZone, TestObjectTemplate)` constructor wraps `BitmapImage` initialization in a try/catch that silently sets `PictureIndex = -1` on failure. The image load failure is not logged or surfaced.
3. **Commented-Out BasePropertyChanged Inheritance**: All three classes have commented-out `: BasePropertyChanged` inheritance, suggesting a refactoring or migration away from a common base class. This may indicate incomplete property change notification.
4. **Commented-Out Event Subscription**: In `Region.Template` setter and constructor, the `Template_PropertyChanged` subscription is commented out, but the handler method `Template_PropertyChanged` remains. This is dead code.
5. **Inconsistent Null Handling in Coordinate Transformation**: `GetUpperLeft()` returns `SelectRect.TopLeft` if the adorned element is not an `Image`, but `GetLowerRight()` returns `new Point(0, 0)` in the same scenario. This asymmetry could cause unexpected behavior.
6. **Application.Current Cast Without Null Check**: `Region.DetermineAvailableISOSettings()` uses `(Application.Current as App).IsoDb` without null checking. Will throw if called from a non-WPF context or before application initialization.
7. **Magic Strings for ISO Defaults**: Default/fallback values ("?", "??", "????") are hardcoded in multiple places (`SetISOCode`, `DetermineAvailableISOSettings`, `FilterRegionChannels`). These should be constants.
8. **Index Tracking Without Validation**: Properties like `RegionDirection` set `_directionIndex` based on list lookup, but if the value is not found in the list, the index behavior is undefined (would be `-1` from `IndexOf`).

View File

@@ -0,0 +1,50 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Sensors/ZeroMethod.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/Sensors/InitialOffset.cs
generated_at: "2026-04-17T16:12:18.709203+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "cb2911eb84adcb4a"
---
# Sensors
### Purpose
This module contains data structures representing sensor calibration and configuration parameters, specifically `ZeroMethod` and `InitialOffset`. It handles the parsing, storage, and change notification for sensor zeroing methods and initial engineering unit offsets.
### Public Interface
* **`ZeroMethod`**: A class implementing `INotifyPropertyChanged` to represent a sensor zeroing configuration.
* `ZeroMethod(ZeroMethodType zm, double start, double end)`: Constructor initializing method type and range.
* `ZeroMethod(string zm)`: Constructor that parses a comma-separated string to initialize the object.
* `ZeroMethod(ZeroMethod copy)`: Deep copy constructor.
* `event PropertyChangedEventHandler PropertyChanged`: Event raised when a property value changes.
* `ZeroMethodType Method { get; set; }`: The type of zeroing method.
* `double Start { get; set; }`: The start value for the zeroing range.
* `double End { get; set; }`: The end value for the zeroing range.
* **`InitialOffset`**: A class representing an initial offset in Engineering Units (EU), supporting different calculation forms.
* `InitialOffset()`: Default constructor (sets `Form` to `None`).
* `InitialOffset(double d)`: Constructor for legacy format (sets `Form` to `EU`).
* `InitialOffset(InitialOffset copy)`: Deep copy constructor.
* `void FromDbSerializeString(string input)`: Deserializes the object from a string format used for database storage.
* `enum Forms`: Defines the offset format (`None = 0`, `EU = 1`, `EUAtMV = 2`).
* `Forms Form { get; set; }`: The format of the current instance.
* `double EU { get; set; }`: The Engineering Unit value.
* `double MV { get; set; }`: The millivolt (mV) value (used only when `Form` is `EUAtMV`).
### Invariants
* **`ZeroMethod`**: When parsing via the string constructor, the invariant culture is used. If fewer than 3 tokens are present, the method returns without setting properties.
* **`InitialOffset`**: When `Form` is `EUAtMV`, the `EU` property represents the value observed at `MV`, not the final offset (calculation required elsewhere).
* **`InitialOffset`**: The `FromDbSerializeString` method expects exactly 3 tokens separated by the invariant culture list separator for valid forms; otherwise, it throws `InvalidDataException` or `FormatException`.
### Dependencies
* **Depends on**:
* `System`
* `System.ComponentModel` (for `INotifyPropertyChanged`)
* `System.Globalization` (for `CultureInfo.InvariantCulture`)
* `System.IO` (for `InvalidDataException`)
* **Dependents**: Unknown (consumers not present in provided source).
### Gotchas
* **Silent Failure in `ZeroMethod`**: The `Initialize` method in `ZeroMethod` silently returns (doing nothing) if the input string has fewer than 3 tokens, potentially leaving the object in an uninitialized/default state without throwing an exception.
* **Parsing Culture**: Both classes rely heavily on `CultureInfo.InvariantCulture

View File

@@ -0,0 +1,65 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestMetaData/LabratoryDetails.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestMetaData/CustomerDetails.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestMetaData/TestEngineerDetails.cs
generated_at: "2026-04-17T16:44:34.283612+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2e1e8d7dd687d918"
---
# Documentation: TestMetaData Classes
## 1. Purpose
This module provides wrapper classes for test metadata entities (Laboratory, Customer, and Test Engineer details) within the `DatabaseImport` namespace. These classes serve as proxies to underlying `ISO` namespace types, exposing a simplified `Name` property interface. The module facilitates CRUD-like operations on test metadata, including singleton-based caching for test engineer records with thread-safe population and deletion capabilities.
---
## 2. Public Interface
### `LabratoryDetails`
A wrapper class for `ISO.LabratoryDetails`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `Name` | `string` (get/set) | Gets or sets the laboratory name by delegating to the underlying `ISO.LabratoryDetails.Name`. |
**Note:** The class contains a `readonly` field `_lab` of type `ISO.LabratoryDetails`, but no constructor is visible in the source. Initialization behavior is unclear.
---
### `LabratoryDetailsList`
A static utility class for laboratory collection operations.
| Member | Signature | Description |
|--------|-----------|-------------|
| `DeleteAll` | `static void DeleteAll()` | Deletes all laboratory details by calling `ISO.LabratoryDetails.DeleteLabratoryDetails()`. |
---
### `CustomerDetails`
A wrapper class for `ISO.CustomerDetails`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `Name` | `string` (get/set) | Gets or sets the customer name by delegating to the underlying `ISO.CustomerDetails.Name`. |
**Note:** The class contains a `readonly` field `_customerDetails` of type `ISO.CustomerDetails`, but no constructor is visible in the source. Initialization behavior is unclear.
---
### `CustomerDetailsList`
A static utility class for customer collection operations.
| Member | Signature | Description |
|--------|-----------|-------------|
| `DeleteAll` | `static void DeleteAll()` | Deletes all customer details by calling `ISO.CustomerDetails.DeleteCustomerDetails()`. |
---
### `TestEngineerDetails`
A wrapper class for `ISO.TestEngineerDetails`.
| Member | Signature | Description |

View File

@@ -0,0 +1,361 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TemplateChannelUI.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TestObjectTemplateCollection.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TestObjectList.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TestTestObject.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TestObjectTemplate.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestObject/TestObject.cs
generated_at: "2026-04-17T15:53:12.658358+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "3da6de582f653aae"
---
# TestObject Module Documentation
## 1. Purpose
This module provides the domain model for test objects (physical test groups) and their templates within the DatabaseImport subsystem. It manages the lifecycle, persistence, and configuration of test objects through an ISO 13499-compliant database layer. The module bridges between UI representations (`TemplateChannelUI`), business logic (`TestObject`, `TestTestObject`), template definitions (`TestObjectTemplate`), and the underlying ISO database storage, while supporting both ISO-standard and non-ISO test object configurations.
---
## 2. Public Interface
### TemplateChannelUI
**File:** `TemplateChannelUI.cs`
A GUI wrapper for template channels.
```csharp
public TemplateChannelUI(TestObjectTemplateChannel channel)
```
Constructs a wrapper containing the provided `TestObjectTemplateChannel`. The internal `_channel` field is private with no public accessor exposed in the source.
---
### TestObjectTemplateCollection
**File:** `TestObjectTemplateCollection.cs`
A singleton collection managing test object templates.
```csharp
public static TestObjectTemplateCollection TemplateCollection { get; }
```
Lazy-initialized singleton accessor. Not thread-safe (no lock on initialization).
```csharp
public void ReloadAll(bool loadSubComponents)
```
Currently empty implementation (logic commented out).
```csharp
public TestObjectTemplate GetTemplate(string templateId)
```
Retrieves a template by ID from the ISO database. Returns `null` if not found.
```csharp
public TestObjectTemplate SysBuiltTestObjectTemplate { get; }
```
Returns the system-built test object template (may be `null` as `_sysBuiltTestObjectTemplate` is never assigned in visible code).
```csharp
public static void DeleteAll()
```
Static method that deletes all templates via `DeleteAllTemplates()` and reinitializes the singleton instance.
---
### TestObjectList
**File:** `TestObjectList.cs`
A thread-safe singleton list managing test objects.
```csharp
public static TestObjectList TestObjectsList { get; }
```
Thread-safe singleton accessor using `lock(MyLock)`.
```csharp
public static TestObjectList AddedGroupsList { get; }
```
Separate thread-safe singleton for "added groups" (system-built test objects).
```csharp
public void ReloadAll(bool bLoadSubComponents)
```
Empty implementation.
```csharp
public TestObject GetTestObject(string serialNumber, bool bSysBuilt)
```
Retrieves a test object from the ISO database by serial number. Returns `null` if not found.
```csharp
public TestObject GetTestObject(string serialNumber)
```
Attempts retrieval with `bSysBuilt=false` first, then `bSysBuilt=true` if the first attempt returns `null`.
```csharp
public TestObject GetAddedGroup(string serialNumber)
```
Equivalent to `GetTestObject(serialNumber, true)`.
```csharp
public void DeleteAll()
```
Deletes all test objects via `ISO.TestObject.DeleteAllTestObjects()`. Exceptions are silently caught.
---
### TestTestObject
**File:** `TestTestObject.cs`
A test-specific test object with additional configuration, inheriting from `TestObject`.
```csharp
public TestTestObject(TestObject obj)
public TestTestObject(TestTestObject to)
```
Constructors that delegate to base `TestObject` constructor and copy metadata via `MetaCommonConstructor()`.
```csharp
public MMEPositions Position { get; set; }
```
Gets/sets the group position. Setting propagates position to all required sensors with non-empty serial numbers in the test object. Special handling for `UserSetKey` ("@") toggles UI visibility.
```csharp
public const string ChannelDefaultsKey = "#";
public const string UserSetKey = "@";
```
Constants for position key values.
```csharp
public Visibility GroupPositionComboBoxVisible { get; set; }
public Visibility GroupPositionButtonVisible { get; set; }
```
UI visibility properties that collapse to `Visibility.Collapsed` when `SerializedSettings.ISOSupportLevel == ISOSupportLevels.NO_ISO`.
```csharp
public MMETestObjects TestObject { get; set; }
```
Gets/sets the test object reference. Setting propagates `Test_Object` value to all required sensors.
```csharp
public int ChannelTypesIndex { get; set; }
```
Index for channel types selection.
```csharp
public void SetTestObject(string s)
public void SetPosition(string s)
```
Direct setters that update backing fields and raise `OnPropertyChanged`.
```csharp
public MMEPositions[] AvailablePositions { get; }
public MMEPositions[] AvailableGroupPositions { get; }
```
Returns available positions from the database. `AvailableGroupPositions` prepends `_channelDefaultsGUID`.
```csharp
public int ExcitationWarmupTimeMS { get; set; }
public double TargetSampleRate { get; set; }
public double PreTriggerSeconds { get; set; }
public double PostTriggerSeconds { get; set; }
```
Test-specific timing configuration properties.
---
### TestObjectTemplate
**File:** `TestObjectTemplate.cs`
Defines a template for creating test objects.
```csharp
public enum Tags { ChannelCountText, PossibleChannelCountText, TemplateName, ... }
```
Enum for property change notification identifiers.
```csharp
public TestObjectTemplate()
public TestObjectTemplate(TestObjectTemplate copy, ref ISO13499FileDb db)
public TestObjectTemplate(ISO.TestObjectTemplate template, ref ISO13499FileDb db)
```
Constructors: default, copy, and ISO-based initialization.
```csharp
public string LastModifiedBy { get; set; } = "N/A";
public DateTime LastModified { get; set; } = SqlDateTime.MinValue;
```
Audit metadata.
```csharp
public int CurrentZoneIndex { get; set; }
public Zone CurrentZone { get; set; }
```
Zone selection state.
```csharp
public List<TestObjectTemplateChannel> RequiredChannels { get; set; }
public TestObjectTemplateChannel[] TemplateAllChannels { get; set; }
public TemplateChannelUI[] TemplateAllUIChannels { get; set; }
public Zone[] TemplateZones { get; set; }
```
Channel and zone collections.
```csharp
public MMETestObjects TestObject { get; set; }
public string TestObjectType { get; set; }
public string[] AvailableTestObjectTypes { get; set; }
public int TestObjectTypeIndex { get; set; }
```
Test object type configuration.
```csharp
public static MMETestObjects GetNonISOTestObject()
```
Creates or retrieves a non-ISO test object, generating a unique single-character code (A-Z, then 0-9). Throws `NotSupportedException` if all codes are exhausted.
```csharp
public ISO.TestObjectTemplate ToISOTestObjectTemplate()
```
Converts this template to an ISO-compatible `ISO.TestObjectTemplate`.
---
### TestObject
**File:** `TestObject.cs`
Core class representing a physical test object/group.
```csharp
public enum Tags { SerialNumber, SerialNumberConverted, TestObjectType, ... }
```
Enum for property change notification identifiers.
```csharp
public TestObject()
public TestObject(TestObject copy)
public TestObject(ISO.TestObject to, bool sysBuilt)
```
Constructors: default, copy, and ISO-based.
```csharp
public void RefreshHardware()
```
Refreshes hardware collection from ISO test object.
```csharp
public SerializedSettings.ISOSupportLevels GetObjectISOLevel()
```
Returns `NO_ISO` if template type contains `NON_ISO_TESTOBJECT_CHANNEL_TYPE` or `NONISOCHANNELTYPE`; otherwise `ISO_ONLY`.
```csharp
public SensorData GetSensor(string channelId, string serialNumber, string alternateChannelId = null)
```
Retrieves sensor data with ISO settings applied. Falls back to `alternateChannelId` if primary lookup yields no settings. Applies filter class, position, polarity, range, timing, and mode settings from ISO sensor settings.
```csharp
public void SetSensor(string channelName, SensorData sensor)
```
Persists sensor settings to the ISO test object for all `ISO.TestObject.SensorSettings` enum values.
```csharp
public string SerialNumber { get; set; }
public string SerialNumberConverted { get; set; }
public string SerialNumberOrOriginalSerialNumber { get; }
public string DisplaySerialNumber { get; set; }
```
Serial number properties with embedded/original handling.
```csharp
public string TestSetupName { get; set; }
public string TestObjectType { get; set; }
public string ParentObject { get; set; }
public bool SysBuilt { get; set; }
```
Core metadata properties.
```csharp
public DASHardware[] Hardware { get; }
public bool ContainsHardware(DASHardware h)
public void SetHardwareFromISO()
public void SetHardware(DASHardware[] hardware)
public void AddHardware(DASHardware hardware)
```
Hardware management. `AddHardware` handles dummy hardware by appending `(01)`, `(02)`, etc. suffixes to avoid collisions.
```csharp
public ISO.TestObject GetISOTestObject()
```
Returns the underlying ISO test object.
```csharp
public TestObjectTemplate Template { get; set; }
public void SetTemplateDontResetISOObject(TestObjectTemplate value)
```
Template management. `SetTemplateDontResetISOObject` avoids full ISO template reset.
```csharp
public string[] ZoneNames { get; set; }
public string TemplateType { get; }
```
Zone and template type accessors.
---
## 3. Invariants
1. **Singleton Initialization**: `TestObjectTemplateCollection.TemplateCollection` and `TestObjectList.TestObjectsList` are lazily initialized and, once created, return the same instance until explicitly reset (via `DeleteAll()` for templates).
2. **Thread Safety**: `TestObjectList` singleton access uses `lock(MyLock)`; `TestObjectTemplateCollection` does not.
3. **Hardware Uniqueness**: Within a `TestObject`, hardware is stored in a `Dictionary<string, DASHardware>` keyed by `SerialNumber`. `AddHardware` will not add duplicate serial numbers.
4. **Dummy Hardware Naming**: When adding dummy hardware with a conflicting serial number, the system appends `(NN)` suffixes starting at `(01)`.
5. **ISO Object Synchronization**: Setting `TestObject.SerialNumber`, `TestObject.ParentObject`, or `TestObject.Template` updates the underlying `_isoTestObject` accordingly.
6. **Position Propagation**: In `TestTestObject`, setting `Position` or `TestObject` propagates the value to all required sensors with non-empty serial numbers.
7. **Filter Class Fallback**: In `GetSensor()`, if `FilterClassIso` is `"?"`, it defaults to `"P"` (Prefiltered/Unfiltered).
---
## 4. Dependencies
### This module depends on:
- **System namespaces**: `System`, `System.Collections.Generic`, `System.Linq`, `System.Globalization`, `System.Data.SqlTypes`, `System.Windows`
- **ISO Database Layer**: `ISO.TestObject`, `ISO.TestObjectTemplate`, `ISO13499FileDb`, `ISO.TestObject.SensorSettings`, `ISO.TestObject.SensorSetting`, `TemplateZone`
- **Application Layer**: `App` (accessed via `Application.Current as App`), `App.IsoDb`
- **Domain Types**: `MMEPositions`, `MMETestObjects`, `MMEPossibleChannels`, `Zone`, `DASHardware`, `DASHardwareList`, `SensorData`, `SensorsCollection`, `FilterClass`, `DigitalOutputModes`, `SquibFireMode`, `DigitalInputModes`
- **Configuration**: `SerializedSettings.ISOSupportLevels`
- **Constants**: `Constants.NON_ISO_TESTOBJECT_NAME`, `Constants.NON_ISO_TESTOBJECT_CHANNEL_TYPE`
- **Base Classes**: `DbTimeStampBase` (inherited by `TestObject`)
### What depends on this module:
- Cannot be determined from source alone; however, the public singletons (`TestObjectTemplateCollection.TemplateCollection`, `TestObjectList.TestObjectsList`) suggest external consumers access templates and test objects through these entry points.
---
## 5. Gotchas
1. **Commented-Out Code**: `TestObjectTemplateCollection.ReloadAll()` and `TestObjectList.ReloadAll()` have empty implementations with commented-out logic. Calling these methods does nothing.
2. **Non-Thread-Safe Singleton**: `TestObjectTemplateCollection.TemplateCollection` uses `volatile` but no `lock`, unlike `TestObjectList` which is properly thread-safe.
3. **SysBuiltTestObjectTemplate Always Null**: The `_sysBuiltTestObjectTemplate` field is declared but never assigned in the visible source, so `SysBuiltTestObjectTemplate` will always return `null`.
4. **Silent Exception Swallowing**: `DeleteAll()` methods in both `TestObjectTemplateCollection` and `TestObjectList` catch and silently ignore all exceptions.
5. **GetNonISOTestObject Code Exhaustion**: If all single-character codes (A-Z, 0-9) are exhausted, `GetNonISOTestObject()` throws `NotSupportedException` with message `"TestObjectTemplate_CouldNotCreateNONISOTESTOBJECT"`.
6. **DisplaySerialNumber Side Effect**: Setting `DisplaySerialNumber` assumes the object is an "Added Group" and modifies `SerialNumber`, `SerialNumberConverted`, `OriginalSerialNumber`, and `OriginalTemplateName` in a specific pattern.
7. **Channel ID vs Channel Name**: `GetSensor()` accepts both `channelId` and `alternateChannelId` because, per the source comment (fogbugz 11910), channel name and channel ID were alternately used for sensor lookups.
8. **ISO Support Level Affects UI Visibility**: `TestTestObject.GroupPositionComboBoxVisible` and `GroupPositionButtonVisible` return `Visibility.Collapsed` when `ISOSupportLevel == NO_ISO`, regardless of their backing field values.
9. **Hardware Dictionary Keyed by SerialNumber**: `TestObject._hardware` is keyed by serial number, not hardware ID. Two hardware items with different IDs but the same serial number cannot coexist in the same test object.

View File

@@ -0,0 +1,120 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestTemplate/ICachedContainer.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestTemplate/HardwareInclusionInstruction.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestTemplate/TestTemplateLite.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestTemplate/RegionOfInterest.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Classes/TestTemplate/TestTemplateList.cs
generated_at: "2026-04-17T15:52:00.688061+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "580aa33f674a5152"
---
# Documentation: DatabaseImport.TestTemplate Namespace
## 1. Purpose
This module provides classes and interfaces for managing test templates, hardware configuration, and sensor settings within the DatabaseImport system. It handles the definition of test setups (via `TestTemplateLite`), regions of interest for data analysis, hardware inclusion rules for test configurations, and cached hardware lookups. The module serves as a bridge between database-stored test configurations and runtime test execution, supporting both lightweight test setup representations and full template management through a singleton list pattern.
---
## 2. Public Interface
### ICachedContainer (Interface)
**Namespace:** `DatabaseImport`
```csharp
DASHardware GetCachedHardware(string serialNumber);
IISOHardware[] GetAllCachedHardware();
```
- **GetCachedHardware**: Retrieves a single `DASHardware` instance by serial number from cache.
- **GetAllCachedHardware**: Returns an array of all cached `IISOHardware` instances.
---
### HardwareInclusionInstruction (Class)
**Namespace:** `DatabaseImport`
```csharp
public HardwareInclusionInstruction(string hardwareId, Actions action)
```
**Properties:**
- `string HardwareId { get; }` - Identifier for the hardware item.
- `Actions Action { get; }` - The inclusion action to perform.
**Nested Enum:**
- `Actions.Remove` - Exclude hardware that would otherwise be included by group membership.
- `Actions.Add` - Include hardware that would not otherwise be included by group membership.
---
### TestTemplateLite (Class)
**Namespace:** `DatabaseImport`
**Implements:** `ITestSetup`
**Properties:**
- `string Name { get; set; }` - Test setup name.
- `string Description { get; set; }` - Default: empty string.
- `RecordingModes RecordingMode { get; set; }` - Recording mode selection.
- `double PreTriggerSeconds { get; set; }` - Returns `0D` when `RecordingMode` is `Recorder` or `HybridRecorder`; otherwise returns the private `_preTriggerSeconds` value.
- `string ErrorMessage { get; set; }` - Error message string.
- `string CompletionErrorMessage { get; }` - Read-only; returns `ErrorMessage` truncated to 250 characters if longer.
- `double PostTriggerSeconds { get; set; }` - Post-trigger duration.
- `DateTime LastModified { get; set; }` - Modification timestamp.
- `string LastModifiedBy { get; set; }` - User who last modified the setup.
- `bool IsComplete { get; set; }` - Completion status flag.
---
### RegionOfInterest (Class)
**Namespace:** `DatabaseImport`
**Implements:** `INotifyPropertyChanged`
**Attribute:** `[Serializable]`
**Constructors:**
```csharp
public RegionOfInterest()
public RegionOfInterest(bool isDefault = false)
public RegionOfInterest(string suffix = "", bool isDefault = false, double start = -1D, double end = 1D)
```
**Properties:**
- `string Suffix { get; set; }` - Auto-prefixed with `"_"` if not already present; empty/whitespace-only values are handled specially.
- `double Start { get; set; }` - Region start time; constrained to be less than `End` and greater than or equal to `PreTrigger`.
- `double End { get; set; }` - Region end time; constrained to be greater than `Start` and less than or equal to `PostTrigger`.
- `double PreTrigger { get; set; }` - Pre-trigger boundary; setting this updates `Start` if `Start < PreTrigger`.
- `double PostTrigger { get; set; }` - Post-trigger boundary; setting this updates `End` if `End > PostTrigger`.
- `bool IsEnabled { get; set; }` - Default: `true`.
- `bool IsDefault { get; private set; }` - Set via constructor only.
**Event:**
- `event PropertyChangedEventHandler PropertyChanged` - Raised on property changes.
---
### TestTemplateList (Class)
**Namespace:** `DatabaseImport`
**Singleton Access:**
```csharp
public static TestTemplateList TestTemplatesList { get; }
```
**Properties:**
- `TestTemplate TemporaryTemplate { get; set; }` - Holds a template in memory without committing to database.
**Static Methods:**
```csharp
public static SensorData GetSensorFromSettings(string settings, string serial)
public static SensorData GetSensorFromSettings(string settings, string serial, Dictionary<string, SensorData> lookup)
public static string GetSensorSettings(SensorData sd)
public static bool SysBuiltObject(string serialNumber)
public static void ConvertToDictionary(DataTable dt, ref Dictionary<string, List<Dictionary<string, object>>> lookup, string key)
```
**Instance Methods:**
```csharp
public void Reload()
public void DeleteAll

View File

@@ -0,0 +1,32 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Controls/SensorsAndModels/ImportSensorsImportControl.cs
generated_at: "2026-04-17T15:59:41.103394+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "a1d05ecf81eb6d1b"
---
# Documentation: ImportSensorsImportControl.cs
## 1. Purpose
This module provides database cleanup functionality for the DatabaseImporter system, specifically for clearing application data tables during TDM export operations. It serves as a WPF UserControl that orchestrates the deletion of test templates, test objects, sensors, sensor models, calibrations, customer details, and various database entities. The module supports two modes: a basic clear operation and an extended database import mode that also removes users, tags, UI items, locked items, and historical database versions.
---
## 2. Public Interface
### `public static void ClearAllTables(bool clearForDbImport)`
Clears all major application data tables. When `clearForDbImport` is `true`, performs additional cleanup including DAS tables, locked items, users, tags, UI items, and old database versions. When `false`, only clears the core application collections.
**Signature:**
```csharp
public static void ClearAllTables(bool clearForDbImport)
```
### `public static List<string[]> GetAllUsers()`
Retrieves all users from the database using the `sp_UserGet` stored procedure. Returns a list of string arrays, each containing user fields: ID, UserName, DisplayName, Password, Role, LastModified, LastModifiedBy, and LocalOnly.

View File

@@ -0,0 +1,60 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Controls/TestSetups/ImportTestSetup.cs
generated_at: "2026-04-17T16:00:10.803585+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "fc36fa53e2d8d797"
---
# Documentation: ImportTestSetup.cs
## 1. Purpose
`ImportTestSetup` is a WPF `UserControl` that handles importing test setup configuration data from XML into a SQL Server database. It serves as the import orchestrator for the DatabaseImport module, parsing XML elements and routing them to appropriate stored procedures. The module maintains static collections of imported entities (sensors, calibrations, customers, labs, test setups, etc.) and supports versioned import logic to handle different file format versions.
## 2. Public Interface
### Public Static Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `ProcessRootNode` | `void ProcessRootNode(string name, string outerXML, DbImporter.SetStatusDelegate SetStatus)` | Routes XML root elements to appropriate import handlers based on element name. Dispatches to `ImportElement` with corresponding stored procedure names. |
### Public Static Collections (Read-only Fields)
| Field | Type | Description |
|-------|------|-------------|
| `Directions` | `List<MMEDirections>` | Custom ISO direction fields |
| `FilterClasses` | `List<MMEFilterClasses>` | Custom filter class fields |
| `FineLoc1s` | `List<MMEFineLocations1>` | Fine location 1 fields |
| `FineLoc2s` | `List<MMEFineLocations2>` | Fine location 2 fields |
| `FineLoc3s` | `List<MMEFineLocations3>` | Fine location 3 fields |
| `MainLocs` | `List<MMETransducerMainLocation>` | Transducer main location fields |
| `TestObjects` | `List<MMETestObjects>` | Test object fields |
| `PhysicalDimensions` | `List<MMEPhysicalDimensions>` | Physical dimension fields |
| `Positions` | `List<MMEPositions>` | Position fields |
| `Calibrations` | `List<SensorCalibration>` | Sensor calibration histories |
| `CustomerDetails` | `List<ISO.CustomerDetails>` | Customer detail records |
| `LabDetails` | `List<ISO.LabratoryDetails>` | Laboratory detail records |
| `Sensors` | `List<SensorData>` | Sensor data records |
| `_testSetups` | `List<TestTemplate>` | Test setup templates (public despite underscore prefix) |
### Public Enum
```csharp
public enum PossibleStatus
{
Waiting,
Working,
Done,
Failed
}
```
## 3. Invariants
- **Version Constant**: `CurrentVersion` is always `2.0D`.
- **Command Timeout**: All stored procedure executions use a 60-second command timeout.
- **XML Wrapping**: All XML passed to stored procedures is wrapped with outer element tags: `"<" + outerElementName + ">" + outerXML + "</" + outerElementName + ">"`.
- **Collection State**: All static collections must be

View File

@@ -0,0 +1,30 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Converters/EnumDescriptionTypeConverter.cs
generated_at: "2026-04-17T16:29:45.029341+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b3c152d40e6fbba4"
---
# Converters
### Purpose
This module provides WPF data binding converters for the DatabaseImporter subsystem. The `EnumDescriptionTypeConverter` class enables display of enum description attributes instead of raw enum values in UI bindings, improving user-facing representation of enumerated types.
### Public Interface
**`EnumDescriptionTypeConverter`** (inherits from `EnumConverter`)
- `public EnumDescriptionTypeConverter(Type type)` — Constructor that accepts the enum `Type` to be converted and passes it to the base `EnumConverter` constructor.
### Invariants
- The converter must be instantiated with a valid enum `Type`; behavior is undefined for non-enum types (delegated to base `EnumConverter` behavior).
### Dependencies
- **Depends on**: `System`, `System.ComponentModel` (specifically `EnumConverter`).
- **Depended by**: Unclear from source alone; likely used in WPF XAML bindings within the DatabaseImporter module.
### Gotchas
- The class contains no overridden conversion methods (e.g., `ConvertTo`, `ConvertFrom`). The actual description-display logic referenced in the documentation comment is not present in this source file. It is unclear whether this is incomplete, relies on base class behavior, or the implementation exists elsewhere.
---

View File

@@ -0,0 +1,99 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/Test.Module.Channel.Sensor.SensorUnits.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/Test.Module.Channel.Sensor.Bridge.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/DigitalInputScaleMultiplier.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/DASConcepts/LinearizationFormula.cs
generated_at: "2026-04-17T15:53:56.452748+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d057a2503f607f02"
---
# Documentation: DatabaseImport DAS Concepts
## 1. Purpose
This module defines sensor-related data structures and parsing logic for a Data Acquisition System (DAS) database import facility. It provides enumeration types for sensor sensitivity units and bridge configurations, a class for transforming digital input values to arbitrary scales, and a comprehensive linearization formula system supporting multiple calibration formats (IRTracc variants and polynomial). These components are part of a larger `Test` class hierarchy representing channel and sensor configuration concepts.
---
## 2. Public Interface
### `Test.Module.Channel.Sensor.SensUnits` (enum)
**Location:** `Test.Module.Channel.Sensor.SensorUnits.cs`
Enumeration of sensitivity unit types for sensors.
| Member | Value | Description Attribute |
|--------|-------|----------------------|
| `NONE` | 0 | "NONE" - For polynomial sensors |
| `mV` | 1 | "mV" - Millivolts at capacity EU |
| `mVperV` | 2 | "mV/V" - Excitation proportional at capacity EU |
| `mVperVperEU` | 3 | "mV/V/EU" - Excitation proportional per EU |
| `mVperEU` | 4 | "mV/EU" - Millivolts per engineering unit |
---
### `Test.Module.Channel.Sensor.BridgeType` (enum)
**Location:** `Test.Module.Channel.Sensor.Bridge.cs`
Enumeration of bridge/sensor configuration types. Values are bit flags.
| Member | Value | Description Attribute |
|--------|-------|----------------------|
| `IEPE` | 1 (1 << 0) | "IEPE" |
| `QuarterBridge` | 2 (1 << 1) | "Quarter" |
| `HalfBridge` | 4 (1 << 2) | "Bridge-Half" |
| `FullBridge` | 8 (1 << 3) | "Bridge-Full" |
| `DigitalInput` | 16 (1 << 4) | "DigitalInput" |
| `SQUIB` | 32 (1 << 5) | "SQUIB" |
| `TOMDigital` | 64 (1 << 6) | "TOMDigital" |
| `HalfBridge_SigPlus` | 128 (1 << 7) | "Bridge-Half SigPlus" |
---
### `DigitalInputScaleMultiplier` (class)
**Location:** `DigitalInputScaleMultiplier.cs`
Transforms digital input data by mapping binary 0/1 values to arbitrary low/high display values.
**Nested Enum:**
```csharp
public enum Forms { ArbitraryLowAndHigh }
```
**Properties:**
- `Forms Form { get; set; }` — Default: `Forms.ArbitraryLowAndHigh`
- `double DefaultValue { get; set; }` — Value to display for digital 0 (OFF)
- `double ActiveValue { get; set; }` — Value to display for digital 1 (ON), default: `1.0`
**Constructors:**
```csharp
public DigitalInputScaleMultiplier() // Sets DefaultValue to 0.0
public DigitalInputScaleMultiplier(DigitalInputScaleMultiplier copy) // Copy constructor
```
**Methods:**
```csharp
public void FromDbSerializeString(string s)
```
Deserializes from a string format. Silently returns on null input. Throws `NotSupportedException` for invalid formats.
---
### `LinearizationFormula` (class)
**Location:** `LinearizationFormula.cs`
Holds linearization parameters for sensor calibration, supporting multiple formula styles.
**Properties:**
- `NonLinearStyles NonLinearStyle { get; set; }` — Default: `NonLinearStyles.IRTraccDiagnosticsZero`
- `double PolynomialSensitivity { get; set; }` — Default: `1.0`
- `double LinearizationExponent { get; set; }` — Default: `1.0`
- `double MMPerV { get; set; }` — Millimeters per volt (see Gotchas)
- `double MVAt0MM { get; set; }` — Millivol

View File

@@ -0,0 +1,51 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/DigitalInputs.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/DigitalOutputs.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/SupportedExportFormatBitFlags.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Squibs.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/ExcitationVoltageOptions.cs
generated_at: "2026-04-17T16:44:17.508414+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "e72bc78b9ae7a008"
---
# DatabaseImport Enums Documentation
## 1. Purpose
This module defines a set of enumeration types used within the `DatabaseImport` namespace to configure hardware channel modes, export formats, and measurement parameters. These enums serve as configuration options for data acquisition hardware—specifically digital I/O channels, squib firing mechanisms, excitation voltage settings, and supported export file formats. The enums are designed primarily as bit flags to allow combination of multiple modes, and several employ `DescriptionAttribute` and custom attributes for UI display purposes.
---
## 2. Public Interface
### `DigitalInputModes`
**Signature:** `public enum DigitalInputModes`
Defines input modes for digital data channels. Values are bit-shifted to enable bitwise combination.
| Member | Value | Description |
|--------|-------|-------------|
| `TLH` | `1 << 1` (2) | Transition low to high |
| `THL` | `1 << 2` (4) | Transition high to low |
| `CCNO` | `1 << 3` (8) | Contact closure normally open |
| `CCNC` | `1 << 4` (16) | Contact closure normally closed |
Decorated with `[TypeConverter(typeof(EnumDescriptionTypeConverter))]` and `[DescriptionAttribute]` on each member.
---
### `DigitalOutputModes`
**Signature:** `public enum DigitalOutputModes`
Defines output modes for digital channels. Values are bit-shifted to enable bitwise combination.
| Member | Value | Description |
|--------|-------|-------------|
| `NONE` | `0` | Digital channel's mode not set |
| `FVLH` | `1 << 0` (1) | Five volt, low-to-high transition |
| `FVHL` | `1 << 1` (2) | Five volt, high-to-low transition |
| `CCNO` | `1 << 2` (4) | Contact closure normally open |
| `CCNC` | `1 <<

View File

@@ -0,0 +1,35 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Hardware/HardwareTypes.cs
generated_at: "2026-04-17T16:14:41.840190+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c3e7211775a00a58"
---
# Hardware
### Purpose
This module defines the `HardwareTypes` enumeration within the `DatabaseImport` namespace. It provides a comprehensive catalog of hardware device identifiers used throughout the system, covering SLICE device variants (Base, Bridge, IEPE, NANO, Micro, etc.), TDAS equipment, G5 components, Ribeye devices, and various modules (TOM, SIM, DIM). This enum serves as the canonical hardware type reference for database import operations and hardware identification across the system.
### Public Interface
- **`HardwareTypes`** (enum) - A public enumeration with 34 named hardware type constants:
- `SLICE_Base = 0`, `SLICE_Bridge = 1`, `SLICE_Distributor = 2`
- `TDAS_Pro_Rack = 3`
- `SLICE2_IEPE_Hi = 4`, `SLICE2_IEPE_Lo = 5`, `SLICE2_Bridge_Hi = 6`, `SLICE2_Bridge_Lo = 7`, `SLICE2_Base = 8`
- `TOM = 9`, `SIM = 10`, `DIM = 11`
- `G5VDS = 12`
- `Ribeye = 13`, `RibeyeLED = 14`
- `SLICE_IEPE = 15`
- `SLICE1_5_Nano_Base = 16`, `SLICE_Micro_Base = 17`, `SLICE_NANO_Base = 18`
- `SLICE2_SIM = 19`, `SLICE2_DIM = 20`, `SLICE2_TOM = 21`
- `G5INDUMMY = 23` (note: value 22 is skipped/commented out as `G5IPORT`)
- `SLICE_EthernetController = 24`
- `SLICE1_5_Micro_Base = 25`
- `SLICE_LabEthernet = 26`
- `SLICE2_SLS = 27`, `SLICE1_G5Stack = 28`, `SLICE2_SLT = 29`, `SLICE2_SLD = 30`
- `TDAS_LabRack = 31`
- `SLICE6_Base = 32`, `SLICE6DB = 33`
### Invariants
- Enum values are explicitly assigned and

View File

@@ -0,0 +1,79 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Sensors/SensorStatus.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Sensors/LinearizationFormula.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Enums/Sensors/ZeroMethodType.cs
generated_at: "2026-04-17T16:44:42.091498+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "dd75266de8fb5275"
---
# Documentation: Sensor Enums (DatabaseImport)
## 1. Purpose
This module defines three enumeration types used within the `DatabaseImport` namespace to represent sensor-related states and configuration options. `SensorStatus` tracks the operational lifecycle state of a sensor. `NonLinearStyles` specifies available linearization formulas for processing non-linear sensor data, with several options specific to IRTracc devices. `ZeroMethodType` defines methods for calculating electrical zero values during sensor data import, with explicit values maintained for legacy compatibility with older data formats (e.g., GM ISF imports).
---
## 2. Public Interface
### `SensorStatus` (enum)
Represents the operational status of a sensor in the system.
| Member | Description |
|--------|-------------|
| `Available` | Sensor is available for use |
| `InUse` | Sensor is currently in use |
| `OutForService` | Sensor is out for service |
| `OutForCalibration` | Sensor is out for calibration |
| `Retired` | Sensor has been retired |
---
### `NonLinearStyles` (enum)
Defines linearization formula types for non-linear sensor data processing.
| Member | Description |
|--------|-------------|
| `IRTraccManual` | IRTracc manual linearization |
| `IRTraccDiagnosticsZero` | IRTracc diagnostics zero method |
| `IRTraccZeroMMmV` | IRTracc zero MM/mV method |
| `IRTraccAverageOverTime` | IRTracc average over time method |
| `Polynomial` | Polynomial-based linearization |
| `IRTraccCalFactor` | IRTracc calibration factor method |
---
### `ZeroMethodType` (enum)
Defines methods for calculating electrical zero values. Members have explicit integer values assigned for legacy compatibility.
| Member | Value | Description |
|--------|-------|-------------|
| `AverageOverTime` | 0 | Calculate electrical zero using an average over time |
| `UsePreEventDiagnosticsZero` | 1 | Calculate zero using time in pre-event diagnostics |
| `None` | 2 | Calculate zero using an injected value (absolute zero) |
---
## 3. Invariants
- **`ZeroMethodType` explicit values must not change**: The source explicitly states that "Lots of legacy compatibility (e.g. importing GM ISF) depends on the order/value of this enum." The integer values 0, 1, and 2 are contractually bound for backward compatibility.
- **Enum member order for `ZeroMethodType` is significant**: Reordering members would break legacy data import functionality.
---
## 4. Dependencies
**Dependencies of this module:**
- None visible from source. These enums are self-contained with no external imports.
**Dependents (inferred):**
- Other components within the `DatabaseImport` namespace that handle sensor data import, particularly those processing IRTracc sensor data or GM ISF legacy formats.
---
## 5. Gotchas
1

View File

@@ -0,0 +1,414 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TemplateZone.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/CalculatedValueClass.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/LevelTriggerChannel.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestObjectChannel.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TemplateRegion.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/IsoCode.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestEngineerDetails.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestSetting.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/HardwareChannel.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestObjectMetaData.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/CustomerDetails.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/LabratoryDetails.cs
generated_at: "2026-04-17T15:45:33.440998+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b4d75a90ad9bddba"
---
# DatabaseImport.ISO Module Documentation
## 1. Purpose
This module provides data entity classes for the DatabaseImport system, representing domain objects used in crash test data management according to ISO standards. It handles template definitions (zones, regions), channel configurations (test object channels, hardware channels, calculated values, level triggers), metadata management (test objects, test setups, engineer/lab/customer details), and ISO code generation for channel identification. These entities serve as DTOs (Data Transfer Objects) that map directly to database rows and support serialization for persistence and interchange.
---
## 2. Public Interface
### TemplateZone
```csharp
public class TemplateZone
```
Represents a zone within a test template containing regions.
**Constructors:**
- `TemplateZone(string template, string name, string picture, string description)` — Initializes with explicit values.
- `TemplateZone(DataRow dr)` — Initializes from a database row; automatically loads `TemplateRegions` via `TemplateRegion.GetAllRegions()`.
**Properties:**
- `string TemplateName { get; }` — Read-only template identifier.
- `string ZoneName { get; }` — Zone name; defaults to `"Default zone"` if DBNull.
- `string Picture { get; set; }` — Picture path/identifier.
- `string Description { get; }` — Zone description; defaults to empty string if DBNull.
- `TemplateRegion[] TemplateRegions { get; set; }` — Array of regions; setter clears and repopulates internal list.
---
### TemplateRegion
```csharp
public class TemplateRegion
```
Represents a region within a template zone with location and positioning data.
**Constructors:**
- `TemplateRegion(string templateName, string zoneName, bool bLocalOnly)` — Initializes with template/zone names and local-only flag.
- `TemplateRegion(DataRow dr)` — Initializes from a database row.
**Properties:**
- `string TemplateName { get; }`, `string TemplateZone { get; }` — Parent identifiers.
- `int RegionNumber { get; set; }`, `string RegionName { get; set; }`, `string RegionDescription { get; set; }` — Region identification.
- `string TestObject { get; set; }`, `string Position { get; set; }` — Association data.
- `string MainLocation { get; set; }`, `string FineLocation1/2/3 { get; set; }` — Location hierarchy.
- `string PhysicalDimension { get; set; }`, `string Direction { get; set; }`, `string FilterClass { get; set; }` — Physical properties.
- `bool LocalOnly { get; }` — Whether region is local-only.
- `System.Drawing.Point UpperLeft { get; set; }`, `LowerRight { get; set; }` — Bounding coordinates.
**Static Methods:**
- `internal static TemplateRegion[] GetAllRegions(string templateName, string zoneName)` — Retrieves all regions from database via stored procedure `sp_TemplateRegionsGet`.
---
### CalculatedValueClass
```csharp
public class CalculatedValueClass
```
Represents a calculated/derived channel (sums, averages, IRTRACC calculations).
**Constructor:**
- `CalculatedValueClass(DataRow dr)` — Initializes from database row using `DbOperations.CalculatedChannels.Fields` enum.
**Properties:**
- `int Id { get; set; }` — Defaults to `-1`.
- `Operations Operation { get; set; }` — Calculation type; defaults to `Operations.SUM`.
- `string CalculatedValueCode { get; set; }` — Defaults to `"???????????????X"`.
- `string[] InputChannelIds { get; set; }` — Input channel identifiers.
- `byte[] InputChannelIdsBlob { get; set; }` — UTF-8 encoded, list-separator-delimited blob of channel IDs.
- `string CFCForInputChannels { get; set; }`, `string ChannelFilterClassForOutput { get; set; }` — Filter classes.
- `string TestSetupName { get; set; }`, `string Name { get; set; }` — Identification.
**Nested Enum:**
- `Operations``SUM = 1`, `AVERAGE = 2`, `IRTRACC3D = 3`, `IRTRACC3D_ABDOMEN = 4`, `IRTRACC3D_LOWERTHORAX = 5`.
---
### LevelTriggerChannel
```csharp
public class LevelTriggerChannel
```
Stores level trigger threshold configuration for a channel.
**Constructors:**
- `LevelTriggerChannel(LevelTriggerChannel copy)` — Copy constructor.
- `LevelTriggerChannel(DataRow dr)` — Initializes from database row using `DbOperations.LevelTriggers.Fields`.
**Properties:**
- `string TestSetupName`, `string GroupSerialNumber`, `string TestObjectChannelId`, `string HardwareChannelId`, `string SensorSerialNumber` — Association identifiers.
- `bool GreaterThanEnabled { get; set; }` — Defaults to `true`.
- `double GreaterThanThresholdEU`, `double LessThanThresholdEU` — Threshold values in Engineering Units.
- `bool LessThanEnabled`, `bool TriggerBetweenBounds`, `bool TriggerOutsideBounds` — Trigger mode flags.
- `double InsideUpperLevelEU`, `double InsideLowerLevelEU`, `double OutsideUpperLevelEU`, `double OutsideLowerLevelEU` — Boundary values.
---
### TestObjectChannel
```csharp
public class TestObjectChannel : TestObjectTemplateChannel, IComparable<TestObjectChannel>
```
Represents a channel on a test object with metadata and hardware association.
**Constructor:**
- `TestObjectChannel(TestObjectTemplateChannel copy, ISO.TestObject testObject, ISO.TestObjectTemplate template)`
**Properties:**
- `bool Disabled { get; set; }` — Whether channel is excluded from data collection.
- `int ChannelIdx { get; set; }` — Defaults to `CHANNEL_IDX_UNKNOWN` (-1).
- `string SensorSerialNumber` — Via property bag; sensor association.
- `string HardwareId` — Via property bag; parses and normalizes format.
- `SquibChannelTypes SquibChannelType { get; set; }` — Squib channel classification.
- `ISO.TestObject TestObject { get; }` — Parent test object.
**Methods:**
- `int CompareTo(TestObjectChannel right)` — Compares by DisplayOrder, then Name, then TestObject serial number.
- `string GetGraphId()` — Returns ID with current suffix for squib current channels.
- `string GetId()` — Returns composite ID: `{SerialNumber}_{MMEChannelType}_{ChannelId}`.
- `string GetIdWithSpecificChannelId(long id)` — Returns ID with specified channel ID.
**Nested Enum:**
- `SquibChannelTypes``None`, `Voltage`, `Current`.
**Constants:**
- `const int CHANNEL_IDX_UNKNOWN = -1`
---
### IsoCode
```csharp
public class IsoCode
```
Represents a 16-character ISO channel code with positional fields.
**Constructor:**
- `IsoCode(string isoCode)` — Pads/truncates to 16 characters; pads with `'?'` if short.
**Properties:**
- `string StringRepresentation { get; set; }` — Full 16-character code.
**Static Methods:**
- `static string GetString(MMEPossibleChannels channel, bool careAboutTestTimeFields)` — Generates ISO code from channel; masks test object and filter class with `'?'` if `careAboutTestTimeFields` is false.
- `static string GetString(string testObject, string position, string main, string floc1, string floc2, string floc3, string physdim, string dir, string fc)` — Concatenates parameters into code string.
---
### TestEngineerDetails
```csharp
public class TestEngineerDetails
```
Stores test engineer contact information.
**Constructors:**
- `TestEngineerDetails()`
- `TestEngineerDetails(DataRow dr)`
- `TestEngineerDetails(TestEngineerDetails copy)`
- `TestEngineerDetails(ITestEngineerDetailsDbRecord testEngineerDetailsDbRecord)`
**Properties:**
- `string TestEngineerName`, `TestEngineerPhone`, `TestEngineerFax`, `TestEngineerEmail` — Default to `"NOVALUE"`.
- `string Name`, `bool LocalOnly`, `DateTime LastModified`, `string LastModifiedBy`, `int Version` — Record metadata.
**Static Methods:**
- `static void DeleteAllTestEngineerDetails()` — Deletes all records via `DTS.Common.Storage.DbOperations.TestEngineerDetailsDelete()`.
- `static TestEngineerDetails[] GetAllTestEngineerDetails()` — Retrieves all records.
---
### CustomerDetails
```csharp
public class CustomerDetails
```
Stores customer information for tests.
**Constructors:**
- `CustomerDetails()`, `CustomerDetails(DataRow dr)`, `CustomerDetails(CustomerDetails copy)`
**Properties:**
- `string CustomerName`, `string CustomerTestRefNumber` — Default to `string.Empty`.
- `string ProjectRefNumber`, `string CustomerOrderNumber`, `string CustomerCostUnit` — Default to `"NOVALUE"`.
- `string Name`, `bool LocalOnly`, `DateTime LastModified`, `string LastModifiedBy`, `int Version`.
**Static Methods:**
- `static CustomerDetails ReadXML(XmlElement root)` — Deserializes from XML.
- `static void DeleteCustomerDetails(string name = null)` — Deletes records via `DTS.Common.Storage.DbOperations.CustomerDetailsDelete()`.
**Instance Methods:**
- `void WriteXML(ref XmlWriter writer)` — Serializes to XML.
---
### LabratoryDetails
```csharp
public class LabratoryDetails
```
Stores laboratory contact information. Note: class name contains typo ("Labratory" vs "Laboratory").
**Constructors:**
- `LabratoryDetails()`, `LabratoryDetails(DataRow dr)`
**Properties:**
- `string LabratoryName`, `string LabratoryContactName`, `string LabratoryTestRefNumber`, `string LabratoryProjectRefNumber` — Default to `string.Empty`.
- `string LabratoryContactPhone`, `string LabratoryContactFax`, `string LabratoryContactEmail` — Default to `"NOVALUE"`.
- `string Name`, `bool LocalOnly`, `DateTime LastModified`, `string LastModifiedBy`, `int Version`.
**Static Methods:**
- `static LabratoryDetails ReadXML(XmlElement root)` — Deserializes from XML.
- `static void DeleteLabratoryDetails()` — Deletes records via `DTS.Common.Storage.DbOperations.LabratoryDetailsDelete()`.
---
### TestSetting
```csharp
public class TestSetting
```
Represents a single test setting with ID, value, and default.
**Constructors:**
- `TestSetting(string id, string value, string defaultValue)`
- `TestSetting(TestSetting copy)`, `TestSetting(TestSetting copy, string value)`
**Properties:**
- `string Id { get; }`, `string Value { get; set; }`, `string DefaultValue { get; }` — All read-only except Value.
**Methods:**
- `string ToSerializeString()` — Returns `{Id}={Value}` with separator escaping.
**Static Methods:**
- `static bool TryParse(string s, out TestSetting ts)` — Parses serialized format.
---
### TestSettingDictionary
```csharp
public class TestSettingDictionary
```
Dictionary container for test settings with serialization support.
**Constructor:**
- `TestSettingDictionary()`, `TestSettingDictionary(TestSettingDictionary copy)`
**Methods:**
- `string GetValue(string id, string defaultValue)` — Returns value or default if not found.
- `void SetValue(TestSetting setting, string value)` — Updates value, creates new TestSetting.
- `void SetValue(TestSetting setting)` — Initializes setting in dictionary.
- `void SetValue(string id, string value)` — Sets or creates setting.
- `void UnLoad()` — Clears dictionary.
- `string ToSerializeString()` — Serializes all settings.
- `void LoadSettings(string s)` — Deserializes settings string.
---
### HardwareChannel
```csharp
public class HardwareChannel : INotifyPropertyChanged
```
Represents a hardware channel on a Data Acquisition System.
**Constructors:**
- `HardwareChannel(HardwareChannel copy, Hardware h)`
- `HardwareChannel(IDataRecord reader, Hardware hardware)`
**Properties (all notify property changed):**
- `Hardware ParentDAS` — Parent hardware reference.
- `int ChannelIdx`, `int DASDisplayOrder`, `int ModuleArrayIndex` — Indexing.
- `string ModuleSerialNumber` — Module identifier.
- `int SupportedBridges` — Defaults to `12`.
- `int SupportedSquibFireModes`, `int SupportedExcitations`, `int SupportedDigitalInputModes`, `int SupportedDigitalOutputModes` — All default to `16`.
- `bool LocalOnly`.
**Static Methods:**
- `static int PhysicalCompare(HardwareChannel left, HardwareChannel right)` — Compares by ChannelIdx.
---
### TestObjectMetaData
```csharp
public class TestObjectMetaData
```
Metadata container for test objects.
**Constructor:**
- `TestObjectMetaData(char testobject)` — Initializes all fields with defaults.
**Properties:**
- `static double Version { get; set; }` — Defaults to `1.06`.
- `char TestObject { get; }` — Test object character code.
- Methods: `void SetProperty(MetaData meta)`.
**Nested Enums:**
- `CommentFields``Comment1`, `Comment2`, `Comment3`.
- `Fields``NameOfTestObject`, `VelocityOfTestObject`, `MassOfTestObject`, etc.
- `OptionFields``Offset`, `BarrierWidth`, `BarrierHeight`, etc.
---
### MetaData
```csharp
public class MetaData
```
Single metadata entry.
**Constructor:**
- `MetaData(string name, bool optional, string value, double version)`, `MetaData(MetaData copy)`
**Properties:**
- `string Name { get; }`, `bool IsOptional { get; }`, `double Version { get; }`, `string Value { get; set; }`.
---
### TestSetupMetaData
```csharp
public class TestSetupMetaData
```
Metadata container for test setups.
**Constructor:**
- `TestSetupMetaData(bool requireXCrashCompatibilityForISOExports)` — Initializes fields; uses empty string for certain fields if XCrash compatibility required.
**Properties:**
- `double Version` — Defaults to `1.06`.
**Methods:**
- `void SetProperty(MetaData meta, bool requireXCrashCompatibilityForISOExports)` — Sets property with XCrash compatibility handling.
**Nested Enum:**
- `Fields``LabName`, `LaboratoryContactName`, `TestEngineerName`, `Title`, `MediumNoNumberOfMedia`, etc.
---
## 3. Invariants
1. **IsoCode Length**: `IsoCode.StringRepresentation` is always exactly 16 characters. Shorter strings are padded with `'?'`; longer strings are truncated.
2. **TemplateZone Read-Only Properties**: `TemplateName` and `Description` are read-only after construction. `ZoneName` is read-only with a default of `""` but set during construction.
3. **TemplateRegions Array Semantics**: The `TemplateRegions` setter on `TemplateZone` clears the internal list before adding new values; it does not append.
4. **InputChannelIdsBlob Encoding**: Always UTF-8 encoded, using `CultureInfo.InvariantCulture.TextInfo.ListSeparator` as delimiter.
5. **TestObjectChannel ChannelIdx**: Defaults to `CHANNEL_IDX_UNKNOWN` (-1) when not assigned.
6. **HardwareId Parsing**: If `HardwareId` is set with a 3-part underscore-delimited format, it is normalized by removing the third token's prefix up to `'x'`.
7. **"NOVALUE" Sentinel**: `TestEngineerDetails`, `CustomerDetails`, `LabratoryDetails`, `TestObjectMetaData`, and `TestSetupMetaData` use `"NOVALUE"` as a sentinel value for unset string fields. Empty string inputs are ignored (do not overwrite "NOVALUE").
8. **CalculatedValueClass Id**: Defaults to `-1` indicating unassigned.
9. **LevelTriggerChannel GreaterThanEnabled**: Defaults to `true`; `LessThanEnabled` defaults to `false`.
---
## 4. Dependencies
### External Dependencies (from imports):
- `System` — Core framework.
- `System.Collections.Generic` — Generic collections.
- `System.Data` / `System.Data.SqlClient` — ADO.NET data access.
- `System.Drawing` — Point structure for coordinates.
- `System.Text` — StringBuilder, Encoding.
- `System.Xml` — XML read/write.
- `System.Globalization` — Culture-invariant parsing.
- `System.ComponentModel` — INotifyPropertyChanged.
- `DTS.Common.Interface.TestMetaData``ITestEngineerDetailsDbRecord` interface.
- `DTS.Common.Storage.DbOperations` — Database operations for details records.
- `DTS.Common.Constants``CURRENT_SUFFIX` constant.
### Internal Dependencies (inferred):
- `DbOperations` — Static class providing database access, stored procedure names via `DbOperationsEnum`, and field name enums (`CalculatedChannels.Fields`, `LevelTriggers.Fields`, `DAS.DASChannelFields`).
- `DbOperations.Connection` — Database connection with `QueryDataSet` method.
- `TestObjectTemplateChannel` — Base class for `TestObjectChannel`.
- `ISO.TestObject` — Referenced by `TestObjectChannel`.
- `ISO.TestObjectTemplate` — Referenced by `TestObjectChannel`.
- `MMEPossibleChannels` — Channel definition class used by `IsoCode`.
- `Hardware` — Hardware/DAS class referenced by `HardwareChannel`.
### Consumers:
Unknown from source alone — these appear to be data entities consumed by higher-level import/export logic.
---
## 5. Gotchas
1. **Swallowed Exceptions**: `LevelTriggerChannel(DataRow)` catches and silently ignores all exceptions. `TemplateRegion.GetAllRegions()` catches and ignores exceptions at multiple levels. This can result in partial or missing data without any indication of failure.
2. **Commented-Out Logging**: Multiple files contain commented-out `APILogger.Log()` calls (e.g., `LevelTriggerChannel`, `TemplateRegion`, `TestEngineerDetails`, `CustomerDetails`, `LabratoryDetails`). This suggests logging was removed or disabled, making debugging difficult.
3. **Typo in Class Name**: `LabratoryDetails` is misspelled (should be "Laboratory"). This typo propagates to property names (`LabratoryName`, `LabratoryContactName`, etc.) and database column names.
4. **Future Breaking Change**: `CalculatedValueClass` documentation states it "will probably become an abstract base class in the future." Direct instantiation may break in later versions.
5. **IsoCode Padding Character**: When padding short ISO codes, the class uses `'?'` not `'0'`. This differs from the default initialization which uses `'0'`.
6. **HardwareChannel Default Values**: `SupportedBridges` defaults to `12` while all other "Supported*" properties default to `16`. Reason unclear from source.
7. **TestSettingDictionary Separator Inconsistency

View File

@@ -0,0 +1,30 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/DataRecorders/IHardwareChannel.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/DataRecorders/IDASHardware.cs
generated_at: "2026-04-17T16:12:18.707405+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "13ed9f0f902f8811"
---
# DataRecorders
### Purpose
This module defines marker interfaces for hardware components within the `DatabaseImport` subsystem. It appears to establish a contract for hardware abstraction, specifically for "TTS import" functionality, though the interfaces currently lack members.
### Public Interface
* **`IHardwareChannel`**: An empty public interface. It imposes no methods or properties on implementers.
* **`IDASHardware`**: An empty public interface. According to the XML documentation, it "represents hardware in TTS import".
### Invariants
* None identified from source alone (interfaces are empty).
### Dependencies
* **Depends on**: None (only uses the `DatabaseImport` namespace).
* **Dependents**: Unknown (consumers not present in provided source).
### Gotchas
* Both `IHardwareChannel` and `IDASHardware` are currently empty interfaces. They may serve as marker interfaces for type checking, or they may be unfinished stubs requiring implementation in the future.
---

View File

@@ -0,0 +1,30 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/Hardware/IISOHardware.cs
generated_at: "2026-04-17T16:46:21.406876+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "772b87749e7fb24d"
---
# Documentation: IISOHardware.cs
## 1. Purpose
This file defines the `IISOHardware` interface within the `DatabaseImport` namespace. Based on the source code provided, the interface is currently empty. It appears to serve as a structural placeholder or a marker interface for hardware-related abstractions within the Database Import module, though it does not currently enforce any specific contract or behavior.
## 2. Public Interface
The module exposes a single public interface:
* **`interface IISOHardware`**
* **Signature:** `public interface IISOHardware`
* **Behavior:** Defines no members, methods, properties, or events. It represents an empty contract.
## 3. Invariants
No invariants can be determined from the source code alone. As the interface has no members, it enforces no state constraints or validation rules.
## 4. Dependencies
* **This module depends on:** None. The file contains no `using` directives and relies only on standard system namespaces implicitly.
* **What depends on this:** Unknown from source alone. Consumers of this interface are not present in the provided file.
## 5. Gotchas
* **Empty Interface:** The `IISOHardware` interface is explicitly empty. It is unclear if this is an intentional design choice (e.g., a marker interface used for type checking) or if the implementation is incomplete. Developers should not assume any members exist on this interface without checking the codebase for extension interfaces or implementation details.

View File

@@ -0,0 +1,70 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/Sensors/ISensorData.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/Sensors/ISensorCalibration.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/Sensors/ICalibrationRecords.cs
generated_at: "2026-04-17T16:44:29.472956+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f364623d1f54a6c3"
---
# Documentation: Sensor Interfaces (DatabaseImport)
## 1. Purpose
This module defines three marker interfaces—`ISensorData`, `ISensorCalibration`, and `ICalibrationRecords`—within the `DatabaseImport` namespace. These interfaces appear to establish type contracts for sensor-related data structures used in database import operations. Based on their naming and location within the `Interface/Sensors` directory, they likely serve as abstraction points for polymorphic handling of sensor data, calibration information, and calibration record collections within the database import subsystem. **However, the interfaces contain no members, so their specific behavioral contracts cannot be determined from source alone.**
---
## 2. Public Interface
### `ISensorData`
- **Namespace:** `DatabaseImport`
- **Signature:** `public interface ISensorData`
- **Members:** None (empty interface)
- **Behavior:** Undefined from source. Appears to be a marker interface for sensor data types.
### `ISensorCalibration`
- **Namespace:** `DatabaseImport`
- **Signature:** `public interface ISensorCalibration`
- **Members:** None (empty interface)
- **Behavior:** Undefined from source. Appears to be a marker interface for sensor calibration types.
### `ICalibrationRecords`
- **Namespace:** `DatabaseImport`
- **Signature:** `public interface ICalibrationRecords`
- **Members:** None (empty interface)
- **Behavior:** Undefined from source. Appears to be a marker interface for calibration record collections.
---
## 3. Invariants
**None can be determined from source alone.** All three interfaces are empty marker interfaces with no properties, methods, events, or constraints defined. Any invariants would be established by implementing classes or by consumer code, but these are not visible in the provided source files.
---
## 4. Dependencies
### Dependencies of this module:
- **None visible.** The source files contain no `using` directives and reference no external types. They depend only on the .NET type system for interface declaration.
### What depends on this module:
- **Cannot be determined from source alone.** No consumers, implementers, or related types are shown in the provided files. The directory structure (`DatabaseImport/Interface/Sensors/`) suggests these are foundational abstractions expected to be implemented by concrete sensor data classes, but no implementations are provided.
---
## 5. Gotchas
1. **All interfaces are empty marker interfaces.** This is unusual for a production codebase. Possible explanations include:
- They are intended purely for type identification/categorization.
- The implementation is incomplete or in progress.
- Members were removed during refactoring but the interfaces were retained for backward compatibility.
- Behavior is defined elsewhere (e.g., via extension methods, external contracts, or convention).
2. **No documentation or XML comments.** The interfaces lack any inline documentation explaining their purpose or intended usage patterns.
3. **Relationship between interfaces is unclear.** The source provides no indication whether `ISensorCalibration` and `ICalibrationRecords` are related, or how `ISensorData` relates to the calibration interfaces.
4. **Namespace naming inconsistency.** The directory path contains `DatabaseImporter` while the namespace is `DatabaseImport` (no "er" suffix). This may be intentional or a historical naming inconsistency.

View File

@@ -0,0 +1,28 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Interface/TestSetups/TestSetupsList/ITestSetup.cs
generated_at: "2026-04-17T16:14:41.837991+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "993b64490752370f"
---
# TestSetupsList
### Purpose
This module defines the `ITestSetup` interface within the `DatabaseImport` namespace. It appears to be a placeholder or marker interface for test setup entities, intended to be implemented by concrete test setup classes used during database import operations. The interface is currently empty, suggesting it may serve as a contract extension point or type marker for dependency injection and polymorphic handling of test setup objects.
### Public Interface
- **`ITestSetup`** (interface) - An empty public interface in the `DatabaseImport` namespace. No members are defined. Intended usage patterns are not clear from source alone.
### Invariants
- None identifiable from the empty interface definition.
### Dependencies
- **Depends on**: None (standalone interface definition).
- **Depended on by**: Unknown from source alone; likely consumed by other DatabaseImport components handling test setup data.
### Gotchas
- The interface is completely empty with no members, which may indicate it is under development, deprecated, or serves purely as a marker/type discriminator. The intended contract is unclear from source alone.
---

View File

@@ -0,0 +1,41 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Properties/AssemblyInfo.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Properties/Settings.Designer.cs
generated_at: "2026-04-17T16:28:42.805400+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "798fca9d3593b72e"
---
# Properties
### Purpose
This module provides assembly-level metadata and application/user settings configuration for the DatabaseImport assembly. It defines persistent configuration values including download paths, auto-arm permissions, calibration warning periods, database type selection, and ISO export compatibility requirements.
### Public Interface
**`Settings` (sealed partial class, internal)**
- `public static Settings Default { get; }` — Singleton instance accessor returning synchronized settings.
- `public string DownloadFolder { get; }` — Application-scoped setting, default value `"..\\Data"`.
- `public bool AllowAutoArm { get; }` — Application-scoped setting, default value `false`.
- `public int CalWarningPeriodDays { get; set; }` — User-scoped setting, default value `7`.
- `public int DBType { get; }` — Application-scoped setting, default value `1`.
- `public bool RequireXCrashCompatibilityForISOExports { get; }` — Application-scoped setting, default value `true`.
### Invariants
- `Settings` inherits from `System.Configuration.ApplicationSettingsBase` and uses thread synchronization via `Synchronized()`.
- Application-scoped settings (`DownloadFolder`, `AllowAutoArm`, `DBType`, `RequireXCrashCompatibilityForISOExports`) are read-only at runtime.
- User-scoped settings (`CalWarningPeriodDays`) can be modified and persisted.
- The class is auto-generated by `SettingsSingleFileGenerator`; manual changes will be overwritten.
### Dependencies
- **Depends on**: `System.Configuration.ApplicationSettingsBase`, `System.Runtime.CompilerServices`, `System.CodeDom.Compiler`.
- **Depended on by**: Unclear from source alone; likely consumed throughout the DatabaseImport assembly for configuration access.
### Gotchas
- `DownloadFolder` uses a relative path `"..\\Data"`; the actual location depends on the working directory at runtime.
- `DBType` is an integer (default `1`); the mapping of integer values to database types is not defined in this source.
- The `CalWarningPeriodDays` is user-scoped, meaning it can vary per user profile; other settings are application-wide.
---

View File

@@ -0,0 +1,269 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SensorRange.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SensorDB.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/DigitalInputSetting.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/DigitalOutputSetting.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SquibSetting.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/FilterClass.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SensorCalibrationList.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/CalibrationRecords.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/IsoCode.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SensorsCollection.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SensorDB/SensorCalibration.cs
generated_at: "2026-04-17T15:48:08.013914+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "7a9bc918bd6b0831"
---
# SensorDB Module Documentation
## 1. Purpose
This module provides the data layer for sensor configuration and calibration management within the DataPRO database import system. It defines data structures for various sensor types (analog, digital input/output, squib), their calibration records, ISO codes for sensor identification, and filter class specifications. The module handles database serialization/deserialization, implements property change notification for UI binding, and manages cached collections of sensors and calibrations for efficient lookup operations.
---
## 2. Public Interface
### SensorRange
```csharp
public class SensorRange : INotifyPropertyChanged
```
Stores triple-value sensor range thresholds.
| Member | Signature | Description |
|--------|-----------|-------------|
| `SensorRange(string value)` | Constructor | Parses comma-separated string "low,medium,high". Throws `InvalidDataException` if not exactly 3 values. |
| `SensorRange(double low, double medium, double high)` | Constructor | Initializes with explicit values. |
| `Low` | `double { get; set; }` | Low threshold value. |
| `Medium` | `double { get; set; }` | Medium threshold value. |
| `High` | `double { get; set; }` | High threshold value. |
### LowHigh
```csharp
public class LowHigh : INotifyPropertyChanged
```
Stores low/high value pairs.
| Member | Signature | Description |
|--------|-----------|-------------|
| `LowHigh(double low, double high)` | Constructor | Initializes with explicit values. |
| `LowHigh(string value)` | Constructor | Parses comma-separated string. Requires at least 2 values. Uses `InvariantCulture` for parsing. |
| `Low` | `double { get; set; }` | Low value. |
| `High` | `double { get; set; }` | High value. |
### Enums (SensorDB.cs)
| Enum | Values | Description |
|------|--------|-------------|
| `ShuntMode` | `None, Emulation, Internal, External` | Shunt calibration modes. |
| `BridgeLeg` | `First, Second, Third, Fourth` | Bridge measurement leg selection. |
| `CouplingModes` | `AC = 0, DC` | Signal coupling modes. |
### FilterClass
```csharp
public class FilterClass : INotifyPropertyChanged
```
Represents CFC (Channel Frequency Class) filter specifications per SAE J211.
| Member | Signature | Description |
|--------|-----------|-------------|
| `FilterClassType` | Nested enum | `None = 0, AdHoc = -1, CFC10 = 17, CFC60 = 100, CFC180 = 300, CFC600 = 1000, CFC1000 = 1650` |
| `FilterClass(FilterClassType fc)` | Constructor | Creates from enum value. Throws `Exception` for unknown types. |
| `FilterClass(string fclass)` | Constructor | Parses string by numeric value or name substring matching. |
| `FClass` | `FilterClassType { get; set; }` | The filter class type. |
| `Frequency` | `double { get; set; }` | Frequency in Hz. |
| `ToString()` | `override string` | Returns formatted string like "100 (CFC60)" or integer for AdHoc. |
### IsoCode
```csharp
public class IsoCode
```
Represents a 16-character ISO sensor identification code.
| Member | Signature | Description |
|--------|-----------|-------------|
| `IsoCode(string isoCode)` | Constructor | Parses 16-char code. Pads with '?' if shorter, truncates if longer. Null becomes empty string. |
| `TestObject` | `string { get; set; }` | Character at position 0. |
| `Position` | `string { get; set; }` | Character at position 1. |
| `MainLocation` | `string { get; set; }` | Characters at positions 2-5 (4 chars). |
| `FineLocation1` | `string { get; set; }` | Characters at positions 6-7 (2 chars). |
| `FineLocation2` | `string { get; set; }` | Characters at positions 8-9 (2 chars). |
| `FineLocation3` | `string { get; set; }` | Characters at positions 10-11 (2 chars). |
| `PhysicalDimension` | `string { get; set; }` | Characters at positions 12-13 (2 chars). |
| `Direction` | `string { get; set; }` | Character at position 14. |
| `FilterClass` | `string { get; set; }` | Character at position 15. |
| `StringRepresentation` | `string { get; set; }` | Full 16-character string. |
### CalibrationRecord
```csharp
public class CalibrationRecord
```
Single calibration data point.
| Member | Signature | Description |
|--------|-----------|-------------|
| `CalibrationRecord()` | Constructor | Creates with default `LinearizationFormula`. |
| `CalibrationRecord(string s)` | Constructor | Parses from serialized string using `FromString()`. |
| `CalibrationRecord(CalibrationRecord copy)` | Constructor | Deep copy constructor. |
| `Sensitivity` | `double { get; set; }` | Sensitivity value. |
| `ZeroPoint` | `double { get; set; }` | Calculated from `Poly.ZeroPositionIntercept / Poly.CalibrationFactor` when factor non-zero; otherwise stored value. |
| `Poly` | `LinearizationFormula { get; set; }` | Linearization polynomial. |
| `AtCapacity` | `bool { get; set; }` | Default `false`. |
| `EngineeringUnits` | `string { get; set; }` | Default "g". |
| `SensitivityUnits` | `Test.Module.Channel.Sensor.SensUnits { get; set; }` | Default `NONE`. |
| `Excitation` | `ExcitationVoltageOptions.ExcitationVoltageOption { get; set; }` | Default `Volt5`. |
| `CapacityOutputIsBasedOn` | `double { get; set; }` | Default 1.000. |
| `FromString(string s)` | `void` | Deserializes from token-separated string. |
### CalibrationRecords
```csharp
public class CalibrationRecords : ICalibrationRecords
```
Collection of calibration records.
| Member | Signature | Description |
|--------|-----------|-------------|
| `CalibrationRecords()` | Constructor | Creates with single default `CalibrationRecord`. |
| `CalibrationRecords(CalibrationRecords copy)` | Constructor | Deep copy constructor. |
| `CalibrationRecords(string records)` | Constructor | Deserializes using `FromSerializedString()`. |
| `Records` | `CalibrationRecord[] { get; set; }` | Array of records. Default single empty record. |
| `FromSerializedString(string s)` | `void` | Parses records separated by `"__x__"`. |
### SensorCalibration
```csharp
public class SensorCalibration : IComparable<SensorCalibration>, INotifyPropertyChanged, ISensorCalibration
```
Complete calibration data for a sensor.
| Member | Signature | Description |
|--------|-----------|-------------|
| `SensorCalibration()` | Constructor | Default constructor. |
| `SensorCalibration(string s)` | Constructor | Deserializes from string. |
| `SensorCalibration(DataRow dr)` | Constructor | Populates from database row. |
| `SensorCalibration(SensorCalibration sc)` | Constructor | Deep copy constructor. |
| `NewDigitalSC()` | `static SensorCalibration` | Factory for digital sensor calibration. |
| `GetLatestCalibrationBySerialNumberAndExcitation(SensorData, ExcitationVoltageOption)` | `static SensorCalibration` | Delegates to `SensorCalibrationList`. |
| `CalVersion` | `long { get; set; }` | Default `long.MinValue`. |
| `SerialNumber` | `string { get; set; }` | Sensor serial number. |
| `CalibrationDate` | `DateTime { get; set; }` | Primary sort key. |
| `ModifyDate` | `DateTime { get; set; }` | Secondary sort key. |
| `Username` | `string { get; set; }` | User who created calibration. |
| `Records` | `CalibrationRecords { get; set; }` | Calibration data points. |
| `NonLinear` | `bool { get; set; }` | When set true, forces `Sensitivity=1`, `IsProportional=false`, `RemoveOffset=false`. |
| `IsProportional` | `bool { get; set; }` | Returns `false` if `NonLinear` is true. Default `true`. |
| `RemoveOffset` | `bool { get; set; }` | Returns `false` if `NonLinear` is true. Default `true`. |
| `LocalOnly` | `bool { get; set; }` | Whether calibration is local-only. |
| `ZeroMethod` | `ZeroMethod { get; set; }` | Lazy-initialized with default. Modified by `NonLinear` state. |
| `InitialOffset` | `InitialOffset { get; set; }` | Initial offset configuration. |
| `CertificationDocuments` | `string[] { get; set; }` | Associated certification docs. |
| `CompareTo(SensorCalibration other)` | `int` | Compares by `CalibrationDate` (descending), then `ModifyDate` (descending), then `CalVersion`. |
| `FromSerializedString(string s)` | `void` | Deserializes from field-separated string. |
| `ReadXML(XmlElement root)` | `void` | Populates from XML element. |
### SensorCalibrationList
```csharp
public class SensorCalibrationList
```
Manages cached calibration lookups.
| Member | Signature | Description |
|--------|-----------|-------------|
| `Reload()` | `static void` | Resets singleton instance under lock. |
| `GetLatestCalibrationBySerialNumberAndExcitation(SensorData, ExcitationVoltageOption)` | `static SensorCalibration` | Returns latest matching calibration. Returns `NewDigitalSC()` for digital/squib types. Checks cached list first, then database. |
| `DeleteAll()` | `static void` | Deletes all calibrations via stored procedure `sp_SensorCalibrationsDelete`. Clears internal cache. |
### SensorsCollection
```csharp
public class SensorsCollection : INotifyPropertyChanged
```
Singleton collection for sensor lookup.
| Member | Signature | Description |
|--------|-----------|-------------|
| `SensorsList` | `static SensorsCollection { get; }` | Singleton accessor (lazy-initialized under lock). |
| `HookedUp` | `bool { get; set; }` | Controls whether `PropertyChanged` events are raised. Default `true`. |
| `Reload()` | `void` | **Empty implementation.** |
| `DeleteAll()` | `void` | Deletes all sensors via `sp_SensorDeleteAll`, then calls `SensorCalibrationList.DeleteAll()`. |
| `GetSensorBySerialNumber(string, bool, bool)` | `SensorData` | Searches cache then database across analog, digital input, squib, and digital output tables. Returns `null` if not found (unless test-specific digital out SN). |
### DigitalInputSetting
```csharp
public class DigitalInputSetting : SensorData
```
Configuration for digital input channels.
| Member | Signature | Description |
|--------|-----------|-------------|
| `DigitalInputSetting(IDataRecord reader)` | Constructor | Populates from database record. Catches and silently ignores exceptions. |
| `SetDefaults(SensorData sd)` | `static void` | Sets `Bridge = DigitalInput`, `Capacity = 1`, `DisplayUnit = "V"`, `BridgeResistance = NaN`, etc. |
### DigitalOutputSetting
```csharp
public class DigitalOutputSetting : SensorData
```
Configuration for digital output channels.
| Member | Signature | Description |
|--------|-----------|-------------|
| `DigitalOutputSetting()` | Constructor | Calls `SetDefaults()`. |
| `DigitalOutputSetting(IDataRecord reader)` | Constructor | Populates from database record, then calls `SetDefaults()`. Silently catches exceptions. |
| `SetDefaults(SensorData sd)` | `static void` | Sets `Bridge = TOMDigital`, `Capacity = 1`, `DisplayUnit = "V"`, etc. |
| `ChannelDescription` | `string { get; set; }` | Alias for `SerialNumber`. Raises `PropertyChanged` on set. |
### SquibSetting
```csharp
public class SquibSetting : SensorData
```
Configuration for squib (explosive initiator) channels.
| Member | Signature | Description |
|--------|-----------|-------------|
| `SquibSetting(IDataRecord reader)` | Constructor | Populates from database record. Silently catches exceptions. |
| `SetDefaults(SensorData sd)` | `static void` | Sets `Bridge = SQUIB`, `Capacity = 5`, `DisplayUnit = "V"`, etc. |
| `SquibDescription` | `string { get; set; }` | Alias for `SerialNumber`. |
| `ArticleId` | `string { get; set; }` | Alias for `Id`. |
| `BypassCurrentFilter` | `bool { get; set; }` | Uses `SetProperty` for notification. |
| `BypassVoltageFilter` | `bool { get; set; }` | Uses `SetProperty` for notification. |
---
## 3. Invariants
1. **SensorRange parsing**: Input string must contain exactly 3 comma-separated values; otherwise `InvalidDataException` is thrown.
2. **LowHigh parsing**: Input string must contain at least 2 comma-separated values; otherwise `InvalidDataException` is thrown.
3. **IsoCode length**: Always exactly 16 characters. Shorter inputs are right-padded with '?'; longer inputs are truncated to 16.
4. **FilterClass frequency mapping**: `FilterClassType` enum values double as their frequency in Hz (e.g., `CFC60 = 100` means 100 Hz).
5. **CalibrationRecord.ZeroPoint**: When `Poly.CalibrationFactor != 0`, the getter returns a calculated value (`Poly.ZeroPositionIntercept / Poly.CalibrationFactor`) rather than the stored `_zeroPoint`.
6. **NonLinear calibration state**: Setting `SensorCalibration.NonLinear = true` forcibly sets `Records[0].Sensitivity = 1`, `IsProportional = false`, and `RemoveOffset = false`.
7. **SensorCalibration ordering**: `CompareTo` sorts descending by `CalibrationDate`, then `ModifyDate`, then `CalVersion`.
8. **Digital sensor calibration**: `GetLatestCalibrationBySerialNumberAndExcitation` returns `NewDigitalSC()` for any sensor where `IsDigitalInput()`, `IsSquib()`, or `IsDigitalOutput()` returns true.
9. **SensorsCollection.HookedUp**: When `false`, `OnPropertyChanged` is a no-op; no events are raised.
---
## 4. Dependencies
### This module depends on:
- `System.Data` / `System.Data.SqlClient` - Database operations via `IDataRecord`, `DataRow`, `SqlCommand`
- `System.ComponentModel` - `INotifyPropertyChanged` interface
- `System.Globalization` - `CultureInfo.InvariantCulture` for parsing
- `System.Xml` - XML parsing in `SensorCalibration.ReadXML`
### External types referenced (not defined in source):
- `SensorData` - Base class for sensor settings
- `DbOperations` - Database field name constants and `GetSQLCommand()` factory
- `DbOperationsEnum.StoredProcedure` - Stored procedure name enum
- `ExcitationVoltageOptions.ExcitationVoltageOption` - Excitation voltage enum
- `Test.Module.Channel.Sensor.BridgeType` - Bridge type enum (`DigitalInput`, `TOMDigital`, `SQUIB`)
- `Test

View File

@@ -0,0 +1,41 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SettingsDB/GlobalSetting.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SettingsDB/SettingsDB.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/SettingsDB/Setting.cs
generated_at: "2026-04-17T15:54:56.419164+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "13a82f958bbaccd7"
---
# Documentation: SettingsDB Module
## 1. Purpose
This module provides a thread-safe, database-backed key-value store for application settings. It implements a singleton pattern (`SettingsDB`) that manages in-memory cached `Setting` objects, with concrete implementations like `GlobalSetting` for system-wide configuration. The module abstracts database operations for persisting and retrieving settings via SQL stored procedures, supporting both string and boolean values with automatic default value initialization.
---
## 2. Public Interface
### `SettingsDB` (Concrete Class)
A singleton class that serves as the primary entry point for managing global settings.
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetGlobalValue` | `public static string GetGlobalValue(string id, string defaultValue)` | Retrieves a global setting by ID. Creates a new `GlobalSetting` with the provided default value if the ID doesn't exist in the cache. Returns the cached `PropertyValue`. |
| `GetGlobalValueBool` | `public static bool GetGlobalValueBool(string id, bool defaultValue)` | Retrieves a global setting as a boolean. Parses the stored string value; returns `defaultValue` if parsing fails. |
| `SetGlobalValue` | `public static void SetGlobalValue(string id, string value)` | Stores a global property in the database. Creates a new `GlobalSetting` if the ID doesn't exist; otherwise updates the existing value via `SetValue()`. |
| `SetGlobalValueBoolean` | `public static void SetGlobalValueBoolean(string id, bool value)` | Stores a boolean global property. Converts the bool to string using `InvariantCulture` before persisting. |
### `Setting` (Abstract Base Class)
Base class for all setting types, handling database persistence.
| Member | Signature | Description |
|--------|-----------|-------------|
| `PropertyId` | `public string PropertyId => _propertyId` | Read-only string identifier for the property. |
| `PropertyValue` | `public string PropertyValue => _propertyValue` | Read-only string value of the property. |
| `UserId` | `public string UserId

View File

@@ -0,0 +1,168 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Storage/IDbTimeStampAware.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Storage/DbOperationsEnum.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Storage/DbOperations.cs
generated_at: "2026-04-17T15:55:34.382481+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2b4b04a70e36d4d6"
---
# DatabaseImport Storage Module Documentation
## 1. Purpose
This module provides the data access layer for the DatabaseImport system, managing database connections, schema definitions, and timestamp-based synchronization between in-memory objects and the database. It defines the structure of database entities through strongly-typed field enumerations, centralizes stored procedure references, and implements a timestamp comparison mechanism to detect when local data is out of sync with the database. The module supports both centralized SQL Server deployments and local SQL LocalDB instances.
---
## 2. Public Interface
### IDbTimeStampAware (Interface)
**Signature:** `public interface IDbTimeStampAware`
Defines the contract for objects that track synchronization state with the database.
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetTimeStampMemory` | `long GetTimeStampMemory()` | Returns the current in-memory timestamp value. |
| `SetTimeStampMemory` | `void SetTimeStampMemory(long value)` | Sets the in-memory timestamp to the specified value. |
| `GetTimeStampDb` | `long GetTimeStampDb()` | Retrieves the current timestamp from the database. |
| `IsOutOfDate` | `bool IsOutOfDate()` | Returns `true` if the in-memory data differs from the database. |
### DbTimeStampBase (Abstract Class)
**Signature:** `public abstract class DbTimeStampBase : IDbTimeStampAware, INotifyPropertyChanged`
Base class providing `INotifyPropertyChanged` implementation and timestamp tracking functionality.
| Member | Signature | Description |
|--------|-----------|-------------|
| `PropertyChanged` | `event PropertyChangedEventHandler PropertyChanged` | Event raised when a property value changes. |
| `SetProperty<T>` | `protected bool SetProperty<T>(ref T storage, T value, string propertyName = null)` | Helper method for property setters; returns `true` if value changed. |
| `OnPropertyChanged` | `protected void OnPropertyChanged(string propertyName = null)` | Raises the `PropertyChanged` event. |
| `GetTimeStampMemory` | `public long GetTimeStampMemory()` | Returns the protected `DbTimeStamp` field. |
| `SetTimeStampMemory` | `public void SetTimeStampMemory(long value)` | Assigns `value` to `DbTimeStamp`. |
| `SetTimeStampMemory` | `public void SetTimeStampMemory(DataRow row)` | Sets `DbTimeStamp` to `0`. |
| `SetTimeStampMemory` | `public void SetTimeStampMemory(IDataReader reader)` | Sets `DbTimeStamp` to `0`. |
| `GetTimeStampDb` | `public long GetTimeStampDb(Dictionary<string, long> lookup)` | Returns `0`. |
| `GetTimeStampDb` | `public long GetTimeStampDb()` | Returns `0`. |
| `IsOutOfDate` | `public bool IsOutOfDate()` | Compares memory and DB timestamps; returns `false` if DB timestamp is `0`, syncs memory to DB if memory is `0` but DB is not. |
### DbOperationsEnum (Class)
**Signature:** `public class DbOperationsEnum`
Container class for database-related enumerations.
| Member | Description |
|--------|-------------|
| `StoredProcedure` (enum) | Contains 120+ stored procedure names including `sp_UserDelete`, `sp_UserGet`, `sp_DBImportUsers`, `sp_SensorModelsGet`, `sp_TestSetupsGet`, etc. |
### DbOperations (Class)
**Signature:** `public class DbOperations`
Primary database operations class containing schema definitions and connection management.
#### Constants
| Constant | Value | Description |
|----------|-------|-------------|
| `CURRENT_DB_VERSION` | `61` | Current database schema version for this codebase. |
#### Static Fields
| Field | Default | Description |
|-------|---------|-------------|
| `_usingCentralizedDB` | `true` | `true` = remote centralized server; `false` = local SqlLocalDB. |
| `_usingMSSQL` | `true` | Indicates MSSQL usage. |
| `_usingNTLMAuthentication` | `false` | Whether to use Windows Authentication. |
| `_previousDir` | `string.Empty` | Previous directory path. |
| `cmd` | `SqlCommand` | Static SQL command instance. |
#### Static Properties
| Property | Description |
|----------|-------------|
| `Connection` | Singleton accessor returning the `DbOperations` instance. |
#### Instance Properties
| Property | Type | Description |
|----------|------|-------------|
| `Server` | `string` | Database server address. |
| `Username` | `string` | SQL authentication username. |
| `Password` | `string` | SQL authentication password. |
| `DBName` | `string` | Database name. |
#### Static Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetSQLCommand` | `public static SqlCommand GetSQLCommand()` | Returns `_cmd`, initializing connection if needed. |
| `GetSQLCommand` | `public static SqlCommand GetSQLCommand(bool newCommand)` | Returns existing or new `SqlCommand` with open connection. |
| `IsServerConnected` | `public static bool IsServerConnected()` | Tests connection to local database; returns `true` if successful. |
#### Instance Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetLocalConnectionString` | `public string GetLocalConnectionString()` | Builds connection string based on authentication mode. |
| `QueryDataSet` | `public DataSet QueryDataSet(SqlCommand icmd)` | Executes query and returns populated `DataSet`. |
#### Nested Schema Classes
All nested classes are `abstract` and contain field enumerations with optional `DbTypeAttr` attributes:
| Class | Key Members |
|-------|-------------|
| `Tags` | `TagFields` enum |
| `DbVersions` | `DbVersionFields` enum |
| `Settings` | `UserFields` enum |
| `Users` | `UserFields`, `UIItemFields` enums |
| `SensorDB` | `SensorDataFields`, `SensorModelFields`, `SensorCalibrationFields` enums |
| `CalculatedChannels` | `Table` constant, `Fields` enum with `DbTypeAttr` |
| `LevelTriggers` | `Fields` enum with `DbTypeAttr` |
| `TestSetups` | `HardwareFields`, `ChannelSettingFields`, `Fields`, `TestSetupObjectFields`, `TestObjectMetaDataFields`, `GraphFields` enums |
| `TestObjectChannelSettings` | `Fields` enum |
| `DigitalOutputSettings` | `Fields` enum |
| `Squib` | `Fields` enum |
| `MMETables` | `MMEDirectionsFields`, `MMEFilterClassesFields`, `MMEFineLocations1Fields`, `MMEFineLocations2Fields`, `MMEFineLocations3Fields`, `MMEPhysicalDimensionFields`, `MMEPositionsFields`, `MMETestObjectsFields`, `MMEMainLocationsFields` enums |
| `DAS` | `Fields`, `DASChannelFields` enums |
| `DigitalInputSettings` | `Fields` enum |
#### DbTypeAttr (Attribute Class)
**Signature:** `public class DbTypeAttr : Attribute`
| Member | Description |
|--------|-------------|
| `DbType` | SQL type string (e.g., `"INTEGER PRIMARY KEY NOT NULL"`, `"NVARCHAR(255)"`). |
| `GetDbType(object o)` | Static method to retrieve `DbType` value from enum member via reflection. |
---
## 3. Invariants
1. **Singleton Pattern**: `DbOperations.Connection` always returns the same instance; access is thread-safe via `dbLock`.
2. **Connection State**: `GetSQLCommand()` ensures the returned `SqlCommand` has an open connection; it calls `Parameters.Clear()` before returning.
3. **Timestamp Comparison Logic**: `IsOutOfDate()` returns `false` when `db == 0` (no record exists), preventing false "out of date" flags for new records.
4. **Auto-Sync Behavior**: When `mem == 0 && db != 0`, `IsOutOfDate()` silently syncs memory to DB value before comparison.
5. **Database Version**: The codebase expects database schema version `61` (`CURRENT_DB_VERSION`).
6. **Field Enum Indexing**: `SensorDataFields.SerialNumber` is explicitly set to value `1`, not the default `0`.
---
## 4. Dependencies
### This Module Depends On:
- `System.Collections.Generic` (for `Dictionary<string, long>`)
- `System.ComponentModel` (for `INotifyPropertyChanged`, `PropertyChangedEventHandler`)
- `System.Data` (for `DataSet`, `DataRow`, `IDataReader`, `ConnectionState`)
- `System.Data.SqlClient` (for `SqlConnection`, `SqlCommand`, `SqlDataAdapter`, `SqlException`)
### External Dependencies Referenced (but not defined in source):
- `APILogger` - Referenced in commented code for exception logging.
- `Connection.GetLocalConnectionString()` - Called in `IsServerConnected()` (appears to be a static method on `DbOperations.Connection`).
---
## 5. Gotchas
1. **Non-functional Timestamp Methods**: `SetTimeStampMemory(DataRow)`, `SetTimeStampMemory(IDataReader)`, `

View File

@@ -0,0 +1,86 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Users/User.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Users/ITagAware.cs
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Users/Tags.cs
generated_at: "2026-04-17T16:44:26.882862+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "a4f52a52acc619da"
---
# Documentation: DatabaseImport.Users Module
## 1. Purpose
This module provides the domain model for User entities within the DatabaseImport system, with support for tag associations. It enables serialization of tag IDs to binary blobs for database storage, and defines the structure for tag entities that can be persisted and cloned. The module is designed to facilitate importing user data with associated metadata (tags) from external sources.
---
## 2. Public Interface
### `User` Class
**Namespace:** `DatabaseImport`
**Inheritance:** `TagAwareBase`
A minimal entity class representing a single user. Inherits all behavior from `TagAwareBase`, including tag management and timestamp functionality.
```csharp
public class User : TagAwareBase
```
---
### `ITagAware` Interface
**Namespace:** `DatabaseImport`
A marker interface for classes that support tag awareness. Currently defines no members.
```csharp
public interface ITagAware
```
---
### `TagAwareBase` Class (Abstract)
**Namespace:** `DatabaseImport`
**Inheritance:** `DbTimeStampBase`
Base class providing tag storage and binary serialization capabilities.
#### Properties
| Signature | Description |
|-----------|-------------|
| `byte[] TagsBlobBytes { get; set; }` | Gets or sets tag IDs as a binary blob. Getter converts `TagIDs` to a byte array; setter parses bytes back to `TagIDs`. |
| `int[] TagIDs { get; set; }` | Gets or sets the array of tag IDs. Never null; defaults to empty array. |
---
### `Tags` Class
**Namespace:** `DatabaseImport`
Container class for tag-related types.
---
### `Tags.Tag` Class (Nested)
**Namespace:** `DatabaseImport`
**Implements:** `ICloneable`
Represents a single tag entity with ID, text, and obsolescence state.
#### Properties
| Signature | Description |
|-----------|-------------|
| `int ID { get; set; }` | The unique identifier for the tag. |
| `string Text { get; set; }` | The display text of the tag. |
| `bool IsObsolete { get; set; }` | Indicates whether the tag is obsolete. |
#### Constructors
| Signature | Description |
|-----------|-------------|
| `Tag(Tag copy)` | Copy constructor. Creates a new instance with values copied from `copy`. |
| `Tag(IDataRecord reader)` | Constructs a tag from a database record, reading fields via `DbOperations.Tags.TagFields`

View File

@@ -0,0 +1,21 @@
---
source_files:
- DataPRO/Modules/DatabaseImporter/DatabaseImport/Utilities/DiskUtility.cs
generated_at: "2026-04-17T16:29:45.030001+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "0f336a841c73386c"
---
# Utilities
### Purpose
This module provides disk and file system utility functions for the DatabaseImporter subsystem. It centralizes validation logic for file and path naming to ensure compatibility with operating system constraints.
### Public Interface
**`DiskUtility`**
- `public static bool ValidateFileAndPathNameChars(string nameToValidate)` — Validates that the input string contains no illegal characters for file or path names. Returns `true` if valid, `false` otherwise. Checks against `Path.GetInvalidFileNameChars()`, `Path.GetInvalidPathChars()`, and additionally rejects strings containing periods (`.`) or strings that are empty/whitespace-only after trimming.
### Invariants
- Input string must not be

View File

@@ -0,0 +1,40 @@
---
source_files:
- DataPRO/Modules/Groups/GroupChannelList/GroupChannelListModule.cs
generated_at: "2026-04-17T16:46:52.499953+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b6c76c982c83d2d8"
---
# Documentation: GroupChannelListModule
## 1. Purpose
This module provides the "Group Channel List" functionality within a modular WPF application built on the Prism framework. It serves as a self-contained unit that registers views and view-models for group channel listing and settings management with the Unity dependency injection container. The module is categorized under the "Prepare" assembly group and exposes assembly-level metadata (name and image) for use by the main application shell, likely for module discovery and UI presentation purposes.
## 2. Public Interface
### `GroupChannelListModule` (class)
**Implements:** `Prism.Modularity.IModule`
The main module class responsible for type registration with the DI container.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `GroupChannelListModule(IUnityContainer unityContainer)` | Accepts a Unity container instance via constructor injection. |
| `Initialize` | `void Initialize()` | Registers three type mappings with Unity: `IGroupChannelListViewModel``GroupChannelListViewModel`, `IGroupChannelListView``GroupChannelListView`, `IGroupChannelSettingsListView``GroupChannelSettingsListView`. |
| `OnInitialized` | `void OnInitialized(IContainerProvider containerProvider)` | Empty implementation. No post-initialization logic executed. |
| `RegisterTypes` | `void RegisterTypes(IContainerRegistry containerRegistry)` | Delegates to `Initialize()`. This is the Prism lifecycle method for type registration. |
---
### `GroupChannelListModuleNameAttribute` (class)
**Inherits from:** `TextAttribute`
Assembly-level attribute exposing the module's name as text metadata.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `GroupChannelListModuleNameAttribute()` | Default constructor; sets `AssemblyName` to `AssemblyNames.GroupChannelList.ToString()`. |
| Constructor | `GroupChannelListModuleNameAttribute(string s)` | Overload accepting a string parameter (parameter is unused).

View File

@@ -0,0 +1,31 @@
---
source_files:
- DataPRO/Modules/Groups/GroupChannelList/Converters/BooleanToWidthConverter.cs
- DataPRO/Modules/Groups/GroupChannelList/Converters/SensorIdBackgroundConverter.cs
generated_at: "2026-04-17T16:13:20.076259+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "e25d08690ef1d9de"
---
# Converters
### Purpose
This module provides WPF value converters for the `GroupChannelList` UI component. It exists to transform data values into visual representations in XAML bindings, specifically converting boolean values to width measurements and background brush colors for sensor ID display elements.
### Public Interface
- **`BooleanToWidthConverter` class** (public) - Implements `IValueConverter`. Converts boolean values to width values for UI element sizing.
- `object Convert(object value, Type targetType, object parameter, CultureInfo culture)` - Returns `width` (parsed from parameter) if `value` is `true`, returns `0` if `value` is `false`, returns `0` if `value` is `null`. If parameter parsing fails, returns `double.NaN`.
- `object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)` - Throws `NotImplementedException`.
- **`SensorIdBackgroundConverter` class** (public) - Implements `IValueConverter`. Converts boolean values to background brush colors.
- `object Convert(object value, Type targetType, object parameter, CultureInfo culture)` - Returns a light green brush (`#FFE3FBE1`) if `value` is `true`, returns `Brushes.Transparent` if `value` is `false` or `null`. Catches and traces exceptions.
- `object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)` - Throws `NotImplementedException`.
### Invariants
- `ConvertBack` is not implemented on either converter; these are one-way converters only.
- `SensorIdBackgroundConverter.SensorIdBrush` is a static field that is frozen before return to make it thread-safe and non-modifiable.
### Dependencies
- **Depends on**: `System.Windows.Data.IValueConverter`, `System.Windows.Media.SolidColorBrush`, `System.Windows.Media.Color`, `System.Windows.Media.Brushes`, `System.Globalization.CultureInfo`, `System.Diagnostics.Trace`.
- **Depended on by**: XAML views in the `GroupChannelList

View File

@@ -0,0 +1,38 @@
---
source_files:
- DataPRO/Modules/Groups/GroupChannelList/Properties/Settings.Designer.cs
- DataPRO/Modules/Groups/GroupChannelList/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:13:20.076523+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "db9235aae8cb1ff1"
---
# Properties
### Purpose
This module provides assembly metadata and application-scoped configuration settings for the `RegAddProductCode` custom installer action. It exists to configure Windows Installer policy-related registry operations, specifically for managing secure repair whitelisting. The settings defined here are used during installation to register product codes that allow the application to be repaired without elevated privileges.
### Public Interface
- **`Settings` class** (internal sealed, partial) - Auto-generated settings class inheriting from `System.Configuration.ApplicationSettingsBase`.
- `static Settings Default { get; }` - Returns the synchronized singleton instance of settings.
- `string InstallerKey { get; }` - Returns `"SOFTWARE\\Policies\\Microsoft\\Windows\\Installer"`. Application-scoped setting.
- `string MissingKey { get; }` - Returns `"No key at {0}"`. Format string template for missing key messages. Application-scoped setting.
- `string ProductCode { get; }` - Returns `"{C4889149-0CAF-44C1-B226-8F6E73684DF4}"`. The GUID product code for this product. Application-scoped setting.
- `string SecureRepairPolicy { get; }` - Returns `"SecureRepairPolicy"`. Application-scoped setting.
- `string SecureRepairWhitelistKey { get; }` - Returns `"SOFTWARE\\Policies\\Microsoft\\Windows\\Installer\\SecureRepairWhitelist"`. Application-scoped setting.
### Invariants
- All settings are application-scoped and read-only at runtime.
- The `ProductCode` GUID must be a valid Windows Installer product code format.
- Registry key paths use double backslash escaping for .NET string literals.
### Dependencies
- **Depends on**: `System.Configuration.ApplicationSettingsBase`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices`.
- **Depended on by**: The parent `RegAddProductCode` installer custom action module (inferred from namespace).
### Gotchas
- The `MissingKey` setting contains a format placeholder `{0}` suggesting it's intended for `string.Format()` usage, but the consuming code is not visible in this module.
- The `ProductCode` GUID `{C4889149-0CAF-44C1-B226-8F6E73684DF4}` is hardcoded; if the actual product code changes, this setting must be updated manually.
---

View File

@@ -0,0 +1,216 @@
---
source_files:
- DataPRO/Modules/Groups/GroupChannelList/Resources/TranslateExtension.cs
- DataPRO/Modules/Groups/GroupChannelList/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T15:58:50.253166+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "fc71a9ad19b8ef2b"
---
# Documentation: GroupChannelList Resources Module
## 1. Purpose
This module provides localization infrastructure for the GroupChannelList feature within the DataPRO Groups module. It consists of a WPF XAML markup extension (`TranslateExtension`) that enables declarative string localization in XAML bindings, backed by an auto-generated strongly-typed resource class (`StringResources`) containing localized strings for channel configuration UI elements, parameter labels, validation messages, and user-facing text. The module supports the configuration and display of various channel types including Analog, CAN, Digital I/O, Squib, Stream, and UART channels.
---
## 2. Public Interface
### TranslateExtension (Markup Extension)
**Class Definition:**
```csharp
[MarkupExtensionReturnType(typeof(string))]
public class TranslateExtension : MarkupExtension
```
**Constructor:**
```csharp
public TranslateExtension(string key)
```
- Creates an instance with the specified resource key to look up.
**Public Method:**
```csharp
public override object ProvideValue(IServiceProvider serviceProvider)
```
- Returns the localized string for the key stored in `_key` by querying `StringResources.ResourceManager.GetString(_key)`.
- Returns `NotFound` ("#stringnotfound#") if `_key` is null or empty.
- Returns `NotFound + " " + _key` (e.g., "#stringnotfound# SomeKey") if the resource lookup returns null.
**Private Constants:**
- `private const string NotFound = "#stringnotfound#"` — Fallback value for missing keys.
---
### StringResources (Auto-Generated Resource Class)
**Class Definition:**
```csharp
internal class StringResources
```
- Internal class; not accessible outside the `GroupChannelList.Resources` namespace.
**Static Properties:**
| Property | Description (from source comments) |
|----------|-------------------------------------|
| `ResourceManager` | Returns cached `ResourceManager` instance for this assembly. |
| `Culture` | Gets/sets `CultureInfo` for resource lookups. |
**Resource String Properties (selected):**
| Property | Default Text |
|----------|--------------|
| `AnalogParameter_ACCouplingEnable` | "AC coupling enabled" |
| `AnalogParameters_Capacity` | "Sensor max range" |
| `AnalogParameters_CFC` | "Channel filter class" |
| `AnalogParameters_InitialOffset` | "Initial offset" |
| `AnalogParameters_MaximumUsage` | "Maximum Usage" |
| `AnalogParameters_Polarity` | "Polarity" |
| `AnalogParameters_Range` | "Channel full-scale" |
| `AnalogParameters_Sensitivity` | "Sensitivity" |
| `AnalogParameters_Units` | "Units" |
| `AnalogParameters_UsageCount` | "Usage Count" |
| `AnalogParameters_UserValue1/2/3` | "User Value 1/2/3" |
| `AnalogParameters_ZeroMethod` | "Zero Method" |
| `AnalogParameters_ZeroMethodEnd` | "End (sec)" |
| `AnalogParameters_ZeroMethodStart` | "Start (sec)" |
| `CanParameters_ArbBaseBitrate` | "Arb/Base Bitrate" |
| `CanParameters_ArbBaseSJW` | "Arb/Base SJW" |
| `CanParameters_DataBitrate` | "Data Bitrate" |
| `CanParameters_DataSJW` | "Data SJW" |
| `CanParameters_FileType` | "FileType" |
| `CanParameters_IsFD` | "CAN is FD" |
| `DigitalInParameters_ActiveValue` | "Active value" |
| `DigitalInParameters_DefaultValue` | "Default value" |
| `DigitalInParameters_InputMode` | "Input mode" |
| `DigitalOutParameters_Delay` | "Delay (ms)" |
| `DigitalOutParameters_Duration` | "Duration (ms)" |
| `DigitalOutParameters_LimitDuration` | "Limit duration" |
| `DigitalOutParameters_OutputMode` | "Output mode" |
| `SquibParameters_Current` | "Current (A)" |
| `SquibParameters_Delay` | "Delay (ms)" |
| `SquibParameters_Duration` | "Duration (ms)" |
| `SquibParameters_FireMode` | "Fire mode" |
| `SquibParameters_LimitDuration` | "Limit duration" |
| `StreamInParameters_UDPAddress` | "UDP Address" |
| `StreamOutParameters_DataChannelId` | "Data channel id" |
| `StreamOutParameters_IENA_Key` | "IENA key" |
| `StreamOutParameters_IENA_SourcePort` | "Source port" |
| `StreamOutParameters_IRIGTimeDataPacketIntervalMs` | "IRIG time data packet interval (ms)" |
| `StreamOutParameters_StreamProfile` | "Stream profile" |
| `StreamOutParameters_TimeChannelId` | "Time channel id" |
| `StreamOutParameters_TMATSIntervalMs` | "TMATS interval (ms)" |
| `StreamOutParameters_TMNS_MessageId` | "Message Id" |
| `StreamOutParameters_TMNS_MinorPerMajor` | "Minor per major" |
| `StreamOutParameters_TMNS_SubFrameId` | "Subframe Id" |
| `StreamOutParameters_TMNS_TMATSPort` | "TMATS port" |
| `StreamOutParameters_TmNSConfig` | "TmNS config" |
| `StreamOutParameters_UDPAddress` | "UDP Address" |
| `UartParameters_BaudRate` | "Baud rate" |
| `UartParameters_DataBits` | "Data bits" |
| `UartParameters_DataFormat` | "Data format" |
| `UartParameters_FlowControl` | "Flow control" |
| `UartParameters_Parity` | "Parity" |
| `UartParameters_StopBits` | "Stop bits" |
| `ChannelName` | "Channel name" |
| `ChannelType` | "Type" |
| `Channels` | " channel(s) in " |
| `Clear` | "Clear" |
| `Delete` | "Delete" |
| `DisplayName` | "Display name" |
| `DisplayOrder` | "Display order" |
| `DragAndDropFilterWarning` | "Drag and drop operation completed. Note that the table is currently being filtered..." |
| `DuplicateSensor` | "Sensor appears more than once" |
| `EnterValue` | "Enter value" |
| `GlobalRangeCAC` | "Global range (CAC)" |
| `Group` | "Group" |
| `GroupLower` | "group" |
| `Hardware` | "Hardware" |
| `IEPESupport` | "IEPE support" |
| `IntervalOn` | "On" |
| `InvalidAnalogAssignment` | "Sensor {0} can not be assigned to channel {1}" |
| `InvalidDigitalInputAssignment` | "DigitalInput {0} can not be assigned to channel {1}" |
| `InvalidDigitalOutputAssignment` | "DigitalOutput {0} can not be assigned to channel {1}" |
| `InvalidExcitationAssignment` | "Sensor {0} does not support any of the excitation options provided by channel {1}" |
| `InvalidLine` | "Invalid pasted group channel, line: {0}" |
| `InvalidSensor` | "Invalid sensor, line: {0}" |
| `InvalidSquibAssignment` | "Squib {0} can not be assigned to channel {1}" |
| `ISOAndUserCode` | "ISO 13499 and user codes" |
| `ISOChannelName` | "ISO channel name" |
| `ISOCode` | "ISO (13499) code" |
| `ISOOnly` | "ISO 13499 only" |
| `ModifyGlobalRangeCAC` | "Modify global range CAC" |
| `Not_Applicable` | "N/A" |
| `Of` | " of " |
| `Order` | "Order" |
| `Parameters_Analog` | "Analog" |
| `Parameters_CAN` | "CAN" |
| `Parameters_DigitalIn` | "Digital in" |
| `Parameters_DigitalOut` | "Digital out" |
| `Parameters_Squib` | "Squib" |
| `Parameters_StreamIn` | "Stream in" |
| `Parameters_StreamOut` | "Stream out" |
| `Parameters_Uart` | "UART" |
| `PhysicalChannelsAssigned` | " physical channel(s) assigned" |
| `RemoveSensor` | "Remove Sensor" |
| `Sensor` | "Sensor (SN)" |
| `DallasId` | "Dallas ID" |
| `AssignedBySensorId` | "(Assigned by ID)" |
| `btnApplyGlobalRangeCAC` | "Apply" |
| `ChannelDelete_Tooltip` | "To delete a channel, please contact an Administrator" |
| `Table_NA` | "---" |
| `Test` | "test" |
| `TestChannelsGroupName` | "Test channels" |
| `UserChannelName` | "User channel name" |
| `UserCode` | "User code" |
| `UserCodeOnly` | "User codes only" |
---
## 3. Invariants
1. **TranslateExtension key requirement**: The `_key` field is set via constructor and is `readonly`. It cannot be changed after instantiation.
2. **Missing resource handling**: `ProvideValue` will never return null. It returns either:
- The localized string from resources
- `#stringnotfound#` (if key is null/empty)
- `#stringnotfound# {key}` (if key exists but no matching resource)
3. **StringResources visibility**: The `StringResources` class is `internal` and cannot be accessed outside the `GroupChannelList.Resources` namespace.
4. **ResourceManager singleton pattern**: The `ResourceManager` property uses lazy initialization with a null-check pattern; once initialized, the same instance is returned on subsequent calls.
5. **Auto-generated code constraint**: `StringResources.Designer.cs` is auto-generated by `System.Resources.Tools.StronglyTypedResourceBuilder` version 17.0.0.0. Manual changes will be overwritten on regeneration.
---
## 4. Dependencies
### This module depends on:
- `System` (core .NET framework)
- `System.Windows.Markup` (for `MarkupExtension` and `MarkupExtensionReturnTypeAttribute`) — WPF-specific
- `System.Resources` (for `ResourceManager`)
- `System.Globalization` (for `CultureInfo`)
- `System.CodeDom.Compiler`, `System.Diagnostics`, `System.Runtime.CompilerServices`, `System.ComponentModel` (for generated attributes)
### What depends on this module:
- **Inferred**: XAML files within the `GroupChannelList` module that use the `{local:Translate KeyName}` markup extension syntax for localized UI strings.
- **Inferred**: Code-behind files that reference `StringResources` properties directly (though the class is `internal`, limiting this to within the assembly).
---
## 5. Gotchas
1. **Missing key indicator**: When a resource key is not found, the returned string includes the key name appended (e.g., `#stringnotfound# MyMissingKey`). This is useful for debugging but may appear in production UI if resources are missing.
2. **Null/empty key handling**: Passing `null` or empty string to `TranslateExtension` constructor returns only `#stringnotfound#` without a key suffix, making it impossible to distinguish which empty/null key caused the issue.
3. **Auto-generated file warning**: `StringResources.Designer.cs` is regenerated from a `.resx` file. Developers should not edit this file directly; instead, modify the underlying `.resx` file and regenerate.
4. **Culture not explicitly set**: The `TranslateExtension.ProvideValue` method does not explicitly pass a `CultureInfo` to `GetString()`. It relies on `StringResources.ResourceManager.GetString(key)` which uses the current UI culture. If `StringResources.Culture` is set, it must be done separately; the markup extension does not interact with it.
5. **Internal visibility limitation**: `StringResources` is `internal`, meaning direct programmatic access to resource strings is restricted to within the `GroupChannelList.Resources` namespace/assembly. External consumers must use `TranslateExtension` in XAML or use reflection.

View File

@@ -0,0 +1,100 @@
---
source_files:
- DataPRO/Modules/Groups/GroupChannelList/View/GroupChannelListView.xaml.cs
generated_at: "2026-04-17T15:58:43.555476+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d3939bb26e2af959"
---
# GroupChannelListView Documentation
## 1. Purpose
`GroupChannelListView` is a WPF UserControl (code-behind) that provides the view layer for displaying and managing a list of group channels in a tabular format. It handles user interactions including drag-and-drop sensor/hardware assignment, channel reordering, column visibility management based on view modes, and navigation events. This view implements `IGroupChannelListView` and serves as the UI component within the Groups module for configuring channel assignments in test setups and group configurations.
## 2. Public Interface
### Properties
| Signature | Description |
|-----------|-------------|
| `bool ReadOnlyChannelsMode { get; }` | Returns whether user input controls should be read-only. Delegates to `IGroupChannelListViewModel.ReadOnlyChannelsMode` if DataContext is valid; otherwise returns `false`. |
### Methods
| Signature | Description |
|-----------|-------------|
| `void HandleColumns(IsoViewMode viewMode)` | Dynamically configures column visibility based on the specified `IsoViewMode`. Manages Group, ISO Code, User Code, Dallas ID, and Test Setup Order columns. Reads global setting "ShowGroups" to determine group column visibility. |
### Constructor
| Signature | Description |
|-----------|-------------|
| `GroupChannelListView()` | Initializes the component and subscribes to `ListViewStatusEvent` via `IEventAggregator` to handle scroll-to-bottom requests. |
### Event Handlers (Private, wired to XAML)
| Method | Trigger | Behavior |
|--------|---------|----------|
| `Clear_Click(object sender, RoutedEventArgs e)` | Clear button click | Calls `viewModel.Clear(channel)` and `viewModel.NotifyChannelsChanged()` for the affected `IGroupChannel`. |
| `Delete_Click(object sender, RoutedEventArgs e)` | Delete button click | Publishes `GroupChannelDeleteRequestEvent` with `GroupChannelDeleteRequestEventArgs`. Special handling for blank channels with order values (bug fix 14546). |
| `MoveTop_Click`, `MoveUp_Click`, `MoveDown_Click`, `MoveBottom_Click` | Move button clicks | Calls corresponding `vm.MoveTop()`, `vm.MoveUp()`, `vm.MoveDown()`, `vm.MoveBottom()` methods. Supports multi-selection via `GetSelectedChannelsOrdered()`. |
| `ChannelList_Drop(object sender, DragEventArgs e)` | Drop operation | Handles `DragAndDropPayload.FORMAT` for sensor assignment and `DTS.Common.Classes.Hardware.DragAndDropPayload.FORMAT` for hardware assignment via `vm.DoSensorAssignment()` and `vm.DoHardwareAssignment()`. |
| `TextBox_Drop(object sender, DragEventArgs e)` | Drop on text box | Same drop handling as `ChannelList_Drop`, but extracts `IGroupChannel` from `Control.DataContext` or `TextBlock.DataContext`. |
| `ChannelCodeBuilder_OnChannelCodeSelected(object sender, string code, string name, ChannelEnumsAndConstants.ChannelCodeType codeType)` | Channel code selection | Sets `IsoCode`/`IsoChannelName` or `UserCode`/`UserChannelName` based on `codeType`. Calls `viewModel.MarkModified(channel)`. |
| `ChannelNameBuilder_OnChannelCodeSelected(...)` | Channel name selection | Similar to above but sets name first, then code. |
| `ISOCode_LostFocus(object sender, RoutedEventArgs e)` | ISO Code field loses focus | If `UseISOCodeFilterMapping` is true, retrieves software filters and calls `channel.GetFilterClassFromISOCode()` to set `FilterClass`. |
| `Hyperlink_Click(object sender, RoutedEventArgs e)` | Hyperlink click | Publishes `PageNavigationRequestEvent` with destination `Sensor` for navigation. |
## 3. Invariants
- **DataContext Contract**: Most operations assume `DataContext` is either `IGroupChannelListViewModel` or `GroupChannelListViewModel`. Operations silently return if this contract is violated.
- **Column Management**: `ChannelListListView.View` must be of type `DTS.Common.Controls.AutoSizedGridView` for column manipulation methods to function.
- **Drag-Drop Payload Formats**: The view recognizes specific format strings:
- `DragAndDropPayload.FORMAT` and `DragAndDropPayload.ALT_FORMAT` for sensor payloads
- `DTS.Common.Classes.Hardware.DragAndDropPayload.FORMAT` for hardware payloads
- **Selection Ordering**: `GetSelectedChannelsOrdered()` returns channels sorted by their index in `ChannelListListView.Items`, preserving visual order.
- **Order Column Exclusivity**: Either `TestSetupOrderColumn` or `GroupOrderColumn` is displayed at index 0, never both simultaneously.
## 4. Dependencies
### Imports (This module depends on)
| Namespace | Purpose |
|-----------|---------|
| `DTS.Common.Classes.Groups` | `GroupChannel` entity |
| `DTS.Common.Classes.Sensors.SensorsList` | Sensor-related types |
| `DTS.Common.Controls` | `AutoSizedGridView`, `GridViewColumnHeaderSearchable` |
| `DTS.Common.Enums` | `IsoViewMode` enum |
| `DTS.Common.Enums.Channels` | `ChannelEnumsAndConstants` |
| `DTS.Common.Events` | `PageNavigationRequestEvent`, `PageNavigationRequest` |
| `DTS.Common.Events.Groups.GroupChannelList` | `ListViewStatusEvent`, `ListViewStatusArg`, `GroupChannelDeleteRequestEvent`, `GroupChannelDeleteRequestEventArgs` |
| `DTS.Common.Interface.Channels` | `IHardwareChannel` |
| `DTS.Common.Interface.DataRecorders` | Data recorder interfaces |
| `DTS.Common.Interface.Groups.GroupChannelList` | `IGroupChannelListView`, `IGroupChannelListViewModel`, `IGroupChannel` |
| `DTS.Common.Settings` | `SettingsDB.GetGlobalValueBool()` |
| `DTS.Common.Utils` | `MouseUtilities` for drag-drop coordinate handling |
| `Prism.Ioc` | `ContainerLocator` for service resolution |
| `Prism.Events` | `IEventAggregator` for pub/sub messaging |
| `DTS.SensorDB` | `SoftwareFilter.GetSoftwareFilters()` (referenced in `ISOCode_LostFocus`) |
### Known Dependents
Not determinable from this source file alone.
## 5. Gotchas
1. **Drag-Drop Mouse Position**: The code explicitly uses `MouseUtilities.GetMousePosition(target)` instead of standard WPF mechanisms because "during a drag-drop operation, the WPF mechanisms for getting the coordinates behave strangely."
2. **Blank Channel Deletion (Bug 14546)**: Blank channels may still have `TestSetupOrder` or `GroupChannelOrder` assigned. The delete logic allows deletion of blank channels only if their order value is greater than 0, depending on `UseTestSetupOrder` mode.
3. **Modifier Key Format Mutation**: During drag operations, the code mutates format strings by prepending `"ALT_"` or `"CTRL_"` based on `DragDropKeyStates`. This creates format strings like `"ALT_FORMAT"` that must match expected payload constants.
4. **Inconsistent Drag-Over Behavior**: `ChannelList_DragOver` allows `DragAndDropPayload.ALT_FORMAT` but `TextBox_DragOver` handles it differently—some formats that are allowed in list-level drag-over are rejected in text-box drag-over.
5. **Hardcoded Column Dependencies**: `AddDallasIdColumn()` relies on `HardwareColumn` existing to determine insertion index. If `HardwareColumn` is not in the view, the insertion logic may fail or insert at an unexpected position.
6. **Empty Event Handler**: `ChannelListListView_SelectionChanged` is wired but contains no implementation.
7. **Global Setting Dependency**: `HandleColumns` reads `"ShowGroups"` global setting via `SettingsDB.GetGlobalValueBool()` with default `true`. This creates implicit runtime configuration dependency.

View File

@@ -0,0 +1,111 @@
---
source_files:
- DataPRO/Modules/Groups/GroupChannelList/ViewModel/GroupChannelListViewModel.cs
generated_at: "2026-04-17T16:01:14.282913+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "593e1e1e445f103d"
---
# GroupChannelListViewModel Documentation
## 1. Purpose
The `GroupChannelListViewModel` class serves as the presentation logic layer for managing channel configurations within Groups and Test Setups in a data acquisition system. It orchestrates the assignment of sensors and hardware channels, handles text parsing for bulk channel creation, manages filtering and sorting of channel lists, and coordinates UI interactions through Prism's event aggregation system. The class supports both Group-based channel management and Test Setup ordering modes, providing bidirectional synchronization between channel properties and underlying data models.
## 2. Public Interface
### Properties
| Signature | Description |
|-----------|-------------|
| `IGroupChannelListView View { get; set; }` | The associated view instance. |
| `IGroupChannelSettingsListView SettingsView { get; set; }` | The settings view instance. |
| `InteractionRequest<Notification> NotificationRequest { get; }` | Interaction request for displaying notifications. |
| `InteractionRequest<Confirmation> ConfirmationRequest { get; }` | Interaction request for displaying confirmations. |
| `bool SettingsViewLoaded { get; set; }` | Indicates whether the SettingsView has loaded. |
| `bool SettingChannelsLoaded { get; set; }` | Indicates whether SettingChannel UI elements were created. |
| `event PropertyChangedEventHandler PropertyChanged` | Property change notification event. |
### Methods
| Signature | Description |
|-----------|-------------|
| `void OnPropertyChanged(string propertyName)` | Raises `PropertyChanged` event; publishes `GroupChannelsChangedEvent` when `ChannelCount` changes. |
| `void UpdateRangeLowG(IGroupChannel channelChanged)` | Updates all Low G channels on the same DAS to match the range of the changed channel. |
| `void UpdateRangeARS(IGroupChannel channelChanged)` | Updates all ARS channels on the same DAS to match the range of the changed channel. |
| `void UpdateACCouplingEnabled(IGroupChannel channelChanged)` | Propagates AC coupling enabled state to other channels on the same DAS. |
| `IGroup CreateGroupIfNeeded(ITestSetup testSetup, string groupName)` | Creates a group if it doesn't exist; delegates to `GroupList.Model.Group.CreateGroupIfNeeded`. |
| `void DoSensorAssignment(IGroupChannel groupChannel, IDragAndDropItem[] sensors)` | Assigns sensors to channels starting at the specified channel index. Refuses assignment to TSR AIR channels (non-StreamOut/non-Uart). |
| `void DoHardwareAssignment(IGroupChannel groupChannel, IHardwareChannel[] hardwareChannels)` | Assigns hardware channels starting at the specified index. TSR AIR hardware has special restrictions. |
| `void Unset()` | Clears all channels, dictionaries, and filters; resets view state. |
| `void ClearAllFilters()` | Resets search term, bridge filter, and field filters; publishes `ListViewStatusEvent`. |
| `void OnSetActive()` | Refreshes channel state, column visibility, and UI bindings when the view becomes active. |
| `bool CompareAndMarkChannelParameters(IGroupChannel ch)` | Compares channel parameters against sensor database values; marks differences for UI decoration. |
| `IDictionary<IGroup, IGroupChannel[]> PopulateChannels(object page, IDictionary<int, ISensorData> sensorLookup, IDictionary<int, IDASHardware> hardwareLookup, IChannelSetting[] channelDefaults, bool allowChannelDeletionByNonAdminUser = true, bool userIsAdmin = true, bool allowSensorPushAndPull = false, bool keepExistingChannels = false, bool allowChannelDeletionFromFixedGroup = false)` | Populates channel lists from sensor and hardware lookups; handles TSR AIR embedded sensors and fixed group constraints. |
| `void Cleanup()` | Empty cleanup method. |
| `Task CleanupAsync()` | Returns `Task.CompletedTask`. |
| `void Initialize()`, `void Initialize(object parameter)`, `void Initialize(object parameter, object model)` | Empty initialization methods. |
| `Task InitializeAsync()`, `Task InitializeAsync(object parameter)` | Return `Task.CompletedTask`. |
| `void Activated()` | Empty activation method. |
| `void ReportErrors(string[] errors)` | Publishes `PageErrorEvent` with provided errors. |
| `void GroupNameChanged(IGroupChannel channel)` | Handles group name changes in Test Setup mode; removes channel from old group, creates new group if needed. |
| `void MarkModified(IGroupChannel channel, bool bNotifyChanged = true)` | Marks a channel as modified; adds a new blank channel if modifying the last one. |
| `void NotifyChannelsChanged()` | Publishes `PageModifiedEvent` and `GroupUpdatedEvent`; raises property change for counts. |
| `void Clear(IGroupChannel channel)` | Clears the specified channel's data. |
| `void Remove(IGroupChannel channel, bool notifyChanged = true)` | Removes a channel from the list; handles Test Setup group cleanup. |
## 3. Invariants
1. **Blank Channel at End**: `AllChannels` and `Channels` collections always contain a blank `GroupChannel` at the end, used for adding new channels via `MarkModified`.
2. **TSR AIR Channel Restrictions**: Channels with `HardwareChannel.IsTSRAIR == true` (excluding StreamOut and Uart types) cannot have sensors or hardware reassigned via drag-and-drop.
3. **Channel Ordering**: Channels maintain either `TestSetupOrder` or `GroupChannelOrder` (1-indexed), determined by `UseTestSetupOrder` property.
4. **ISO Code Length**: ISO codes are truncated to 16 characters maximum in `ParseText`.
5. **Move Button State**: The first channel has `CanMoveUp = false`; the last non-blank channel has `CanMoveDown = false`.
6. **Filter Preservation**: Channels in `_dontFilterList` are excluded from filtering operations to maintain visibility during editing.
7. **Fixed Group Deletion**: When `AllowChannelDeletionFromFixedGroup = false`, channels with non-null `StaticGroupId` have `DeleteShouldBeEnabled = false`.
## 4. Dependencies
### This Module Depends On:
- **Prism Framework**: `IEventAggregator`, `IRegionManager`, `Delegate` commands, `InteractionRequest`
- **Unity Container**: `IUnityContainer` for service resolution
- **DTS.Common.Classes.Groups**: `Group` model class
- **DTS.Common.Enums**: `HardwareTypes`, `PossibleFilters`, `Fields`, sensor enums
- **DTS.Common.Events**: `GroupChannelsChangedEvent`, `RaiseNotification`, `BusyIndicatorChangeNotification`, `TextPastedEvent`, `PageErrorEvent`, `PageModifiedEvent`, `GroupUpdatedEvent`, `AppStatusEvent`, `ListViewStatusEvent`
- **DTS.Common.Interface.Channels**: `IHardwareChannel`, `IChannelCode`, `IChannelSetting`
- **DTS.Common.Interface.Groups.GroupChannelList**: `IGroupChannelListView`, `IGroupChannelSettingsListView`, `IGroupChannel`
- **DTS.Common.Interface.Sensors**: `ISensorData`, `IDragAndDropItem`
- **DTS.Common.Storage**: `DbOperations` for channel setting defaults
- **DTS.Common.Constants**: `TDAS_TOM_DIGITAL_OUT_DURATION_MAX`
- **System.ComponentModel.Composition**: `[PartCreationPolicy(CreationPolicy.Shared)]` for MEF
### Events Consumed:
- `RaiseNotification``OnRaiseNotification`
- `BusyIndicatorChangeNotification``OnBusyIndicatorNotification`
- `TextPastedEvent``OnTextPasted`
### Events Published:
- `GroupChannelsChangedEvent`, `PageErrorEvent`, `PageModifiedEvent`, `GroupUpdatedEvent`, `AppStatusEvent`, `ListViewStatusEvent`
## 5. Gotchas
1. **TSR AIR Embedded Sensors**: The `PopulateChannels` method contains special logic to handle embedded sensors in TSR-AIR units, only adding them if the unit isn't already represented in the group. This logic is spread across multiple checks and can be difficult to follow.
2. **Sensor Serial Number Parsing**: `GetSensorSerialNumber` handles sensors with names in format `"Name (SerialNumber)"` vs. just `"SerialNumber"`. The dictionary lookup depends on this parsing being consistent.
3. **Blank Channel Management**: The blank channel at the end of lists is both a UI affordance and a state management mechanism. Removing or modifying it triggers creation of a new blank channel, which can cause unexpected list changes.
4. **Test Setup vs. Group Mode**: Many methods check `UseTestSetupOrder` to determine behavior. The same ViewModel serves both contexts, and some operations (like `GroupNameChanged`) are no-ops in Group mode.
5. **Filter State Persistence**: `_dontFilterList` is cleared on user-initiated filter operations but preserved during programmatic filtering. This can lead to unexpected channel visibility if not managed carefully.
6. **Digital Out Duration Max**: TDAS TOM hardware has a hardcoded max value (`TDAS_TOM_DIGITAL_OUT_DURATION_MAX`) applied in `ResetSettingChannels`, separate from other channel validation.
7. **Sensor Push/Pull**: The `AllowSensorPushAndPull` flag affects whether channel parameters are compared against sensor database values and whether `BorderShouldShowOutOfDate` is set. This feature appears to be for highlighting parameter drift from sensor defaults.

View File

@@ -0,0 +1,31 @@
---
source_files:
- DataPRO/Modules/Groups/GroupImport/GroupImportModule.cs
generated_at: "2026-04-17T16:15:12.801021+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "64c3568f982b9a92"
---
# GroupImport
### Purpose
This module is a Prism-based plugin module that provides group import functionality to the main application. It registers views and view models for group import operations (import view, options view, preview view) with the Unity dependency injection container, enabling the application to display and manage group import workflows.
### Public Interface
- **`GroupImportModule`** (class, implements `IModule`)
- `public GroupImportModule(IUnityContainer unityContainer)` - Constructor accepting a Unity container via dependency injection.
- `public void Initialize()` - Registers the following types with the Unity container:
- `IGroupImportImportView``GroupImportImportView`
- `IGroupImportOptionsView``GroupImportOptionsView`
- `IGroupImportPreviewView``GroupImportPreviewView`
- `IGroupImportViewModel``GroupImportViewModel`
- `public void OnInitialized(IContainerProvider containerProvider)` - Empty implementation.
- `public void RegisterTypes(IContainerRegistry containerRegistry)` - Calls `Initialize()`.
- **`GroupImageAttribute`** (class, extends `ImageAttribute`)
- `public override BitmapImage AssemblyImage` - Returns an image loaded via `AssemblyInfo.GetImage(AssemblyNames.GroupImport.ToString())`.
- `public override string AssemblyName` - Returns `AssemblyNames.GroupImport.ToString()`.
- `public override string AssemblyGroup` - Returns `eAssemblyGroups.Prepare.ToString()`.
- `public override eAssemblyRegion AssemblyRegion` - Throws `NotImplementedException

View File

@@ -0,0 +1,13 @@
---
source_files:
- DataPRO/Modules/Groups/GroupImport/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:47:44.902525+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "60b8a2e7063ea2af"
---
# Documentation: GroupImportModule Assembly Configuration
## 1. Purpose
This source file, `AssemblyInfo.cs`, serves as the assembly manifest configuration for the `GroupImportModule` component within the DataPRO system. Its

View File

@@ -0,0 +1,68 @@
---
source_files:
- DataPRO/Modules/Groups/GroupImport/Resources/TranslateExtension.cs
- DataPRO/Modules/Groups/GroupImport/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T15:58:05.941398+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "649541a3a7393158"
---
# Documentation: GroupImport Resources Module
## 1. Purpose
This module provides localization infrastructure for the Group Import feature in DataPRO. It consists of a WPF markup extension (`TranslateExtension`) enabling XAML-based string resource lookup, and an auto-generated strongly-typed resource class (`StringResources`) containing localized strings for TDAS group file import operations, validation messages, preview UI labels, and error/warning text. The module supports the import workflow from file selection through validation to completion.
---
## 2. Public Interface
### `TranslateExtension` (Class)
**Namespace:** `DBImportExport.Resources`
**Attribute:** `[MarkupExtensionReturnType(typeof(string))]`
A WPF markup extension for retrieving localized strings in XAML bindings.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `TranslateExtension(string key)` | Initializes the extension with the resource key to look up. |
| `ProvideValue` | `override object ProvideValue(IServiceProvider serviceProvider)` | Returns the localized string for `_key`, or a fallback indicator if not found. |
| `NotFound` | `const string = "#stringnotfound#"` | Constant returned when the key is null, empty, or the resource is missing. |
**Behavior of `ProvideValue`:**
- Returns `NotFound` if `_key` is null or empty.
- Returns `StringResources.ResourceManager.GetString(_key)` if the key exists.
- Returns `NotFound + " " + _key` if the key is not found in the resource manifest.
---
### `StringResources` (Class)
**Namespace:** `GroupImport.Resources`
**Modifiers:** `internal`, `sealed` (implied by auto-generation)
A strongly-typed resource class auto-generated by `StronglyTypedResourceBuilder`. Provides access to localized strings via static properties.
| Member | Type | Description |
|--------|------|-------------|
| `ResourceManager` | `static ResourceManager` | Returns the cached `ResourceManager` instance for this assembly. Lazy-initialized. |
| `Culture` | `static CultureInfo` | Gets/sets the current UI culture for resource lookups. |
**Resource String Properties (static, read-only):**
| Property | Default Value (from comments) | Context |
|----------|-------------------------------|---------|
| `GroupTags` | "Group Tag(s): " | Label for group tags display |
| `Import_Importing` | "Importing {0}:{1}" | Import progress message (format string) |
| `ImportFileFilter` | "TDAS group file (*.grp)\|*.grp\|All Files (*.*)\|*.*" | File dialog filter |
| `Importing_Done` | "Done" | Import completion status |
| `None` | "(None)" | Null/empty placeholder |
| `Options_Browse` | "Browse" | Browse button label |
| `Options_Files` | "File(s)" | Files label |
| `Options_Format` | "Format" | Format label |
| `Preview_CompleteGroupChannels` | "Channels that will be imported" | Preview section header |
| `Preview_EmptyFile` | "Empty file" | Empty file warning |
| `Preview_Groups` | "Groups" | Groups label |
| `Preview_IncompleteGroupChannels` | "Channels that will not be imported" | Preview section header |
| `Preview_InvalidFullScaleCapacity` | "Invalid full scale capacity" | Validation error |
| `Preview_InvalidFullScaleInput` | "Invalid desired range for {0}::{1}, the sensor capacity will be used instead." | Validation warning (format string)

View File

@@ -0,0 +1,54 @@
---
source_files:
- DataPRO/Modules/Groups/GroupImport/View/GroupImportImportView.xaml.cs
- DataPRO/Modules/Groups/GroupImport/View/GroupImportOptionsView.xaml.cs
- DataPRO/Modules/Groups/GroupImport/View/GroupImportPreviewView.xaml.cs
generated_at: "2026-04-17T15:55:09.583371+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "6791e57197b8d508"
---
# Documentation: GroupImport Views
## 1. Purpose
This module provides the WPF view components for a Group Import wizard workflow. It contains three views—`GroupImportImportView`, `GroupImportOptionsView`, and `GroupImportPreviewView`—that implement interfaces from `DTS.Common.Interface.Groups` and handle user interaction for importing groups from files. The views serve as the UI layer, delegating business logic to `GroupImportViewModel` and validating user input before allowing progression through the wizard steps.
---
## 2. Public Interface
### GroupImportImportView
**Signature:** `public partial class GroupImportImportView : IGroupImportImportView`
| Member | Description |
|--------|-------------|
| `GroupImportImportView()` | Constructor. Calls `InitializeComponent()` to load the XAML-defined UI. |
---
### GroupImportOptionsView
**Signature:** `public partial class GroupImportOptionsView : IGroupImportOptionsView`
| Member | Description |
|--------|-------------|
| `GroupImportOptionsView()` | Constructor. Calls `InitializeComponent()` to load the XAML-defined UI. |
| `bool Validate(out List<string> errors, out List<string> warnings)` | Validates whether the user can proceed to the preview step. Returns `true` if at least one file is selected (`vm.SourceFiles.Length >= 1`); otherwise, adds `StringResources.Preview_NoFilesSelected` to errors and returns `false`. |
---
### GroupImportPreviewView
**Signature:** `public partial class GroupImportPreviewView : IGroupImportPreviewView`
| Member | Description |
|--------|-------------|
| `GroupImportPreviewView()` | Constructor. Calls `InitializeComponent()` to load the XAML-defined UI. |
| `void GroupName_Changed(object sender, TextChangedEventArgs e)` | Private event handler. Updates `group.GroupName` from the TextBox, calls `ch.GroupNameInvalidate()` on all channels, and invokes `vm.CheckGroupName()`. |
| `void GroupTags_Changed(object sender, TextChangedEventArgs e)` | Private event handler. Updates `group.GroupTags` from the TextBox. |
| `void IncludedChecked(object sender, RoutedEventArgs e)` | Private event handler. Calls `vm.InvalidateChannels()` when a group's included checkbox is checked. |
| `void IncludedUnchecked(object sender, RoutedEventArgs e)` | Private event handler. Calls `vm.InvalidateChannels()` when a group's included checkbox is unchecked. |
| `bool Validate(bool userIsAdmin, out List<string> errors, out List<string> warnings)` | Public validation method. Checks group and channel validity for import. Returns `true` if valid to proceed. See detailed behavior below

View File

@@ -0,0 +1,98 @@
---
source_files:
- DataPRO/Modules/Groups/GroupImport/ViewModel/GroupImportViewModel.cs
generated_at: "2026-04-17T16:01:00.422137+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ea98f9d39127a201"
---
# GroupImportViewModel Documentation
## 1. Purpose
`GroupImportViewModel` is the ViewModel responsible for importing Groups and TestObjects from `.grp` files in a WPF/Prism-based application. It orchestrates the complete import workflow: file browsing, parsing source files into group/channel structures, validating data, previewing import contents, and executing the import on a background thread. The class implements `IGroupImportViewModel` and serves as the data context for three views (`IGroupImportOptionsView`, `IGroupImportPreviewView`, `IGroupImportImportView`).
---
## 2. Public Interface
### Constructor
```csharp
public GroupImportViewModel(
IGroupImportOptionsView optionsView,
IGroupImportPreviewView previewView,
IGroupImportImportView importView,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
Initializes the ViewModel, wires up view DataContexts, creates interaction requests, and subscribes to `RaiseNotification` and `BusyIndicatorChangeNotification` events.
### Public Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `ParseSourceFiles` | `void ParseSourceFiles(string userTags)` | Reads `.grp` files from `SourceFiles`, parsing groups and channels. Populates `Groups` and `Channels` arrays. |
| `Import` | `void Import()` | Queues the import operation on a background thread via `ThreadPool.QueueUserWorkItem`. |
| `SetStatus` | `void SetStatus(string message, Color color)` | Updates `ImportProgressColor`, hides progress bar, sets `ImportProgressText`, and invokes `EnableUI`. |
| `Reset` | `void Reset()` | Re-initializes the ViewModel to default state (clears `SourceFiles`, `Channels`, `Groups`, resets progress UI). |
| `CheckGroupName` | `void CheckGroupName()` | Validates group names for duplicates within the import and against existing groups (if `Overwrite` is false). Sets `GroupNameHasError` on each group. |
| `OnPropertyChanged` | `void OnPropertyChanged(string propertyName)` | Raises the `PropertyChanged` event. |
| `InvalidateChannels` | `void InvalidateChannels()` | Raises PropertyChanged for `IncompleteChannels` and `CompleteChannels`. |
| `Cleanup` | `void Cleanup()` | Empty implementation. |
| `CleanupAsync` | `Task CleanupAsync()` | Returns `Task.CompletedTask`. |
| `Initialize` | `void Initialize()` / `void Initialize(object parameter)` / `void Initialize(object parameter, object model)` | Empty implementations. |
| `InitializeAsync` | `Task InitializeAsync()` / `Task InitializeAsync(object parameter)` | Return `Task.CompletedTask`. |
| `Activated` | `void Activated()` | Empty implementation. |
### Commands
| Property | Type | Description |
|----------|------|-------------|
| `ImportBrowseCommand` | `DelegateCommand` | Opens an `OpenFileDialog` for selecting `.grp` files. Sets `SourceFiles` and `BrowseOk`, then invokes `SwitchNavSteps` with `Preview` step. |
### Public Properties
| Property | Type | Description |
|----------|------|-------------|
| `ImportOptionsView` | `IGroupImportOptionsView` | The options view instance. |
| `ImportPreviewView` | `IGroupImportPreviewView` | The preview view instance. |
| `ImportView` | `IGroupImportImportView` | The import view instance. |
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for notifications. |
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for confirmations. |
| `IsDirty` | `bool` | Always returns `false` (private setter never called). |
| `IsBusy` | `bool` | Bound to `BusyIndicatorChangeNotification` event. |
| `IsMenuIncluded` | `bool` | Menu inclusion flag. |
| `IsNavigationIncluded` | `bool` | Navigation inclusion flag. |
| `HeaderInfo` | `string` | Returns `"MainRegion"`. |
| `ImportProgressText` | `string` | Status text for import progress bar. |
| `ImportProgressColor` | `Color` | Color of the import progress bar. |
| `ImportProgressBarVisibility` | `Visibility` | Controls progress bar visibility. |
| `ImportProgressValue` | `double` | Percentage complete of import process. |
| `SourceFiles` | `string[]` | Array of `.grp` file paths to parse. Initialized to empty array. |
| `BrowseOk` | `bool` | Indicates if file browse completed successfully. Default `false`. |
| `Groups` | `GroupGRPImportGroup[]` | All parsed groups. Initialized to empty array. |
| `Channels` | `GroupGRPImportChannel[]` | All channels from all groups. Setter calls `InvalidateChannels()`. |
| `IncompleteChannels` | `GroupGRPImportChannel[]` | Computed: channels that will NOT be imported (errors other than `InvalidFullScaleInput` or `InvalidInvertInput`). |
| `CompleteChannels` | `GroupGRPImportChannel[]` | Computed: channels that WILL be imported (no error, or only `InvalidFullScaleInput`/`InvalidInvertInput`). |
| `Logger` | `FileUtils.LogDelegate` | Logging facility. If `null`, no logging occurs. |
| `SwitchNavSteps` | `SwitchNavStepsDelegate` | Command for switching navigation steps. |
| `CheckGroupExists` | `CheckGroupExistsDelegate` | Command to check if a group exists in the application. |
| `CheckSensorExists` | `CheckSensorExistsDelegate` | Command to check if a sensor exists. |
| `CreateGroup` | `CreateGroupDelegate` | Command to create a group. |
| `AddChannel` | `AddChannelToGroupDelegate` | Command to add a channel to a group. |
| `CommitGroups` | `CommitGroupsDelegate` | Command to commit groups to the database. |
| `DisableUI` | `Disable_UIDelegate` | Command to disable the UI during import. |
| `EnableUI` | `Enable_UIDelegate` | Command to enable the UI after import. |
### Events
```csharp
public event PropertyChangedEventHandler PropertyChanged;
```
---
## 3. Invariants
- **File Format**: `.grp` files

View File

@@ -0,0 +1,36 @@
---
source_files:
- DataPRO/Modules/Groups/GroupList/GroupListModule.cs
generated_at: "2026-04-17T16:46:55.033658+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "4ac5a94ee419c4b2"
---
# Documentation: GroupListModule
## 1. Purpose
The `GroupListModule` is a Prism module responsible for registering the Group List feature's view and view-model with the Unity dependency injection container. It provides assembly-level metadata (name, image, group, and region) that enables the main application shell to discover and display this module as an available component. The module belongs to the "Prepare" assembly group and targets the `GroupListRegion` for UI composition.
---
## 2. Public Interface
### `GroupListModule` (Class)
Implements `Prism.Modularity.IModule`. The primary module entry point for the Group List feature.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `GroupListModule(IUnityContainer unityContainer)` | Accepts a Unity container via dependency injection and stores it in `_unityContainer`. |
| `Initialize` | `void Initialize()` | Registers `IGroupListView``GroupListView` and `IGroupListViewModel``GroupListViewModel` with the Unity container. |
| `OnInitialized` | `void OnInitialized(IContainerProvider containerProvider)` | Empty implementation (no post-initialization logic). |
| `RegisterTypes` | `void RegisterTypes(IContainerRegistry containerRegistry)` | Delegates to `Initialize()`. |
### `GroupListModuleNameAttribute` (Class)
Extends `TextAttribute`. Assembly-level attribute providing the module's name.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `GroupListModuleNameAttribute()` | Default constructor; sets `AssemblyName` to `AssemblyNames.GroupList.ToString()`. |
| Constructor | `GroupListModuleNameAttribute(string s)` | Overload accepting a string parameter (

View File

@@ -0,0 +1,16 @@
---
source_files:
- DataPRO/Modules/Groups/GroupList/Model/ChannelSetting.cs
generated_at: "2026-04-17T16:47:02.302066+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "e3fe02109fc0ecbe"
---
# Documentation for ChannelSetting.cs
## 1. Purpose
This file is intended to define a model within the `GroupList.Model` namespace, likely representing configuration or settings for a channel. However, the provided source code contains only an empty namespace definition and an unused import. The actual implementation of the `ChannelSetting` type is missing from the file.
## 2. Public Interface
**None.** The namespace `GroupList.Model` is empty in the provided source. No classes, structs, interfaces

View File

@@ -0,0 +1,34 @@
---
source_files:
- DataPRO/Modules/Groups/GroupList/Properties/Settings.Designer.cs
- DataPRO/Modules/Groups/GroupList/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:28:16.255702+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "5576497584da23f4"
---
# Properties
### Purpose
This module contains auto-generated build artifacts for the `GroupTemplateList` assembly, including application settings infrastructure and assembly metadata. It provides the standard .NET Settings singleton pattern for persisting user or application configuration scoped to the GroupList module, and defines assembly identity attributes used by the CLR for binding and versioning.
### Public Interface
- **`Settings` class** (internal sealed partial) - Inherits from `global::System.Configuration.ApplicationSettingsBase`. Provides strongly-typed access to application settings.
- `public static Settings Default { get; }` - Returns a synchronized singleton instance of the Settings class, lazily initialized via `ApplicationSettingsBase.Synchronized(new Settings())`.
### Invariants
- The `Settings` class is auto-generated by `SettingsSingleFileGenerator` (version 17.10.0.0) and should not be manually edited; changes will be lost on regeneration.
- The `defaultInstance` field is always assigned via `Synchronized()`, ensuring thread-safe access to settings.
- Assembly version is fixed at `1.0.0.0` for both `AssemblyVersion` and `AssemblyFileVersion`.
- COM visibility is disabled at the assembly level (`ComVisible(false)`).
### Dependencies
- **Depends on**: `System.Configuration.ApplicationSettingsBase` (from System.Configuration assembly), `System.Runtime.CompilerServices`, `System.CodeDom.Compiler`.
- **Depended on by**: Unclear from source alone; presumably consumed by the parent `GroupList` module for settings access.
### Gotchas
- The assembly title is `"GroupTemplateList"` but the namespace is `GroupList.Properties` — this naming inconsistency may cause confusion when searching for the assembly or namespace.
- The `Settings` class is `internal`, so it cannot be accessed from outside this assembly without friend assembly declarations (`InternalsVisibleTo`).
---

View File

@@ -0,0 +1,35 @@
---
source_files:
- DataPRO/Modules/Groups/GroupList/Resources/TranslateExtension.cs
- DataPRO/Modules/Groups/GroupList/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T16:12:38.870054+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "075ddccdc71b15d4"
---
# Resources
### 1. Purpose
This module provides localization infrastructure for the `GroupList` assembly. It contains a XAML markup extension for declarative string lookup and a strongly-typed resource accessor class generated from a `.resx` file. It centralizes UI string management for group-related views (e.g., "AssociatedTestSetups", "Channels", "Description").
### 2. Public Interface
**Class: `TranslateExtension`** (inherits `MarkupExtension`)
* `TranslateExtension(string key)`: Constructor that accepts the resource key to look up.
* `object ProvideValue(IServiceProvider serviceProvider)`: Returns the localized string for the stored `_key`. Returns `#stringnotfound#` if the key is null/empty, or `#stringnotfound# {key}` if the lookup fails.
**Class: `StringResources`** (internal, auto-generated)
* `static ResourceManager ResourceManager`: Gets the cached `ResourceManager` instance for the `GroupList.Resources.StringResources` resource set.
* `static CultureInfo Culture`: Gets or sets the current UI culture for resource lookups.
* `static string AssociatedTestSetups`: Looks up the "AssociatedTestSetups" string.
* `static string Channels`: Looks up the "Channels" string.
* `static string Description`: Looks up the "Description" string.
* `static string LastModified`: Looks up the "LastModified" string.
* `static string LastModifiedBy`: Looks up the "LastModifiedBy" string.
* `static string Name`: Looks up the "Name" string.
* `static string TemplateName`: Looks up the "TemplateName" string.
### 3. Invariants
* `TranslateExtension._key` is immutable after construction (readonly).
* `TranslateExtension` always returns a non-null string; it never throws on missing keys, instead returning a specific error constant.
* `

View File

@@ -0,0 +1,35 @@
---
source_files:
- DataPRO/Modules/Groups/GroupList/View/GroupListView.xaml.cs
generated_at: "2026-04-17T16:47:04.094415+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "1c720369523e38e0"
---
# GroupListView Documentation
## 1. Purpose
`GroupListView` is a WPF view component that provides a sortable, filterable list interface for displaying groups. It serves as the code-behind for `GroupListView.xaml` and implements `IGroupListView`. The view handles user interactions—column header clicks for sorting, search input for filtering, and mouse double-clicks for item selection—delegating all business logic to an `IGroupListViewModel` via the `DataContext`.
---
## 2. Public Interface
### `GroupListView()` (Constructor)
**Signature:** `public GroupListView()`
Initializes the view component by calling `InitializeComponent()`, which loads the associated XAML layout.
### `IGroupListView` (Implemented Interface)
The class implements `IGroupListView` from `DTS.Common.Interface.Groups.GroupTemplateList`. The specific interface members are not visible in this source file.
### Private Event Handlers (wired to XAML events)
| Method | Signature | Behavior |
|--------|-----------|----------|
| `ListViewHeader_Click` | `void ListViewHeader_Click(object sender, RoutedEventArgs e)` | Extracts the clicked `GridViewColumnHeader` from `e.OriginalSource`, retrieves `IGroupListViewModel` from the header's `DataContext`, and calls `viewModel.Sort(colHeader.Tag, true)`. |
| `GridViewColumnHeaderSearchable_OnSearch` | `void GridViewColumnHeaderSearchable_OnSearch(object sender, RoutedEventArgs e)` | Extracts search term from `e.OriginalSource` (cast to `string`), retrieves column tag from `sender`, and calls `vm.Filter(columnTag, searchTerm)` on the view model. |
| `GridViewColumnHeader_OnClick` | `void GridViewColumnHeader_OnClick(object sender, RoutedEventArgs e)` | Handles sorting for searchable column headers. Retrieves column tag either directly from `sender` or by traversing the visual tree via `Utils.FindChild<GridViewColumnHeaderSearchable>`, then calls `vm.Sort(columnTag, true)`. |
| `MouseDoubleClick` | `void MouseDoubleClick(object sender, MouseButtonEventArgs e)` | Determines which ListView item is under the mouse cursor using hit-testing, validates the index is within bounds, and

View File

@@ -0,0 +1,54 @@
---
source_files:
- DataPRO/Modules/Groups/GroupList/ViewModel/GroupListViewModel.cs
generated_at: "2026-04-17T16:00:47.692641+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b926e051d9942d3a"
---
# GroupListViewModel Documentation
## 1. Purpose
`GroupListViewModel` is the presentation logic layer for the Group List module in a WPF/Prism-based application. It manages the display, filtering, sorting, and manipulation of group entities. The class serves as a mediator between the `IGroupListView` view and the underlying `Group` model, handling user interactions (selection, double-click editing, filtering), coordinating with the event system for cross-module communication, and enforcing tag-based access control for non-administrator users.
---
## 2. Public Interface
### Methods
| Signature | Description |
|-----------|-------------|
| `void ClearAllFilters()` | Clears all field-based filters by emptying the internal `_filterByField` dictionary. |
| `void MouseDoubleClick(int index)` | Publishes a `GroupListEditGroupEvent` with the group ID when a single group is selected and the index is valid. |
| `void Filter(string term)` | Sets `CurrentSearchTerm` and triggers a sort/refresh operation. |
| `IGroup GetGroup(int? id, bool updateTags = true)` | Retrieves a group by ID. Optionally updates tags from the database. Returns an empty `Group` if not found or if `id < 0`. |
| `IGroup GetGroup(string displayName)` | Retrieves a non-embedded group by display name. Returns `null` if no non-embedded match is found. |
| `IGroup[] GetGroups(int[] ids)` | Returns all groups whose IDs are contained in the provided array. |
| `IGroup[] GetAllGroups()` | Returns all groups from the model layer. |
| `void DeleteGroups(int[] ids)` | Deletes groups by ID, nullifies `StaticGroupId` on related embedded groups, updates `AllGroups`, and re-applies filters. |
| `IGroup CreateGroup()` | Creates a new `Group` instance (marked as new). |
| `IGroup CreateGroup(SqlDataReader reader, List<string> includedHardwareStringList, List<int> dasIdList)` | Creates a `Group` from a SQL data reader. |
| `IGroup CreateGroup(IGroupDbRecord groupRecord, List<string> includedHardwareStringList, List<int> dasIdList)` | Creates a `Group` from a database record object. |
| `IGroup CreateGroup(List<string> includedHardwareStringList)` | Creates a `Group` with specified hardware strings. |
| `void Filter(object tag, string term)` | Parses `tag` as a `GroupFields` enum, updates filter dictionary, and triggers filtering. |
| `void OnSetActive(object page, bool groupTile, object o)` | Initializes the view model when activated. Filters groups by user role and tag compatibility. If `groupTile` is true, loads test setup lists asynchronously. |
| `void Unset()` | Clears all group arrays, filters, and publishes a `ListViewStatusEvent` with `Unloaded` status. |
| `void Sort(object o, bool bColumnClick)` | Sorts `Groups` by the specified field. Toggles sort direction on repeated column clicks. Applies both search term and field-based filters. |
| `void Cleanup()` | Empty implementation. |
| `Task CleanupAsync()` | Returns `Task.CompletedTask`. |
| `void Initialize()` | Empty implementation. |
| `void Initialize(object parameter)` | Empty implementation. |
| `void Initialize(object parameter, object model)` | Empty implementation. |
| `Task InitializeAsync()` | Returns `Task.CompletedTask`. |
| `Task InitializeAsync(object parameter)` | Returns `Task.CompletedTask`. |
| `void Activated()` | Empty implementation. |
| `void OnPropertyChanged(string propertyName)` | Raises the `PropertyChanged` event. |
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `View` | `IGroupListView` | The associated view instance. Set via constructor; `DataContext` is

View File

@@ -0,0 +1,59 @@
---
source_files:
- DataPRO/Modules/Hardware/AddEditHardware/AddEditHardwareModule.cs
generated_at: "2026-04-17T16:30:25.823878+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "10ec7c0a38ddc3b1"
---
# AddEditHardware
### Purpose
This module provides functionality for adding and editing hardware configurations within the DataPRO system. It is a Prism module that registers its view and view model with the Unity dependency injection container, enabling the hardware management UI to be loaded dynamically. The module belongs to the "Prepare" assembly group and targets the "AddEditHardwareRegion" for UI composition.
### Public Interface
**`AddEditHardwareModule`** (class)
- `AddEditHardwareModule(IUnityContainer unityContainer)` - Constructor accepting a Unity container via dependency injection.
- `void Initialize()` - Registers `IAddEditHardwareView` to `AddEditHardwareView` and `IAddEditHardwareViewModel` to `AddEditHardwareViewModel` with the Unity container.
- `void OnInitialized(IContainerProvider containerProvider)` - Empty implementation; no initialization logic executed.
- `void RegisterTypes(IContainerRegistry containerRegistry)` - Calls `Initialize()` to perform type registration.
**`AddEditHardwareModuleNameAttribute`** (class, inherits `TextAttribute`)
- `AddEditHardwareModuleNameAttribute()` / `AddEditHardwareModuleNameAttribute(string s)` - Constructors that set `AssemblyName` to `AssemblyNames.AddEditHardware.ToString()`.
- `string AssemblyName` (property, override) - Returns the assembly name.
- `Type GetAttributeType()` - Returns `typeof(TextAttribute)`.
- `string GetAssemblyName()` - Returns the `AssemblyName` property value.
**`AddEditHardwareModuleImageAttribute`** (class, inherits `ImageAttribute`)
- `AddEditHardwareModuleImageAttribute()` / `AddEditHardwareModuleImageAttribute(string s)` - Constructors that load the assembly image via `AssemblyInfo.GetImage()`.
- `BitmapImage AssemblyImage` (property, override) - Lazy-loads and returns the module's image.
- `string AssemblyName` (property, override) - Returns `AssemblyNames.AddEditHardware.ToString()`.
- `string AssemblyGroup` (property, override) - Returns `eAssemblyGroups.Prepare.ToString()`.
- `eAssemblyRegion AssemblyRegion` (property, override) - Returns `eAssemblyRegion.AddEditHardwareRegion`.
- `BitmapImage GetAssemblyImage()`, `string GetAssemblyName()`, `string GetAssemblyGroup()`, `eAssemblyRegion GetAssemblyRegion()` - Accessor methods for respective properties.
- `Type GetAttributeType()` - Returns `typeof(ImageAttribute)`.
### Invariants
- The module must be instantiated with a non-null `IUnityContainer` reference.
- `Initialize()` must be called (via `RegisterTypes`) before views/view models can be resolved.
- View and ViewModel registrations are transient (not singleton), despite the comment claiming singleton registration.
### Dependencies
**Imports:**
- `DTS.Common` - Provides `TextAttribute`, `ImageAttribute`, `AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, `eAssemblyRegion`.
- `DTS.Common.Interface` - Provides base interfaces.
- `DTS.Common.Interface.Hardware.AddEditHardware` - Provides `IAddEditHardwareView`, `IAddEditHardwareViewModel`.
- `Prism.Modularity` - Provides `IModule`, `ModuleAttribute`.
- `Prism.Ioc` - Provides `IContainerProvider`, `IContainerRegistry`.
- `Unity` - Provides `IUnityContainer`.
**Depended on by:** Unknown from source alone (likely shell/bootstrapper and region navigation).
### Gotchas
- The comment in `Initialize()` states "Register View & View-Model... as a singleton," but `RegisterType` registers types as transient by default in Unity. If singleton behavior is required, `RegisterSingleton` or `RegisterInstance` should be used.
- `OnInitialized` is empty but required by `IModule` interface.
- The constructor parameter `string s` in both attribute classes is accepted but never used.
---

View File

@@ -0,0 +1,43 @@
---
source_files:
- DataPRO/Modules/Hardware/AddEditHardware/Model/DASModule.cs
generated_at: "2026-04-17T15:57:30.628257+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "22ac148f69b9c507"
---
# Documentation: DASModule.cs
## 1. Purpose
`DASModule` is a model class representing a Data Acquisition System (DAS) hardware module within the hardware configuration system. It serves as a data-bound view model for the Add/Edit Hardware feature, managing module metadata including type identification, bridge configuration, serial numbers, and visual representation. The class implements property change notification to support WPF data binding and automatically resolves appropriate hardware images based on module configuration.
---
## 2. Public Interface
### Class: `DASModule`
**Namespace:** `HardwareList.Model`
**Inheritance:** `BasePropertyChanged`
**Implements:** `IAddEditHardwareDASModule`
#### Properties
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `Disabled` | `bool` | `false` | Flag indicating whether the module is disabled. |
| `SLICEBridgeType` | `SLICEBridgeTypes` | `SLICEBridgeTypes.Bridge` | The bridge type for SLICE modules. Setter triggers `SetImage()`. |
| `ModuleType` | `HardwareTypes` | `HardwareTypes.UNDEFINED` | The hardware module type. Setter triggers `SetImage()`. |
| `SerialNumber` | `string` | `""` | The serial number of the module. |
| `DASImage` | `ImageSource` | `null` | The visual representation of the module as a WPF image source. |
| `AvailableNanoBridges` | `SLICEBridgeTypes[]` | `static readonly` | Array of bridge types available for Nano hardware: `[Bridge, IEPE]`. |
| `AvailableMicroBridges` | `SLICEBridgeTypes[]` | `static readonly` | Array of bridge types available for Micro hardware: `[Bridge, IEPE, ARS, ACC]`. |
| `AvailableRACKModules` | `HardwareTypes[]` | `static readonly` | Array of available rack module types: `[UNDEFINED, SIM, TOM, DIM]`. |
| `OwningHardware` | `IAddEditHardwareHardware` | N/A | Reference to the parent hardware object. |
#### Methods
**`GetSerialNumberPrefix()`**
- **Signature:** `public string GetSerialNumberPrefix()`
- **Returns:** A string prefix corresponding to the module type for serial number formatting.

View File

@@ -0,0 +1,63 @@
---
source_files:
- DataPRO/Modules/Hardware/AddEditHardware/Properties/Settings.Designer.cs
- DataPRO/Modules/Hardware/AddEditHardware/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:44:59.120131+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "5f8154fbe79383b1"
---
# Documentation: AddEditHardware Module Properties
## 1. Purpose
This module provides the property and assembly configuration infrastructure for the `AddEditHardware` component within the DataPRO system. The `Settings.Designer.cs` file defines a strongly-typed settings class for persisting application configuration, while `AssemblyInfo.cs` establishes the assembly's identity, version, and COM visibility metadata. These files represent the configuration layer rather than the core business logic of hardware add/edit operations.
---
## 2. Public Interface
### `AddEditHardware.Properties.Settings` (class)
**Signature:**
```csharp
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
```
**Description:** A thread-safe singleton class that provides access to application-scoped and user-scoped settings for the AddEditHardware module. This class is auto-generated by Visual Studio's Settings Designer.
**Members:**
| Member | Signature | Description |
|--------|-----------|-------------|
| `Default` | `public static Settings Default { get; }` | Static property that returns the singleton instance of the `Settings` class. The instance is synchronized for thread-safe access. |
---
## 3. Invariants
- **Singleton Pattern:** The `Settings` class maintains exactly one instance via the `defaultInstance` field, created through `ApplicationSettingsBase.Synchronized()`.
- **Thread Safety:** The default instance is created using `Synchronized()`, ensuring thread-safe access to settings.
- **Auto-generation:** The `Settings.Designer.cs` file is machine-generated (Runtime Version: 4.0.30319.42000, Generator Version: 17.10.0.0) and will be overwritten on regeneration.
- **Internal Visibility:** The `Settings` class is marked `internal`, restricting access to within the `AddEditHardware` assembly.
- **COM Invisibility:** The assembly has `ComVisible(false)`, meaning types are not exposed to COM components by default.
---
## 4. Dependencies
### This module depends on:
- `System.Configuration.ApplicationSettingsBase` — Base class providing settings persistence and synchronization infrastructure.
- `System.Reflection` — For assembly metadata attributes.
- `System.Runtime.CompilerServices` — For `CompilerGeneratedAttribute`.
- `System.Runtime.InteropServices` — For `ComVisible` and GUID attributes.
### What depends on this module:
- **Cannot be determined from source alone.** The `AddEditHardware` assembly (identified by GUID `79856d8f-191f-4528-b78f-892283e21e7b`) is presumably consumed by other DataPRO components, but the specific consumers are not visible in these files.
---
## 5. Gotchas
- **Auto-generated Code:** The `Settings.Designer.cs` file contains

View File

@@ -0,0 +1,20 @@
---
source_files:
- DataPRO/Modules/Hardware/AddEditHardware/Resources/TranslateExtension.cs
- DataPRO/Modules/Hardware/AddEditHardware/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T16:13:00.122317+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "209c67de8aede7be"
---
# Resources
### 1. Purpose
This module provides localization support for the `AddEditHardware` assembly. It contains a WPF markup extension for declarative XAML binding to string resources and an auto-generated strongly-typed resource class that wraps access to culture-specific strings such as UI labels, error messages, and hardware configuration names.
### 2. Public Interface
**Class: `TranslateExtension`**
* **Signature:** `public class TranslateExtension : MarkupExtension`
* **Constructor:** `TranslateExtension(string key)` — Initializes the extension with the resource key to look up.
* **Method:** `public override object ProvideValue(IServiceProvider serviceProvider)` — Retrieves the localized string for the stored `_key`. Returns `#stringnotfound#

View File

@@ -0,0 +1,23 @@
---
source_files:
- DataPRO/Modules/Hardware/AddEditHardware/View/AddEditHardwareView.xaml.cs
generated_at: "2026-04-17T16:00:07.079272+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "6e5b358ea40be28e"
---
# Documentation: AddEditHardwareView
## 1. Purpose
`AddEditHardwareView` is a WPF code-behind file that serves as the view component for adding and editing hardware configurations in a Data Acquisition System (DAS). It implements `IAddEditHardwareView` and `INotifyPropertyChanged` to provide data binding support. The view manages hardware type selection based on database version compatibility, handles module addition/removal within hardware configurations, and notifies the underlying view model of user modifications through various UI event handlers.
---
## 2. Public Interface
### Properties
| Signature | Description |
|-----------

View File

@@ -0,0 +1,24 @@
---
source_files:
- DataPRO/Modules/Hardware/AddEditHardware/ViewModel/AddEditHardwareViewModel.cs
generated_at: "2026-04-17T16:00:07.067031+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "9a47572c9293f8ae"
---
# AddEditHardwareViewModel Documentation
## 1. Purpose
`AddEditHardwareViewModel` is a Prism-based ViewModel that manages the UI logic for adding and editing hardware devices within the DTS application. It serves as the intermediary between the `IAddEditHardwareView` and the underlying hardware data models, handling validation, persistence, SLICE6 database associations, and event-based communication with other modules. The class is designed as a shared singleton (via MEF `CreationPolicy.Shared`) and integrates with the application's event aggregation, region management, and dependency injection systems.
---
## 2. Public Interface
### Properties
| Name | Type | Description |
|------|------|-------------|
| `AllowStandin` | `bool

View File

@@ -0,0 +1,18 @@
---
source_files:
- DataPRO/Modules/Hardware/HardwareList/HardwareListModule.cs
generated_at: "2026-04-17T16:15:42.553640+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "7d197781627bb359"
---
# HardwareList
### Purpose
This module serves as the entry point for the HardwareList feature within the DTS application. It is a Prism Module (`IModule`) responsible for registering its associated views and view models with the Unity dependency injection container. It also provides assembly-level metadata (name, image, group, and region) to the application shell, identifying itself as part of the "Prepare" group targeting the "HardwareListRegion".
### Public Interface
* **`HardwareListModule` (Class)**
* `HardwareListModule(IUnityContainer unity

View File

@@ -0,0 +1,45 @@
---
source_files:
- DataPRO/Modules/Hardware/HardwareList/Converters/FirstUseDateConverter.cs
- DataPRO/Modules/Hardware/HardwareList/Converters/StandInFieldConverter.cs
generated_at: "2026-04-17T16:45:06.957738+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "efc40e7dad9708c9"
---
# HardwareList.Converters Documentation
## 1. Purpose
This module provides WPF `IValueConverter` implementations for the HardwareList UI layer. These converters transform `HardwareModel` data into display-friendly values for data-bound controls, handling edge cases such as missing data, invalid states, and stand-in hardware representations. The converters ensure consistent display formatting (e.g., returning `"---"` or `"N/A"` placeholders) across the hardware list views.
---
## 2. Public Interface
### `FirstUseDateConverter`
**Implements:** `System.Windows.Data.IValueConverter`
| Method | Signature | Description |
|--------|-----------|-------------|
| `Convert` | `(object value, Type targetType, object parameter, CultureInfo culture) → object` | Returns the first use date display value. If `value` is not a `HardwareModel`, returns `Strings.Table_NA`. If `model.IsFirstUseValid` is `false`, returns `Strings.NotApplicable`. If `model.FirstUseDate` is non-null, returns that date. Otherwise returns `Strings.Table_NA`. |
| `ConvertBack` | `(object value, Type targetType, object parameter, CultureInfo culture) → object` | Returns the input `DateTime` unchanged if `value` is a `DateTime`; otherwise returns `Strings.Table_NA`. |
---
### `StandInFieldConverter`
**Implements:** `System.Windows.Data.IValueConverter`
| Method | Signature | Description |
|--------|-----------|-------------|
| `Convert` | `(object value, Type targetType, object parameter, CultureInfo culture) → object` | Returns field values for non-stand-in hardware. If `value` is not a `HardwareModel`, returns `Strings.Table_NA`. If `model.Hardware` is not an `IISOHardware`, returns `string.Empty`. If `isoHW.StandIn` is `true`, returns `Strings.Table_NA`. Otherwise, uses the string `parameter` to select: `"CalDueDate"``model.CalDueDate`, `"CalDate"``model.CalDate`, `"Firmware"``model.Firmware`. Unrecognized parameters return `Strings.Table_NA`. |
| `ConvertBack` | `(object value, Type targetType, object parameter, CultureInfo culture) → object` | Returns the input `DateTime` unchanged if `value` is a `DateTime`; otherwise returns `Strings.Table_NA`. |
---
## 3. Invariants
-

View File

@@ -0,0 +1,173 @@
---
source_files:
- DataPRO/Modules/Hardware/HardwareList/Model/HardwareChannelAssignment.cs
- DataPRO/Modules/Hardware/HardwareList/Model/SLICE6TreeNode.cs
- DataPRO/Modules/Hardware/HardwareList/Model/Hardware.cs
generated_at: "2026-04-17T15:56:03.551323+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f80851e7f913e0b5"
---
# Hardware List Model Documentation
## 1. Purpose
This module provides the data models for representing and managing hardware devices (DAS - Data Acquisition Systems) within the Hardware List feature. It handles hardware configuration state, channel assignments, SLICE6 device tree node relationships, database persistence for device associations, and calibration date calculations. The models serve as the bridge between raw hardware interface objects (`IISOHardware`) and the UI layer, exposing computed properties for display and user interaction.
---
## 2. Public Interface
### HardwareChannelAssignment (HardwareList.Model)
A simple immutable data transfer object representing a channel-to-sensor mapping.
| Member | Signature | Description |
|--------|-----------|-------------|
| `ChannelNumber` | `string { get; }` | Read-only channel identifier. |
| `Sensor` | `string { get; }` | Read-only sensor identifier. |
| `Name` | `string { get; }` | Read-only name for the assignment. |
| Constructor | `HardwareChannelAssignment(string channelNumber, string sensor, string name)` | Initializes all three properties. |
---
### SLICE6TreeNode (HardareList.Model)
**Note:** Namespace has a typo ("HardareList" vs "HardwareList").
Represents a SLICE6 device node in a tree structure, with database operations for managing parent-child relationships between SLICE6 devices and SLICE6DB distributors.
| Member | Signature | Description |
|--------|-----------|-------------|
| `DASId` | `int { get; set; }` | Database ID of the DAS record. |
| `SerialNumber` | `string { get; set; }` | Serial number of the DAS. |
| `Port` | `int { get; set; }` | Port number on the S6DB. |
| `PortString` | `string { get; }` | Returns `"---"` if Port < 0, otherwise Port.ToString(). |
| `Number` | `int { get; set; }` | Order of the DAS on the S6DB. |
| `PositionOnChain` | `int { get; set; }` | Order on the chain for a given port. |
| `PositionOnChainString` | `string { get; }` | Returns `"---"` if PositionOnChain < 0, otherwise PositionOnChain.ToString(). |
| Constructor | `SLICE6TreeNode(int dasId, string serialNumber, int port, int number, int positionOnChain)` | Initializes all properties. |
| `GetAvailableTreeNodes` | `static ISLICE6TreeNode[](string serialNumberParent)` | Returns all SLICE6 devices NOT associated with the given S6DB serial number. Filters by `HardwareTypes.SLICE6_Base` and excludes 'Prototype' positions. Results sorted by SerialNumber. |
| `GetTreeNodes` | `static ISLICE6TreeNode[](string serialNumberParent)` | Returns all SLICE6 devices associated with the given S6DB serial number. Results sorted by Number. |
| `SwapNodes` | `static void(string serialNumberA, string serialNumberB)` | Swaps all child DAS associations between two distributors. |
| `SaveAssociations` | `static void(string serialNumber, ISLICE6TreeNode[] attachedSLICE6)` | Commits SLICE6-to-S6DB associations to the database. First clears all associations, then applies new ones. |
---
### HardwareModel (HardareList.Model)
Primary model for hardware devices, implementing `IHardware`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `FirstUseDate` | `DateTime? { get; set; }` | First date of use after calibration; null if not used since calibration. |
| `IsFirstUseValid` | `bool { get; set; }` | Whether hardware supports and is using first use date. |
| `DASId` | `int { get; set; }` | Database ID. |
| `Disabled` | `bool { get; set; }` | Whether device is disabled. |
| `SerialNumber` | `string { get; set; }` | Device serial number. |
| `HardwareType` | `string { get; set; }` | Localized hardware type name. |
| `ChannelCount` | `string { get; set; }` | Formatted channel count string. |
| `HasIncludedChildren` | `bool { get; set; }` | Whether device has included child devices. |
| `Firmware` | `string { get; set; }` | Firmware version. |
| `MaxSampleRate` | `double? { get; set; }` | Maximum sample rate, null if not applicable. |
| `TestSampleRate` | `double { get; set; }` | Sample rate for testing; setter fires `SelectedSampleRateIndex` change. |
| `TestAAFilterRateHz` | `double { get; set; }` | Anti-alias filter rate; setter calls `_vm.FireAAFilterRate()`. |
| `CalDate` | `DateTime? { get; set; }` | Calibration date. |
| `CalDueDate` | `DateTime? { get; set; }` | Calculated calibration due date based on hardware type. |
| `Included` | `bool { get; set; }` | Whether device is included in test; setter fires multiple property changes and calls `_vm.FireIncluded()`. |
| `DSPStreamingFilter` | `double { get; set; }` | DSP streaming filter value. |
| `MasterProfile` | `DTS.Common.ClockSyncProfile { get; set; }` | Clock sync profile for master mode. |
| `SlaveProfile` | `DTS.Common.ClockSyncProfile { get; set; }` | Clock sync profile for slave mode. |
| `IsClockMaster` | `bool { get; set; }` | Whether device is clock master; setter calls `_vm.FireClockMaster()`. |
| `IsClockedDAS` | `bool { get; }` | True for SLICE6_AIR, S6A_EthernetRecorder, SLICE6_Base, SLICE6_AIR_BR, SLICE6DB, SLICE6DB3, SLICE6DB_InDummy, TSR_AIR, TSR_AIR_RevB, SLICE6_AIR_TC. |
| `PTPDomainID` | `byte { get; set; }` | PTP domain ID; setter calls `_vm.FirePTPDomainID()`. |
| `IsPTPSync` | `bool { get; }` | Computed from MasterProfile/SlaveProfile containing "E2E". |
| `MixedRates` | `bool { get; set; }` | Whether mixed rates are enabled. |
| `IsDistributor` | `bool { get; }` | True for SLICE_EthernetController, SLICE_Distributor, SLICE_Mini_Distributor, SLICE6DB, SLICE_LabEthernet, SLICE6DB3, SLICE6DB_InDummy, SLICE_Pro_Distributor. |
| `IsBattery` | `bool { get; }` | True for PowerPro. |
| `IsTSRAIR` | `bool { get; }` | True for TSR_AIR, TSR_AIR_RevB, DKR, DIR. |
| `IncludedAndNotMixedRatesAndCompactOrNotDistributor` | `bool { get; }` | Computed property for UI binding. |
| `IncludedAndMixedRatesAndCompact` | `bool { get; }` | Computed property for UI binding. |
| `ParentDAS` | `string { get; set; }` | Serial number of parent DAS. |
| `PositionOnChain` | `int { get; set; }` | Position on chain. |
| `PositionOnDistributor` | `int { get; set; }` | Position on distributor. |
| `Port` | `int { get; set; }` | Port number. |
| `HasTreeView` | `bool { get; set; }` | Whether device has a tree view (true for SLICE6DB, SLICE6DB3, SLICE6DB_InDummy). |
| `SerialNumberDisplay` | `string { get; }` | Returns hardware type description if `StandIn` is true, otherwise SerialNumber. |
| Constructor | `HardwareModel(IISOHardware d, int tdasCalPeriod, ...)` | Takes 14 calibration period parameters and a view model reference. Calculates CalDueDate based on hardware type. |
| `DetermineChannelCount` | `void(bool showCompact, IHardware[] allHardware)` | Builds channel count string and determines MaxSampleRate for distributors. |
| `SetIncluded` | `void(bool bIncluded)` | Sets included flag without firing `_vm.FireIncluded()`. |
| `SetMixedRates` | `void(bool mixedRates)` | Sets mixed rates flag. |
| `Filter` | `bool(string term)` | Returns true if term matches SerialNumber, Firmware, or HardwareType (case-insensitive). |
| `GetAvailableSLICE6DB` | `static IHardware[](string serialNumber)` | Returns SLICE6DB devices excluding the one matching the given serial number. |
| `ToString` | `override string()` | Returns SerialNumberDisplay. |
---
### HardwareComparer (HardareList.Model)
Comparer class for sorting `IHardware` instances.
| Member | Signature | Description |
|--------|-----------|-------------|
| `SortField` | `HardwareListTags { get; set; }` | Field to sort by. |
| `SortAscending` | `bool { get; set; }` | Sort direction; default is true. |
| `Compare` | `int(IHardware left, IHardware right)` | Compares two hardware instances based on SortField. Handles nulls and various data types. |
Supported sort fields: `Included`, `DSPStreamingFilter`, `SerialNumber`, `HardwareType`, `ChannelCount`, `Firmware`, `MaxSampleRate`, `CalDate`, `CalDueDate`, `IPAddress`, `FirstUseDate`.
---
## 3. Invariants
1. **PortString / PositionOnChainString**: Always return `"---"` when the underlying integer value is negative; otherwise return the string representation of the value.
2. **CalDueDate Calculation**: Always calculated from `dateOfFirstUse` (either `CalDate` or `FirstUseDate` or `DateTime.Today` depending on `IsFirstUseValid`) plus the hardware-type-specific calibration period. Throws `ArgumentOutOfRangeException` for unknown `HardwareTypes` values.
3. **GetAvailableTreeNodes**: Returns empty array if `serialNumberParent` is null or whitespace. Always sorts results by SerialNumber.
4. **GetTreeNodes**: Returns empty array if `serialNumberParent` is null or whitespace. Always sorts results by Number.
5. **GetAvailableSLICE6DB**: Returns empty array if `serialNumber` is null or whitespace. Filters for `Position=''` (empty string).
6. **SaveAssociations**: Always performs a two-step process: first clears all associations (sets `IsModule=0`, `PositionOnDistributor=-1`, `PositionOnChain=-1`, `Port=-1`, `ParentDAS=''`), then applies new associations.
7. **IsPTPSync**: Returns true only if the appropriate profile's description contains "E2E".
8. **IsClockMaster**: Returns false if `IsClockedDAS` is false, regardless of `_bIsClockMaster` value.
---
## 4. Dependencies
### This module depends on:
- `DTS.Common.Base.BasePropertyChanged` - Base class for property change notification
- `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList.ISLICE6TreeNode` - Interface for SLICE6 tree nodes
- `DTS.Common.Interface.DASFactory.Diagnostics.IHardware` - Interface for hardware model
- `DTS.Common.Interface.DASFactory.Diagnostics.IISOHardware` - Interface for ISO hardware objects
- `DTS.Common.Enums.Hardware.HardwareTypes` - Enum for hardware type identification
- `DTS.Common.Enums.HardwareListTags` - Enum for sort field identification
- `DTS.Common.ClockSyncProfile` - Enum for clock synchronization profiles
- `DTS.Common.Storage.DbOperations` - Database access utilities
- `DTS.Common.Converters.EnumDescriptionTypeConverter` - For enum description conversion
- `DTS.Common.Classes.Hardware` - Hardware-related classes
- `System.Data.SqlClient.SqlParameter` - SQL parameter construction
- `HardwareList.Resources.StringResources` - Localized string resources
- `HardwareList.HardwareListViewModel` - View model reference (passed to HardwareModel constructor)
### Database Dependencies:
- `[DAS]` table with columns: `DASId`, `SerialNumber`, `PositionOnDistributor`, `PositionOnChain`, `Port`, `ParentDAS`, `Type`, `Position`, `IsModule`, `FirmwareVersion`, `CalDate`, `MaxSampleRate`, `IPAddress`
---
## 5. Gotchas
1. **Namespace Typo**: `SLICE6TreeNode` and `HardwareModel` are in namespace `HardareList.Model` (missing 'w'), while `HardwareChannelAssignment` is in `HardwareList.Model`. This inconsistency may cause resolution issues.
2. **Bug in SwapNodes**: The method contains a likely bug where `Associate` is called with `serialNumberB` for both lists:
```csharp
if (listA.Any()) { Associate(serialNumberB, listA.ToArray()); }
if (listB.Any()) { Associate(serialNumberB, listB.ToArray()); } // Should be serialNumberA?
```
This would result in all nodes being associated with `serialNumberB` instead of swapping.
3. **Direct Field Access in SetIncluded**: The `SetIncluded` method sets `_bIncluded` directly and calls `OnPropertyChanged`, but does NOT call `_vm.FireIncluded()`. The `Included` property setter does call `_vm.FireIncluded()`. This inconsistency may cause unexpected behavior.
4. **Database Connection Disposal**: All database

View File

@@ -0,0 +1,24 @@
---
source_files:
- DataPRO/Modules/Hardware/HardwareList/Properties/Settings.Designer.cs
- DataPRO/Modules/Hardware/HardwareList/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:53:13.870656+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "347d313124875b2c"
---
# Documentation: HardwareList Module Properties
## 1. Purpose
This module contains the assembly metadata and configuration settings infrastructure for the `HardwareList` component within the DataPRO system. It defines the assembly's identity, version information, and COM visibility attributes, while providing a strongly-typed, thread-safe wrapper for accessing application settings via the `Settings` class.
## 2. Public Interface
### `HardwareList.Properties.Settings`
**Kind:** Class (Internal, Sealed, Partial)
**Inheritance:** `System.Configuration.ApplicationSettingsBase`
This is an auto-generated class that provides access to application-scoped and user-scoped settings.
* **`Default

View File

@@ -0,0 +1,140 @@
---
source_files:
- DataPRO/Modules/Hardware/HardwareList/Resources/TranslateExtension.cs
- DataPRO/Modules/Hardware/HardwareList/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T15:58:02.305916+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "044fd045b3bc16bb"
---
# Documentation: HardwareList Resources Module
## 1. Purpose
This module provides localization/internationalization support for the HardwareList component of the DataPRO system. It enables XAML-based UI elements to declaratively reference localized strings through a markup extension pattern, while the underlying resource class provides strongly-typed access to hardware-related display text (device names, column headers, action labels, etc.). The module abstracts the resource lookup mechanism, allowing UI code to reference string resources by key without direct interaction with `ResourceManager`.
---
## 2. Public Interface
### `TranslateExtension` Class
**Namespace:** `HardwareList`
**Inheritance:** `System.Windows.Markup.MarkupExtension`
**Attribute:** `[MarkupExtensionReturnType(typeof(string))]`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `TranslateExtension(string key)` | Initializes the extension with the resource key to look up. The key is stored in a readonly field `_key`. |
| `ProvideValue` | `override object ProvideValue(IServiceProvider serviceProvider)` | Returns the localized string for the stored key. Returns `#stringnotfound#` if key is null/empty, or `#stringnotfound# <key>` if the key is not found in resources. |
### `StringResources` Class
**Namespace:** `HardwareList.Resources`
**Accessibility:** `internal`
**Attribute:** Auto-generated by `StronglyTypedResourceBuilder`
| Member | Signature | Description |
|--------|-----------|-------------|
| `ResourceManager` | `static global::System.Resources.ResourceManager ResourceManager { get; }` | Returns the cached ResourceManager instance for the `HardwareList.Resources.StringResources` resource set. Lazily initialized on first access. |
| `Culture` | `static global::System.Globalization.CultureInfo Culture { get; set; }` | Gets or sets the culture used for resource lookups. Overrides `Thread.CurrentUICulture` for this resource class. |
**Static String Properties (selection):**
| Property | Default Value (English) |
|----------|------------------------|
| `Add` | "Add" |
| `Remove` | "Remove" |
| `Replace` | "Replace" |
| `Swap` | "Swap" |
| `SerialNumber` | "Serial Number" |
| `Firmware` | "Firmware" |
| `IPAddress` | "IP Address" |
| `Port` | "Port" |
| `HardwareType` | "Type" |
| `ChannelCount` | "Channels" |
| `MaxSampleRate` | "Max Sample Rate" |
| `TestSampleRate` | "Test Sample Rate" |
| `CalDate` | "Cal Date" |
| `CalDueDate` | "Cal Due Date" |
| `FirstUseDate` | "First Use Date" |
| `Connection` | "Connection" |
| `USB` | "USB" |
| `CAN` | "CAN" |
| `UART` | "UART" |
| `PositionOnChain` | "Position on chain" |
| `IsHWClockMaster` | "Clock Master?" |
| `PTPDomain` | "PTP Domain" |
| `NotFound` (constant in `TranslateExtension`) | `#stringnotfound#` |
**Hardware Device Name Properties (partial list):**
| Property | Default Value |
|----------|--------------|
| `SLICE_Base` | "SLICE" |
| `SLICE6_Base` | "SLICE 6" |
| `SLICE6_AIR` | "SLICE 6 AIR" |
| `SLICE2_Base` | "SLICE PRO SIM" |
| `SLICE2_DIM` | "SLICE PRO DIM" |
| `SLICE_IEPE` | "SLICE (IEPE)" |
| `SLICE_NANO_Base` | "SLICE (Nano)" |
| `SLICE_Micro_Base` | "SLICE (Micro)" |
| `SLICE1_5_Micro_Base` | "SLICE+" |
| `SLICE_Distributor` | "SLICE Distributor" |
| `SLICE_EthernetController` | "SLICE Ethernet Controller" |
| `TDAS_Pro_Rack` | "TDAS PRO Rack" |
| `TDAS_LabRack` | "TDAS PRO Lab Rack" |
| `G5VDS` | "G5 (VDS)" |
| `TSR_AIR` | "TSR AIR" |
| `Ribeye` | "Ribeye" |
| `PowerPro` | "PowerPRO Battery" |
---
## 3. Invariants
1. **Key Immutability:** The `_key` field in `TranslateExtension` is `readonly` and can only be set via the constructor.
2. **Error String Format:** Missing translations always follow the pattern:
- Null/empty key → `#stringnotfound#`
- Key not found → `#stringnotfound# <key>` (note the space before the key)
3. **Resource Manager Singleton:** The `ResourceManager` property uses lazy initialization with a null-check pattern; once initialized, the same instance is returned for all subsequent calls.
4. **Auto-generation Constraint:** `StringResources` is marked with `GeneratedCodeAttribute` and `CompilerGeneratedAttribute`. Manual edits will be overwritten when the `.resx` file is regenerated.
5. **Internal Visibility:** `StringResources` is `internal`, restricting access to within the defining assembly.
---
## 4. Dependencies
### This Module Depends On:
- `System` (core types)
- `System.Windows.Markup` (`MarkupExtension` base class, `MarkupExtensionReturnTypeAttribute`)
- `System.Resources` (`ResourceManager` for resource lookup)
- `System.Globalization` (`CultureInfo` for culture-specific lookups)
- `System.CodeDom.Compiler` (attributes on generated code)
- `System.ComponentModel` (`EditorBrowsableAttribute`)
- `System.Diagnostics` (`DebuggerNonUserCodeAttribute`)
- `System.Runtime.CompilerServices` (`CompilerGeneratedAttribute`)
### External Resource Dependency:
- A `.resx` file named `StringResources.resx` (and culture-specific variants) must exist in the `HardwareList.Resources` namespace at compile time.
### What Depends On This Module:
- **Inferred:** Any XAML files in the `HardwareList` module that use `{local:Translate KeyName}` syntax for localized strings.
- **Inferred:** Code-behind files that reference `StringResources.<PropertyName>` directly.
---
## 5. Gotchas
1. **Silent Failure Pattern:** `TranslateExtension.ProvideValue` never throws exceptions for missing keys. It returns error strings instead, which may appear directly in the UI. Consumers should test for the `#stringnotfound#` prefix if they need to detect missing translations programmatically.
2. **Culture Must Be Set Explicitly:** The `StringResources.Culture` property allows overriding the current thread's UI culture. If set, all subsequent lookups use this culture until reset. This can cause unexpected language switches if not managed carefully.
3. **Auto-generated File Warning:** The file header explicitly warns that changes to `StringResources.Designer.cs` will be lost on regeneration. Developers must edit the underlying `.resx` file instead.
4. **No Null Key Validation in Constructor:** `TranslateExtension` accepts null or empty keys without throwing; the validation only occurs in `ProvideValue()`. This means XAML with `{x:Null}` or empty string bindings will compile but produce `#stringnotfound#` at runtime.
5. **Inconsistent Device Naming:** Some device strings appear to have copy-paste errors in comments (e.g., `SLICE2_Bridge_Hi`, `SLICE2_Bridge_Lo`, `SLICE2_IEPE_Hi`, `SLICE2_IEPE_Lo` all have summary comments saying "SLICE PRO SIM" rather than their actual device type). This is documentation debt in the auto-generated file, not a runtime issue.

View File

@@ -0,0 +1,30 @@
---
source_files:
- DataPRO/Modules/Hardware/HardwareList/View/HardwareListOverdueView.xaml.cs
- DataPRO/Modules/Hardware/HardwareList/View/HardwareListReplaceView.xaml.cs
- DataPRO/Modules/Hardware/HardwareList/View/SLICE6TreeView.xaml.cs
- DataPRO/Modules/Hardware/HardwareList/View/HardwareListSelectView.xaml.cs
- DataPRO/Modules/Hardware/HardwareList/View/HardwareListView.xaml.cs
generated_at: "2026-04-17T15:52:26.243728+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "aa0519467c51d90d"
---
# Hardware List Views Documentation
## 1. Purpose
This module provides the WPF view components for the Hardware List feature within the DataPRO diagnostics system. It contains five partial classes that implement view interfaces for displaying, selecting, and managing hardware items—including overdue hardware tracking, hardware replacement operations, and SLICE6 device tree associations. These views serve as the UI layer that binds user interactions to the `IHardwareListViewModel` and related view models, handling events such as sorting, filtering, column management, and hardware association workflows.
---
## 2. Public Interface
### HardwareListOverdueView
**Implements:** `IHardwareListOverdueView`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public HardwareListOverdueView()` | Initializes the component via `InitializeComponent()`. |
| ListViewHeader_Click | `private void ListViewHeader_Click(object sender, RoutedEventArgs e)` | Handles column header clicks; extracts `GridViewColumnHeader` from `e.OriginalSource`, retrieves

View File

@@ -0,0 +1,242 @@
---
source_files:
- DataPRO/Modules/Hardware/HardwareList/ViewModel/HardwareListViewModel.cs
generated_at: "2026-04-17T16:01:30.188313+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "516e7030d5d58a0c"
---
# HardwareListViewModel Documentation
## 1. Purpose
`HardwareListViewModel` is the ViewModel for the Hardware List module in a WPF/Prism-based application. It manages the display, filtering, sorting, and manipulation of hardware devices (DAS units, SLICE modules, racks, etc.) within the system. The class handles hardware configuration including sample rates, anti-aliasing filter rates, clock synchronization, PTP domain IDs, calibration tracking, and SLICE6-to-SLICE6DB associations. It serves as the intermediary between hardware data models and the UI views, exposing bindable properties and commands for hardware management operations.
---
## 2. Public Interface
### Constructor
```csharp
public HardwareListViewModel(IHardwareListView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
```
Initializes the ViewModel with its associated view, Prism region manager, event aggregator for pub/sub messaging, and Unity DI container. Sets up event subscriptions for `RaiseNotification` and `BusyIndicatorChangeNotification` events.
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `View` | `IHardwareListView` | The associated view, with DataContext set to this ViewModel |
| `OverdueView` | `IHardwareListOverdueView` | View for overdue hardware display |
| `SelectView` | `IHardwareListSelectView` | View for hardware selection |
| `ReplaceView` | `IHardwareListReplaceView` | View for hardware replacement |
| `SLICE6TreeView` | `ISLICE6TreeView` | Tree view for SLICE6/Slice 6 Air hardware hierarchy |
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for showing notifications |
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for confirmations |
| `StreamingDSPProfile` | `IStreamingFilterProfile` | Profile for DSP streaming filter calculations |
| `Hardware` | `IHardware[]` | Array of hardware items for display |
| `OverdueHardware` | `IHardware[]` | Array of hardware with overdue calibration |
| `SelectedHardwareItems` | `ObservableCollection<IHardware>` | Currently selected hardware items |
| `ShowCompact` | `bool` | Whether to show compact view (hides rack modules) |
| `IsBusy` | `bool` | Busy indicator state for UI |
| `IsEdit` | `bool` | Edit mode flag |
| `ListViewId` | `string` | Returns `"HardwareListView"` |
### Calibration Period Properties
```csharp
public int TDASCalPeriod { get; set; }
public int G5CalPeriod { get; set; }
public int SLICE1CalPeriod { get; set; }
public int SLICE1_5CalPeriod { get; set; }
public int SLICE2_CalPeriod { get; set; }
public int SLICE6_CalPeriod { get; set; }
public int POWERPRO_CalPeriod { get; set; }
public int SLICE6Air_CalPeriod { get; set; }
public int SLICE6AirBridge_CalPeriod { get; set; }
public int SLICE6DB_CalPeriod { get; set; }
public int TSRAir_CalPeriod { get; set; }
public int SLICETC_CalPeriod { get; set; }
public int SLICE_PRO_CAN_FD_CalPeriod { get; set; }
```
### Key Methods
#### Hardware Loading and Management
```csharp
public void GetHardware(bool bIncludeModules, bool bIncludeOverdue, bool bIncludeBridges, int? testId, int? groupId)
```
Loads all DAS hardware from the system, applies filtering based on parameters, aggregates child module properties to parent devices, and populates `Hardware` and `OverdueHardware` arrays.
```csharp
public void LoadTreeView(string serialNumber)
```
Loads SLICE6 tree nodes for a given serial number, populating `SLICE6TreeNodes` and `AvailableSLICE6`.
```csharp
public void Unset()
```
Clears all hardware arrays, filters, cached data, and publishes `ListViewStatusEvent` with `Unloaded` status.
#### Sample Rate Methods
```csharp
public void GetAvailableSampleRates(int[] availableSampleRates)
public void SetTestSampleRates(Dictionary<string, double> testSampleRates)
public void UpdateTestSampleRate(string childSerialNumber, double testSampleRate)
```
Manage sample rate configuration for hardware. `SetTestSampleRates` automatically selects the next highest available rate if a requested rate is unavailable (except for TSRAIR hardware).
#### Anti-Aliasing Filter Methods
```csharp
public void SetTestAAFRates(Dictionary<string, float> testAAFRates)
public void UpdateTestAAFilterRate(string childSerialNumber, float testAAFilterRate)
public internal float GetAAFForHardware(IISOHardware h, int sampleRate)
```
Configure anti-aliasing filter rates. `GetAAFForHardware` routes to different AAF calculations based on `DASTypeEnum` (TDAS vs SLICE types).
```csharp
public Func<SerializableAAF.DAS_TYPE, int, float> GetAAFForHardwareFunc { get; set; }
```
Injectable function for AAF calculation, allowing external implementation.
#### Clock and PTP Methods
```csharp
public void SetTestClockProfiles(DTS.Common.ClockSyncProfile masterProfile, DTS.Common.ClockSyncProfile slaveProfile)
public void SetTestClockMasters(Dictionary<string, bool> testClockMasters)
public void UpdateTestClockMaster(string childSerialNumber, bool testClockMaster)
public void SetTestPTPDomainIDs(Dictionary<string, byte> testPTPDomainIDs)
public void UpdateTestPTPDomainID(string childSerialNumber, byte ptpDomainId)
```
#### Event Publishing Methods
```csharp
public void FireAAFilterRate(IHardware hardware, string testAAFilterRate)
public void FireSampleRate(IHardware hardware, string testSampleRate)
public void FireClockMaster(IHardware hardware, bool isClockMaster)
public void FireIncluded(IHardware hardware)
public void FirePTPDomainID(IHardware hardware, byte ptpDomainID)
```
Publish corresponding Prism events via `IEventAggregator`.
#### Filtering and Sorting
```csharp
public void Filter(string term)
public void Filter(object tag, string term)
public void Sort(object o, bool bColumnClick)
public void SortOverdue(object o, bool bColumnClick)
public void ClearAllFilters()
```
#### Hardware Replacement
```csharp
public void InitializeReplace(ITestSetup testSetup, IsoViewMode viewMode)
public void Replace()
```
`InitializeReplace` prepares the replacement workflow by loading channel assignments. `Replace` executes the replacement and publishes `HardwareReplaceEvent`.
#### SLICE6 Association Methods
```csharp
public void SaveSLICE6Associations(string serialNumber)
public void Associate(ISLICE6TreeNode node)
public void Associate(IHardware node)
public void UnAssociate(ISLICE6TreeNode node)
```
Manage SLICE6-to-SLICE6DB associations. Changes are in-memory until `SaveSLICE6Associations` is called.
#### Selection
```csharp
public IHardware[] GetSelectedItems()
public void SetIncluded(string[] serialNumbers, bool included)
public void SetIncluded(int[] ids)
```
### Nested Enum
```csharp
public enum Fields
{
SerialNumber, HardwareType, IPAddress, ChannelCount, Firmware,
MaxSampleRate, TestSampleRate, CalDate, CalDueDate,
IsClockMaster, FirstUseDate, PTPDomainID
}
```
Used for field-specific filtering.
### Event
```csharp
public event PropertyChangedEventHandler PropertyChanged
public void OnPropertyChanged(string propertyName)
```
Standard `INotifyPropertyChanged` implementation.
---
## 3. Invariants
1. **Selection Synchronization**: `SelectedHardwareItems` collection changes trigger `FireSelectionChanged()`, which publishes `HardwareListHardwareSelectedEvent` with serial numbers, unless `SelectedItemsStatus.GetUpdating()` returns true.
2. **Parent-Child Hardware Aggregation**: In `GetHardware()`, child module properties (channel counts, calibration dates, max sample rates) are aggregated to parent DAS devices. Parent `MaxSampleRate` takes the minimum of children; parent `CalDate`/`CalDueDate` takes the earliest date.
3. **Duplicate Prevention**: `GetHardware()` uses a `HashSet<string>` (`processed`) to prevent double-counting hardware by serial number during aggregation.
4. **Mixed Rate Detection**: When a child's sample rate differs from siblings with the same `ParentDAS`, the parent's `MixedRates` property is set to `true`.
5. **Overdue Hardware Separation**: Hardware with `CalDueDate <= DateTime.Today` is always added to `OverdueHardware` array regardless of other filters.
6. **Sort State Consistency**: `_sortField` and `_sortAscending` track current sort state; clicking the same column toggles direction.
---
## 4. Dependencies
### Imports (This Module Depends On)
- `DTS.Common.Classes.Hardware` - Hardware data classes
- `DTS.Common.Enums.Hardware` - Hardware type enumerations
- `DTS.Common.Events` / `DTS.Common.Events.Hardware.HardwareList` - Event definitions
- `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList` - Diagnostic interfaces
- `DTS.Common.Interface.DASFactory.Diagnostics` - DAS factory interfaces
- `DTS.Common.Interface.TestSetups.TestSetupsList` - Test setup interfaces
- `DTS.Common.Enums` / `DTS.Common.Enums.DASFactory` - Enumerations
- `DTS.Common.Utilities.Logging` - `APILogger` for logging
- `DTS.Common.Classes.DSP` - DSP-related classes
- `DTS.Common.Interactivity` - `InteractionRequest`, `Notification`, `Confirmation`
- `DTS.Common.ISO.Hardware` - ISO hardware interfaces (referenced via `IISOHardware`)
- `HardareList.Model` - Note: namespace appears to have a typo (missing 'w')
- `Unity` - IoC container
- `Prism.Regions` / `Prism.Events` - Prism framework
### Published Events (Consumed By Others)
- `HardwareListEditHardwareEvent`
- `HardwareListHardwareTestAAFilterRateEvent`
- `HardwareListHardwareTestSampleRateEvent`
- `HardwareListHardwareTestClockMasterEvent`
- `HardwareListHardwareIncludedEvent`
- `HardwareListHardwareSelectedEvent`
- `HardwareListHardwareTestPTPDomainIDEvent`
- `HardwareReplaceEvent`
- `HardwareListShowCompactEvent`
- `ListViewStatusEvent`
- `PageErrorEvent`
### Subscribed Events
- `RaiseNotification`
- `BusyIndicatorChangeNotification`
---
## 5. Gotchas
1. **Incomplete `SetCache` Implementation**: The method `SetCache(IISOHardware[] hardware)` only clears `_cachedHardware` but never populates it with the passed parameter. This appears to be incomplete functionality.
2. **Namespace Typo**: The namespace `HardareList.Model` is imported (missing 'w' in "Hardware"), suggesting a historical naming inconsistency.
3. **`IsDirty` Never Set**: The `IsDirty` property is declared with a private setter but is never assigned `true` anywhere in the class. Its purpose is unclear from the source.
4. **Empty Lifecycle Methods**: `Initialize()`, `Initialize(object)`, `Initialize(object, object)`, `InitializeAsync()`, `InitializeAsync(object)`, `Activated()`, `Cleanup()`, and `CleanupAsync()` all have empty or `Task.CompletedTask` implementations, suggesting either interface compliance or placeholder code.
5. **ReSharper Suppressions**: The file includes `// ReSharper disable` directives for `CheckNamespace`, `MemberCanBePrivate.Global`, and `InconsistentNaming`, indicating intentional deviations from standard conventions.
6. **TSRAIR Special Handling**: `GetAvailableSampleRates()` applies different valid sample rates (`DFConstantsAndEnums.TSRAIR_ValidSampleRates`) for TSRAIR hardware, and `SetTestSampleRates()` skips the "next highest rate" fallback for TSRAIR.
7. **AAF Rate Fallback Behavior**: In `SetTestAAFRates()`, if a serial number is missing from the dictionary, the code logs a warning, calculates a default AAF rate, and shows a user notification—but only on the first occurrence (`shown` flag).
8. **Module Visibility Logic**: In `Filter(string term)`, when `ShowCompact` is true, modules with a non-empty `ParentDAS` are excluded from the main list but still added to `OverdueHardware` if calibration is overdue.

View File

@@ -0,0 +1,46 @@
---
source_files:
- DataPRO/Modules/ISO/ExtraProperties/ExtraPropertiesModule.cs
generated_at: "2026-04-17T16:30:25.825122+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2be65806338da7b0"
---
# ExtraProperties
### Purpose
This module provides a user interface for managing ISO extra properties, which appear to be key-value pairs associated with ISO channel configurations. It is a Prism module that registers a list view and view model for displaying and editing extra properties. The module belongs to the "Prepare" assembly group and targets the "ExtraPropertiesRegion" for UI composition.
### Public Interface
**`ExtraPropertiesModule`** (class)
- `ExtraPropertiesModule(IUnityContainer unityContainer)` - Constructor accepting a Unity container via dependency injection.
- `void Initialize()` - Registers `IExtraPropertiesListViewModel` to `ExtraPropertiesListViewModel` and `IExtraPropertiesListView` to `ExtraPropertiesListView` with the Unity container.
- `void OnInitialized(IContainerProvider containerProvider)` - Empty implementation; no initialization logic executed.
- `void RegisterTypes(IContainerRegistry containerRegistry)` - Calls `Initialize()` to perform type registration.
**`ExtraPropertiesModuleNameAttribute`** (class, inherits `TextAttribute`)
- `ExtraPropertiesModuleNameAttribute()` / `ExtraPropertiesModuleNameAttribute(string s)` - Constructors that set `AssemblyName` to `AssemblyNames.ExtraProperties.ToString()`.
- `string AssemblyName` (property, override) - Returns the assembly name.
- `Type GetAttributeType()` - Returns `typeof(TextAttribute)`.
- `string GetAssemblyName()` - Returns the `AssemblyName` property value.
**`ExtraPropertiesModuleImageAttribute`** (class, inherits `ImageAttribute`)
- `ExtraPropertiesModuleImageAttribute()` / `ExtraPropertiesModuleImageAttribute(string s)` - Constructors that load the assembly image via `AssemblyInfo.GetImage()`.
- `BitmapImage AssemblyImage` (property, override) - Lazy-loads and returns the module's image.
- `string AssemblyName` (property, override) - Returns `AssemblyNames.ExtraProperties.ToString()`.
- `string AssemblyGroup` (property, override) - Returns `eAssemblyGroups.Prepare.ToString()`.
- `eAssemblyRegion AssemblyRegion` (property, override) - Returns `eAssemblyRegion.ExtraPropertiesRegion`.
- `BitmapImage GetAssemblyImage()`, `string GetAssemblyName()`, `string GetAssemblyGroup()`, `eAssemblyRegion GetAssemblyRegion()` - Accessor methods for respective properties.
- `Type GetAttributeType()` - Returns `typeof(ImageAttribute)`.
### Invariants
- The module must be instantiated with a non-null `IUnityContainer` reference.
- `Initialize()` must be called (via `RegisterTypes`) before views/view models can be resolved.
- View and ViewModel registrations are transient (not singleton), despite the comment claiming singleton registration.
### Dependencies
**Imports:**
- `DTS.Common` - Provides `TextAttribute`, `ImageAttribute`, `AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, `eAssemblyRegion`.
- `DTS.Common

View File

@@ -0,0 +1,45 @@
---
source_files:
- DataPRO/Modules/ISO/ExtraProperties/Model/ExtraPropertyModel.cs
generated_at: "2026-04-17T16:46:25.727645+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d34798e70a17e682"
---
# ExtraPropertyModel Documentation
## 1. Purpose
This module provides a model class `ExtraPropertyModel` for representing key-value pairs (ISO codes/user codes and their associated channel names) within the UI layer. It implements `IExtraProperty` and provides data binding support through `BasePropertyChanged`, along with a custom paste command infrastructure (`PasteCommandClass`) that handles clipboard text parsing and event publication for multi-field paste operations. This model serves as a bridge between raw property data and WPF UI components.
---
## 2. Public Interface
### `ExtraPropertyModel` Class
**Inherits from:** `DTS.Common.Base.BasePropertyChanged`
**Implements:** `DTS.Common.Interface.ISO.ExtraProperties.IExtraProperty`
#### Constructors
| Signature | Description |
|-----------|-------------|
| `ExtraPropertyModel(IExtraProperty extraProperty)` | Initializes from an existing `IExtraProperty` instance, copying `Key` and `Value`. |
| `ExtraPropertyModel()` | Parameterless constructor. |
| `ExtraPropertyModel(KeyValuePair<string, string> extraProperty)` | Initializes from a key-value pair. |
#### Properties
| Name | Type | Description |
|------|------|-------------|
| `ItemStatus` | `UIItemStatus` | Tracks UI status of the item. Defaults to `UIItemStatus.None`. |
| `Key` | `string` | The code value (ISO code or user code). |
| `Value` | `string` | The name associated with the code (ISO channel name or user channel name). |
| `PasteCommand` | `ICommand` | Command registered for paste operations. |
#### Constants
| Name | Value | Description |
|------|

View File

@@ -0,0 +1,46 @@
---
source_files:
- DataPRO/Modules/ISO/ExtraProperties/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:30:25.826163+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "4b53392d715e3121"
---
# Properties
### Purpose
This module provides a user interface for managing ISO extra properties, which appear to be key-value pairs associated with ISO channel configurations. It is a Prism module that registers a list view and view model for displaying and editing extra properties. The module belongs to the "Prepare" assembly group and targets the "ExtraPropertiesRegion" for UI composition.
### Public Interface
**`ExtraPropertiesModule`** (class)
- `ExtraPropertiesModule(IUnityContainer unityContainer)` - Constructor accepting a Unity container via dependency injection.
- `void Initialize()` - Registers `IExtraPropertiesListViewModel` to `ExtraPropertiesListViewModel` and `IExtraPropertiesListView` to `ExtraPropertiesListView` with the Unity container.
- `void OnInitialized(IContainerProvider containerProvider)` - Empty implementation; no initialization logic executed.
- `void RegisterTypes(IContainerRegistry containerRegistry)` - Calls `Initialize()` to perform type registration.
**`ExtraPropertiesModuleNameAttribute`** (class, inherits `TextAttribute`)
- `ExtraPropertiesModuleNameAttribute()` / `ExtraPropertiesModuleNameAttribute(string s)` - Constructors that set `AssemblyName` to `AssemblyNames.ExtraProperties.ToString()`.
- `string AssemblyName` (property, override) - Returns the assembly name.
- `Type GetAttributeType()` - Returns `typeof(TextAttribute)`.
- `string GetAssemblyName()` - Returns the `AssemblyName` property value.
**`ExtraPropertiesModuleImageAttribute`** (class, inherits `ImageAttribute`)
- `ExtraPropertiesModuleImageAttribute()` / `ExtraPropertiesModuleImageAttribute(string s)` - Constructors that load the assembly image via `AssemblyInfo.GetImage()`.
- `BitmapImage AssemblyImage` (property, override) - Lazy-loads and returns the module's image.
- `string AssemblyName` (property, override) - Returns `AssemblyNames.ExtraProperties.ToString()`.
- `string AssemblyGroup` (property, override) - Returns `eAssemblyGroups.Prepare.ToString()`.
- `eAssemblyRegion AssemblyRegion` (property, override) - Returns `eAssemblyRegion.ExtraPropertiesRegion`.
- `BitmapImage GetAssemblyImage()`, `string GetAssemblyName()`, `string GetAssemblyGroup()`, `eAssemblyRegion GetAssemblyRegion()` - Accessor methods for respective properties.
- `Type GetAttributeType()` - Returns `typeof(ImageAttribute)`.
### Invariants
- The module must be instantiated with a non-null `IUnityContainer` reference.
- `Initialize()` must be called (via `RegisterTypes`) before views/view models can be resolved.
- View and ViewModel registrations are transient (not singleton), despite the comment claiming singleton registration.
### Dependencies
**Imports:**
- `DTS.Common` - Provides `TextAttribute`, `ImageAttribute`, `AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, `eAssemblyRegion`.
- `DTS.Common

View File

@@ -0,0 +1,46 @@
---
source_files:
- DataPRO/Modules/ISO/ExtraProperties/Resources/TranslateExtension.cs
- DataPRO/Modules/ISO/ExtraProperties/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T16:12:22.117936+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "98cd5a2347e82926"
---
# Resources
### Purpose
This module provides localization infrastructure for the ISO ExtraProperties feature. It contains a WPF markup extension for XAML-based string resource lookup and an auto-generated strongly-typed resource class that wraps a `.resx` file containing localized strings for validation messages and UI labels related to key-value property handling.
### Public Interface
**`TranslateExtension` class** (`MarkupExtension`):
- `TranslateExtension(string key)` - Constructor accepting the resource key to look up.
- `object ProvideValue(IServiceProvider serviceProvider)` - Returns the localized string for `_key`, or an error marker if not found.
**`StringResources` class** (internal, auto-generated):
- `static ResourceManager ResourceManager { get; }` - Returns the cached `ResourceManager` instance for the `ExtraProperties.Resources.StringResources` resource bundle.
- `static CultureInfo Culture { get; set; }` - Gets or sets the current UI culture for resource lookups.
- `static string InvalidLine { get; }` - Localized string: "Invalid pasted channel code, line: {0}".
- `static string Key { get; }` - Localized string: "Key".
- `static string NoValueWarning { get; }` - Localized string: "The following keys have no value:".
- `static string RepeatKeyError { get; }` - Localized string: "Keys must be unique. The following repeat:".
- `static string Value { get; }` - Localized string: "Value".
### Invariants
- `TranslateExtension._key` is immutable after construction (readonly field).
- `ProvideValue` always returns a non-null string; it never returns null.
- When `_key` is null or empty, `ProvideValue` returns the constant `"#stringnotfound#"`.
- When the resource key is not found in the resource manager, `ProvideValue` returns `"#stringnotfound# "` concatenated with the key name.
- `StringResources` is marked `internal` and cannot be accessed outside its assembly.
### Dependencies
- **Depends on**: `System`, `System.Windows.Markup` (for `MarkupExtension` and `MarkupExtensionReturnTypeAttribute`), `System.Resources` (for `ResourceManager`), `System.Globalization` (for `CultureInfo`).
- **Depended on by**: Unclear from source alone; presumably XAML files in the ISO ExtraProperties module that use `{x:Static}` or the `TranslateExtension` markup extension.
### Gotchas
- The `NotFound` constant value `"#stringnotfound#"` is hardcoded and duplicated across multiple modules (see DBImportExport/Resources). Changes to this error format would require updates in multiple places.
- The `StringResources` class is auto-generated; manual edits will be lost when the `.resx` file is regenerated.
---

View File

@@ -0,0 +1,58 @@
---
source_files:
- DataPRO/Modules/ISO/ExtraProperties/View/ExtraPropertiesListView.xaml.cs
generated_at: "2026-04-17T16:14:53.590489+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "bd27f211c49da9eb"
---
# View
### Purpose
This module provides a WPF view component (`ExtraPropertiesListView`) for displaying, editing, sorting, and filtering a list of "extra properties" (key-value pairs) in an ISO-related context. It serves as the code-behind for an XAML user control, mediating user interactions (clicks, text changes, selection) to a view model and handling visual tree hit-testing for column header interactions.
### Public Interface
- **`ExtraPropertiesListView()`** (Constructor)
- Initializes the component by calling `InitializeComponent()`.
- **`GridViewColumnHeaderSearchable_OnSearch(object sender, RoutedEventArgs e)`** (private event handler)
- Extracts a search term from `e.OriginalSource` (as string) and a column tag from the sender. Calls `viewModel.Filter(columnTag, searchTerm)` on the `IExtraPropertiesListViewModel` DataContext.
- **`GridViewColumnHeader_OnClick(object sender, RoutedEventArgs e)`** (private event handler)
- Extracts the column tag from the sender or via `Utils.FindChild<GridViewColumnHeaderSearchable>`. Calls `vm?.Sort(columnTag, true)` on the view model.
- **`ExtraPropertyKeyTextBox_KeyDown(object sender, KeyEventArgs e)`** / **`ExtraPropertyValueTextBox_KeyDown(...)`** (private event handlers)
- Casts `DataContext` to `ExtraPropertiesListViewModel` and `e.Source`'s DataContext to `IExtraProperty`. Calls `vm.MarkModified(iep)`.
- **`ExtraPropertyKeyTextBox_TextChanged(object sender, TextChangedEventArgs e)`** / **`ExtraPropertyValueTextBox_TextChanged(...)`** (private event handlers)
- Calls `vm.MarkModified(iep)` and then `vm.Validate(ref notUsed1, ref notUsed2)` with two empty `List<string>` instances.
- **`ExtraProperties_SelectionChanged(object sender, SelectionChangedEventArgs e)`** (private event handler)
- Collects all `IExtraProperty` items from `lv.SelectedItems` into a list and calls `vm.SetSelection(list.ToArray())`.
- **`ExtraPropertiesListView_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)`** (private event handler)
- Performs multiple hit-tests using `VisualTreeHelper.HitTest` and `InputHitTest`. Handles sorting when clicking on `KeyColumnHeader` or `ValueColumnHeader` (or their descendant TextBlocks). Ignores clicks on `ScrollViewer`.
### Invariants
- The `DataContext` must be castable to `IExtraPropertiesListViewModel` for most operations; handlers early-return if not.
- Items in the `ListView` must implement `IExtraProperty` for selection handling.
- The view expects `GridViewColumnHeaderSearchable` controls with `Tag` properties for column identification.
- `KeyColumnHeader` and `ValueColumnHeader` are named XAML elements that must exist.
### Dependencies
- **Depends on:**
- `DTS.Common.Controls` (for `GridViewColumnHeaderSearchable`)
- `DTS.Common.Interface.ISO.ExtraProperties` (`IExtraPropertiesListView`, `IExtraPropertiesListViewModel`, `IExtraProperty`)
- `DTS.Common.Utils` (for `Utils.FindChild<T>`)
- `System.Windows.*` (WPF infrastructure)
- `ExtraProperties.Resources.StringResources` (localized strings for "Key" and "Value")
- **Depended on by:** Unclear from source alone; likely consumed by ISO module views.
### Gotchas
- The `Validate` method is called with two throwaway `List<string>` instances (`notUsed1`, `notUsed2`) that are never examined. The validation results are discarded, which may indicate incomplete error handling or a side-effect-based validation pattern.
- Multiple hit-tests are required in `ExtraPropertiesListView_PreviewMouseLeftButtonUp` due to visual tree complexity (borders, rectangles). This is fragile and may break with template changes.
- The handler casts `DataContext` to the concrete `ExtraPropertiesListViewModel` in text/keydown handlers, but to the interface `IExtraPropertiesListViewModel` elsewhere—inconsistent pattern.
---

View File

@@ -0,0 +1,120 @@
---
source_files:
- DataPRO/Modules/ISO/ExtraProperties/ViewModel/ExtraPropertiesListViewModel.cs
generated_at: "2026-04-17T16:00:24.517111+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b887776733154f74"
---
# ExtraPropertiesListViewModel Documentation
## 1. Purpose
`ExtraPropertiesListViewModel` is a Prism-based ViewModel that manages a collection of key-value pair properties ("Extra Properties") within the DataPRO ISO module. It provides CRUD operations, sorting, filtering, validation, and clipboard support (copy/paste) for extra properties. The class serves as the presentation logic layer between the `IExtraPropertiesListView` and the underlying `IExtraProperty` data model, coordinating changes through Prism's `IEventAggregator` for loose coupling with other system components.
---
## 2. Public Interface
### Constructor
```csharp
public ExtraPropertiesListViewModel(
IExtraPropertiesListView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
Initializes the ViewModel, sets up the View's DataContext, creates interaction requests, and subscribes to `RaiseNotification`, `BusyIndicatorChangeNotification`, and conditionally `TextPastedEvent` events.
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `View` | `IExtraPropertiesListView` | Gets/sets the associated view. |
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for displaying notifications. |
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for displaying confirmations. |
| `Page` | `IDataPROPage` | Gets/sets the associated page context. |
| `Parent` | `object` | Gets/sets the parent object reference. |
| `IsDirty` | `bool` | Indicates whether the data has been modified. |
| `IsBusy` | `bool` | Controls busy indicator state; notifies on change. |
| `IsMenuIncluded` | `bool` | Controls menu inclusion; notifies on change. |
| `IsNavigationIncluded` | `bool` | Controls navigation inclusion; notifies on change. |
| `IsReadOnly` | `bool` | Controls read-only state (FB14098: permission-based editing disable). |
| `AllExtraProperties` | `List<IExtraProperty>` | Complete list of all extra properties. |
| `ExtraProperties` | `ObservableCollection<IExtraProperty>` | Filtered/sorted collection bound to the view. |
| `SelectedProperties` | `IExtraProperty[]` | **Throws `NotImplementedException`**. |
### Methods
```csharp
public void SetPage(IDataPROPage page)
```
Sets the `Page` property.
```csharp
public void SetParent(object parent)
```
Sets the `Parent` property.
```csharp
public void Cleanup()
public Task CleanupAsync()
```
No-op cleanup methods. `CleanupAsync` returns `Task.CompletedTask`.
```csharp
public void Initialize()
public void Initialize(object parameter)
public void Initialize(object parameter, object model)
public Task InitializeAsync()
public Task InitializeAsync(object parameter)
```
No-op initialization methods. Async versions return `Task.CompletedTask`.
```csharp
public void Activated()
```
No-op activation method.
```csharp
public void OnPropertyChanged(string propertyName)
```
Raises `PropertyChanged` event. When `propertyName` is `"ExtraProperties"`, publishes `ExtraPropertiesChangedEvent`.
```csharp
public void Filter(object tag, string term)
```
Filters properties by search term for the specified field tag (`"Key"` or `"Value"`).
```csharp
public void Sort(object columnTag, bool columnClick)
```
Sorts properties by the specified column tag (`"Key"` or `"Value"`). Toggles sort direction on repeated clicks.
```csharp
public bool Validate(ref List<string> errors)
```
Validates properties, adding error messages to the list. Returns `true` if no new errors were added.
```csharp
public void SetExtraProperties(IList<IExtraProperty> properties)
```
Replaces all properties with the provided list, adds an empty row at the end, resets sort to Key/ascending, and applies sort/filter.
```csharp
public void CopySelected()
```
Copies `_selectedItems` to the end of `AllExtraProperties` (before the empty row), re-sorts, filters, and publishes `PageModifiedEvent`.
```csharp
public void DeleteSelected()
```
Removes `_selectedItems` from collections. Ensures an empty row remains at the end. Publishes `PageModifiedEvent`.
### Internal Methods
```csharp
internal void MarkModified(IExtraProperty iep)
```
Adds a

View File

@@ -0,0 +1,41 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/Common/PreviousInstall.cs
generated_at: "2026-04-17T16:11:25.802939+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d28200fca61fff55"
---
# Common
**Purpose:**
This module provides utility logic for Windows Installer custom actions. Its primary role is to interact with the Windows Registry to detect previous installations of the software. It identifies the most recent version installed (that is older than the currently installing version) and determines its installation path, facilitating upgrade or migration scenarios.
**Public Interface:**
* `PreviousInstall` (Static Class)
* `string GetMostRecentlyInstalledSubKeyName(Version installingVersion, out string mostRecentlyInstalledLowerVersion)`: Scans the registry (specifically `HKLM\Software\...Products`) for installed versions of "DataPRO". Returns the subkey name of the most recent version found that is less than `installingVersion`. The `out` parameter returns the version string.
* `string GetMostRecentlyInstalledPath(string mostRecentlyInstalledSubKeyName)`: Given a product subkey name, searches the registry ("Products" and "Components" keys) to find the installation directory path.
* `bool IsGreaterThan(this Version leftString, Version rightString)` (Extension Method): Returns true if `leftString` > `rightString`.
* `bool IsLessThan(this Version leftString, Version rightString)` (Extension Method): Returns true if `leftString` < `rightString`.
**Invariants:**
* Registry paths are read from `Settings.Default` (e.g., `RegistrySoftwareInstalledProducts`, `RegistryDisplayName`).
* The module specifically targets the `RegistryHive.LocalMachine` with `RegistryView.Registry64`.
* `GetMostRecentlyInstalledSubKeyName` only considers versions strictly less than `installingVersion`.
* `GetMostRecentlyInstalledPath` modifies the path string if it contains "DTSSuite", appending the DataPRO folder name.
**Dependencies:**
* **Depends on:**
* `System`
* `Microsoft.Win32`
* `Common.Properties` (for `Settings.Default`)
* `System.Diagnostics` (for `EventLog`)
* **Depended on by:** Installer custom actions (implied by module path).
**Gotchas:**
* **Hardcoded Event Log Source:** The method `GetMostRecentlyInstalledPath` creates an `EventLog` with `Source = "DataPROInstaller"`. If this source does not exist on the target machine, writing to the log may throw a security exception if the installer does not have sufficient privileges or if the source isn't registered beforehand.
* **Magic Strings/Values:** The code checks for `val == "-1"` to indicate missing registry values, which relies on the specific implementation of `GetValue(...).ToString()`.
* **Path Logic:** The logic appending `Settings.Default.RegistryDataPRO + "\\"` when `DTSSuite` is detected assumes a specific directory structure that may break if the suite installation layout changes.
* **Extension Method Scope:** The `IsGreaterThan` and `IsLessThan` extension methods are defined in a static class but are effectively utility methods for `Version` objects used within this class.

View File

@@ -0,0 +1,46 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/Common/Properties/AssemblyInfo.cs
- DataPRO/Modules/InstallerCustomActions/Common/Properties/Settings.Designer.cs
generated_at: "2026-04-17T16:25:38.817230+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ed8c28138f9017aa"
---
# Properties
### Purpose
This module provides assembly metadata and strongly-typed application settings for the `Installer.Common` assembly. It defines registry path constants and key names used for locating installed products, components, and configuration information related to DataPRO installations. These settings support Windows Installer custom actions that query the registry for installation state.
### Public Interface
**`Common.Properties.Settings`** (internal sealed partial class)
- Inherits from `global::System.Configuration.ApplicationSettingsBase`
- `public static Settings Default { get; }` - Returns a synchronized singleton instance.
**Registry Path Settings** (all application-scoped, read-only):
| Property Name | Type | Default Value |
|---------------|------|---------------|
| `RegistrySoftwareInstalledProducts` | `string` | `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products` |
| `RegistryInstallProperties` | `string` | `InstallProperties` |
| `RegistryDisplayName` | `string` | `DisplayName` |
| `RegistryDataPRO` | `string` | `DataPRO` |
| `RegistryDisplayVersion` | `string` | `DisplayVersion` |
| `RegistrySoftwareInstalledComponents` | `string` | `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Components` |
| `RegistryDataPROExeConfig` | `string` | `DataPRO.exe.config` |
| `RegistryInstallLocation` | `string` | `InstallLocation` |
| `DTSSuite` | `string` | `DTS.Suite` |
### Invariants
- All settings are `ApplicationScopedSettingAttribute`, meaning they are read-only at runtime and must be modified via the `.config` file or by regenerating the settings.
- The registry paths target the `S-1-5-18` SID (LOCAL_SYSTEM account), indicating these settings are designed for machine-level installer queries, not per-user installations.
- The `Settings` class is `internal sealed`, restricting access to the `Installer.Common` assembly.
### Dependencies
- **Depends on**: `System.Configuration.ApplicationSettingsBase`, `System.Diagnostics`, `System.Configuration` attributes
- **Depended on by**: Cannot be determined from source alone (likely consumed by custom action classes within Installer.Common)
### Gotchas
- The registry paths hardcode `S-1-5-18` (LOCAL_SYSTEM).

View File

@@ -0,0 +1,145 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/DBConfiguration/MigrationStatus.cs
- DataPRO/Modules/InstallerCustomActions/DBConfiguration/DBConfig.cs
- DataPRO/Modules/InstallerCustomActions/DBConfiguration/CommonUtilities.cs
- DataPRO/Modules/InstallerCustomActions/DBConfiguration/DBTypeChoice.Designer.cs
generated_at: "2026-04-17T15:53:09.999426+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "759c4bea5bfc5343"
---
# DBConfiguration Module Documentation
## 1. Purpose
The DBConfiguration module is a Windows Forms application that serves as a custom action for the DataPRO installer. It provides database configuration and migration capabilities, allowing users to choose between Local, Centralized, or Both database configurations. The module handles SQL Server Express LocalDB instance management (create, start, stop, delete), database attach/detach operations for DataPRO and ISO databases, and supports initializing databases to preset configurations (TSR AIR, Aero, Crash) or migrating data from previous installations.
## 2. Public Interface
### MigrationStatus Class
```csharp
public class MigrationStatus
```
A data class representing migration status information.
**Properties:**
- `StatusTypes StatusType { get; set; }` - The type of status being reported
- `string StatusText { get; set; }` - The status message text
**Nested Enum:**
```csharp
public enum StatusTypes
{
Status,
MigrationStatus,
SourceDb
}
```
---
### DBConfig Class (Static)
```csharp
static class DBConfig
```
The application entry point class.
**Methods:**
- `static void Main(string[] args)` - Entry point that parses command-line arguments and launches either the configuration UI or TSR AIR initialization. Accepts arguments in order: `targetDir`, `productVersion`, `noUI`, `tsrAirGo` (boolean). Supports standalone mode with 0 or 2 arguments.
---
### CommonUtilities Class
```csharp
public class CommonUtilities
```
Core utility class for database operations.
**Constructor:**
- `CommonUtilities()` - Initializes the event log with source "DataPRODbMigratorInstaller"
**Public Methods:**
- `void InitializeDbToTSRAIR(string targetDir)` - Initializes the database to TSR AIR settings. Attaches databases, initializes via `DbOperations.Connection.Initialize()`, then detaches.
- `string Attach(string targetDbDir, string scriptsDir)` - Attaches the previous LocalDB database. Logs and sets migration status before calling `InstallDatabase()`.
- `string InstallDatabase(string dBdir, string dbName, string scriptsDir)` - Creates, starts a new LocalDB instance, and attaches both DataPRO and ISO databases. Sets `DbOperations._usingCentralizedDB = false`, `DbOperations._usingMSSQL = true`, and `DbOperations._usingNTLMAuthentication = true`.
- `string Detach(string sourceDbName, string targetDbDir, string scriptsDir)` - Detaches both the specified source database and ISO database.
- `MigrationStatus SetMigrationStatus(string migrationStatus, bool output = false)` - Sets the current migration status text and returns a `MigrationStatus` instance with `StatusTypes.MigrationStatus`.
- `string ProcessSqlLocalDbCommand(string command)` - Executes a SQL LocalDB command using the highest version of SQL Server Express LocalDB installed.
- `static string AttachOrDetachDatabase(string scriptsDir, string dbName, string sqlDbFileName, string sqlLogFileName, string attachOrDetach)` - Executes a batch file to attach or detach a database using sqlcmd.exe.
- `static void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)` - Event handler for process output, appends to static `sb` StringBuilder.
- `static string SqlCommandProcessor(string sqlLocalDbExeFileName, string command)` - Executes a SQL LocalDB command and returns output/errors.
- `static string BatchCommandProcessor(string batchFileName, string dbName, string sqlDbFileName, string sqlLogFileName, string fullSqlcmdPath)` - Executes a batch file with database parameters and returns output/errors.
**Public Fields:**
- `public static StringBuilder sb` - Static StringBuilder shared across process output handling
---
### DBTypeChoice Class (Windows Form)
```csharp
partial class DBTypeChoice
```
Configuration UI form for selecting database type and initialization options.
**Key UI Controls:**
- `rbLocal`, `rbCentralized`, `rbBoth` - Radio buttons for database type selection
- `rbMigrateLocal`, `rbAero`, `rbCrash`, `rbTSRAIR`, `rbNoneOfTheAbove` - Radio buttons for initialization mode
- `tbDBHostname`, `tbDBName`, `tbDBUser`, `tbDBPassword` - Text fields for centralized database connection
- `cbUseNTLMAuthentication`, `cbShowPassword`, `cbCopyConfig` - Checkbox options
- `tbSourceDB`, `tbDestinationDB` - Text fields for migration paths (conditionally visible)
- `btnOK`, `btnCancel` - Action buttons
## 3. Invariants
- **SQL Server Express LocalDB 2014** is a prerequisite and must be installed unless subsequently uninstalled
- Database name is hardcoded to `"DataPRO"` during TSR AIR Go installation and cannot be changed
- `Settings.Default.LocalDbFolder`, `Settings.Default.ScriptsFolder`, and other Settings values must be properly configured
- The registry path `SOFTWARE\Microsoft\Microsoft SQL Server\LocalDB\InstalledVersions` must exist for LocalDB detection
- Process output handling uses a shared static `StringBuilder` that is cleared before each operation
- The form is displayed as topmost (`TopMost = true`) with no control box (`ControlBox = false`)
## 4. Dependencies
**External Dependencies (from imports):**
- `DTS.Common.Storage` - Provides `ConfigInitializationHelper`
- `DTS.Common.Enums` - Provides `InitializationTypes`
- `DTS.Common.Utilities` - Referenced in namespace
- `DTS.Common.Utils.Database` - Provides `GetODBCToolsPath()`
- `Microsoft.Win32` - Registry access
- `System.Windows.Forms` - UI framework
- `System.Diagnostics` - `EventLog`, `Process` classes
- `System.Runtime.InteropServices` - P/Invoke support
**Internal Dependencies:**
- `DbOperations.Connection` - Used for database connection settings (`DBName`, `Server`, `Initialize()`)
- `DbOperations` - Static fields: `_usingCentralizedDB`, `_usingMSSQL`, `_usingNTLMAuthentication`
- `Settings.Default` - Application settings for paths, instance names, messages
**Native Dependencies:**
- `kernel32.dll` - `GetConsoleWindow()` function
- `user32.dll` - `ShowWindow()` function
## 5. Gotchas
1. **DEBUG mode hardcodes**: When compiled with DEBUG defined, the application uses hardcoded test paths (`D:\DTS\DTS.Suite\4.4.309\DataPRO`) and version strings. The comment instructs developers to enable this via project properties.
2. **Console window visibility**: The application hides/shows the console window via P/Invoke. In standalone mode (0 args), the window briefly flashes; with 2 args, it remains visible; when called from installer (4 args), it's hidden.
3. **Shared static StringBuilder**: The `sb` field is static and shared across `SqlCommandProcessor` and `BatchCommandProcessor`. It's cleared at the start of each call, which could cause issues if multiple operations run concurrently.
4. **Argument parsing fragility**: The `Main` method parses arguments by position (index 0-3) rather than named parameters, making the calling convention brittle.
5. **Registry dependency**: `GetSqlServerLocalDBPath()` returns `string.Empty` if the LocalDB registry keys are not found, which causes `ProcessSqlLocalDbCommand` to return an error message but not throw an exception.
6. **UI element visibility**: Several controls (`lblSourceDB`, `tbSourceDB`, `btnBrowseSourceDB`, `lblDestinationDB`, `tbDestinationDB`, `btnBrowseDestinationDB`) are initialized with `Visible = false` and their visibility logic is not shown in the designer file (likely controlled in the code-behind file `DBTypeChoice.cs` which was not provided).

View File

@@ -0,0 +1,51 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/DBConfiguration/Properties/AssemblyInfo.cs
- DataPRO/Modules/InstallerCustomActions/DBConfiguration/Properties/Resources.Designer.cs
generated_at: "2026-04-17T15:55:04.289329+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "00d236f5c3fe3a52"
---
# Documentation: DBConfiguration Assembly Properties
## 1. Purpose
This module contains assembly-level metadata and auto-generated resource management infrastructure for the `DBConfiguration` component, which is part of the `DataPRO/Modules/InstallerCustomActions` subsystem. It exists to define the identity, version, and COM visibility settings for the DBConfiguration assembly, and to provide strongly-typed access to localized resources. The module serves as a configuration and resource foundation for database-related custom actions during installation processes.
## 2. Public Interface
### Assembly Attributes (AssemblyInfo.cs)
| Attribute | Value |
|-----------|-------|
| `AssemblyTitle` | `"DBConfiguration"` |
| `AssemblyDescription` | `""` (empty) |
| `AssemblyCompany` | `""` (empty) |
| `AssemblyProduct` | `"DBConfiguration"` |
| `AssemblyCopyright` | `"Copyright © 2017"` |
| `AssemblyVersion` | `"1.0.0.0"` |
| `AssemblyFileVersion` | `"1.0.0.0"` |
| `ComVisible` | `false` |
| `Guid` | `"a5087f45-0949-4e27-b367-ccb6556fc68d"` |
### Internal Class: `Resources` (Resources.Designer.cs)
**Namespace:** `DBConfiguration.Properties`
**Access Modifier:** `internal`
| Member | Signature | Description |
|--------|-----------|-------------|
| `ResourceManager` | `internal static global::System.Resources.ResourceManager ResourceManager { get; }` | Returns the cached `ResourceManager` instance for this assembly. Initializes with base name `"DBConfiguration.Properties.Resources"` on first access. |
| `Culture` | `internal static global::System.Globalization.CultureInfo Culture { get; set; }` | Gets or sets the current thread's `CurrentUICulture` for resource lookups. |
| Constructor | `internal Resources()` | Parameterless constructor. Marked with `SuppressMessageAttribute` for `CA1811:AvoidUncalledPrivateCode`. |
**Note:** The `Resources` class is marked `internal` and is not accessible outside the `DBConfiguration` assembly.
## 3. Invariants
- **Auto-generated code constraint:** The `Resources` class in `Resources.Designer.cs` is auto-generated by `System.Resources.Tools.StronglyTypedResourceBuilder` (version 17.0.0.0). Manual modifications will be lost upon regeneration.
- **COM visibility:** All types in this assembly are not visible to COM components (`ComVisible(false)` at assembly level).
- **Resource base name:** The `ResourceManager` is always initialized with the base name

View File

@@ -0,0 +1,49 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/LocalSQLDB/LocalDBPreparation.cs
- DataPRO/Modules/InstallerCustomActions/LocalSQLDB/LocalDBPrepare.cs
generated_at: "2026-04-17T16:45:09.055203+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "23d0d5081a0df6ea"
---
# Documentation: LocalSQLDB Module
## 1. Purpose
This module provides installer custom actions for preparing LocalDB database files during DataPRO installation. It determines whether the application will use a local or centralized database configuration, and if local, copies database files (`.mdf` and `.ldf`) from a previous installation to the new installation directory. This enables database migration during upgrades while preserving existing data.
---
## 2. Public Interface
### `LocalDBPreparation` (Class)
Entry point class invoked by the installer.
**Method: `Main(string[] args)`**
- **Signature:** `static void Main(string[] args)`
- **Behavior:** Parses command-line arguments, creates a `LocalDBPrepare` instance, and invokes `PrepareDB()`. On exception, displays a message box with the error message and rethrows an empty `Exception`.
**Arguments:**
- `args[0]` — Target installation directory path (`targetDir`)
- `args[1]` — Product version string (parsed into `Version`)
---
### `LocalDBPrepare` (Class)
Core logic class for database preparation.
**Constructor: `LocalDBPrepare(string targetDir, Version productVersion)`**
- Initializes the instance with the target directory and installing version.
**Method: `PrepareDB()`**
- **Signature:** `public bool PrepareDB()`
- **Behavior:**
1. Loads configuration from the newly installed executable via `GetNewConfig()`
2. Determines `DbType` from configuration (defaults to `DbType.Local` on parse failure)
3. Returns `false` if `DbType.Centralized`
4. Retrieves `dbName` from configuration (defaults to `Settings.Default.DataPRO`)
5. Returns `true` if `dbName` matches `Settings.Default.DataPRO` (case-insensitive)
6. Otherwise, copies `.mdf` and `.ldf` files from the most recent previous installation to the new location

View File

@@ -0,0 +1,38 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/LocalSQLDB/Properties/AssemblyInfo.cs
- DataPRO/Modules/InstallerCustomActions/LocalSQLDB/Properties/Settings.Designer.cs
generated_at: "2026-04-17T16:13:20.075967+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "1f2e29b6af979ed1"
---
# Properties
### Purpose
This module provides assembly metadata and application-scoped configuration settings for the `LocalSQLDB` custom installer action. It exists to configure file paths, extensions, and registry keys related to local SQL Database deployment for the DataPRO application. The settings support the installer's ability to locate and configure local database files during installation.
### Public Interface
- **`Settings` class** (internal sealed, partial) - Auto-generated settings class inheriting from `System.Configuration.ApplicationSettingsBase`.
- `static Settings Default { get; }` - Returns the synchronized singleton instance of settings.
- `string RegistryDataPROExe { get; }` - Returns `"DataPRO.exe"`. Application-scoped setting.
- `string ApplicationSettings { get; }` - Returns `"applicationSettings"`. Application-scoped setting.
- `string LocalDbFolder { get; }` - Returns `"db"`. Application-scoped setting.
- `string Mdf { get; }` - Returns `".mdf"`. SQL Server primary database file extension. Application-scoped setting.
- `string LogLdf { get; }` - Returns `"_log.ldf"`. SQL Server log file suffix/extension. Application-scoped setting.
- `string DataPRO { get; }` - Returns `"DataPRO"`. Application-scoped setting.
### Invariants
- All settings are application-scoped and read-only at runtime.
- File extension settings (`Mdf`, `LogLdf`) must include the leading dot where appropriate (`.mdf` does, `_log.ldf` includes prefix).
### Dependencies
- **Depends on**: `System.Configuration.ApplicationSettingsBase`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices`.
- **Depended on by**: The parent `LocalSQLDB` installer custom action module (inferred from namespace).
### Gotchas
- The `LogLdf` setting value is `"_log.ldf"` which includes a prefix underscore, not just the extension. This suggests it's meant to be appended to a database name, not just a pure extension.
- The `RegistryDataPROExe` setting name suggests registry usage, but the value is just a filename without a path.
---

View File

@@ -0,0 +1,86 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/MigrateConfiguration/ConfigurationMigration.cs
generated_at: "2026-04-17T16:00:30.279115+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f2a5a0c47cf8f162"
---
# ConfigurationMigration Module Documentation
## 1. Purpose
This module is an installer custom action executable that handles migration of configuration settings and license files from a previously installed version of DataPRO to a newly installed version. It runs during the installation process, locates the most recent prior installation, copies forward user-modified settings (preserving custom values while respecting new defaults), and migrates license files. Its role is to ensure continuity of user configuration across version upgrades.
---
## 2. Public Interface
### `ConfigurationMigration` (static class)
- **Visibility**: `internal static`
- **Namespace**: `MigrateConfiguration`
#### `Main(string[] args)` (entry point)
- **Visibility**: `private static`
- **Signature**: `void Main(string[] args)`
- **Behavior**: Entry point for the custom action. Parses command-line arguments, creates an event log source if needed, orchestrates configuration migration, and displays results via MessageBox unless suppressed.
- **Arguments** (positional, by index):
- `args[0]` - `targetDir`: Installation target directory
- `args[1]` - `productVersion`: Version of DataPRO being installed (parsed as `Version`)
- `args[2]` - `noUI`: Set to `"TRUE"` to suppress MessageBox output
- `args[3]` - `setupExeDir`: Directory containing the setup executable
#### `UpdateConfigurationIfPossible(string targetDir, Version installingVersion, string setupExeDir, out string result)`
- **Visibility**: `public static`
- **Signature**: `void UpdateConfigurationIfPossible(string targetDir, Version installingVersion, string setupExeDir, out string result)`
- **Behavior**: Locates the most recent previously installed version using `PreviousInstall.GetMostRecentlyInstalledSubKeyName`, retrieves its path, and migrates the license file. Sets `result` to describe migration status.
---
## 3. Invariants
1. **Version ordering**: Migration only proceeds if `PreviousInstall.GetMostRecentlyInstalledSubKeyName` returns a non-empty subkey (i.e., a previous version exists that is lower than `installingVersion`).
2. **Settings migration condition**: A setting is migrated only if:
- It exists in both old and new configuration files
- Its value differs between old and new configurations
- For `DownloadFolder` specifically: the old value must NOT equal `StringResources.DataUpOneLevel` (the previous default)
3. **License file identification**: A file is considered a valid DataPRO license if it contains both `"<License>"` and `"<LicenseAttributes>"` substrings.
4. **License search depth**: `FindLicenseInPath` searches up to 2 levels of subdirectories recursively.
5. **Event log source**: The module attempts to create an event log source named `"DataPROInstaller"` under log `"DataPROInstallerLog"` if it does not exist (creation failures are silently ignored).
---
## 4. Dependencies
### This module depends on:
- `MigrateConfiguration.Resources.StringResources` - Localized string constants for settings names, paths, and messages
- `Installer.Common.PreviousInstall` - Provides `GetMostRecentlyInstalledSubKeyName` and `GetMostRecentlyInstalledPath` methods
- `DTS.Common.Utilities.ConfigInitializationHelper` - Provides `GetNewSettings` method
- `DTS.Common.Utilities.SettingElementCollection` - Collection type for configuration settings
- `System.Configuration` - `ConfigurationManager`, `Configuration`, `ClientSettingsSection`, `SettingElement`
- `System.Windows.Forms` - `MessageBox` for UI output
- `System.IO` - File and directory operations
### What depends on this module:
- DataPRO installer (WiX or similar) as a custom action executable
---
## 5. Gotchas
1. **Inconsistent event log source**: In `Main`, the event log source is created as `"DataPROInstaller"`, but in `UpdateConfigurationIfPossible`, the `EventLog.Source` is set to `"MySource"` which appears to be a bug or leftover debug code—the log entry is also commented out.
2. **Extensive commented-out code**: Large blocks of code in `Main` are commented out, including logic for modifying `DownloadFolder`, `ImportArchiveFolder`, and `DTSPlugins` settings. This may represent deprecated functionality or work-in-progress.
3. **Silent exception handling**: The event log source creation in `Main` uses an empty `catch {}` block, silently ignoring any failures (e.g., permission issues).
4. **Hardcoded assumption about registry paths**: `GetOldSettings` constructs the old config path by appending `StringResources.RegistryDataPROExe` to `nextLowerPath`, which assumes the previous installation follows a specific directory structure.
5. **License priority**: `MigrateLicenseFile` prioritizes finding a license in the installer directory (`setupExeDir`'s parent) before falling back to the previous installation's license. If found in the installer, it copies that instead of migrating the old one.
6. **No rollback mechanism**: If migration partially succeeds then fails, there is no rollback of already-written changes to the new configuration file.

View File

@@ -0,0 +1,35 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/MigrateConfiguration/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:15:12.799275+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "6a6224dddd7e7c70"
---
# Properties
### Purpose
This module contains only assembly-level metadata for the `MigrateConfiguration` component. It provides versioning, copyright, and COM visibility settings for the assembly but contains no executable logic or public types.
### Public Interface
No public types or members are defined in this file. This is purely assembly-level attribute configuration:
- `AssemblyTitle`: "MigrateConfiguration"
- `AssemblyVersion`: "1.0.0.0"
- `AssemblyFileVersion`: "1.0.0.0"
- `ComVisible`: `false`
- `Guid`: "c255c030-ef08-4974-8654-969e29ab3b77"
### Invariants
- The assembly version is fixed at 1.0.0.0.
- COM visibility is disabled for all types in this assembly.
### Dependencies
- **Depends on**: `System.Reflection`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices` (for attribute definitions only).
- **Depended by**: Unclear from source alone; the actual `MigrateConfiguration` implementation code is not provided in this module.
### Gotchas
- The `AssemblyDescription` attribute is empty, providing no documentation of the assembly's purpose.
- The actual migration logic is not present in this file; only assembly metadata is defined here.
---

View File

@@ -0,0 +1,52 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/MigrateConfiguration/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T16:00:53.953284+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "01948aae8b98627d"
---
# Documentation: StringResources.Designer.cs
## 1. Purpose
This module is an auto-generated strongly-typed resource class that provides localized string constants for the `MigrateConfiguration` installer custom action. It exists to centralize all user-facing messages, configuration key names, path templates, and status strings used during configuration migration operations when upgrading or installing DataPRO. The resource strings indicate this module handles migration of `DataPRO.exe.config` settings between versions, license file copying, and plugin path configuration updates.
## 2. Public Interface
**Note:** This class is marked `internal`, so it is only accessible within the `MigrateConfiguration` assembly.
### Class: `StringResources` (internal)
Namespace: `MigrateConfiguration.Resources`
| Member | Signature | Description |
|--------|-----------|-------------|
| `ResourceManager` | `internal static global::System.Resources.ResourceManager ResourceManager { get; }` | Returns the cached `ResourceManager` instance for this assembly. Lazily initialized on first access. |
| `Culture` | `internal static global::System.Globalization.CultureInfo Culture { get; set; }` | Gets or sets the current thread's `CurrentUICulture` for resource lookups. |
### Resource String Properties (all `internal static string`, getter only):
| Property Name | Inferred Purpose |
|---------------|------------------|
| `ApplicationSettings` | Returns `"applicationSettings"` - likely an XML element/section name. |
| `ConfigDidNotNeedToBeUpdated` | Status message indicating no config changes were required. |
| `ConfigMigrationStatus` | Label for config migration status reporting. |
| `ConfigWasUpdated` | Format string with placeholder `{0}` for installation version info. |
| `DataPROWin7PropertiesSettings` | Returns `"DataPROWin7.Properties.Settings"` - legacy settings section identifier. |
| `DataUpOneLevel` | Returns `"..\Data"` - relative path to Data directory. |
| `DataUpTwoLevels` | Returns `"..\..\Data"` - relative path to Data directory (two levels up). |
| `DownloadFolder` | Returns `"DownloadFolder"` - configuration key name. |
| `DTSCommonCorePluginLibConfig` | Returns `"DTS.Common.Core.PluginLib.Config"` - configuration section name. |
| `DTSPlugins` | Returns `"DTSPlugins"` - configuration key name. |
| `DTSPluginsNeedsModification` | Warning message about manual config modification required. |
| `DTSViewerModules` | Returns `"DTSViewerModules"` - configuration key name. |
| `FailedToCopyLicense` | Error message for license copy failure. |
| `ImportArchiveFolder` | Returns `"ImportArchiveFolder"` - configuration key name. |
| `ImportArchiveUpTwoLevels` | Returns `"..\..\ImportArchive"` - relative path for import archive. |
| `InstallerLicenseFileFoundCopied` | Success message for license file copy from installer. |
| `KeyNotFound` | Format string with placeholder `{0}` for key name. |
| `NewSettingsCouldNotBeFound` | Warning format string with placeholders `{0}` and `{1}`. |
| `NewSettingsCouldNotBeProcessed` | Warning message for processing failure of new settings. |
| `NoLicenseFound` | Status message when no license exists to copy

View File

@@ -0,0 +1,58 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/OpenFolder/App.xaml.cs
- DataPRO/Modules/InstallerCustomActions/OpenFolder/Folder.cs
- DataPRO/Modules/InstallerCustomActions/OpenFolder/MainWindow.xaml.cs
generated_at: "2026-04-17T16:44:48.655732+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "fe185878ebf66d1c"
---
# Documentation: OpenFolder Module
## 1. Purpose
The `OpenFolder` module is a lightweight utility designed as an installer custom action. Its sole responsibility is to open a specific folder (identified as a "manuals folder") in Windows Explorer during or after an installation process. It serves as a bridge between the installer and the Windows shell, accepting a folder path as a command-line argument and delegating the actual folder opening operation to an external utility class.
---
## 2. Public Interface
### `OpenFolder.App`
- **Kind**: Class (WPF Application)
- **Inherits**: `System.Windows.Application`
- **Signature**: `public partial class App : Application`
- **Description**: Standard WPF application entry point. Contains no custom logic beyond the auto-generated partial class definition.
### `OpenFolder.Folder`
- **Kind**: Class
- **Signature**: `class Folder`
- **Members**:
- `static void Main(string[] args)` — Application entry point. Accepts a command-line argument array, extracts `args[0]` as the folder path, and passes it to `WindowsFolder.OpenManualsFolder()`. All exceptions are caught and silently discarded.
### `OpenFolder.MainWindow`
- **Kind**: Class (WPF Window)
- **Inherits**: `System.Windows.Window`
- **Signature**: `public partial class MainWindow : Window`
- **Description**: Standard WPF window code-behind. Contains only the constructor calling `InitializeComponent()`. **Note**: This window is never instantiated or shown by the `Main` entry point.
---
## 3. Invariants
- **Argument requirement**: The `Main` method assumes `args` contains at least one element. Accessing `args[0]` without validation means the caller must guarantee an argument is provided.
- **Silent failure**: All exceptions thrown during the folder opening operation are caught and suppressed. The application will always exit without propagating errors to the caller.
- **No UI interaction**: Despite being a WPF application with a `MainWindow`, the `Main` method never creates or displays any UI elements.
---
## 4. Dependencies
### This module depends on:
- **`DTS.Common.Classes.WindowsFolders.WindowsFolder`** — External class providing the static method `OpenManualsFolder(string)`. The exact behavior and location of this class is not visible in the provided source.
- **WPF assemblies**: `System.Windows`, `System.Windows.Controls`, `System.Windows.Data`, `System.Windows.Documents`, `System.Windows.Input`, `System.Windows.Media`, `System.Windows.Media.Imaging`, `System.Windows.Navigation`, `System.Windows.Shapes`
- **Standard .NET assemblies**: `System`, `System.Collections.Generic`, `System.Configuration`, `System.Data`, `System.Linq`, `System.Threading.Tasks`
### What depends on this module:
- **Unclear from source alone** — The module appears to be invoked by an installer (suggested

View File

@@ -0,0 +1,41 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/OpenFolder/Properties/Settings.Designer.cs
- DataPRO/Modules/InstallerCustomActions/OpenFolder/Properties/AssemblyInfo.cs
- DataPRO/Modules/InstallerCustomActions/OpenFolder/Properties/Resources.Designer.cs
generated_at: "2026-04-17T16:12:01.658034+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "a01c6cbb539c87e6"
---
# Properties
### Purpose
This module provides the build configuration and resource infrastructure for the `OpenFolder` installer custom action. It exists to support the assembly with application settings and resource management capabilities. The module contains auto-generated designer files for settings and resources, along with assembly metadata, but defines no custom resources of its own.
### Public Interface
**`Settings` class** (internal sealed, partial)
- `static Settings Default { get; }` - Returns the synchronized singleton instance of application settings. Inherits from `global::System.Configuration.ApplicationSettingsBase`.
**`Resources` class** (internal sealed)
- `static ResourceManager ResourceManager { get; }` - Returns the cached `ResourceManager` instance for the `OpenFolder.Properties.Resources` resource bundle.
- `static CultureInfo Culture { get; set; }` - Gets or sets the current thread's `CurrentUICulture` for resource lookups.
### Invariants
- The `Settings` class is a thread-safe singleton via `Synchronized()`.
- The `Resources.ResourceManager` property lazily initializes exactly once.
- All classes in this module are `internal` and not accessible outside the assembly.
- No custom resource strings are defined in `Resources.Designer.cs`; the class provides only infrastructure.
### Dependencies
- **Depends on**: `System.Configuration` (for `ApplicationSettingsBase`), `System.Resources` (for `ResourceManager`), `System.Globalization` (for `CultureInfo`), `System.Windows` (for WPF theme support via `ThemeInfo` attribute).
- **Depended on by**: The parent `OpenFolder` assembly and any code within that assembly requiring access to settings or localized resources.
### Gotchas
- The `Settings.Designer.cs` and `Resources.Designer.cs` files are auto-generated by Visual Studio tools. Manual changes will be overwritten on regeneration.
- The `Resources` class exposes no custom string properties, suggesting either the module doesn't require localization or resources are defined elsewhere.
- The `AssemblyInfo.cs` has an empty `AssemblyDescription` and `AssemblyCompany`, which may need to be populated for production builds.
---

View File

@@ -0,0 +1,71 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/RegAddProductCode/AddProductCode.cs
generated_at: "2026-04-17T16:46:50.881996+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "5cf0f99b67b34e4b"
---
# Documentation: RegAddProductCode Module
## 1. Purpose
This module is a Windows Installer custom action that validates architecture compatibility between the installer and the operating system, then configures Windows Registry settings to add the DataPRO product code to the Secure Repair Whitelist. It exists to prevent mismatched architecture installations (e.g., 32-bit installer on 64-bit OS) and to ensure the Windows Installer service permits DataPRO installation by configuring the `SecureRepairPolicy` and whitelist entries under `HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer`.
---
## 2. Public Interface
### `static int Main(string[] args)`
**Signature:** `static int Main(string[] args)`
**Behavior:** Entry point for the custom action. Accepts a single command-line argument specifying the architecture version (`"x86"` or `"x64"`). Validates that the installer architecture matches the operating system architecture—returns `1` (failure) if mismatched, otherwise proceeds to call `AddCodeToRegistry()` and returns `0` on success. Logs diagnostic information to the Windows Event Log under the source `"DataPROInstaller"`.
**Return Values:**
- `0` — Success (architecture validated, registry updated)
- `1` — Failure (architecture mismatch detected)
---
### `private static string AddCodeToRegistry()`
**Signature:** `private static string AddCodeToRegistry()`
**Behavior:** Configures registry settings required for DataPRO installation. Opens `HKEY_LOCAL_MACHINE` with a 64-bit registry view, sets `SecureRepairPolicy` to `2` (DWORD) under the Installer policies key, and adds the product code GUID to the `SecureRepairWhitelist`. Creates the whitelist key if it does not exist. Returns an empty string on success, or an error message string on exception.
**Note:** This method is private and not part of the public interface.
---
## 3. Invariants
1. **Architecture Argument Requirement:** The first command-line argument (`args[0]`) must be either `"x86"` or `"x64"`. Any other value bypasses architecture validation entirely (no error is thrown for unrecognized values).
2. **Architecture Matching:**
- If `architectureVersion == "x86"` and `Environment.Is64BitOperatingSystem == true`, the process must terminate with return code `1`.
- If `architectureVersion == "x64"` and `Environment.Is64BitOperatingSystem == false`, the process must terminate with return code `1`.
3. **Registry View:** The registry is always accessed using `RegistryView.Registry64`, regardless of process bitness.
4. **Event Log Source:** All log entries are written to the event log source `"DataPROInstaller"`, which must exist or be creatable.
5. **Registry Key Existence:** The key at `Settings.Default.InstallerKey` must exist; if it does not, the method returns early with an error message and does not attempt to create it. The `SecureRepairWhitelistKey` will be created if missing.
---
## 4. Dependencies
### External Dependencies (Imports)
- `System` — Core framework types
- `System.Diagnostics``EventLog` for Windows Event Log integration
- `Microsoft.Win32``RegistryKey`, `RegistryHive`, `RegistryView`, `RegistryValueKind` for registry manipulation
- `System.Windows.Forms``MessageBox` for user-facing error dialogs
- `RegAddProductCode.Properties``Settings` class providing configuration values
### Configuration Dependencies (from `Settings.Default`)
- `Settings.Default.InstallerKey` — Registry path to the Installer policies key
- `Settings.Default.SecureRepairWhitelistKey` — Registry path to the SecureRepairWhitelist key
- `Settings.Default.SecureRepairPolicy` — Name of the secure repair policy value
- `Settings

View File

@@ -0,0 +1,38 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/RegAddProductCode/Properties/AssemblyInfo.cs
- DataPRO/Modules/InstallerCustomActions/RegAddProductCode/Properties/Settings.Designer.cs
generated_at: "2026-04-17T16:13:20.075439+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "250803c72b83ea88"
---
# Properties
### Purpose
This module provides assembly metadata and application-scoped configuration settings for the `RegAddProductCode` custom installer action. It exists to configure Windows Installer policy-related registry operations, specifically for managing secure repair whitelisting. The settings defined here are used during installation to register product codes that allow the application to be repaired without elevated privileges.
### Public Interface
- **`Settings` class** (internal sealed, partial) - Auto-generated settings class inheriting from `System.Configuration.ApplicationSettingsBase`.
- `static Settings Default { get; }` - Returns the synchronized singleton instance of settings.
- `string InstallerKey { get; }` - Returns `"SOFTWARE\\Policies\\Microsoft\\Windows\\Installer"`. Application-scoped setting.
- `string MissingKey { get; }` - Returns `"No key at {0}"`. Format string template for missing key messages. Application-scoped setting.
- `string ProductCode { get; }` - Returns `"{C4889149-0CAF-44C1-B226-8F6E73684DF4}"`. The GUID product code for this product. Application-scoped setting.
- `string SecureRepairPolicy { get; }` - Returns `"SecureRepairPolicy"`. Application-scoped setting.
- `string SecureRepairWhitelistKey { get; }` - Returns `"SOFTWARE\\Policies\\Microsoft\\Windows\\Installer\\SecureRepairWhitelist"`. Application-scoped setting.
### Invariants
- All settings are application-scoped and read-only at runtime.
- The `ProductCode` GUID must be a valid Windows Installer product code format.
- Registry key paths use double backslash escaping for .NET string literals.
### Dependencies
- **Depends on**: `System.Configuration.ApplicationSettingsBase`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices`.
- **Depended on by**: The parent `RegAddProductCode` installer custom action module (inferred from namespace).
### Gotchas
- The `MissingKey` setting contains a format placeholder `{0}` suggesting it's intended for `string.Format()` usage, but the consuming code is not visible in this module.
- The `ProductCode` GUID `{C4889149-0CAF-44C1-B226-8F6E73684DF4}` is hardcoded; if the actual product code changes, this setting must be updated manually.
---

View File

@@ -0,0 +1,36 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/WarnWindows11/WarnWindows11.cs
generated_at: "2026-04-17T16:15:12.796756+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2c9c3764491675e8"
---
# WarnWindows11
### Purpose
This module serves as a Windows Installer custom action that detects whether the target system is running Windows 11 and displays a warning message to the user if detected. It is designed to be executed during installation to inform users of potential compatibility concerns with the Windows 11 operating system.
### Public Interface
- **`OSWarning`** (class)
- `public static void Main(string[] args)` - Entry point for the custom action. Spawns `systeminfo.exe`, captures its output, parses it line-by-line for the string "MICROSOFT WINDOWS 11" (case-insensitive), and displays a message box with the warning resource `Properties.Resources.WARNING_WINDOWS11` if detected. All exceptions are silently caught and ignored.
### Invariants
- The process `systeminfo.exe` must be available on the target system PATH.
- The resource string `Properties.Resources.WARNING_WINDOWS11` must be defined in the project's resource file.
- The method always completes without throwing exceptions to the caller (all exceptions are caught and swallowed).
### Dependencies
- **Depends on**: `System`, `System.Diagnostics`, `System.Windows` (for `MessageBox`), and project resources (`Properties.Resources`).
- **Depends on external executable**: `systeminfo.exe` (Windows system utility).
- **Depended by**: Unclear from source alone; likely invoked by an MSI installer or setup executable as a custom action.
### Gotchas
- **Silent failure**: The `catch (Exception) { }` block swallows all exceptions without logging, meaning any failure (missing `systeminfo.exe`, permission issues, resource loading errors) will fail silently.
- **Synchronous blocking**: `reader.ReadToEnd()` and `process.WaitForExit()` block the calling thread; this could cause installer UI freezes if run on the UI thread.
- **Fragile detection logic**: Detection relies on exact string matching of `systeminfo.exe` output format ("MICROSOFT WINDOWS 11"), which could break if Microsoft changes the output format.
- **No exit code handling**: The process exit code is not checked; `systeminfo.exe` could fail and the code would not detect it.
---

View File

@@ -0,0 +1,42 @@
---
source_files:
- DataPRO/Modules/InstallerCustomActions/WarnWindows11/Properties/Settings.Designer.cs
- DataPRO/Modules/InstallerCustomActions/WarnWindows11/Properties/AssemblyInfo.cs
- DataPRO/Modules/InstallerCustomActions/WarnWindows11/Properties/Resources.Designer.cs
generated_at: "2026-04-17T16:12:01.654860+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "644d433cfac6866f"
---
# Properties
### Purpose
This module provides the build configuration and localized resources for the `WarnWindows11` installer custom action. It exists to surface a Windows 11 compatibility warning to users during installation, specifically regarding Microsoft SQL Server installation requirements on Windows 11. The module contains auto-generated designer files for application settings and resources, along with assembly metadata.
### Public Interface
**`Settings` class** (internal sealed, partial)
- `static Settings Default { get; }` - Returns the synchronized singleton instance of application settings. Inherits from `global::System.Configuration.ApplicationSettingsBase`.
**`Resources` class** (internal sealed)
- `static ResourceManager ResourceManager { get; }` - Returns the cached `ResourceManager` instance for the `WarnWindows11.Properties.Resources` resource bundle.
- `static CultureInfo Culture { get; set; }` - Gets or sets the current thread's `CurrentUICulture` for resource lookups.
- `static string WARNING_WINDOWS11 { get; }` - Returns the localized warning message about SQL Server installation on Windows 11, referencing a Microsoft troubleshooting URL for 4KB disk sector size issues.
### Invariants
- The `Settings` class is a thread-safe singleton via `Synchronized()`.
- The `Resources.ResourceManager` property lazily initializes exactly once.
- The `WARNING_WINDOWS11` resource string must exist in the corresponding `.resx` file; otherwise, the property will return `null`.
- All classes in this module are `internal` and not accessible outside the assembly.
### Dependencies
- **Depends on**: `System.Configuration` (for `ApplicationSettingsBase`), `System.Resources` (for `ResourceManager`), `System.Globalization` (for `CultureInfo`), `System.Windows` (for WPF theme support via `ThemeInfo` attribute).
- **Depended on by**: The parent `WarnWindows11` assembly and any code within that assembly requiring access to settings or localized resources.
### Gotchas
- The `Settings.Designer.cs` and `Resources.Designer.cs` files are auto-generated by Visual Studio tools (`SettingsSingleFileGenerator` and `StronglyTypedResourceBuilder`). Manual changes will be overwritten on regeneration.
- The `WARNING_WINDOWS11` string contains a hardcoded Microsoft Learn URL; changes to the URL or documentation location would require updating the `.resx` file.
- The `AssemblyInfo.cs` has an empty `AssemblyDescription` and `AssemblyCompany`, which may need to be populated for production builds.
---

View File

@@ -0,0 +1,38 @@
---
source_files:
- DataPRO/Modules/Menu/HamburgerMenu/HamburgerMenuModule.cs
generated_at: "2026-04-17T16:47:06.193165+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "1307b5881a344ee2"
---
# HamburgerMenuModule Documentation
## 1. Purpose
This module provides a Prism-based "Hamburger Menu" navigation component for the DataPRO application. It exists to register the hamburger menu's view and view-model with the Unity dependency injection container as singletons, and to expose assembly metadata (name, image, group, region) via custom attributes. The module is categorized under the "Prepare" assembly group and targets the `HamburgerMenuRegion` for UI composition.
---
## 2. Public Interface
### `HamburgerMenuModule` (Class)
Implements `Prism.Modularity.IModule`. The primary module entry point for hamburger menu registration.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `HamburgerMenuModule(IUnityContainer unityContainer)` | Accepts a Unity container via dependency injection and stores it in `_unityContainer`. |
| `Initialize` | `void Initialize()` | Registers `IHamburgerMenuView``HamburgerMenuView` and `IHamburgerMenuViewModel``HamburgerMenuViewModel` as singleton types using `ContainerControlledLifetimeManager`. |
| `OnInitialized` | `void OnInitialized(IContainerProvider containerProvider)` | Empty implementation; no post-initialization logic. |
| `RegisterTypes` | `void RegisterTypes(IContainerRegistry containerRegistry)` | Delegates to `Initialize()` to perform type registration. |
### `HamburgerMenuModuleNameAttribute` (Class)
Extends `TextAttribute`. Applied at assembly level to expose the module's name.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `HamburgerMenuModuleNameAttribute()` | Default constructor; delegates to `this(null)`. |
| Constructor | `HamburgerMenuModuleNameAttribute(string s)` | Initializes `AssemblyName` to `AssemblyNames.HamburgerMenu.ToString()`. Parameter `s` is unused. |
| `AssemblyName` | `override string AssemblyName { get; }` | Returns `"HamburgerMenu"` (via enum conversion). |
| `GetAttribute

View File

@@ -0,0 +1,37 @@
---
source_files:
- DataPRO/Modules/Menu/HamburgerMenu/Model/MenuCommand.cs
generated_at: "2026-04-17T16:15:25.512508+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c31776c3db4a4afd"
---
# Model
### Purpose
This module provides the `MenuCommand` class, a simple `ICommand` implementation designed to handle hamburger menu item execution. It serves as a bridge between WPF's command binding system and the application's menu handling logic by invoking a delegate when a menu item is pressed, passing along the menu item's identifier.
### Public Interface
**`MenuCommand` class** - Implements `System.Windows.Input.ICommand`
- **`MenuCommand(string id, MenuItemPressedDelegate menuItemPressed)`** - Constructor. Takes a unique identifier for the menu item and a delegate to invoke upon execution.
- **`bool CanExecute(object parameter)`** - Always returns `true`. The command is always executable.
- **`void Execute(object parameter)`** - Invokes the `MenuItemPressed` delegate with the stored `Id`.
- **`event EventHandler CanExecuteChanged`** - Standard `ICommand` event. Never raised in this implementation.
### Invariants
- `CanExecute` will always return `true` regardless of the parameter value.
- `Id` and `MenuItemPressed` are set at construction and cannot be changed (readonly).
- `MenuItemPressed` delegate must be provided at construction time (no null check visible in source).
### Dependencies
- **Depends on**: `DTS.Common.Interface.Menu.HamburgerMenu` (for `MenuItemPressedDelegate`)
- **Depends on**: `System.Windows.Input` (for `ICommand` interface)
### Gotchas
- The `CanExecuteChanged` event is declared but never invoked, meaning subscribers will never be notified of state changes. This is acceptable given `CanExecute` always returns `true`.
- No null validation on constructor parameters. Passing a null `menuItemPressed` delegate will cause a runtime exception when `Execute` is called.
---

Some files were not shown because too many files have changed in this diff Show More