ZeroLevel 4.1.0

ZeroLevel

NuGet License: MIT

A self-contained .NET Standard 2.1 toolkit that bundles the plumbing every non-trivial .NET service ends up writing: logging, configuration, DI, fast binary serialization, a duplex TCP protocol, a file-based partitioned key-value store, semantic helpers, scheduling, encryption, reflection helpers and more — all without pulling in a heavyweight framework.

Designed as a drop-in foundation for background services, CLI tools and embedded engines. No code generation, no source generators, no reflection-heavy bootstrap — just references and go.

Installation

dotnet add package ZeroLevel

Minimum target: netstandard2.1 (compatible with .NET Core 3.0+, .NET 5+, Mono 6.4+, Xamarin).

External dependencies: System.Text.Json, YamlDotNet, System.Runtime.CompilerServices.Unsafe.

What's inside

Application basics

Area Highlights
Logging Log static facade (Log.Info, Log.Error, Log.Fatal), pluggable ILogger backends, batched async log router.
Configuration Configuration static facade, YAML/JSON readers, layered sets (IConfigurationSet), environment overrides.
Dependency Injection Named containers, constructor injection, singleton/transient, [Resolve] / [Parameter] attributes, Injector.Default fast path.
Scheduling Single-threaded fiber-based scheduler, cron-like triggers, async task queues.
Services BaseZeroService + Bootstrap lifecycle for long-running processes.

Serialization

  • MessageSerializer — compact binary serializer with compiled-expression codecs for ~50 primitive and nullable types, arrays, collections and dictionaries.
  • Explicit IBinarySerializable / IAsyncBinarySerializable for hand-tuned layouts.
  • SerializeCompatible<T> / DeserializeCompatible<T> — version-tolerant round-trips between layout variants.
  • Lazy collection readers (ReadCollectionLazy<T>) that stream elements as they arrive.

Networking

  • Duplex TCP protocol with message / request-response / keep-alive framing.
  • SocketServer + SocketClient built on explicit threads, FrameParser state machine, RequestBuffer for callback correlation.
  • Adaptive buffer manager, chunked file transfer (FileTransfer/).
  • Service discovery client (IDiscoveryClient) and pluggable routing (IRouter / IServiceRoutesStorage).

Storage and data

  • PartitionStorage — embedded key-value store partitioned by computed meta (date, tenant, hash), with merge steps, sparse indexes and compression hooks.
  • DataStructuresBloomFilter, HyperBloomBloom, BitMapCardTable, SafeBit32Vector, SparceVector, SparseMatrix.

Semantic and text

  • Snowball stemmer adapter, stop-word lists, n-gram tokenizer, edit-distance metrics.
  • TextAnalizer.ExtractWords / ExtractRuWords (Russian-aware regex), WordToken with positions.
  • Transliteration, text-on-curve rendering, plain-text table renderer.

Utilities

  • Murmur3 hashing, Rijndael encryption, TokenEncryptor, deterministic StringHash.
  • FSUtils (path correction, folder archiving), leak-free FileSystemWatcher wrapper.
  • InvokeWrapper — cached compiled delegates by name + signature.
  • Object mapping (ObjectMapping), PredicateBuilder for dynamic LINQ, Specification pattern, Query pipeline.
  • Tries, suffix automata, priority queues, round-robin / sparse iterators, EverythingStorage, FixSizeQueue, AtomicBoolean.

Quick start

Logging

using ZeroLevel;

Log.AddConsoleLogger(LogLevel.Info | LogLevel.Error);
Log.Info("Service {0} started", "indexer");

Configuration

var cfg = Configuration.ReadFromApplicationConfig();
var port = cfg.First<int>("port");

Dependency Injection

using ZeroLevel;

Injector.Default.Register<ILogger, ConsoleLogger>();
Injector.Default.Register<IMyService, MyService>();

var svc = Injector.Default.Resolve<IMyService>();

Binary serialization

using ZeroLevel.Services.Serialization;

public sealed class Payload : IBinarySerializable
{
    public string Title;
    public DateTimeOffset CreatedAt;

    public void Serialize(IBinaryWriter w)   { w.WriteString(Title);  w.WriteDateTimeOffset(CreatedAt); }
    public void Deserialize(IBinaryReader r) { Title = r.ReadString(); CreatedAt = r.ReadDateTimeOffset(); }
}

byte[] bytes = MessageSerializer.Serialize(new Payload { Title = "hi", CreatedAt = DateTimeOffset.UtcNow });
Payload back = MessageSerializer.Deserialize<Payload>(bytes);

Duplex TCP client

var exchange = UseExchange();
var client = exchange.GetConnection("127.0.0.1:3456");
client.Send("ping");
var pong = await client.Request<PingRequest, PongResponse>(new PingRequest());

Source layout

ZeroLevel/
├── DataStructures/        BloomFilter, SparseMatrix, BitMapCardTable, ...
├── Models/                BaseModel, InvokeResult, ZeroServiceInfo, DataRequest
└── Services/
    ├── Cache/             TimerCache and friends
    ├── Collections/       EverythingStorage, FixSizeQueue, RoundRobinCollection, ...
    ├── Config/            Configuration facade, YAML/JSON loaders
    ├── DOM/               DSL for templated text generation
    ├── DependencyInjection/   Injector facade, Container, attributes
    ├── Drawing/           Text-on-curve rendering
    ├── Encryption/        Rijndael, token encryption
    ├── FileSystem/        FSUtils, ParallelFileReader, archive helpers
    ├── Formats/           YAML ↔ JSON converter
    ├── HashFunctions/     Murmur3, StringHash (deterministic)
    ├── Invokation/        Cached compiled delegates
    ├── Logging/           Log facade, routers, buffered loggers
    ├── Mathemathics/      (sic — keep the legacy spelling)
    ├── Memory/            MMF view accessors
    ├── Network/           SocketServer / SocketClient / Exchange / FrameParser
    ├── ObjectMapping/     Property-level mapping
    ├── PartitionStorage/  File-based partitioned KV store
    ├── Queries/           PredicateBuilder, query pipeline
    ├── Reflection/        TypeHelpers, getter/setter builders
    ├── Semantic/          Stemmers, stop-words, n-grams, distances
    ├── Serialization/     MessageSerializer, PrimitiveTypeSerializer
    ├── Shedulling/        (sic) Fiber-based scheduler
    ├── Specification/     Specification pattern
    ├── Text/              Transliteration, plain-text tables
    ├── Trees/             Trie, suffix automata
    └── Web/, Windows/, Utils/, Pools/, MemoryPools/, Extensions/

Notes

  • Namespace Mathemathics is an intentional legacy spelling; renaming it would break downstream users and is explicitly avoided.
  • netstandard2.1 constrains some of the newer BCL APIs; the library stays within that surface on purpose.
  • Logging, Configuration, Bootstrap and Injector are exposed as static facades (e.g. Log.Info("msg")) so that startup boilerplate is minimal; all have imperative APIs as well.

License

MIT © Ogoun. See LICENSE for details.

No packages depend on ZeroLevel.

Serialization support DateTimeOffset

.NET Standard 2.1

Version Downloads Last updated
4.1.0 4 04/25/2026
4.0.0.6 21 12/18/2025
4.0.0.5 19 12/10/2025
4.0.0.4 20 12/10/2025
4.0.0.3 16 12/13/2025
4.0.0.2 14 12/14/2025
4.0.0.1 15 12/14/2025
4.0.0 12 12/14/2025
3.4.0.8 16 12/14/2025
3.4.0.7 20 12/13/2025
3.3.9.9 14 12/14/2025
3.3.9.8 15 12/14/2025
3.3.9.7 13 12/14/2025
3.3.9.6 17 12/14/2025
3.3.9.5 15 12/14/2025
3.3.9.4 12 12/14/2025
3.3.9.3 10 12/11/2025
3.3.9.2 12 12/12/2025
3.3.9.1 14 12/14/2025
3.3.9 14 12/14/2025
3.3.8.9 13 12/14/2025
3.3.8.8 12 12/14/2025
3.3.8.7 15 12/14/2025
3.3.8.6 17 12/14/2025
3.3.8.5 14 12/14/2025
3.3.8.4 15 12/14/2025
3.3.8.3 14 12/14/2025
3.3.8.2 16 12/14/2025
3.3.8.1 16 12/14/2025
3.3.7.9 15 12/14/2025
3.3.7.8 16 12/14/2025
3.3.7.7 13 12/14/2025
3.3.7.6 13 12/14/2025
3.3.7.5 18 12/14/2025
3.3.7.4 19 12/14/2025
3.3.7.3 14 12/14/2025
3.3.7.2 21 12/14/2025
3.3.7.1 16 12/14/2025
3.3.7 19 12/14/2025
3.3.6.8 16 12/14/2025
3.3.6.7 14 12/14/2025
3.3.6.6 13 12/14/2025
3.3.6.5 17 12/14/2025
3.3.6.4 15 12/14/2025
3.3.6.3 15 12/14/2025
3.3.6.2 16 12/14/2025
3.3.6.1 15 12/14/2025
3.3.6 16 12/14/2025
3.3.5.7 14 12/14/2025
3.3.5.6 13 12/14/2025
3.3.5.5 13 12/14/2025
3.3.5.4 20 12/13/2025
3.3.5.3 16 12/14/2025
3.3.5.2 15 12/14/2025
3.3.5.1 19 12/14/2025
3.3.5 16 12/14/2025
3.3.4.8 18 12/13/2025
3.3.4.7 18 12/14/2025
3.3.4.6 12 12/09/2025
3.3.4.5 11 12/14/2025
3.3.4.4 12 12/14/2025
3.3.4.3 15 12/14/2025
3.3.4.2 15 12/14/2025
3.3.4 16 12/14/2025
3.3.3 15 12/14/2025
3.3.2 14 12/14/2025
3.3.1 16 12/14/2025
3.2.0 14 12/14/2025
3.1.9 18 12/14/2025
3.1.8 15 12/14/2025
3.1.7 13 12/14/2025
3.1.6 17 12/14/2025
3.1.5 15 12/14/2025
3.1.4 14 12/14/2025
3.1.3 15 12/14/2025
3.1.2 15 12/14/2025
3.1.1 15 12/10/2025
3.1.0 14 12/14/2025
3.0.9 13 12/14/2025
3.0.8 14 12/14/2025
3.0.7 15 12/14/2025
3.0.6 13 12/14/2025
3.0.5 16 12/14/2025
3.0.4 17 12/14/2025
3.0.3 11 12/14/2025
3.0.2 20 12/14/2025
3.0.1 15 12/13/2025
3.0.0 13 12/14/2025
2.0.9 12 12/14/2025
2.0.8 16 12/14/2025
2.0.7 18 12/14/2025
2.0.6 13 12/14/2025
2.0.5 15 12/14/2025
2.0.4 18 12/14/2025
2.0.3 15 12/14/2025
2.0.2 21 12/14/2025
2.0.1 14 12/14/2025
2.0.0 14 12/13/2025
1.0.12 11 12/14/2025
1.0.11 20 12/14/2025
1.0.10 14 12/14/2025
1.0.9 15 12/14/2025
1.0.8 13 12/14/2025
1.0.7 15 12/14/2025
1.0.6 13 12/13/2025
1.0.5 16 12/14/2025
1.0.4 14 12/13/2025
1.0.3 17 12/14/2025
1.0.2 12 12/14/2025
1.0.1 13 12/14/2025
1.0.0 16 12/12/2025