![]() |
VOOZH | about |
dotnet add package CgdataBase.Core --version 1.9.34
NuGet\Install-Package CgdataBase.Core -Version 1.9.34
<PackageReference Include="CgdataBase.Core" Version="1.9.34" />
<PackageVersion Include="CgdataBase.Core" Version="1.9.34" />Directory.Packages.props
<PackageReference Include="CgdataBase.Core" />Project file
paket add CgdataBase.Core --version 1.9.34
#r "nuget: CgdataBase.Core, 1.9.34"
#:package CgdataBase.Core@1.9.34
#addin nuget:?package=CgdataBase.Core&version=1.9.34Install as a Cake Addin
#tool nuget:?package=CgdataBase.Core&version=1.9.34Install as a Cake Tool
一个轻量级的 .NET 基础工具库,聚焦“日常开发中反复出现的小问题”:参数校验、文件系统操作、字节/文本转换、序列化、网络工具、常用扩展方法,以及一些基于 IDisposable 的作用域控制类。
该包以“零外部依赖”为目标,主要使用 .NET 自带 API 实现。
Install-Package CgdataBase.Core
dotnet add package CgdataBase.Core
BusyScope:通过 using 作用域管理“繁忙状态”,支持嵌套调用(内部使用栈计数),适合 MVVM/桌面端 UI 的 IsBusy 场景。DelayInvoke:延迟执行(离开 using 代码块时执行回调),用于“收口式”的资源释放/收尾动作。RingList<T>:固定容量的环形列表(追加超过容量会覆盖最旧数据),用于缓冲区/采样窗口/最近 N 条记录。TempDirectoryScope:创建临时目录并在释放时自动清理;支持创建多个临时目录并统一回收,提供 MoveTo 将临时产物转移到目标位置。IEnumerable/Dictionary/ConcurrentDictionary 的便捷操作(批量、判空等)。DateTime / TimeSpan 的常用计算与格式化辅助。HashHelper 实现)。Guards:空值/空字符串/集合/路径/条件等快速校验,失败时抛出明确异常(支持 CallerArgumentExpression 生成参数名)。FileSystemHelper:拷贝目录、删除文件/目录、读取共享文件、路径格式转换(Windows/Linux)、相对路径计算、判断文件占用等。FileHelper:文本/JSON/XML 文件读写;文件 MD5 计算。JsonEngine:基于 DataContractJsonSerializer 的 JSON 序列化/反序列化。XmlEngine:基于 XmlSerializer 的 XML 序列化/反序列化(文件与字符串)。HashHelper:MD5/SHA1/SHA256(字符串/文件/流/字节)。GZipCompress:GZip 压缩/解压(字符串、字节数组、文件)。TextEncry:AES(CBC/PKCS7) 文本加解密与简单异或加解密(适合业务层“轻量保护”,不建议用于高强度安全场景)。ByteStringConverter:字节与 16/2 进制字符串互转,支持多种输出格式。CgBitArray / CgBitConverter / StructByteConverter:位数组、字节序处理、结构体与字节数组互转等(面向协议/报文场景)。NetworkHelper:域名解析、IP/MAC 校验与解析、Wake-on-LAN 魔术包生成与发送、获取 TcpClient 远端地址等。PingHelper:对主机/IP 执行 Ping 并返回结构化结果。ApplicationSettings / UISettings:基于 JSON 文件(默认 config.json/uiconfig.json)的简易设置存取(Hashtable)。NotifyPropertyClass:实现 INotifyPropertyChanged/Changing 的基础类,提供 SetProperty。RandomIdentifier:生成可读的随机代码标识符(类名/变量名等)。WindowsOsVersion / SystemHelper:Windows 版本判断等系统相关辅助。IAppSettingsBase:定义一组常用应用设置契约(字体、离线模式、数据库配置、更新服务配置等),并附带 DatabaseType 枚举。using CgdataBase.Core.Controllers;
using var scope = new TempDirectoryScope();
var tempDir = scope.GetTempDirectory(create: true);
var outputFile = Path.Combine(tempDir, "output.txt");
File.WriteAllText(outputFile, "hello");
using CgdataBase.Core.Controllers;
var ring = new RingList<int>(capacity: 3);
ring.AddRange(new[] { 1, 2, 3, 4 });
var latest = ring.GetArray(); // [2, 3, 4]
using CgdataBase.Core.Helpers;
Guards.HasValidText(userInput);
var sha256 = HashHelper.GetSHA256FromString(userInput);
using CgdataBase.Core.Helpers;
var bytes = ByteStringConverter.ConvertHexStringToBytes("0A FF 01");
var hex = ByteStringConverter.ConvertBytesToHexString(bytes!, mode: 1); // "0A FF 01"
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on CgdataBase.Core:
| Package | Downloads |
|---|---|
|
CgdataBase.WPF
Package Description |
|
|
CgdataBase.UI
Package Description |
|
|
CgdataBase.Avalonia
Package Description |
|
|
CgdataBase.WPF.FreeSql
Package Description |
|
|
CgdataBase.FreeSql
Package Description |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.9.34 | 88 | 6/15/2026 |
| 1.9.33 | 124 | 6/9/2026 |
| 1.9.32 | 198 | 6/3/2026 |
| 1.9.30 | 219 | 5/11/2026 |
| 1.9.29 | 139 | 5/2/2026 |
| 1.9.28 | 144 | 4/28/2026 |
| 1.9.26 | 127 | 4/27/2026 |
| 1.9.21 | 129 | 4/15/2026 |
| 1.9.19 | 130 | 4/8/2026 |
| 1.9.16 | 129 | 4/7/2026 |
| 1.9.12 | 138 | 4/3/2026 |
| 1.9.11 | 140 | 3/25/2026 |
| 1.9.8 | 134 | 3/23/2026 |
| 1.9.7 | 127 | 3/23/2026 |
| 1.9.6 | 182 | 3/20/2026 |
| 1.9.5 | 132 | 3/19/2026 |
| 1.9.4 | 128 | 3/18/2026 |
| 1.9.3 | 216 | 1/6/2026 |
| 1.9.2 | 246 | 12/5/2025 |
| 1.9.1 | 309 | 11/22/2025 |