131 lines
12 KiB
Markdown
131 lines
12 KiB
Markdown
---
|
||
source_files:
|
||
- Common/DTS.Common.ISO/Strings/StringResources.Designer.cs
|
||
generated_at: "2026-04-16T03:29:29.164879+00:00"
|
||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||
schema_version: 1
|
||
sha256: "f14833e08b2b143d"
|
||
---
|
||
|
||
# Documentation: `ISO.Strings.StringResources`
|
||
|
||
## 1. Purpose
|
||
|
||
This module provides a strongly-typed, auto-generated resource class (`StringResources`) for centralized retrieval of localized UI strings used throughout the ISO (likely *SLICE* or *DAS* — Device Access System) application suite. Its primary role is to decouple user-facing messages—particularly validation and device-detection error messages—from business logic—by storing them externally in `.resx` files and exposing them via compile-time-safe properties. This enables localization (e.g., multi-language support) and improves maintainability by avoiding hardcoded string literals.
|
||
|
||
## 2. Public Interface
|
||
|
||
The class is `internal`, but its members are used internally by the assembly. All members are static and accessed via property getters.
|
||
|
||
### `StringResources.ResourceManager` (property)
|
||
- **Type**: `System.Resources.ResourceManager`
|
||
- **Behavior**: Returns a cached `ResourceManager` instance initialized for the `"ISO.Strings.StringResources"` base name in the current assembly. Lazily initializes on first access.
|
||
|
||
### `StringResources.Culture` (property)
|
||
- **Type**: `System.Globalization.CultureInfo`
|
||
- **Behavior**: Gets or sets the UI culture override for all resource lookups via this class. Allows runtime switching of language (e.g., for testing or user preference).
|
||
|
||
### Device Serial Number Validation & Detection Messages
|
||
The following properties return localized strings used during device auto-detection (e.g., validating serial number prefixes). Each corresponds to a specific device type or validation rule:
|
||
|
||
| Property Name | Example Message Content | Purpose |
|
||
|---------------|-------------------------|---------|
|
||
| `AutoDetectDas_DIMShouldStartWithSPD` | `"SLICE PRO DIM serial numbers should start with 'SPD'."` | Validation error for DIM devices |
|
||
| `AutoDetectDas_DIRShouldStartWithDI` | `"DIR serial numbers should start with 'DI'."` | DIR device validation |
|
||
| `AutoDetectDas_DKRShouldStartWithDK` | `"DKR serial numbers should start with 'DK'."` | DKR device validation |
|
||
| `AutoDetectDas_G5ShouldStartWith5M` | `"TDAS G5 serial numbers should start with '5M'."` | TDAS G5 validation |
|
||
| `AutoDetectDAS_MICROBasePlusShouldStartWithBA0` | `"SLICE MICRO Base+ serial numbers should start with 'BA0'."` | MICRO Base+ validation |
|
||
| `AutoDetectDas_MicroSerialNumberShouldStartWithBA0` | `"SLICE MICRO serial numbers should start with 'BA0'."` | Standard MICRO validation |
|
||
| `AutoDetectDAS_NANOBasePlusShouldStartWithBA5` | `"SLICE NANO Base+ serial numbers should start with 'BA5'."` | NANO Base+ validation |
|
||
| `AutoDetectDas_PowerProShouldStartWithPPRO` | `"PowerPRO serial numbers should start with 'PPRO'."` | PowerPRO validation |
|
||
| `AutoDetectDas_SIMShouldStartWithSPS` | `"SLICE PRO SIM serial numbers should start with 'SPS'."` | SIM device validation |
|
||
| `AutoDetectDAS_SLDShouldStartWithSLD` | `"SLICE PRO Lab DIM serial numbers should start with 'SLD'."` | Lab DIM validation |
|
||
| `AutoDetectDAS_SliceECM` | `"SLICE PRO Ethernet Control Module serial numbers should start with 'SPE'."` | ECM validation |
|
||
| `AutoDetectDas_SliceG5ShouldStartWithSG5` | `"SLICE G5 serial numbers should start with 'SG5'."` | SLICE G5 validation |
|
||
| `AutoDetectDAS_SliceLabEthernetShouldStartWithSLE` | `"SLICE Lab Ethernet serial numbers should start with 'SLE'."` | Lab Ethernet validation |
|
||
| `AutoDetectDas_SLICENanoShouldStartWithBA5` | `"SLICE NANO serial numbers should start with 'BA5'."` | Standard NANO validation |
|
||
| `AutoDetectDAS_SLICEPRODBShouldStartWithSPDB` | `"SLICE PRO Distributor serial numbers should start with 'SPDB'."` | PRO Distributor validation |
|
||
| `AutoDetectDas_SliceSPM` | `"SLICE Mini Distributor serial numbers should start with 'SPM'."` | Mini Distributor validation |
|
||
| `AutoDetectDAS_SLSShouldStartWithSLS` | `"SLICE PRO Lab SIM serial numbers should start with 'SLS'."` | Lab SIM validation |
|
||
| `AutoDetectDAS_SLTShouldStartWithSLT` | `"SLICE PRO Lab TOM serial numbers should start with 'SLT'."` | Lab TOM validation |
|
||
| `AutoDetectDAS_TDASLabRackShouldStartWith` | `"TDAS PRO lab rack serial numbers should start with 'LR'."` | Lab rack validation |
|
||
| `AutoDetectDas_TDASRackShouldStartWith` | `"TDAS PRO rack serial numbers should start with 'DR'."` | Rack validation |
|
||
| `AutoDetectDas_TOMShouldStartWithSPT` | `"SLICE PRO TOM serial numbers should start with 'SPT'."` | TOM validation |
|
||
| `AutoDetectDas_TSRAIRShouldStartWithTA` | `"TSR AIR serial numbers should start with 'TA'."` | TSR AIR validation |
|
||
| `AutoDetectDas_SLICE6AIRBRShouldStartWith` | `"SLICE 6 AIR-BR serial numbers should start with 'S6BR'."` | SLICE 6 AIR-BR validation |
|
||
| `AutoDetectDas_SLICE6AIRShouldStartWith` | `"SLICE 6 AIR serial numbers should start with 'S6A'."` | SLICE 6 AIR validation |
|
||
| `AutoDetectDas_SLICE6DB3ShouldStartWith` | `"SLICE 6 distributor 3 serial numbers should start with S6DB3."` | SLICE 6 DB3 validation |
|
||
| `AutoDetectDas_Slice6DBShouldStartWithS6DB` | `"SLICE 6 distributor serial numbers should start with 'S6DB'."` | SLICE 6 Distributor validation |
|
||
| `AutoDetectDas_SLICE6ShouldStartWith` | `"SLICE 6 serial numbers should start with 'SL6'."` | SLICE 6 validation |
|
||
| `AutoDetectDas_SliceDBShouldStartWithSDB` | `"SLICE distributor serial numbers should start with 'SD'."` | Distributor validation |
|
||
| `AutoDetectDas_TypeShouldStartWithPrepend` | `"{0} serial numbers should start with '{1}'."` | Generic template for prefix validation messages (e.g., `string.Format(..., "SLICE PRO", "SPD")`) |
|
||
|
||
### Device Type Identification Messages
|
||
These properties return messages indicating which device type a given serial number was detected as:
|
||
|
||
| Property Name | Example Message Content | Purpose |
|
||
|---------------|-------------------------|---------|
|
||
| `AutoDetectDAS_SerialNumberBelongsToAG5` | `"Serial number belongs to a TDAS G5."` | TDAS G5 detection |
|
||
| `AutoDetectDAS_SerialNumberBelongsToAMicro` | `"Serial number belongs to a SLICE MICRO."` | SLICE MICRO detection |
|
||
| `AutoDetectDas_SerialNumberBelongsToANano` | `"Serial number belongs to a SLICE NANO."` | SLICE NANO detection |
|
||
| `AutoDetectDAS_SerialNumberBelongsToAPowerPRO` | `"Serial number belongs to a PowerPRO Battery."` | PowerPRO detection |
|
||
| `AutoDetectDas_SerialNumberBelongsToASLICEG5` | `"Serial number belongs to a SLICE G5."` | SLICE G5 detection |
|
||
| `AutoDetectDAS_SerialNumberBelongsToASLICEPROLabSIM` | `"Serial number belongs to a SLICE PRO Lab SIM."` | Lab SIM detection |
|
||
| `AutoDetectDAS_SerialNumberBelongsToASlicePROLabSLE` | `"Serial number belongs to a SLICE Lab Ethernet."` | Lab Ethernet detection |
|
||
| `AutoDetectDas_SerialNumberBelongsToASLICEProSim` | `"Serial number belongs to a SLICE PRO SIM."` | PRO SIM detection |
|
||
| `AutoDetectDAS_SerialNumberBelongsToATDASLabRack` | `"Serial number belongs to a TDAS PRO Lab rack."` | Lab rack detection |
|
||
| `AutoDetectDas_SerialNumberBelongsToATDASRack` | `"Serial number belongs to a TDAS PRO rack."` | Rack detection |
|
||
| `AutoDetectDAS_SLICE_SerialNumberBelongsToASLICELABDIM` | `"Serial number belongs to a SLICE PRO Lab DIM."` | Lab DIM detection |
|
||
| `AutoDetectDAS_SLICE_SerialNumberBelongsToASLICELABTOM` | `"Serial number belongs to a SLICE PRO Lab TOM."` | Lab TOM detection |
|
||
| `AutoDetectDas_SLICE_SerialNumberBelongsToASLICEProDIM` | `"Serial number belongs to a SLICE PRO DIM."` | PRO DIM detection |
|
||
|
||
### Required Field Validation Messages
|
||
|
||
| Property Name | Example Message Content | Purpose |
|
||
|---------------|-------------------------|---------|
|
||
| `AutoDetectDAS_IPAddressRequired` | `"IP address required."` | IP address field validation |
|
||
| `AutoDetectDAS_SerialNumberRequired` | `"Serial number required."` | Serial number field validation |
|
||
|
||
### Commit/Validation Failure Messages for Metadata Entities
|
||
|
||
| Property Name | Example Message Content | Purpose |
|
||
|---------------|-------------------------|---------|
|
||
| `CustomerDetails_FailedToCommit` | `"Failed to commit CustomerDetails."` | Error for saving customer metadata |
|
||
| `CustomerDetails_NullReferenceName` | `"CustomerDetail: Required name is null."` | Null-name validation for customer |
|
||
| `LabDetails_FailedToCommit` | `"Failed to commit LabDetails."` | Error for saving lab metadata |
|
||
| `LabDetails_NullReferenceName` | `"LabDetail: Required name is null."` | Null-name validation for lab |
|
||
| `TestEngineerDetails_FailedToCommit` | `"Failed to commit TestEngineerDetails."` | Error for saving test engineer metadata |
|
||
| `TestEngineerDetails_NullReferenceName` | `"TestEngineerDetail: Required name is null."` | Null-name validation for test engineer |
|
||
|
||
> **Note**: All message properties are read-only; they only expose string values via `ResourceManager.GetString(...)`. No methods or constructors are public.
|
||
|
||
## 3. Invariants
|
||
|
||
- **Thread-safety**: The `ResourceManager` instance is lazily initialized and stored in a static field. While the getter checks for `null`, there is no explicit locking—reliance is on .NET’s `ResourceManager` thread-safety guarantees (which are documented as safe for concurrent reads, but not guaranteed for concurrent *initialization* in older frameworks; however, the code uses `object.ReferenceEquals` and does not reassign after initialization, so it is effectively safe for read-only use).
|
||
- **Localization scope**: All strings are retrieved using the current `Culture` (if set) or the current UI culture. No fallback logic is implemented in this class—it delegates entirely to `ResourceManager`.
|
||
- **No mutation**: The class itself is immutable at runtime. String values are retrieved on-demand from the underlying resource store and not cached per-property (only the `ResourceManager` is cached).
|
||
- **Auto-generation constraint**: As indicated by the `<auto-generated>` header, manual edits to this file will be overwritten. All string keys and properties are derived from the corresponding `.resx` file.
|
||
|
||
## 4. Dependencies
|
||
|
||
### This module depends on:
|
||
- `System.Resources.ResourceManager` (mscorlib)
|
||
- `System.Globalization.CultureInfo` (mscorlib)
|
||
- `System.CodeDom.Compiler`, `System.Diagnostics`, `System.Runtime.CompilerServices`, `System.ComponentModel` (various core assemblies)
|
||
|
||
### This module is depended upon by:
|
||
- Any code in the `ISO` namespace (or referencing this assembly) that needs localized strings—especially UI layers (e.g., WPF/WinForms), validation logic, or device detection routines.
|
||
- Likely consumers include:
|
||
- Device auto-detection modules (e.g., `AutoDetectDAS` logic)
|
||
- Forms or view models that display error messages (e.g., `CustomerDetails`, `LabDetails`, `TestEngineerDetails` classes)
|
||
- Validation utilities that check serial number prefixes or required fields
|
||
|
||
## 5. Gotchas
|
||
|
||
- **No runtime error handling**: If a resource key is missing from the `.resx` file, `ResourceManager.GetString(...)` returns `null`. Callers must handle or guard against null returns (not visible in this file).
|
||
- **Culture override is global**: Setting `StringResources.Culture` affects *all* subsequent lookups in the AppDomain via this class—potentially causing race conditions in multi-threaded UI scenarios if not synchronized.
|
||
- **Hardcoded key names**: The property names (e.g., `AutoDetectDas_DIMShouldStartWithSPD`) are tightly coupled to the `.resx` key names. Renaming keys in the `.resx` without regenerating this file will break consumers.
|
||
- **No localization for generic template**: While `AutoDetectDas_TypeShouldStartWithPrepend` is a format string (`"{0} serial numbers should start with '{1}'."`), callers must manually apply `string.Format`—the class does not provide a helper method for this.
|
||
- **No documentation of `.resx` file location or build process**: The source `.resx` file(s) are not included here, so the full set of keys and their current values (beyond what’s exposed in properties) cannot be verified from this file alone.
|
||
|
||
None identified beyond the above. |