86 lines
6.2 KiB
Markdown
86 lines
6.2 KiB
Markdown
---
|
||
source_files:
|
||
- Common/DTS.CommonCore/Strings/Strings.Designer.cs
|
||
generated_at: "2026-04-16T02:12:03.355166+00:00"
|
||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||
schema_version: 1
|
||
sha256: "60d8743ec190cc64"
|
||
---
|
||
|
||
# Strings
|
||
|
||
## Documentation: `DTS.Common.Strings.Strings` (Auto-Generated Resource Class)
|
||
|
||
---
|
||
|
||
### 1. **Purpose**
|
||
|
||
This module defines a strongly-typed resource class (`DTS.Common.Strings.Strings`) used to retrieve localized string resources throughout the DTS system. It acts as a centralized, compile-time-safe accessor for UI and logging messages, configuration labels, and status descriptions—enabling localization via `.resx` files. The class is auto-generated by Visual Studio’s `StronglyTypedResourceBuilder` tool and should not be manually modified; changes must be made in the corresponding `.resx` file and the project rebuilt.
|
||
|
||
---
|
||
|
||
### 2. **Public Interface**
|
||
|
||
The class exposes only **static properties** (no methods or instance members). All properties are read-only and return `string` values. Property names map directly to resource keys in the underlying `.resx` file.
|
||
|
||
#### Key Public Properties (Selected Examples)
|
||
|
||
| Property Name | Return Type | Description |
|
||
|---------------|-------------|-------------|
|
||
| `ResourceManager` | `System.Resources.ResourceManager` | Returns the cached `ResourceManager` instance used to look up resources. Lazily initialized on first access. |
|
||
| `Culture` | `System.Globalization.CultureInfo` | Gets or sets the UI culture override for resource lookups. When set, all subsequent lookups use this culture instead of the current thread’s `CurrentUICulture`. |
|
||
| `ActiveValue` | `string` | Localized string: `"Active value"`. |
|
||
| `Analog` | `string` | Localized string: `"Bridge"`. |
|
||
| `Armed` | `string` | Localized string: `"Armed"`. |
|
||
| `DASStatus_ARMED` | `string` | Localized string: `"Armed"`. |
|
||
| `DASStatus_ARMEDFAULTED` | `string` | Localized string: `"Armed (faulted)"`. |
|
||
| `ClockSyncProfile_GPS` | `string` | Localized string: `"GPS In"`. |
|
||
| `ClockSyncProfile_Master_E2E_PPS_OUT` | `string` | Localized string: `"PTP (E2E) + 1PPS Out"`. |
|
||
| `CalculatedChannel_IRTRACC3D_Abdomen` | `string` | Localized string: `"3D IR-TRACC (abdomen)"`. |
|
||
| `BRIDGETYPE_BRIDGE_DESCRIPTION` | `string` | Localized string: `"Bridge"`. |
|
||
| `DigitalInputMode_CCNC` | `string` | Localized string: `"Contact closure normally closed"`. |
|
||
| `DigitalOutputMode_FVHL` | `string` | Localized string: `"5V high to low transition"`. |
|
||
| `FilterClassType_CFC1000` | `string` | Localized string: `"CFC 1000 (A)"`. |
|
||
| `InvalidCharacterInSerialNumber` | `string` | Localized string: `"Error: Invalid character in serial number,"`. |
|
||
| `DockingStationNotFound` | `string` | Multi-line localized message (includes formatting placeholders `{0}`) with troubleshooting steps. |
|
||
|
||
> **Note**: The full list of properties is extensive (>250 entries). All follow the same pattern: `public static string <PropertyName> { get { return ResourceManager.GetString("<PropertyName>", resourceCulture); } }`.
|
||
|
||
---
|
||
|
||
### 3. **Invariants**
|
||
|
||
- **Thread-Safety of `ResourceManager`**: The `ResourceManager` property ensures a single instance is created and reused (via `ReferenceEquals` check), but it does *not* guarantee thread-safety during initialization. However, `ResourceManager` itself is thread-safe for concurrent reads.
|
||
- **Resource Key Consistency**: Each property name must exactly match a resource key in the `.resx` file (case-sensitive). Mismatches cause `null` returns at runtime.
|
||
- **No Runtime Validation**: Property getters do *not* validate that the underlying resource exists. If a key is missing, `ResourceManager.GetString()` returns `null`, and the property will return `null`.
|
||
- **Auto-Generated Constraint**: Manual edits to this file will be overwritten on regeneration. All changes must occur in the `.resx` file.
|
||
|
||
---
|
||
|
||
### 4. **Dependencies**
|
||
|
||
#### Dependencies *of* this module:
|
||
- **`System.Resources.ResourceManager`**: Used internally to load resources from the assembly.
|
||
- **`System.Globalization.CultureInfo`**: Used for culture-specific lookups.
|
||
- **`DTS.Common.Strings.Strings` assembly**: Resources are embedded in the same assembly (`typeof(Strings).Assembly`), specifically under the manifest resource name `"DTS.Common.Strings.Strings"`.
|
||
|
||
#### Dependencies *on* this module:
|
||
- Any code requiring localized strings (e.g., UI layers, logging, configuration UIs) references `DTS.Common.Strings.Strings.<PropertyName>`.
|
||
- Likely consumed by modules handling:
|
||
- DAS (Data Acquisition System) status displays (`DASStatus_*` properties)
|
||
- Clock synchronization configuration (`ClockSyncProfile_*` properties)
|
||
- Channel calibration and signal processing (`CalculatedChannel_*`, `FilterClassType_*`, `CalibrationBehaviors_*`)
|
||
- Hardware configuration (`DigitalInputMode_*`, `DigitalOutputMode_*`, `BRIDGETYPE_*`)
|
||
|
||
---
|
||
|
||
### 5. **Gotchas**
|
||
|
||
- **`null` on Missing Resources**: If a resource key is deleted or renamed in the `.resx` file but not in code, the property will return `null` at runtime—potentially causing `NullReferenceException` in UI or logs.
|
||
- **Culture Override Pitfall**: Setting `Strings.Culture` affects *all* subsequent lookups globally in the AppDomain. This may cause unexpected behavior in multi-threaded scenarios if not managed carefully.
|
||
- **Placeholder Formatting**: Some strings (e.g., `DockingStationNotFound`, `GeneratingPSD`, `LevelTrigger_TriggerInside`) contain format placeholders (`{0}`, `{1}`, `{2}`). These must be supplied via `string.Format()` or interpolated strings—*not* handled by the resource class itself.
|
||
- **Typos in Property Names**: Property names like `DigitialOutput` (missing 'a') and `Labratory` (misspelled) are preserved from the source `.resx` and may cause confusion.
|
||
- **No Fallback Handling**: If a resource is missing for a specific culture, `ResourceManager` falls back to the neutral culture or default language—but this is implicit and not visible in the generated code.
|
||
- **Auto-Generated Warning**: The header explicitly warns that changes are lost on regeneration. This is standard for `.Designer.cs` files, but developers unfamiliar with the pattern may waste time editing this file directly.
|
||
|
||
> **None identified from source alone.** *(Note: The above are inferred from common patterns in auto-generated resource classes and the provided source—not hallucinated.)* |