{"id":29708949,"url":"https://github.com/sapteamdev/commontk","last_synced_at":"2026-04-03T10:33:18.206Z","repository":{"id":148269294,"uuid":"527897836","full_name":"SAPTeamDEV/CommonTK","owner":"SAPTeamDEV","description":"All in One and Multi Purpose .NET Library","archived":false,"fork":false,"pushed_at":"2025-06-10T12:38:58.000Z","size":350,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-22T09:36:52.217Z","etag":null,"topics":["config","context","setting","statusbar","timer","toolkit","tools","utility"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/SAPTeam.CommonTK","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SAPTeamDEV.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-23T08:23:59.000Z","updated_at":"2025-05-22T11:54:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"6fc2356c-5ee6-4423-ba9a-4af0393b7df4","html_url":"https://github.com/SAPTeamDEV/CommonTK","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SAPTeamDEV/CommonTK","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAPTeamDEV%2FCommonTK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAPTeamDEV%2FCommonTK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAPTeamDEV%2FCommonTK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAPTeamDEV%2FCommonTK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SAPTeamDEV","download_url":"https://codeload.github.com/SAPTeamDEV/CommonTK/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAPTeamDEV%2FCommonTK/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266737764,"owners_count":23976395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","context","setting","statusbar","timer","toolkit","tools","utility"],"created_at":"2025-07-23T19:08:09.217Z","updated_at":"2026-04-03T10:33:18.175Z","avatar_url":"https://github.com/SAPTeamDEV.png","language":"C#","readme":"# CommonTK - All-in-One and Multi-Purpose .NET Library\n\n[![Gawe CI](https://github.com/SAPTeamDEV/CommonTK/actions/workflows/main.yml/badge.svg?event=push)](https://github.com/SAPTeamDEV/CommonTK/actions/workflows/main.yml)\n[![codecov](https://codecov.io/gh/SAPTeamDEV/CommonTK/graph/badge.svg?token=OT7SS9OCPT)](https://codecov.io/gh/SAPTeamDEV/CommonTK)\n[![NuGet](https://img.shields.io/nuget/v/SAPTeam.CommonTK)](https://www.nuget.org/packages/SAPTeam.CommonTK)\n[![NuGet](https://img.shields.io/nuget/dt/SAPTeam.CommonTK)](https://www.nuget.org/packages/SAPTeam.CommonTK)\n\nCommonTK 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.\n\n## Installation\n\nInstall with dotnet CLI:\n```bash\ndotnet add package SAPTeam.CommonTK\n```\n\n## Features\n\n### Contexts\n\nContexts allow you to define and manage global or private application states, with support for locking execution via action groups.\n\n**Example: Custom Context**\n\n\n```\npublic class ExampleContext : Context\n{\n    public override string[] Groups =\u003e new[] { Context.ActionGroup(ActionScope.Application, \"sample_action\") };\n\n    public ExampleContext()\n    {\n        Initialize(true); // Register as global context. must be called after ctor logic, if not called, the context won't be registered and not working.\n    }\n\n    protected override void CreateContext()\n    {\n        // Initialization logic here\n    }\n\n    protected override void DisposeContext()\n    {\n        // Cleanup logic here\n    }\n}\n\n```\n\n**Usage:**\n\n\n```\nusing (var context = new ExampleContext())\n{\n    // Code here runs with the context changes.\n    // In this state, the action group application.sample_action is locked and all methods that use it will be blocked.\n}\n\n// Action group is unlocked here.\n```\n\n### Action Groups\n\nAction groups let you prevent unintended changes that may conflict eith the running context.\n\n```\npublic void ModifyUnintendedValues()\n{\n    Context.QueryGroup(Context.ActionGroup(ActionScope.Application, \"sample_action\"));\n    // Code here will only run if the action group is not locked\n}\n```\n\n### Hierarchical Settings\n\nDefine and manage settings in a hierarchical structure, with type convention and import/export capabilities.\n\n\n```\nvar root = new SettingsStore();\nvar setting = root.CreateSetting(\"app.theme\", \"dark\", \"UI theme\");\nsetting.Value = \"light\";\nstring theme = setting.Value;\n\n```\n\n### Status Providers\n\nUnified interfaces for reporting status, progress, and multi-status bars.\n\n**Basic Status Provider:**\n\n```\npublic class UIStatusProvider : IStatusProvider\n{\n    private readonly Label status;\n\n    public UIStatusProvider(Label label) =\u003e status = label;\n\n    public void Clear() =\u003e status.Text = \"\";\n\n    public StatusIdentifier Write(string message)\n    {\n        status.Text = message;\n        return StatusIdentifier.Empty;\n    }\n}\n```\n\n### Registry\n\nA simple registry for managing resources with resource locations.\n\n```\nvar registry = new Registry\u003cStream\u003e();\n\n// Register a resource\nvar location = new ResourceLocation(\"private\", \"myimage\");\nvar stream = File.OpenRead(\"path/to/image.png\");\nregistry.TryAdd(location, stream);\n\n// Retrieve a resource\nvar file = registry[location];\n```\n\n### Timer\n\nCall a method after a specified time interval, with optional repeat functionality and exception handling.\n\n\n```\nvar timer = new Timer(5000, () =\u003e SendMessage(\"test\"), repeat: false);\n\n// Stop or pause before the timer ends\ntimer.Pause(); // Only for repeating timers\ntimer.Stop();\n\n// Get thrown exceptions\nvar exception = timer.Exceptions.FirstOrDefault();\n```\n\n## Security Reporting\n\nIf you discover any security vulnerabilities, please report them by following our [Security Guidelines](https://github.com/SAPTeamDEV/CommonTK/blob/master/SECURITY.md).\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing guide](https://github.com/SAPTeamDEV/CommonTK/blob/master/CONTRIBUTING.md) for more information on how to get started.\n\n## License\n\nThis project is licensed under the [MIT License](https://github.com/SAPTeamDEV/CommonTK/blob/master/LICENSE.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsapteamdev%2Fcommontk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsapteamdev%2Fcommontk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsapteamdev%2Fcommontk/lists"}