SAPTeam.CommonTK 5.0.1

Prefix Reserved
dotnet add package SAPTeam.CommonTK --version 5.0.1
                    
NuGet\Install-Package SAPTeam.CommonTK -Version 5.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SAPTeam.CommonTK" Version="5.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SAPTeam.CommonTK" Version="5.0.1" />
                    
Directory.Packages.props
<PackageReference Include="SAPTeam.CommonTK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SAPTeam.CommonTK --version 5.0.1
                    
#r "nuget: SAPTeam.CommonTK, 5.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=SAPTeam.CommonTK&version=5.0.1
                    
Install SAPTeam.CommonTK as a Cake Addin
#tool nuget:?package=SAPTeam.CommonTK&version=5.0.1
                    
Install SAPTeam.CommonTK as a Cake Tool

CommonTK - All-in-One and Multi-Purpose .NET Library

Gawe CI codecov NuGet NuGet

CommonTK is a feature-rich toolkit for .NET applications, providing advanced context management, status providers, hierarchical settings, action groups, and more. It is designed for flexibility, extensibility, and performance.

Installation

Install with dotnet CLI:

dotnet add package SAPTeam.CommonTK

Features

Contexts

Contexts allow you to define and manage global or private application states, with support for locking execution via action groups.

Example: Custom Context

public class ExampleContext : Context
{
    public override string[] Groups => new[] { Context.ActionGroup(ActionScope.Application, "sample_action") };

    public ExampleContext()
    {
        Initialize(true); // Register as global context. must be called after ctor logic, if not called, the context won't be registered and not working.
    }

    protected override void CreateContext()
    {
        // Initialization logic here
    }

    protected override void DisposeContext()
    {
        // Cleanup logic here
    }
}

Usage:

using (var context = new ExampleContext())
{
    // Code here runs with the context changes.
    // In this state, the action group application.sample_action is locked and all methods that use it will be blocked.
}

// Action group is unlocked here.

Action Groups

Action groups let you prevent unintended changes that may conflict eith the running context.

public void ModifyUnintendedValues()
{
    Context.QueryGroup(Context.ActionGroup(ActionScope.Application, "sample_action"));
    // Code here will only run if the action group is not locked
}

Hierarchical Settings

Define and manage settings in a hierarchical structure, with type convention and import/export capabilities.

var root = new SettingsStore();
var setting = root.CreateSetting("app.theme", "dark", "UI theme");
setting.Value = "light";
string theme = setting.Value;

Status Providers

Unified interfaces for reporting status, progress, and multi-status bars.

Basic Status Provider:

public class UIStatusProvider : IStatusProvider
{
    private readonly Label status;

    public UIStatusProvider(Label label) => status = label;

    public void Clear() => status.Text = "";

    public StatusIdentifier Write(string message)
    {
        status.Text = message;
        return StatusIdentifier.Empty;
    }
}

Registry

A simple registry for managing resources with resource locations.

var registry = new Registry<Stream>();

// Register a resource
var location = new ResourceLocation("private", "myimage");
var stream = File.OpenRead("path/to/image.png");
registry.TryAdd(location, stream);

// Retrieve a resource
var file = registry[location];

Timer

Call a method after a specified time interval, with optional repeat functionality and exception handling.

var timer = new Timer(5000, () => SendMessage("test"), repeat: false);

// Stop or pause before the timer ends
timer.Pause(); // Only for repeating timers
timer.Stop();

// Get thrown exceptions
var exception = timer.Exceptions.FirstOrDefault();

Security Reporting

If you discover any security vulnerabilities, please report them by following our Security Guidelines.

Contributing

We welcome contributions! Please see our Contributing guide for more information on how to get started.

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on SAPTeam.CommonTK:

Package Downloads
SAPTeam.CommonTK.Console

All in One and Multi Purpose .NET Library for Professional Console actions. This library contains toolset of classes and methods that can be used by .NET Applications to perform Deep level Controls on Console. Key features of this library are: - Console Form: A way different way to Interact with your users. A Console User Interface! - Creating and Using console windows in Desktop Applications in The easiest way! - Colorize Your console text output! - Global Color Set. and more... For Getting started with this library and See more features you can visit the github page.

SAPTeam.Kryptor.Client

This library has common utilities used by kryptor front-end programs.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.1 183 5/16/2025
5.0.0 209 5/15/2025
4.1.3 207 4/13/2025
4.1.2 128 4/13/2025
4.0.3 304 9/4/2024
4.0.2 160 8/29/2024
3.0.2 718 8/10/2024
3.0.1 454 3/18/2024
2.4.5 701 6/10/2023
2.4.1 338 5/1/2023
2.3.11 419 4/23/2023
2.3.9 267 4/23/2023
2.3.8 275 4/23/2023
2.3.7 279 4/23/2023
2.3.6 189 4/23/2023
2.3.5 191 4/23/2023
2.3.4 216 4/23/2023
2.3.3 671 4/14/2023
2.3.2 297 4/13/2023
2.2.20 200 4/13/2023
2.2.19 194 4/13/2023
2.2.18 182 4/13/2023
2.2.17 209 4/12/2023
2.2.16 192 4/12/2023
2.2.15 187 4/12/2023
2.2.14 198 4/11/2023
2.2.13 215 4/11/2023
2.2.12 201 4/11/2023
2.2.11 209 4/11/2023
2.2.9 219 4/11/2023
2.2.8 187 4/10/2023
2.2.7 192 4/10/2023
2.2.6 216 4/10/2023
2.2.4 219 4/10/2023
2.2.3 202 4/9/2023
2.2.2 226 4/9/2023
2.1.2 214 4/9/2023
2.1.1 232 4/6/2023
2.0.8 389 4/5/2023
2.0.7-alpha 158 4/5/2023
2.0.6-alpha 165 4/5/2023
2.0.5-alpha 164 4/4/2023
2.0.4-alpha 157 4/4/2023
2.0.3-alpha 138 4/4/2023
2.0.2-alpha 154 4/4/2023
2.0.1-alpha 141 4/4/2023
1.3.6 243 4/3/2023
1.3.5 223 4/3/2023
1.3.3 219 4/3/2023
1.3.2 225 4/3/2023
1.2.6 320 4/3/2023
1.2.5 445 4/1/2023
1.2.4 400 4/1/2023
1.2.3 600 3/31/2023
1.2.2 222 3/31/2023
1.2.1 213 3/31/2023
1.2.0 757 3/30/2023
1.1.16 235 3/30/2023
1.1.14 238 3/29/2023
1.1.13 236 3/29/2023
1.1.12 214 3/29/2023
1.1.11 221 3/29/2023
1.1.10 231 3/29/2023
1.1.9 245 3/29/2023
1.1.8 518 3/28/2023
1.1.1 342 3/28/2023
1.0.3 299 3/26/2023