CodeLogic.Common
4.6.72
dotnet add package CodeLogic.Common --version 4.6.72
NuGet\Install-Package CodeLogic.Common -Version 4.6.72
<PackageReference Include="CodeLogic.Common" Version="4.6.72" />
<PackageVersion Include="CodeLogic.Common" Version="4.6.72" />
<PackageReference Include="CodeLogic.Common" />
paket add CodeLogic.Common --version 4.6.72
#r "nuget: CodeLogic.Common, 4.6.72"
#:package CodeLogic.Common@4.6.72
#addin nuget:?package=CodeLogic.Common&version=4.6.72
#tool nuget:?package=CodeLogic.Common&version=4.6.72
CodeLogic.Common
A broad, stateless utility toolkit for CodeLogic 4 — security, ID/password generation, JSON, compression, imaging, strings, time, web, networking, caching, file handling, and reflection.
CodeLogic.Common is a grab-bag of small, dependency-light helpers used across CodeLogic applications. Almost everything is exposed as static helper classes grouped by namespace, so you call them directly — Hashing.Sha256(...), IdGenerator.NanoId(), JsonHelper.Serialize(...) — with no library instance to wire up. Many fallible operations return a framework Result / Result<T> instead of throwing, while simple helpers return plain values (string, bool, byte[]). The package also ships a CommonLibrary (ILibrary) so it participates in the CodeLogic lifecycle and health system.
Install
dotnet add package CodeLogic.Common
Quick start
The static helpers need no setup — import a namespace and call:
using CL.Common.Security;
using CL.Common.Generators;
using CL.Common.Data;
// Hashing — plain string return (lowercase hex)
string digest = Hashing.Sha256("my-secret-data");
// AES-256-GCM authenticated encryption — tampering is detected on decrypt
string cipher = Encryption.EncryptAes("top secret", "passphrase");
string plain = Encryption.DecryptAes(cipher, "passphrase");
// A URL-safe, collision-resistant id — plain string return
string id = IdGenerator.NanoId(); // e.g. "V1StGXR8_Z5jdHi6B-myT"
// JSON — Result-based (never throws)
Result<string> json = JsonHelper.Serialize(new { name = "Ada" }); // {"name":"Ada"}
To participate in the CodeLogic lifecycle and health checks, load the library as usual — the static helpers remain available either way:
using CL.Common;
await Libraries.LoadAsync<CommonLibrary>(); // register before ConfigureAsync()
await CodeLogic.ConfigureAsync();
await CodeLogic.StartAsync();
Features
- Security —
Hashing(SHA-256/512, PBKDF2 password hash/verify, HMAC) andEncryption(AES-256-GCM for strings and bytes, key generation). - Generators —
IdGenerator(GUID, sequential, timestamp, NanoID, URL-safe, sortable) andPasswordGenerator(passwords, passphrases, PINs, strength estimation). - Data & JSON —
JsonHelperserialize/deserialize, file I/O, validation, merge, property extraction. - Conversion —
TypeConvertersafeResult-based conversion to int/long/double/bool/decimal/DateTime/Guid/enum. - Compression —
CompressionHelperGZip, Brotli, and LZ4 for bytes, plus GZip-to-Base64 string helpers. - Strings —
StringHelper(truncate, slug, case conversion, HTML strip) andStringValidator(email/URL/phone/IP/GUID checks). - Time —
DateTimeHelperUnix timestamps, ISO 8601, age, business days, boundaries, relative strings. - Web —
HtmlHelper,HttpClientHelper,HttpHeaderHelper,UrlHelperfor HTML sanitization, typed HTTP requests, header/IP/UA parsing, and URL building. - Networking —
NetworkPing,NetworkDns,SubnetCalculator,TraceRoute. - Parser / Cron —
CronParserparse/validate 5-field cron and compute the next UTC occurrence. - Imaging —
CLU_Imagingresize, crop, format conversion (JPEG/PNG/WebP), thumbnails, dimensions, Base64 — via SkiaSharp. - Caching —
ICache/MemoryCacheasync typed in-process cache with per-entry TTL. - File handling —
FileSystemasync read/write/copy/move/delete, directory create, listing, size, existence. - Reflection —
AssemblyHelperandReflectionHelperfor assembly metadata, type discovery, embedded resources, and dynamic property/method access.
Documentation
Full guide: CL.Common documentation
Requirements
- No configuration required —
CL.Commonis a stateless utility library and writes no config file. - CodeLogic 4 · .NET 10
- SkiaSharp 3.x (imaging) · K4os.Compression.LZ4 1.x (LZ4) · Newtonsoft.Json 13.x
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- CodeLogic (>= 4.0.0 && < 5.0.0)
- K4os.Compression.LZ4.Streams (>= 1.3.8)
- Newtonsoft.Json (>= 13.0.4)
- SkiaSharp (>= 3.119.4)
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 |
|---|---|---|
| 4.6.72 | 180 | 6/20/2026 |
| 4.6.69-preview | 32 | 6/20/2026 |
| 4.5.2 | 103 | 5/24/2026 |
| 4.5.2-preview.68 | 58 | 6/20/2026 |
| 4.5.1 | 157 | 5/24/2026 |
| 4.5.1-preview.56 | 91 | 5/24/2026 |
| 4.4.2-preview.53 | 57 | 5/24/2026 |
| 4.4.1 | 112 | 5/24/2026 |
| 4.0.5 | 102 | 5/15/2026 |
| 4.0.4 | 103 | 5/9/2026 |
| 4.0.3 | 102 | 5/9/2026 |
| 3.2.12 | 808 | 4/18/2026 |
| 3.2.11 | 116 | 4/18/2026 |
| 3.2.10 | 104 | 4/18/2026 |
| 3.2.9 | 104 | 4/18/2026 |
| 3.2.8 | 100 | 4/18/2026 |
| 3.2.7 | 104 | 4/18/2026 |
| 3.2.6 | 103 | 4/18/2026 |
| 3.2.5 | 109 | 4/18/2026 |
| 3.2.4 | 106 | 4/17/2026 |
# CL.Common — Changelog
All notable changes to **CodeLogic.Common** are documented here. Versions follow
[Semantic Versioning](https://semver.org/).
## 2026-06-20
### Documentation
- Full rewrite of the README and docs to house style. The README is now concise
Markdown-only (renders on both GitHub and NuGet): install, quick start showing the
static helpers and the optional `CommonLibrary` load, a grouped feature list, and a
link to the docs site. Notes that `CL.Common` is stateless and needs no configuration.
- Expanded the documentation site into a three-page set under `docs/libs/common/`:
an **Overview** (toolkit map, how static helpers are organized by namespace, the full
catalog table, health check), **Security & Data** (`Encryption`, `Hashing`,
`IdGenerator`, `PasswordGenerator`/`PasswordStrength`, `JsonHelper`, `TypeConverter`,
`CompressionHelper`), and **Utilities** (`StringHelper`/`StringValidator`,
`DateTimeHelper`, the web helpers, the networking set, `CronParser`, `CLU_Imaging`,
`ICache`/`MemoryCache`, `FileSystem`, and the reflection helpers). Each page documents
per-member return types accurately — plain values vs. `Result`/`Result<T>`. No API changes.
## [4.5.2] — 2026-06-20
### Documentation
- Documented the full public surface of the toolkit in the README. Previously only
imaging, hashing, caching, file handling, compression, and networking were listed;
the README now also covers **Security** (`Encryption` AES-256-GCM and the `Hashing`
PBKDF2/HMAC helpers), **Generators** (`IdGenerator`, `PasswordGenerator`),
**Data** (`JsonHelper`), **Conversion** (`TypeConverter`), **Parser** (`CronParser`),
**Time** (`DateTimeHelper`), **Strings** (`StringHelper`, `StringValidator`),
**Web** (`UrlHelper`, `HtmlHelper`, `HttpClientHelper`, `HttpHeaderHelper`),
the full **Networking** set (`NetworkPing`, `NetworkDns`, `SubnetCalculator`,
`TraceRoute`), and **Reflection** (`AssemblyHelper`, `ReflectionHelper`).
- Corrected the Quick Start hashing example: the helper is `Hashing.Sha256(...)`
(no `CLU_Hashing.SHA256` type exists), and clarified that GZip, Brotli, and LZ4
are all available from `CompressionHelper`. No API changes.
## [4.5.0] — 2026-05-24
### Changed
- **Unified versioning.** All CodeLogic.Libs now share a single version line
controlled by `version.txt` in the repo root. This is a version alignment
release — no functional changes to this library.
## [4.0.4] — 2026-04-16
### Changed
- README + manifest refresh across every CodeLogic library for the v4
baseline. No functional changes vs 4.0.3.
- `LibraryManifest.Version` now reads from the assembly's `AssemblyVersion`
attribute at runtime instead of a hard-coded string.
## [4.0.2] — 2026-04-09
### Changed
- Aligned with the v4 baseline across all libraries.
## [4.0.0] — 2026-04-09
Major rewrite — republished as v4.0.0 to reset the version line under the
unified v4 baseline. All public APIs refreshed.
### Notes
- Bundles cross-platform native assets transitively for libraries that need
them (e.g. SkiaSharp for image handling).
- Earlier history is retained in the
[git log](https://github.com/Media2A/CodeLogic.Libs/commits/main/CL.Common).