Files

37 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DataPRO/DataPRO.Core/Config/DataProConfig.cs
generated_at: "2026-04-17T16:11:20.599916+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c85bf33b30f4fe33"
---
# Config
### Purpose
This module provides centralized access to a custom application configuration file, abstracting away the details of `System.Configuration`. It exists to allow the application to read settings from a non-default config file path defined by `DataProConstants.CustomConfigPath`, enabling configuration separation from the main executable.
### Public Interface
**`DataProConfig` (static class)**
- `static Configuration AltConfig { get; }` — Returns the `Configuration` object mapped to the custom config file. Useful for advanced configuration operations not covered by helper methods.
- `static string GetAppSetting(string key)` — Retrieves an application setting value by key from the `<appSettings>` section. Returns `String.Empty` if the key is not found.
- `static object GetSection(string sectionName)` — Retrieves a named configuration section from the config file. Used by plugin code to access custom sections.
### Invariants
- The static constructor runs exactly once, before any member is accessed.
- `Config` is initialized via `ConfigurationManager.OpenMappedExeConfiguration` with `ConfigurationUserLevel.None` and will never be null after static construction.
- `GetAppSetting` always returns a non-null string (empty string if key missing).
- The configuration file path is determined by `DataProConstants.CustomConfigPath` and cannot be changed at runtime.
### Dependencies
- **Depends on**: `System.Configuration`, `DataProConstants` (specifically `DataProConstants.CustomConfigPath`).
- **Depended on by**: Unknown from source alone—likely consumed by plugin code and core application components requiring configuration access.
### Gotchas
- If `DataProConstants.CustomConfigPath` points to a non-existent or malformed config file, the static constructor will throw an exception, rendering the entire class unusable for the application lifetime.
- `GetAppSetting` performs a linear search through `Config.AppSettings.Settings` using LINQ; performance may degrade with very large numbers of settings.
- The third parameter `true` passed to `OpenMappedExeConfiguration` is undocumented in the source context—it appears to be a boolean for "preload" behavior, but its exact effect is unclear from source alone.
---