Darp.Utils.Configuration
1.19.2
dotnet add package Darp.Utils.Configuration --version 1.19.2
NuGet\Install-Package Darp.Utils.Configuration -Version 1.19.2
<PackageReference Include="Darp.Utils.Configuration" Version="1.19.2" />
<PackageVersion Include="Darp.Utils.Configuration" Version="1.19.2" />
<PackageReference Include="Darp.Utils.Configuration" />
paket add Darp.Utils.Configuration --version 1.19.2
#r "nuget: Darp.Utils.Configuration, 1.19.2"
#:package Darp.Utils.Configuration@1.19.2
#addin nuget:?package=Darp.Utils.Configuration&version=1.19.2
#tool nuget:?package=Darp.Utils.Configuration&version=1.19.2
Darp.Utils
This repository bundles all open source c# helper modules of 'rosslight GmbH'. To extend, add a new project and test project.
Darp.Utils.Assets
A collection of simple interfaces for app assets targeting desktop apps.
Currently implemented:
FolderAssetsService: Read or write to a specific folder DI extensions provide helpers forApplicationData,ProgramData, and the App's BaseDirectoryEmbeddedResourceAssetsService: Read files marked asEmbeddedResourceof a specific AssemblyMemoryAssetsService: InMemory service that can be used for testing
When using DI, it is possible to retrieve the following services:
IAssetsFactory: A factory which is able to retrieve named asset servicesIReadOnlyAssets: The base interface which provides readonly access to your assetsIAssetsService: A writable view on your assets, extendsIReadOnlyAssetsIFolderAssetsService: A writable view on your assets with helpers specific to a directory
Named asset services:
- Supports registration of multiple different asset services
- Retrieval via
IAssetFactoryby supplying the name
Example:
// Add EmbeddedResources and AppData assets to the DI Container
ServiceProvider provider = new ServiceCollection()
.AddAppDataAssetsService(relativePath: "RelativePath")
.AddEmbeddedResourceAssetsService(name: "AssemblyResources", typeof(Test).Assembly)
.BuildServiceProvider();
// Example read and write operations with the app data
IAssetsService service = provider.GetRequiredService<IAssetsService>();
await service.SerializeJsonAsync("test.json", new Test("value"));
Test deserialized = await service.DeserializeJsonAsync<Test>("test.json");
await service.WriteTextAsync("test2.txt", "some content");
// Retrieve a named assets service and copy an embedded resource to the app data
IAssetsFactory factory = provider.GetRequiredService<IAssetsFactory>();
IReadOnlyAssetsService resourceService = factory.GetReadOnlyAssets("AssemblyResources");
await resourceService.CopyToAsync("test.json", service, "test.json");
file sealed record Test(string Prop1);
Darp.Utils.Configuration
A writable configuration service. Can be registered using DI and injected into target services. Usage might include reading, writing and listening to changes via the INotifyPropertyChanged interface.
Example:
ServiceProvider provider = new ServiceCollection()
.AddAppDataAssetsService("RelativePath")
.AddConfigurationFile<TestConfig>("config.json")
.BuildServiceProvider();
IConfigurationService<TestConfig> service = provider.GetRequiredService<IConfigurationService<TestConfig>>();
TestConfig config = await service.LoadConfigurationAsync();
await service.WriteConfigurationAsync(config with { Setting = "NewValue" });
Darp.Utils.CodeMirror
A code editor control that supports C# based on a WebView with CodeMirror.
First, create the backend service. It will host a minimal webserver which provides the backend. Afterwards, you can create the editor in the code behind or in xaml:
ICodeMirrorService codeMirrorService = new CodeMirrorService();
await vm.CodeMirror.StartBackendAsync(
onBuild: builder => builder.Services.AddLogging(loggingBuilder => loggingBuilder.AddConsole()),
onConfigureCSharp: options => options.SetScriptMode(true)
);
var editor = new CodeMirrorEditor();
editor.Address = codeMirrorService.Address;
editor.EditorText = "int i = 42";
editor.IsEditorReadOnly = false;
Darp.Utils.Dialog
A lightweight dialog service which allows for opening dialogs from the ViewModel.
| Implementation | Description |
|---|---|
| Implementation based on FluentAvalonia |
Example:
ServiceProvider provider = new ServiceCollection()
.AddSingleton<IDialogService, AvaloniaDialogService>()
.BuildServiceProvider();
IDialogService dialogService = provider.GetRequiredService<IDialogService>();
// Specify the Type of the dataContext of the window the dialog is supposed to be shown on
// .WithDialogRoot<MainWindowViewModel>()
await dialogService.CreateMessageBoxDialog("Title", "Message").ShowAsync();
// Assumes you have registered a view for 'SomeViewModel' in a ViewLocator
// Works with any kind of content
var viewModel = new SomeViewModel();
await dialogService.CreateContentDialog("Title", viewModel)
.SetDefaultButton(ContentDialogButton.Primary)
.SetCloseButton("Close")
.SetPrimaryButton("Ok", onClick: model => model.IsModelValid)
.ShowAsync();
Darp.Utils.Avalonia
A collection of classes and methods to help reduce the boilerplate when working with Avalonia. These contain:
ViewLocatorBase: Resolve views at compile-timeUserControlBase,WindowBase: Add aViewModelproperty to have typed access to the DataContextAvaloniaHelpers: A collection of helper methods
Darp.Utils.ResxSourceGenerator
A source generator for generating strongly typed singleton resource classes from .resx files. Additional documentation here.
Darp.Utils.TestRail
A library allowing for communication with a TestRail instance in a easy and modern way.
Core features:
- Modern: Build on the latest .Net technologies. NativeAot compatible
- Extensible:
ITestRailServiceis the core with a bunch of extension methods defining the actual API - Testable: Operates purely on the interface
ITestRailServicewhich can be mocked easily
Getting started:
var service = TestRailService.Create("https://[your-organization].testrail.io", "username", "passwordOrApiKey");
var projectsEnumerable = service.GetProjects(ProjectsFilter.ActiveProjectsOnly);
await foreach (var project in projectsEnumerable)
{
var casesEnumerable = service.GetCases(project.Id);
}
var caseResponse = await service.GetCaseAsync((CaseId)1);
var customProperty = caseResponse.Properties["custom_property"].GetString();
await service.UpdateCase(new UpdateCaseRequest { CaseId = caseResponse.Id, Title = "New Title" });
Extension methods:
public static async Task<GetCaseResponse> GetCaseAsync(this ITestRailService testRailService, CaseId caseId)
{
var jsonTypeInfo = YourSourceGenerationContext.Default.GetCaseResponse;
return await testRailService.GetAsync($"/get_case/{(int)caseId}", jsonTypeInfo, default(cancellationToken));
}
Usage with IHttpClientFactory for http client caching:
var provider = new ServiceCollection()
.AddHttpClient("TestRailClient", (provider, client) =>
{
client.BaseAddress = new Uri("https://[your-organization].testrail.io");
var authBytes = Encoding.UTF8.GetBytes("username:passwordOrApiKey");
var base64Authorization = Convert.ToBase64String(authBytes);
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", base64Authorization);
client.DefaultRequestHeaders.Add("Accept", "application/json");
})
.AddSingleton<ITestRailService>(provider => new TestRailService<IHttpClientFactory>(
provider.GetRequiredService<IHttpClientFactory>(),
factory => factory.CreateClient("TestRailClient"),
NullLogger.Instance))
.BuildServiceProvider();
var service = provider.GetRequiredService<ITestRailService>();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 is compatible. 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. |
-
net8.0
- Darp.Utils.Assets (>= 1.19.2)
- Glob (>= 1.1.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.6)
-
net9.0
- Darp.Utils.Assets (>= 1.19.2)
- Glob (>= 1.1.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.6)
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 |
|---|---|---|
| 1.19.2 | 0 | 10/24/2025 |
| 1.19.1 | 192 | 7/28/2025 |
| 1.19.0 | 133 | 7/27/2025 |
| 1.18.2 | 165 | 7/10/2025 |
| 1.18.1 | 199 | 7/7/2025 |
| 1.18.0 | 168 | 6/29/2025 |
| 1.17.4 | 119 | 6/28/2025 |
| 1.17.3 | 312 | 6/13/2025 |
| 1.17.2 | 305 | 6/12/2025 |
| 1.17.1 | 299 | 6/12/2025 |
| 1.17.0 | 206 | 6/8/2025 |
| 1.16.1 | 153 | 6/3/2025 |
| 1.16.0 | 139 | 5/24/2025 |
| 1.15.0 | 98 | 5/24/2025 |
| 1.14.3 | 231 | 5/22/2025 |
| 1.14.2 | 201 | 5/22/2025 |
| 1.14.1 | 201 | 5/20/2025 |
| 1.14.0 | 174 | 5/20/2025 |
| 1.13.2 | 179 | 5/19/2025 |
| 1.13.1 | 164 | 5/19/2025 |
| 1.13.0 | 329 | 3/5/2025 |
| 1.12.3 | 423 | 12/17/2024 |
| 1.12.2 | 160 | 12/12/2024 |
| 1.12.1 | 134 | 12/11/2024 |
| 1.12.0 | 115 | 12/11/2024 |
| 1.11.4 | 115 | 12/10/2024 |
| 1.11.3 | 123 | 12/10/2024 |
| 1.11.2 | 117 | 12/10/2024 |
| 1.11.1 | 125 | 12/9/2024 |
| 1.11.0 | 122 | 12/9/2024 |
| 1.10.0 | 210 | 10/21/2024 |
| 1.9.2 | 189 | 10/19/2024 |
| 1.9.1 | 171 | 10/19/2024 |
| 1.9.0 | 147 | 9/30/2024 |
| 1.8.0 | 138 | 9/26/2024 |
| 1.7.4 | 132 | 9/23/2024 |
| 1.7.3 | 134 | 9/22/2024 |
| 1.7.2 | 129 | 9/22/2024 |
| 1.7.1 | 132 | 9/22/2024 |
| 1.7.0 | 114 | 9/22/2024 |
| 1.6.3 | 257 | 9/10/2024 |
| 1.6.2 | 149 | 9/9/2024 |
| 1.6.1 | 155 | 9/9/2024 |
| 1.6.0 | 160 | 9/9/2024 |
| 1.5.1 | 145 | 9/7/2024 |
| 1.5.0 | 154 | 9/5/2024 |
| 1.4.0 | 194 | 8/11/2024 |
| 1.3.0 | 152 | 8/9/2024 |
| 1.2.1 | 139 | 8/9/2024 |
| 1.2.0 | 150 | 8/9/2024 |
| 1.1.0 | 148 | 8/8/2024 |
| 1.0.1 | 161 | 8/8/2024 |
| 1.0.0 | 161 | 8/8/2024 |