BPlusLib.Foundation
2.12.2
dotnet add package BPlusLib.Foundation --version 2.12.2
NuGet\Install-Package BPlusLib.Foundation -Version 2.12.2
<PackageReference Include="BPlusLib.Foundation" Version="2.12.2" />
<PackageVersion Include="BPlusLib.Foundation" Version="2.12.2" />
<PackageReference Include="BPlusLib.Foundation" />
paket add BPlusLib.Foundation --version 2.12.2
#r "nuget: BPlusLib.Foundation, 2.12.2"
#:package BPlusLib.Foundation@2.12.2
#addin nuget:?package=BPlusLib.Foundation&version=2.12.2
#tool nuget:?package=BPlusLib.Foundation&version=2.12.2
BPlusLib.Foundation
Enterprise-grade Windows-only foundation library for .NET 8/10 desktop apps — WinForms, WPF, 32 modules, pure P/Invoke.
Overview
BPlusLib.Foundation is a production-ready C# utility library for Windows desktop development on .NET 8 and .NET 10. It is now intentionally Windows-only so desktop APIs light up predictably in WinForms and WPF. All components use pure P/Invoke — no WMI, no PowerShell, no external executables.
| Targets | net8.0-windows · net10.0-windows |
| Version | 2.12.2 |
| License | MIT |
| Tests | 1,309 (1,217 passing, 92 skipped — Windows-only) |
| Author | thanhbinhqs |
Quick Start
dotnet add package BPlusLib.Foundation
// System info
using BPlusLib.Foundation.SystemInfo;
var cpu = new CpuInfo();
var mem = new MemoryInfo();
// Process management
using BPlusLib.Foundation.Process;
var result = CommandRunner.RunCommand("tasklist", timeoutMs: 10000);
// Service management
using BPlusLib.Foundation.Services;
ServiceHelper.StartService("Spooler");
ServiceHelper.StopService("Spooler", waitMs: 15000);
// UAC detection
using BPlusLib.Foundation.Security;
bool elevated = UacHelper.IsElevated();
IntegrityLevel level = UacHelper.GetIntegrityLevel();
// TCP/UDP communication
using BPlusLib.Foundation.Networking;
using var server = TcpSocketHelper.StartServer(port: 9000);
using var client = TcpSocketHelper.Connect("127.0.0.1", 9000);
client?.Send(Encoding.UTF8.GetBytes("Hello"));
// Credential Manager
using BPlusLib.Foundation.Security;
CredentialHelper.Write("myapp:user", "admin", "s3cret");
var cred = CredentialHelper.Read("myapp:user");
// Named pipe IPC
using var pipeServer = new PipeServer("BPlusLibTest");
pipeServer.WaitForConnection(5000);
pipeServer.Write(Encoding.UTF8.GetBytes("response"));
// Auto-update
using BPlusLib.Foundation.Windows;
await AppUpdater.UpdateAsync("https://example.com/releases/latest.zip");
// Borderless drag-move (WinForms)
using BPlusLib.Foundation.Window;
DragMoveHelper.Attach(this, titleBarPanel);
// Borderless drag-move (WPF)
// DragMoveHelper.BeginDrag(new WindowInteropHelper(this).Handle);
// Cisco EWC (RESTCONF + Syslog)
using BPlusLib.Foundation.Networking.Cisco;
var device = await CiscoEwcHelper.GetDeviceInfoAsync("192.168.1.1", "admin", "pass");
var aps = await CiscoEwcHelper.GetAccessPointsAsync("192.168.1.1", "admin", "pass");
var clients = await CiscoEwcHelper.GetClientsAsync("192.168.1.1", "admin", "pass");
using var syslog = CiscoEwcHelper.StartSyslogListener(514, entry => Console.WriteLine($"[{entry.Severity}] {entry.Message}"));
Modules
| # | Module | Description | Docs |
|---|---|---|---|
| 1 | 🔧 Common | Guard, Result<T>, Option<T>, AsyncLock, AsyncCache, RetryPolicy, Debounce, ObjectPool<T>, DisposableBase, ObservableObject |
→ docs |
| 2 | 🪟 Window | MonitorHelper, DragMoveHelper, ResizeHelper, WindowPositionManager, WindowAnimation |
→ docs |
| 3 | 💬 Dialogs | MessageBoxEx, InputBoxEx, ProgressDialog |
→ docs |
| 4 | 🖥️ System Info | CpuInfo, MemoryInfo, DiskInfo, BatteryInfo, NetworkAdapterInfo, BiosInfo, OperatingSystemInfo |
→ docs |
| 5 | ⚙️ Process | CommandRunner, ProcessExtensions |
→ docs |
| 6 | 🌐 Network | NetHelper — Ping, TCP/UDP table, ARP, DNS, WOL, VPN |
→ docs |
| 7 | 🔌 Networking | TcpConnection, TcpServer, TcpSocketHelper, UdpEndpoint, UdpSocketHelper, NetClientHelper, HttpListenerHelper |
→ docs |
| 8 | 🐦 Cisco EWC | CiscoEwcHelper, RestConfClient, YangParser, SyslogServer |
→ docs |
| 9 | 📁 IO | SafeFileOps, PathHelper, ChecksumHelper, FileVersionHelper |
→ docs |
| 10 | 🗄️ Registry | RegistryHelper — CRUD, export/import .reg, backup/restore |
→ docs |
| 11 | 🔒 Security | UacHelper, CredentialHelper, WinTrustHelper, TokenHelper, PrivilegeHelper, IntegrityHelper, SecurityHelper |
→ docs |
| 12 | 📊 Diagnostics | EventLogReader, CrashDumpHelper |
→ docs |
| 13 | 📝 Logging | FileLogger, LoggerFactory, LogEntry, NLogLogger, RichTextBoxLogTarget |
→ docs |
| 14 | 🔌 VirtualSerial | ISerialEndpoint, RouteEngine, FrameDecoders, WriteArbitration, ModemMapper |
→ docs |
| 14 | 🧩 Extensions | StringExtensions, StreamExtensions, TaskExtensions, CollectionExtensions |
→ docs |
| 15 | 📋 Clipboard | ClipboardHelper — text, files, bitmap |
→ docs |
| 16 | 📂 Explorer | ExplorerHelper — known folders, shortcuts, recycle bin |
→ docs |
| 17 | 🔐 Cryptography | CryptoHelper — AES, RSA, HMAC, PBKDF2, X.509 |
→ docs |
| 18 | 🎵 Media | MediaInfoReader — ID3v1/v2 tags, RIFF/WAV headers |
→ docs |
| 19 | 🖼️ Graphics | ScreenHelper, IconExtractor, DisplayHelper, CircularProgressBar |
→ docs |
| 20 | 🐚 Shell | ShellHelper, ShortcutHelper, NotifyIconHelper, AssocHelper, ThemeHelper |
→ docs |
| 21 | 📱 Device | DeviceHelper — USB detection, volume info, SetupAPI |
→ docs |
| 22 | 🔧 Hardware | HardwareDeviceHelper — USB speed, VID/PID, Serial |
→ docs |
| 23 | 🌍 Localization | LocalizationHelper — multi-language .resx |
→ docs |
| 24 | 🧵 Threading | ThreadHelper — STA/MTA, COM apartment |
→ docs |
| 25 | 🔌 Serial Ports | SerialPortInspector — COM port owner (NtQuerySystemInformation) |
→ docs |
| 26 | ⚙️ Services | ServiceHelper, JobObjectHelper, ConsoleHelper, RestartManagerHelper |
→ docs |
| 27 | ⌨️ Input | InputHelper, HotkeyHelper |
→ docs |
| 28 | 🔗 IPC | PipeServer, PipeClient, PipeHelper |
→ docs |
| 29 | ⚡ Power | PowerHelper — sleep, hibernate, shutdown, restart, lock |
→ docs |
| 30 | 🪟 Windows | AppUpdater, DarkModeHelper, SingleInstanceHelper, TaskbarProgressHelper, AutoStartHelper, AutoUpdateHelper, GlobalExceptionHandler, FileAssociationHelper, CustomWindowHelper, WindowManager, NetworkMonitorHelper |
→ docs |
| 31 | 🔧 Utils | EnvironmentHelper, FileVersionHelper |
— |
🔧 Common
Foundational types: Guard, Result<T>, Option<T>, AsyncLock, AsyncCache, RetryPolicy, Debounce, ObjectPool<T>, DisposableBase, ObservableObject, and polyfills. → Full Documentation
🪟 Window
MonitorHelper — monitor enumeration & info · DragMoveHelper — borderless drag-move · ResizeHelper — borderless resize · WindowPositionManager — save/restore positions · WindowAnimation — fade/slide animations. → Full Documentation
💬 Dialogs
MessageBoxEx — async message box with WH_CBT hook, dark mode, timeout · InputBoxEx — text input dialog · ProgressDialog — modal progress bar. → Full Documentation
🖥️ System Info
OperatingSystemInfo — name, version, architecture, boot time · CpuInfo — cores, speed, virtualization · MemoryInfo — physical, virtual, page file · DiskInfo — drive info, free space · NetworkAdapterInfo — MAC, IP, speed · BatteryInfo — charge, state · BiosInfo — vendor, version · EnvironmentHelper — env vars, PATH, domain · MemoryHelper — memory-mapped files, process memory. → Full Documentation
⚙️ Process
CommandRunner — async process execution with stdout/stderr capture · ProcessExtensions — elevation, image path, command line, kill tree, wait async. → Full Documentation
🌐 Network
NetHelper — Ping, TCP/UDP table, ARP cache, DNS lookup, Wake-on-LAN, VPN detection, routing. → Full Documentation
🔌 Networking
TcpConnection — full-duplex TCP wrapper · TcpServer — async accept · TcpSocketHelper — static connect/start · UdpEndpoint — send/receive/broadcast/multicast · UdpSocketHelper — static one-shot · NetClientHelper — HTTP GET/POST/PUT/DELETE, FTP · HttpListenerHelper — embedded localhost HTTP server. → Full Documentation
🐦 Cisco EWC
CiscoEwcHelper — static facade for Cisco EWC via RESTCONF (RFC 8040) · RestConfClient — HTTPS client with Basic auth, Newtonsoft.Json · YangParser — parse YANG model JSON responses (device info, APs, clients, SSIDs, RF radio data, RF profiles, AP profiles) · SyslogServer — UDP syslog listener (RFC 5424) with real-time callbacks. → Full Documentation
📁 IO
SafeFileOps — atomic write, retry copy/move, lock detection · PathHelper — sanitize, normalize, relative paths · ChecksumHelper — MD5/SHA1/SHA256/SHA512/CRC32 · FileVersionHelper — PE version resources (VerQueryValue). → Full Documentation
🗄️ Registry
RegistryHelper — CRUD values, export/import .reg, backup/restore, typed getters. → Full Documentation
🔒 Security
TokenHelper — token queries, groups, statistics · PrivilegeHelper — enable/disable privileges · IntegrityHelper — integrity level get/set · SecurityHelper — high-level security checks · UacHelper — elevation detection, runas, integrity level · CredentialHelper — Windows Credential Manager (read/write/enumerate/delete) · WinTrustHelper — Authenticode signature verification. → Full Documentation
📊 Diagnostics
EventLogReader — Windows Event Log reading · CrashDumpHelper — MiniDump/FullDump creation. → Full Documentation
📝 Logging
FileLogger — rolling file log writer · LoggerFactory — centralized logger creation · LogEntry — log entry model · NLogLogger — NLog wrapper with file + RichTextBox support · RichTextBoxLogTarget — cross-thread color-coded log display · RichTextBoxLoggerFactory — factory for creating loggers. → Full Documentation
🧩 Extensions
StringExtensions — email validation, truncation, ToTitleCase, slug · StreamExtensions — read exact bytes, read-all · TaskExtensions — WithTimeout, WithRetry, FireAndForget · CollectionExtensions — AddRange, Batch, DistinctBy, Shuffle. → Full Documentation
📋 Clipboard
ClipboardHelper — text, files, bitmap clipboard operations. → Full Documentation
📂 Explorer
ExplorerHelper — known folders, folder picker, shortcut management, recycle bin. → Full Documentation
🔐 Cryptography
CryptoHelper — AES encrypt/decrypt, RSA key pair, HMAC, PBKDF2, self-signed certificates, X.509. → Full Documentation
🎵 Media
MediaInfoReader — ID3v1/v2 tag reading, RIFF/WAV header parsing. → Full Documentation
🖼️ Graphics
ScreenHelper — multi-monitor bounds, virtual screen · IconExtractor — extract icons from EXE/DLL · DisplayHelper — DPI, resolution, color depth, high contrast. → Full Documentation
🐚 Shell
ShellHelper — file verbs, associations, recycle bin · ShortcutHelper — .lnk creation/reading via IShellLink COM · NotifyIconHelper — system tray icon (Shell_NotifyIconW) · AssocHelper — file extension queries · ThemeHelper — dark/light mode, accent color, DWM. → Full Documentation
📱 Device
DeviceHelper — USB detection, volume info, SetupAPI device enumeration. → Full Documentation
🔧 Hardware
HardwareDeviceHelper — USB speed detection (Low/Full/High/Super/SuperSpeed+), VID/PID/Serial parsing via SetupAPI · UsbDeviceParser — USB descriptor string parsing · DeviceInfoParser — device instance ID parsing. → Full Documentation
🌍 Localization
LocalizationHelper — multi-language .resx loading, culture switching. → Full Documentation
🧵 Threading
ThreadHelper — STA/MTA thread management, COM apartment. → Full Documentation
🔌 Serial Ports
SerialPortInspector — identify which process owns each COM port (NtQuerySystemInformation). Pure P/Invoke. → Full Documentation
⚙️ Services
ServiceHelper — start/stop/restart/pause/create/delete/query Windows services · JobObjectHelper — process group management (kill-on-close, process limits) · ConsoleHelper — console window management (show/hide, title, color) · RestartManagerHelper — Restart Manager API (lock detection for file updates). → Full Documentation
⌨️ Input
InputHelper — keyboard/mouse simulation (SendInput, Unicode text) · HotkeyHelper — global hotkey registration (RegisterHotKey). → Full Documentation
🔗 IPC
PipeServer / PipeClient — named pipe client/server with async support · PipeHelper — one-shot transaction. → Full Documentation
⚡ Power
PowerHelper — sleep, hibernate, shutdown, restart, lock, battery status, prevent sleep. → Full Documentation
🪟 Windows
AppUpdater — self-contained auto-updater (lock, download, extract, backup, replace, verify, rollback) · AutoStartHelper — registry-based auto-start management · AutoUpdateHelper — version checking and update orchestration · DarkModeHelper — dark/light mode for WinForms controls · SingleInstanceHelper — single-instance application enforcement · TaskbarProgressHelper — taskbar progress bar (ITaskbarList3) · WindowManager — window state management · NetworkMonitorHelper — network connectivity monitoring · GlobalExceptionHandler — unhandled exception capture · FileAssociationHelper — file type association registration · CustomWindowHelper — custom window chrome. → Full Documentation
🔧 Utils
EnvironmentHelper — environment variable management · FileVersionHelper — file version info extraction.
Architecture
BPlusLib.Foundation/
├── Common/ ← Guard, Result, Option, AsyncLock, ...
├── Native/ ← P/Invoke declarations (15 DLLs)
│ ├── Kernel32.cs
│ ├── User32.cs
│ ├── NtDll.cs
│ ├── Shell32.cs
│ ├── AdvApi32.cs
│ ├── Crypt32.cs
│ ├── WinTrust.cs
│ ├── PowrProf.cs
│ ├── PsApi.cs
│ ├── RstrtMgr.cs
│ ├── VersionApi.cs
│ ├── SetupApi.cs
│ └── Interop/
├── Window/ ← Monitor, Drag, Resize, Animation
├── Dialogs/ ← MessageBoxEx, InputBox, Progress
├── SystemInfo/ ← OS, CPU, Memory, Disk, Battery, ...
├── Process/ ← CommandRunner, ProcessExtensions
├── Network/ ← Ping, TCP/UDP table, ARP, DNS, WOL
├── Networking/ ← TCP/UDP sockets, HTTP/FTP client, HTTP server
│ └── Cisco/ ← RESTCONF client, YANG parser, Syslog server
├── IO/ ← SafeFileOps, Path, Checksum, FileVersion
├── Registry/ ← Registry CRUD, export/import
├── Security/ ← Token, Privilege, Integrity, UAC, Credential, WinTrust
├── Diagnostics/ ← EventLog, CrashDump
├── Logging/ ← FileLogger, LoggerFactory, NLogLogger, RichTextBoxLogTarget
├── Extensions/ ← String, Stream, Task, Collection
├── Clipboard/ ← Text, Files, Bitmap
├── Explorer/ ← Known folders, shortcuts, recycle bin
├── Cryptography/ ← AES, RSA, HMAC, PBKDF2, X.509
├── Media/ ← ID3, WAV
├── Graphics/ ← Screen, Icons, DPI
├── Shell/ ← Verbs, Associations, Theme, NotifyIcon, Shortcut
├── Device/ ← USB, Volume, SetupAPI
├── Hardware/ ← USB speed detection, VID/PID parsing
├── Localization/ ← Multi-language .resx
├── Threading/ ← STA/MTA
├── SerialPorts/ ← COM port owner identification
├── Services/ ← Service, Job Object, Console, Restart Manager
├── Input/ ← SendInput, RegisterHotKey
├── IPC/ ← Named pipes
├── Power/ ← Sleep, Hibernate, Shutdown
├── Windows/ ← AppUpdater, DarkMode, SingleInstance, Taskbar
└── Utils/ ← Environment, FileVersion
Dependencies
| Package | Version | Scope |
|---|---|---|
| Newtonsoft.Json | 13.0.3 | All TFMs (Cisco EWC module) |
| Microsoft.Bcl.HashCode | 1.1.1 | net472, net6.0 |
| System.Threading.Tasks.Extensions | 4.5.4 | net472, net6.0 |
| System.Memory | 4.5.5 | net472, net6.0 |
| System.Net.Http | 4.3.4 | net472, net6.0 |
| System.Diagnostics.EventLog | 6.0.0 | net6.0, net8.0 |
| NLog | 5.3.4 | All TFMs (logging module) |
Native Dependencies
All P/Invoke — no managed wrappers or external dependencies.
| DLL | Modules |
|---|---|
| kernel32 | Process, Handle, Console, Job Object, Pipe, Memory, Power |
| user32 | Window, Hotkey, Input, Power, Display |
| advapi32 | Service, Credential, Token, Privilege, Integrity, Shutdown |
| ntdll | SerialPorts (NtQuerySystemInformation) |
| shell32 | Explorer, Shell, Shortcut, NotifyIcon, Assoc |
| dwmapi | Theme (dark mode), Dialogs |
| wintrust | Authenticode signature verification |
| crypt32 | Certificate query for WinTrust |
| powrprof | Power (SetSuspendState) |
| rstrtmgr | Restart Manager API |
| psapi | Memory (GetProcessMemoryInfo) |
| version | PE file version info |
| shcore | Graphics (DPI) |
| netapi32 | Environment (domain join) |
| shlwapi | Shell (AssocQueryString) |
| setupapi | Hardware (device enumeration, USB speed) |
Building
dotnet restore
dotnet build
dotnet test --framework net8.0
dotnet pack -c Release
NuGet
Source: https://api.nuget.org/v3/index.json
Package: BPlusLib.Foundation
Version: 2.12.2
dotnet add package BPlusLib.Foundation --version 2.12.2
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Newtonsoft.Json (>= 13.0.3)
- NLog (>= 5.3.4)
- System.IO.Ports (>= 8.0.0)
- System.ServiceProcess.ServiceController (>= 8.0.0)
-
net8.0-windows7.0
- Newtonsoft.Json (>= 13.0.3)
- NLog (>= 5.3.4)
- System.IO.Ports (>= 8.0.0)
- System.ServiceProcess.ServiceController (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.