init
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Licensing/Enums/DataProLicensingEnums.cs
|
||||
generated_at: "2026-04-16T03:29:49.432908+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "94783647b326bc4a"
|
||||
---
|
||||
|
||||
# Enums
|
||||
|
||||
## 1. Purpose
|
||||
This module defines core licensing-related enumerations used throughout the DataPro system. Specifically, it declares the `LicenseType` enum, which categorizes different software license tiers available in the product. Its role is to provide a standardized, type-safe representation of license types across licensing validation, feature gating, and configuration logic in the broader codebase.
|
||||
|
||||
## 2. Public Interface
|
||||
The only public type exposed is the `LicenseType` enum, nested inside the `DataProLicensingEnums` class.
|
||||
|
||||
- **`DataProLicensingEnums.LicenseType`**
|
||||
- **Definition**: `public enum LicenseType`
|
||||
- **Values**:
|
||||
- `Standard = 0`
|
||||
- `Enterprise = 1`
|
||||
- `EnterpriseSite = 2`
|
||||
- `TSRAir = 3`
|
||||
- `StandardSite = 4`
|
||||
- **Behavior**: Represents discrete license tiers. Values are explicitly assigned integer constants (0–4). The `StandardSite` value was added in response to feature request FB 30628.
|
||||
|
||||
## 3. Invariants
|
||||
- The `LicenseType` enum contains exactly five defined values; no others are declared in this file.
|
||||
- Each enum value maps to a unique underlying integer (0 through 4), with no duplicates.
|
||||
- The enum is *not* marked with `[Flags]`, implying values are mutually exclusive and not combinable via bitwise operations.
|
||||
- The enum is declared as `public`, but the containing class `DataProLicensingEnums` is also `public` and non-static—however, it serves only as a namespace-like container for the enum (a common C# pattern for grouping related enums).
|
||||
|
||||
## 4. Dependencies
|
||||
- **Dependencies *of* this module**:
|
||||
- `System`, `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks` (standard .NET namespaces).
|
||||
- **Dependencies *on* this module**:
|
||||
- Not inferable from this file alone. However, given the namespace `DTS.Common.Licensing`, it is highly likely that other modules in the `DTS.Common.*` assembly (e.g., licensing validation, feature management, or UI components) depend on this enum.
|
||||
|
||||
## 5. Gotchas
|
||||
- The class `DataProLicensingEnums` is non-static and contains only an enum—this is unusual and may cause confusion (e.g., developers might instantiate it unnecessarily). It likely exists for historical or organizational reasons.
|
||||
- The comment `//FB 30628 Added StandardSite license type` indicates a feature request reference; developers should consult external tracking (e.g., Jira, Azure DevOps) for full context if needed.
|
||||
- No validation or conversion helpers (e.g., `TryParse`, `IsValid`) are defined in this file—consumers must implement their own validation if required.
|
||||
- No documentation comments (XML doc comments) are present on the enum or its members; developers must infer semantics from names and comments alone.
|
||||
- None identified from source alone.
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Licensing/Messages/ValidationFailure.cs
|
||||
- Common/DTS.Common.Licensing/Messages/LicenseKey.cs
|
||||
- Common/DTS.Common.Licensing/Messages/ValidationResult.cs
|
||||
generated_at: "2026-04-16T03:29:48.963073+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "52e7e10ea2ae6d13"
|
||||
---
|
||||
|
||||
# Messages
|
||||
|
||||
## Documentation: Licensing Validation Messages
|
||||
|
||||
### 1. Purpose
|
||||
This module defines core data structures used for representing license validation outcomes and license metadata within the DTS licensing system. It provides strongly-typed message contracts (`ValidationResult`, `ValidationFailure`, `LicenseKey`) that enable consistent communication of license status—such as validity, expiration, version compatibility, and ownership—between licensing validation components and downstream consumers (e.g., UI, service layers, or license enforcement logic). These types serve as the canonical output of license validation operations and are intended to decouple validation logic from business logic by standardizing the shape of validation results.
|
||||
|
||||
---
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `ValidationFailure`
|
||||
- **Namespace**: `DTS.Common.Licensing.Messages`
|
||||
- **Properties**:
|
||||
- `string Message { get; set; }` – A human-readable description of the validation issue (e.g., `"License has expired"`).
|
||||
- `string HowToResolve { get; set; }` – Guidance on how to remediate the failure (e.g., `"Renew your license at https://example.com/renew"`).
|
||||
- **Behavior**: A simple DTO for encapsulating a single validation failure; no validation or side effects occur upon construction or property assignment.
|
||||
|
||||
#### `LicenseKey`
|
||||
- **Namespace**: `DTS.Common.Licensing`
|
||||
- **Properties**:
|
||||
- `string KeyGuid { get; set; }` – A string representation of the license’s unique identifier (likely a GUID).
|
||||
- `string PublicKey { get; set; }` – The public key associated with the license (e.g., used for signature verification).
|
||||
- **Behavior**: A lightweight DTO for conveying core license identification and cryptographic material; no validation or processing is performed.
|
||||
|
||||
#### `ValidationResult`
|
||||
- **Namespace**: `DTS.Common.Licensing.Messages`
|
||||
- **Properties**:
|
||||
- `IEnumerable<ValidationFailure> ValidationFailures { get; set; }` – Collection of all validation failures encountered; may be `null` or empty if no failures occurred.
|
||||
- `bool IsLicenseExpired { get; set; }` – `true` if the license has expired (based on `LicenseExpiration`); `false` otherwise.
|
||||
- `bool IsLicenseVersionValid { get; set; }` – `true` if the license version is compatible with the current product version; `false` otherwise.
|
||||
- `Version ProductVersion { get; set; }` – The version of the product being licensed (e.g., `1.2.3.0`).
|
||||
- `string LicenseVersion { get; set; }` – The version string declared in the license (e.g., `"1.2"`).
|
||||
- `DateTime? LicenseExpiration { get; set; }` – The expiration date/time of the license; `null` if the license does not expire.
|
||||
- `bool IsValid { get; set; }` – `true` if *all* validation checks passed (i.e., `ValidationFailures` is empty, `IsLicenseExpired` is `false`, and `IsLicenseVersionValid` is `true`); `false` otherwise.
|
||||
- `bool IsLicensed { get; set; } = true` – Indicates whether a license file was present and loaded (`true`) or absent (`false`). Default value is `true`.
|
||||
- `string LicensedTo { get; set; }` – The entity (e.g., company or user name) to whom the license was issued.
|
||||
- `DataProLicensingEnums.LicenseType LicenseType { get; set; }` – The type of license (e.g., Trial, Standard, Enterprise); defined in `DataProLicensingEnums`.
|
||||
- `Guid LicenseId { get; set; }` – The unique identifier of the license.
|
||||
- **Behavior**: Encapsulates the complete result of a license validation operation. The `IsValid` property is derived from the combination of other fields (see *Invariants*), not computed independently.
|
||||
|
||||
---
|
||||
|
||||
### 3. Invariants
|
||||
- **`IsValid` is logically dependent**: `IsValid` must be `true` if and only if:
|
||||
- `ValidationFailures` is `null` or empty,
|
||||
- `IsLicenseExpired` is `false`, and
|
||||
- `IsLicenseVersionValid` is `true`.
|
||||
*(Note: The source does not enforce this via code—e.g., no setter logic—but it is the intended semantic contract implied by the property name and comments.)*
|
||||
- **`IsLicensed` default**: `IsLicensed` defaults to `true`; a value of `false` explicitly indicates the license file was not found or could not be loaded.
|
||||
- **`LicenseExpiration` may be null**: A `null` value for `LicenseExpiration` signifies a perpetual (non-expiring) license.
|
||||
- **`ValidationFailures` may be null**: The property is not initialized to an empty collection by default, so consumers must handle `null` explicitly.
|
||||
|
||||
---
|
||||
|
||||
### 4. Dependencies
|
||||
- **Internal dependencies**:
|
||||
- `System` (via `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks`, `System` implicitly for `Version`, `DateTime`, `Guid`).
|
||||
- `DataProLicensingEnums.LicenseType` (referenced in `ValidationResult.LicenseType`); defined in an external assembly (`DTS.Common.Licensing` namespace implies a dependency on `DTS.Common.Licensing.dll`, but the enum itself is not defined in the provided sources).
|
||||
- **Consumers**:
|
||||
- Licensing validation services (e.g., a `LicenseValidator` class not shown here) are expected to produce `ValidationResult` instances.
|
||||
- UI or middleware layers that consume validation results to make decisions (e.g., enabling/disabling features, prompting renewal).
|
||||
- **No external library dependencies** beyond core .NET types (e.g., no third-party packages referenced in the provided files).
|
||||
|
||||
---
|
||||
|
||||
### 5. Gotchas
|
||||
- **`ValidationFailures` is not initialized**: The property `ValidationFailures` is not auto-initialized to an empty collection (e.g., via `= new List<ValidationFailure>()`), so consumers must check for `null` before enumeration.
|
||||
- **`IsValid` is not computed automatically**: Though logically defined by other properties, `IsValid` is a simple `bool` with no setter logic or computed backing; callers must ensure it is set consistently by the producer (e.g., validation service).
|
||||
- **`IsLicensed` default may be misleading**: Its default value of `true` could cause confusion if a `ValidationResult` is constructed without explicitly setting `IsLicensed = false` when no license file exists.
|
||||
- **`LicenseKey.KeyGuid` is a string, not a `Guid`**: Despite the name suggesting a GUID, it is stored as a `string`, which may include formatting (e.g., with/without dashes) or non-GUID values. Consumers should not assume parseability without validation.
|
||||
- **No version comparison logic in `ValidationResult`**: While `ProductVersion` and `LicenseVersion` are present, the class itself provides no helper for comparing them (e.g., `IsLicenseVersionValid` is set externally).
|
||||
- **Missing `LicenseKey` usage context**: The `LicenseKey` class is defined but no usage or relationship to `ValidationResult`/`ValidationFailure` is evident from these files alone (e.g., whether `LicenseKey` is used as input to validation).
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Licensing/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T03:29:56.774702+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b8a216f95467a02c"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
## 1. Purpose
|
||||
This module (`DTS.Common.Licensing`) is an assembly containing licensing-related functionality for the DTS (presumably *Document Tracking System* or domain-specific) platform. Based solely on the provided file, it serves as a foundational .NET assembly with no visible licensing logic exposed in the snippet—its purpose is likely to encapsulate licensing infrastructure (e.g., license validation, feature flags, or activation logic), but the actual implementation resides in other source files not included here. The assembly is configured as a non-`ComVisible` library with version `1.0.0.0`, indicating it is an initial stable release intended for internal use within the .NET ecosystem.
|
||||
|
||||
## 2. Public Interface
|
||||
**No public types, functions, classes, or methods are defined in this file.**
|
||||
The file `AssemblyInfo.cs` contains only assembly-level metadata attributes (e.g., title, version, GUID) and does not declare any executable code, interfaces, or public APIs. Therefore, there are *no* public functions, classes, or methods documented here.
|
||||
|
||||
## 3. Invariants
|
||||
- The assembly is **not visible to COM** (`ComVisible(false)`), meaning external COM clients cannot directly instantiate or reference its types.
|
||||
- The assembly version is fixed at `1.0.0.0` for both `AssemblyVersion` and `AssemblyFileVersion`.
|
||||
- The `Guid` attribute (`8b169b1c-37cb-4b7c-8071-385036b96faa`) uniquely identifies the typelib for COM interop *if* `ComVisible` were enabled (though it is not).
|
||||
- All assembly attributes are statically defined and immutable at compile time.
|
||||
|
||||
## 4. Dependencies
|
||||
- **Dependencies**: None declared in this file. It only references standard .NET attributes (`System.Reflection`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices`).
|
||||
- **Dependents**: Unknown from this file alone. As a shared library (`DTS.Common.*`), it is likely referenced by other modules in the DTS platform (e.g., `DTS.Server`, `DTS.Client`), but no explicit references are visible here.
|
||||
|
||||
## 5. Gotchas
|
||||
- **No licensing logic is present in this file**—this is purely assembly metadata. Developers should not expect to find licensing functionality here; implementation resides in other source files (e.g., `LicenseManager.cs`, `LicenseValidator.cs`).
|
||||
- The `AssemblyVersion` and `AssemblyFileVersion` are both hardcoded to `1.0.0.0`. If versioning is managed elsewhere (e.g., via CI/CD or `Directory.Build.props`), this may be redundant or overridden.
|
||||
- The `AssemblyConfiguration` and `AssemblyCompany` attributes are empty strings, which may cause issues in environments expecting non-empty metadata (e.g., installer tools or telemetry).
|
||||
- None identified from source alone.
|
||||
@@ -0,0 +1,91 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Licensing/SystemInformation/MachineInfo.cs
|
||||
- Common/DTS.Common.Licensing/SystemInformation/ComputerSystemInfo.cs
|
||||
- Common/DTS.Common.Licensing/SystemInformation/MainBoardInfo.cs
|
||||
- Common/DTS.Common.Licensing/SystemInformation/ProcessorInfo.cs
|
||||
- Common/DTS.Common.Licensing/SystemInformation/SystemInformationXSD.cs
|
||||
generated_at: "2026-04-16T03:29:41.596274+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "3f95f5cfcf14dbc2"
|
||||
---
|
||||
|
||||
# SystemInformation
|
||||
|
||||
## Documentation: System Information Module (`DTS.Common.Licensing.SystemInformation`)
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module provides static accessors to retrieve hardware-identifying information from the local Windows machine using WMI (Windows Management Instrumentation) and .NET environment APIs. It is part of the licensing subsystem and is intended to supply stable, hardware-based identifiers (e.g., motherboard serial, CPU ID, system UUID) for machine fingerprinting or license validation. The module is read-only and defensive: all property getters return empty strings on failure instead of throwing exceptions, ensuring robustness in constrained or non-standard environments.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
All types are `static` classes; no instantiation is required.
|
||||
|
||||
| Type | Member | Signature | Behavior |
|
||||
|------|--------|-----------|----------|
|
||||
| `MachineInfo` | `MachineName` | `public static string MachineName { get; }` | Returns the network name of the machine via `Environment.MachineName`. Returns `""` on any exception. |
|
||||
| `ComputerSystemInfo` | `SystemID` | `public static string SystemID { get; }` | Returns the UUID of the computer system product (from `Win32_ComputerSystemProduct.UUID`). Returns `""` on any exception. |
|
||||
| `MainBoardInfo` | `SerialNumber` | `public static string SerialNumber { get; }` | Returns the serial number of the baseboard (motherboard) (from `Win32_BaseBoard.SerialNumber`). Returns `""` on any exception. |
|
||||
| `ProcessorInfo` | `ProcessorID` | `public static string ProcessorID { get; }` | Returns the `ProcessorID` field of the first processor (from `Win32_Processor.ProcessorID`). Returns `""` on any exception. |
|
||||
| `SystemInformationXSD` | `XSD` | `public static string XSD { get; }` | Returns a hardcoded XML Schema Definition (XSD) string for validating a `SysInfo` XML document containing the above fields. |
|
||||
|
||||
> **Note**: All getters are *eagerly evaluated* on first access and cached internally (via static field initialization or static property getter logic). Subsequent accesses reuse the result unless the underlying WMI query is re-executed (see *Gotchas*).
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- **Non-null return values**: All public properties return either a non-empty string (if WMI/Environment data is successfully retrieved) or `""` (empty string) on failure. **No property ever returns `null`.**
|
||||
- **No side effects**: Property getters are idempotent *per call*, but due to static `ManagementObjectSearcher` fields, repeated access may reuse cached WMI results (see *Gotchas*).
|
||||
- **Windows-only dependency**: All WMI-based properties (`SystemID`, `SerialNumber`, `ProcessorID`) assume Windows and rely on `System.Management`. Behavior on non-Windows platforms is undefined (but likely to return `""` due to exception handling).
|
||||
- **Schema consistency**: The `XSD` string defines a fixed schema for a `SysInfo` XML element containing exactly four child elements (`MainBoardSerialNumber`, `ProcessorID`, `SystemID`, `MachineName`) and two attributes (`Version`, `SystemInformationGuid`). The order of child elements is fixed.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
| Dependency | Usage |
|
||||
|------------|-------|
|
||||
| `System.Environment` (mscorlib) | Used by `MachineInfo.MachineName` to fetch machine name. |
|
||||
| `System.Management` (System.Management.dll) | Required for all WMI-based properties (`ComputerSystemInfo.SystemID`, `MainBoardInfo.SerialNumber`, `ProcessorInfo.ProcessorID`). |
|
||||
| `System.Linq` (System.Core.dll) | Used via LINQ extension methods (`OfType<T>()`, `FirstOrDefault()`) to safely extract WMI results. |
|
||||
| `System.Collections.Generic` (System.Core.dll) | Used for `ManagementObjectSearcher.Get()` result enumeration. |
|
||||
|
||||
**Depended on by**:
|
||||
This module is part of `DTS.Common.Licensing`, implying it is consumed by licensing validation logic (e.g., to generate or verify machine fingerprints). No direct reverse dependencies are visible in the provided source.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **WMI query execution is not lazy per access**:
|
||||
`ManagementObjectSearcher` instances are *static fields*, initialized once at type initialization. Each property getter calls `systemSearcher.Get()` (or equivalent) *on every access*, meaning repeated calls to `ProcessorInfo.ProcessorID` will re-execute the WMI query each time. This is inefficient and may cause performance issues if called frequently. Consider caching the first result (e.g., via `Lazy<T>` or a static field) if repeated access is expected.
|
||||
|
||||
- **`Win32_*` WMI classes are Windows-specific**:
|
||||
On non-Windows platforms (e.g., via .NET Core on Linux/macOS), `System.Management` may not be available or may throw exceptions. All properties will return `""`, but this behavior is not guaranteed across all environments.
|
||||
|
||||
- **`ProcessorID` may be empty or non-unique**:
|
||||
The `Win32_Processor.ProcessorID` field is *not guaranteed* to be populated on all systems (e.g., virtual machines, some OEM hardware). It may be empty or fall back to a placeholder value. The code does not validate uniqueness or consistency across processors.
|
||||
|
||||
- **`SystemID` vs. `UUID` ambiguity**:
|
||||
The WMI class `Win32_ComputerSystemProduct.UUID` is used for `SystemID`. While commonly stable, UUIDs can be reset (e.g., BIOS reset, VM cloning) or duplicated in some virtualized environments.
|
||||
|
||||
- **No validation of WMI field presence**:
|
||||
The code assumes the WMI properties (`UUID`, `SerialNumber`, `ProcessorID`) exist and are non-null. If a property is missing from the WMI result (e.g., due to driver issues), `["FieldName"]` may throw a `NullReferenceException`, which is caught and returns `""`. This is safe but obscures the root cause.
|
||||
|
||||
- **`SystemInformationXSD.XSD` is hardcoded and immutable**:
|
||||
The schema string is constant at compile time. There is no mechanism to update or version the schema dynamically. The `Version` and `SystemInformationGuid` attributes are defined in the schema but not used by any code in this module.
|
||||
|
||||
- **No thread-safety guarantees**:
|
||||
While `ManagementObjectSearcher` is generally thread-safe for concurrent reads, the module does not document or enforce thread-safety. Concurrent access to these properties is *likely* safe but not guaranteed by design.
|
||||
|
||||
- **No cleanup of WMI resources**:
|
||||
`ManagementObjectSearcher` implements `IDisposable`, but none of the searchers are disposed. This may lead to resource leaks in long-running processes (e.g., services), though `ManagementObjectSearcher` internally manages native handles and may mitigate this.
|
||||
|
||||
> **Recommendation for future refactoring**: Cache results on first access using `Lazy<string>` and ensure proper disposal of WMI resources if repeated access is common.
|
||||
Reference in New Issue
Block a user