Wisdom.CommonUtil.Configuration
1.0.1
dotnet add package Wisdom.CommonUtil.Configuration --version 1.0.1
NuGet\Install-Package Wisdom.CommonUtil.Configuration -Version 1.0.1
<PackageReference Include="Wisdom.CommonUtil.Configuration" Version="1.0.1" />
<PackageVersion Include="Wisdom.CommonUtil.Configuration" Version="1.0.1" />
<PackageReference Include="Wisdom.CommonUtil.Configuration" />
paket add Wisdom.CommonUtil.Configuration --version 1.0.1
#r "nuget: Wisdom.CommonUtil.Configuration, 1.0.1"
#:package Wisdom.CommonUtil.Configuration@1.0.1
#addin nuget:?package=Wisdom.CommonUtil.Configuration&version=1.0.1
#tool nuget:?package=Wisdom.CommonUtil.Configuration&version=1.0.1
Wisdom.CommonUtil.Configuration
Wisdom 电表检测软件强类型配置库:功率源、表架、误差仪、温湿箱、铭牌/报告编号等硬件与系统参数的 JSON 持久化。通过 ConfigurationContainer 单例统一加载与保存,文件位于 %LocalAppData%。支持 netstandard2.0、net48、net8.0-windows。
功能概览
| 类型 | 说明 |
|---|---|
ConfigBase |
配置基类,INotifyPropertyChanged + 默认 JSON 路径 |
ConfigurationContainer |
单例容器:注册、加载、Get<T>() / Save<T>() |
HardwareParameters |
功率源、表架、误差仪等硬件参数模型 |
SystemConfiguration |
区域、铭牌、报告编号、通信信息、温湿箱等 |
Common |
串口/TCP 通信通道配置模型 |
Enums |
物理通道类型、误差计算设备类型等 |
已在容器中注册的配置(启动即加载)
GlobalConfigurationPowerSourceConfigurationMeterStandConfigurationWsdErrorInstrumentConfigurationWarmHumidBoxConfigurationRs485SwitcherSichuanConfigurationNameplateConfigurationReportNumberConfigurationCommunicationInformationConfigurationChipIdCertificationConfiguration
源码中另有
DeviceCommunicationConfiguration、Dlt645EncryptorConfiguration等模型,当前默认未在容器注册,可按需自行扩展。
目标框架
netstandard2.0net48net8.0-windows
依赖
| 包 | 用途 |
|---|---|
| Newtonsoft.Json | JSON 读写 |
| log4net | 加载日志 |
| System.IO.Ports | 串口枚举类型 |
| Microsoft.Extensions.Configuration* | 包引用(扩展预留) |
| Wisdom.Communicate.Protocol.MeterStand | 四川 485 切换模式枚举等 |
快速开始
using Wisdom.CommonUtil.Configuration;
using Wisdom.CommonUtil.Configuration.SystemConfiguration;
using Wisdom.CommonUtil.Configuration.HardwareParameters;
var global = ConfigurationContainer.Instance.Get<GlobalConfiguration>();
global.Region = Region.CsgCity;
ConfigurationContainer.Instance.Save<GlobalConfiguration>();
var power = ConfigurationContainer.Instance.Get<PowerSourceConfiguration>();
var stand = ConfigurationContainer.Instance.Get<MeterStandConfiguration>();
配置文件默认路径:
%LocalAppData%\Wisdom.CommonUtil.Configuration\Config\{类型名}.json
典型场景
- 主程序「硬件参数 / 软件参数」设置界面读写
- 测试项运行时读取功率源、表架、误差仪通道映射
- 按区域(国网/南网)切换业务行为
安装
NuGet(推荐)
Visual Studio「管理 NuGet 程序包」中添加源后搜索安装,或使用 CLI:
dotnet add package Wisdom.CommonUtil.Configuration --source wisdom-commonlibrary
NuGet 源:
https://nuget.cnb.cool/Wisdom-ProductTestingDepartment/CommonLibrary/-/packages/v3/index.json
源码(git submodule)
本仓库作为主工程 CommonLibrary/Wisdom.CommonUtil.Configuration 子模块维护。修改后推送 Tag(如 v1.2.3)触发 CNB CI 自动打包发布。
发布
git tag v1.2.3
git push origin v1.2.3
CI 仅在 v* Tag 推送时执行 dotnet pack / dotnet nuget push,包版本取自 Tag(去掉前缀 v)。
仓库与制品
许可证
内部使用组件,版权归属 烟台东方威思顿电气有限公司(威思顿检测产品部)。未经授权请勿对外分发。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- log4net (>= 3.3.2)
- Microsoft.Extensions.Configuration (>= 9.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.9)
- Microsoft.Extensions.Configuration.Json (>= 9.0.9)
- Newtonsoft.Json (>= 13.0.4)
- System.IO.Ports (>= 6.0.0)
- Wisdom.Communicate.Protocol.MeterStand (>= 1.0.1)
-
.NETStandard 2.0
- log4net (>= 3.3.2)
- Microsoft.Extensions.Configuration (>= 9.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.9)
- Microsoft.Extensions.Configuration.Json (>= 9.0.9)
- Newtonsoft.Json (>= 13.0.4)
- System.IO.Ports (>= 6.0.0)
- Wisdom.Communicate.Protocol.MeterStand (>= 1.0.1)
-
net8.0-windows7.0
- log4net (>= 3.3.2)
- Microsoft.Extensions.Configuration (>= 9.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.9)
- Microsoft.Extensions.Configuration.Json (>= 9.0.9)
- Newtonsoft.Json (>= 13.0.4)
- System.IO.Ports (>= 6.0.0)
- Wisdom.Communicate.Protocol.MeterStand (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|
1.0.1:补充完整 README、NuGet 元数据与 WSD 包图标;Tag 触发自动发布。