├── icon.png
├── toolbox.ico
├── ToolboxTopService
├── icon.png
├── GlobalUsings.cs
├── ToolboxTopService.csproj
├── README.md
├── HostApplicationBuilderExtension.cs
└── TopServiceBuilder.cs
├── WpfTools
├── Images
│ └── question.png
├── README.md
├── Services
│ └── IDialogService.cs
├── Dialogs
│ ├── DialogWindow.xaml.cs
│ ├── AskInputDialogView.xaml.cs
│ ├── DialogViewModel.cs
│ ├── AskInputDialogViewModel.cs
│ ├── DialogWindow.xaml
│ └── AskInputDialogView.xaml
├── BaseModels
│ ├── Interfaces.cs
│ ├── BaseViewModelClose.cs
│ ├── BaseViewModel.cs
│ └── BaseNotifier.cs
├── Commands
│ ├── OpenWindowCommand.cs
│ ├── OpenDialogCommand.cs
│ ├── DelegateCommand.cs
│ ├── BaseCommand.cs
│ ├── ShowWindowCommand.cs
│ └── AsyncDelegateCommand.cs
├── Helpers
│ ├── ProgressEventArgs.cs
│ ├── MessageBoxHelper.cs
│ ├── ProgressHelper.cs
│ └── WindowCloser.cs
├── BaseNav
│ ├── NavigationSetupService.cs
│ └── ViewStuff.cs
├── Extensions
│ ├── CurrentCultureHelper.cs
│ ├── ImageExtensions.cs
│ └── LocalizedDescriptionAttribute.cs
├── Converters
│ ├── Converters.xaml
│ ├── Multiply.cs
│ ├── ObjectToJson.cs
│ ├── BoolToVisibilityInvers.cs
│ ├── IntToString.cs
│ ├── BoolToVisibility.cs
│ ├── TimespanToString.cs
│ ├── EnumTypeConverter.cs
│ └── ImageToImageSource.cs
├── WindowStuff
│ └── IWindowService.cs
├── Controls
│ ├── SliderMenuItem.xaml
│ └── CustomSlider.cs
├── MarkupExtensions
│ └── EnumBindingSourceExtension.cs
├── Resources.xaml
├── AssemblyInfo.cs
├── WpfTools.csproj
└── readme.txt
├── ConsoleTools
├── GlobalUsings.cs
├── Power
│ ├── Spectre
│ │ ├── ProgressTask.cs
│ │ ├── Json.cs
│ │ ├── Status.cs
│ │ └── Progress.cs
│ ├── Commands
│ │ ├── Position.cs
│ │ └── Window.cs
│ ├── Input
│ │ ├── Decision.cs
│ │ ├── InputHelpers.cs
│ │ ├── ClassBasedSelection.cs
│ │ └── Text.cs
│ └── Shutdown
│ │ └── CancelKeyPressHandler.cs
├── README.md
├── Progress
│ ├── ConsoleInlineProgressBar.cs
│ └── ConsoleTopProgressBar.cs
├── BootstrapperExtensions.cs
├── Interop
│ ├── WindowVisibility.cs
│ └── PowerShellHelper.cs
├── SpectreInfrastructure
│ ├── ServiceCollectionTypeResolver.cs
│ ├── ServiceCollectionTypeRegistrar.cs
│ └── AppTypeRegistrar.cs
└── ConsoleTools.csproj
├── ToolboxImage
├── Resources
│ └── icon.png
├── README.md
├── LICENSE.md
├── Contracts
│ ├── IFixedImageInImage.cs
│ └── IImageInImage.cs
├── Configuration
│ └── FixedImageInImageSettings.cs
├── GlobalUsings.cs
├── ToolboxImage.csproj
├── Model
│ ├── FixedImageInImage.cs
│ └── Enums
│ │ └── ImageScaleMode.cs
├── Extensions
│ └── ImageInImageExtensions.cs
└── NOTICE.md
├── ToolboxConsole
├── Resources
│ └── icon.png
├── README.md
├── CommandApp
│ ├── ScTypeResolver.cs
│ └── AppTypeRegistrar.cs
├── LICENSE.md
├── ToolboxConsole.csproj
└── NOTICE.md
├── WebTools
├── WebToolsAssemblyMarker.cs
├── Configuration
│ ├── CertSettingsBase.cs
│ └── OidcSettingsBase.cs
├── Properties
│ └── launchSettings.json
├── webtools-schema.json
├── Filter
│ └── ValidationFilter.cs
├── Models
│ └── ErrorResponse.cs
├── Authorization
│ └── AllowedClients.cs
├── Cors
│ ├── readme.md
│ ├── CorsAttributes.cs
│ └── CorsExtensions.cs
├── Exceptions
│ └── BadRequestException.cs
├── Extensions
│ └── ContextExtensions.cs
├── WebTools.csproj
├── README.md
├── Authentication
│ └── AlwaysSucceedAuthenticationHandler.cs
└── Middleware
│ └── BearerToHeaderMiddleware.cs
├── ToolboxAppOptions
├── Resources
│ └── icon.png
├── ISettingsBase.cs
├── GlobalUsings.cs
├── Configuration
│ ├── ToolboxAppOptionsSettings.cs
│ └── ToolboxAppOptionsSettingsBuilder.cs
├── Services
│ ├── AppOptionsTransformationService.cs
│ └── StartupValidationService.cs
├── ToolboxAppOptions.csproj
└── Transformations
│ └── ProtectedTransformer.cs
├── ToolboxFluentValidation
├── GlobalUsings.cs
├── Resources
│ └── icon.png
├── README.md
├── LICENSE.md
├── NOTICE.md
└── ToolboxFluentValidation.csproj
├── global.json
├── Tests
├── ToolboxTests
│ ├── Resources
│ │ ├── 1680_525.jpg
│ │ └── 840_1050.jpg
│ ├── BootstrapperExtensionsTests.cs
│ ├── ToolboxTests.csproj
│ ├── GeoTools
│ │ └── GeoServiceTests.cs
│ ├── InteropTests
│ │ └── WallpaperHelperTests.cs
│ └── SecurityTests
│ │ └── VirusScanServiceTests.cs
├── WpfToolsManualTests
│ ├── ViewModel
│ │ ├── TestViewModel.cs
│ │ ├── TestManualDialogViewModel.cs
│ │ └── MainWindowViewModel.cs
│ ├── View
│ │ ├── MainWindow.xaml.cs
│ │ ├── TestWindow.xaml.cs
│ │ ├── TestManualDialogView.xaml.cs
│ │ ├── TestWindow.xaml
│ │ ├── MainWindow.xaml
│ │ └── TestManualDialogView.xaml
│ ├── App.xaml
│ ├── WpfToolsManualTests.csproj
│ └── App.xaml.cs
├── Directory.Build.props
├── ToolboxTopServiceManualTests
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Program.cs
│ ├── GlobalUsings.cs
│ ├── ToolboxTopServiceManualTests.csproj
│ └── SampleService.cs
├── ExtensionsTests
│ ├── MonadExtensionTests
│ │ └── MappingTests.cs
│ ├── CryptoExtensionsTests
│ │ ├── Base64StuffTests.cs
│ │ └── HexStuffTests.cs
│ ├── NumberExtensionsTests
│ │ └── ComparisonExtensionsTests.cs
│ ├── FileExtensionsTests
│ │ └── StorageSizeStuffTests.cs
│ ├── ExtensionsTests.csproj
│ ├── TimeExtensionsTests
│ │ └── ComparisonExtensionsTests.cs
│ └── TextExtensionsTests
│ │ └── RegexExtensionsTests.cs
├── ConsoleToolsManualTests
│ └── ConsoleToolsManualTests.csproj
├── ToolboxAppOptionsTests
│ ├── GlobalUsings.cs
│ ├── Configuration
│ │ └── ToolboxAppOptionsSettingsTests.cs
│ ├── appsettings.json
│ ├── Bases
│ │ └── AppOptionTestBase.cs
│ ├── ToolboxAppOptionsTests.csproj
│ └── Transformations
│ │ ├── PlaceholderTransformationTests.cs
│ │ └── ProtectedTransformerTests.cs
└── WpfToolsTests
│ └── WpfToolsTests.csproj
├── Extensions
├── README.md
├── MonadExtensions
│ └── Mapping.cs
├── TypeExtensions.cs
├── ExceptionExtensions
│ └── ReadingStuff.cs
├── TextExtensions
│ ├── FormattingExtensions.cs
│ └── Parsing.cs
├── FileExtensions
│ ├── FileSystemStuff.cs
│ ├── StorageSizeStuff.cs
│ └── HashStuff.cs
├── StorageExtensions
│ ├── ReflectionStuff.cs
│ └── FileOpsExtensions.cs
├── TimeExtensions
│ ├── TimingExtensions.cs
│ └── CalculationExtensions.cs
├── VersionExtensions
│ └── VersionExtensions.cs
├── Extensions.csproj
├── CryptoExtensions
│ ├── HexStuff.cs
│ └── ByteStuff.cs
├── NetworkExtensions
│ └── IpAddressExtensions.cs
├── NumberExtensions
│ └── ComparisonExtensions.cs
├── DictionaryExtensions.cs
├── OwinExtensions
│ └── ClaimExtensions.cs
└── StringManipulationExtensions.cs
├── Toolbox
├── SerializationTools
│ ├── ITypeToFileStore.cs
│ ├── JsonExtensions.cs
│ ├── TypeToFileValue.cs
│ └── EmbeddedResourceQuery.cs
├── NetworkTools
│ ├── IgnoreServerCertificateHandler.cs
│ └── Internet.cs
├── README.md
├── CustomDatastructures
│ └── DropOutStack.cs
├── SortTools
│ └── NaturalSort.cs
├── Oidc
│ └── SessionStore.cs
├── GeoTools
│ └── GeoService.cs
├── SecurityTools
│ └── SslHelper.cs
├── SyncTools
│ └── AppSingleStartup.cs
├── Ioc
│ └── DecoratorRegistrationExtensions.cs
└── _Obsolete
│ └── RegistryEditor.cs
├── version.json
├── README.md
├── aemarcoCommons.sln.DotSettings
└── LICENSE.md
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemarco/aemarcoCommons/HEAD/icon.png
--------------------------------------------------------------------------------
/toolbox.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemarco/aemarcoCommons/HEAD/toolbox.ico
--------------------------------------------------------------------------------
/ToolboxTopService/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemarco/aemarcoCommons/HEAD/ToolboxTopService/icon.png
--------------------------------------------------------------------------------
/WpfTools/Images/question.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemarco/aemarcoCommons/HEAD/WpfTools/Images/question.png
--------------------------------------------------------------------------------
/ConsoleTools/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 |
4 | global using Spectre.Console;
5 | global using System;
--------------------------------------------------------------------------------
/ToolboxImage/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemarco/aemarcoCommons/HEAD/ToolboxImage/Resources/icon.png
--------------------------------------------------------------------------------
/ToolboxConsole/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemarco/aemarcoCommons/HEAD/ToolboxConsole/Resources/icon.png
--------------------------------------------------------------------------------
/WebTools/WebToolsAssemblyMarker.cs:
--------------------------------------------------------------------------------
1 | namespace aemarcoCommons.WebTools;
2 | public class WebToolsAssemblyMarker
3 | {
4 | }
5 |
--------------------------------------------------------------------------------
/ToolboxAppOptions/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemarco/aemarcoCommons/HEAD/ToolboxAppOptions/Resources/icon.png
--------------------------------------------------------------------------------
/ToolboxFluentValidation/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using FluentValidation;
4 | global using System;
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "9.0.304",
4 | "rollForward": "minor",
5 | "allowPrerelease": false
6 | }
7 | }
--------------------------------------------------------------------------------
/Tests/ToolboxTests/Resources/1680_525.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemarco/aemarcoCommons/HEAD/Tests/ToolboxTests/Resources/1680_525.jpg
--------------------------------------------------------------------------------
/Tests/ToolboxTests/Resources/840_1050.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemarco/aemarcoCommons/HEAD/Tests/ToolboxTests/Resources/840_1050.jpg
--------------------------------------------------------------------------------
/ToolboxFluentValidation/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aemarco/aemarcoCommons/HEAD/ToolboxFluentValidation/Resources/icon.png
--------------------------------------------------------------------------------
/WpfTools/README.md:
--------------------------------------------------------------------------------
1 | # `aemarcoWpfTools`
2 |
3 | 
4 |
--------------------------------------------------------------------------------
/Extensions/README.md:
--------------------------------------------------------------------------------
1 | # `aemarcoExtensions`
2 |
3 | 
4 |
--------------------------------------------------------------------------------
/ToolboxImage/README.md:
--------------------------------------------------------------------------------
1 | # `aemarcoToolboxImage`
2 |
3 | 
4 |
--------------------------------------------------------------------------------
/Tests/WpfToolsManualTests/ViewModel/TestViewModel.cs:
--------------------------------------------------------------------------------
1 | using aemarcoCommons.WpfTools.BaseModels;
2 |
3 | namespace WpfToolsManualTests.ViewModel;
4 | internal class TestViewModel : BaseViewModel;
5 |
--------------------------------------------------------------------------------
/ToolboxConsole/README.md:
--------------------------------------------------------------------------------
1 | # `aemarcoToolboxConsole`
2 |
3 | 
4 |
--------------------------------------------------------------------------------
/WpfTools/Services/IDialogService.cs:
--------------------------------------------------------------------------------
1 | namespace aemarcoCommons.WpfTools.Services;
2 | public interface IDialogService
3 | {
4 |
5 |
6 |
7 | bool ShowDialog(object viewModel);
8 |
9 |
10 |
11 | }
--------------------------------------------------------------------------------
/Tests/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | enable
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Tests/ToolboxTopServiceManualTests/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "ToolboxTopServiceManualTests": {
4 | "commandName": "Project",
5 | "commandLineArgs": ""
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/Tests/WpfToolsManualTests/View/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace WpfToolsManualTests.View;
2 |
3 | public partial class MainWindow
4 | {
5 | public MainWindow()
6 | {
7 | InitializeComponent();
8 | }
9 | }
--------------------------------------------------------------------------------
/Tests/WpfToolsManualTests/View/TestWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace WpfToolsManualTests.View;
2 |
3 | public partial class TestWindow
4 | {
5 | public TestWindow()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/ToolboxFluentValidation/README.md:
--------------------------------------------------------------------------------
1 | # `aemarcoToolboxFluentValidation`
2 |
3 | 
4 |
5 |
--------------------------------------------------------------------------------
/ToolboxTopService/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using CliWrap;
4 | global using CliWrap.Buffered;
5 | global using Microsoft.Extensions.Hosting;
6 | global using System;
7 | global using System.Threading.Tasks;
--------------------------------------------------------------------------------
/WpfTools/Dialogs/DialogWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace aemarcoCommons.WpfTools.Dialogs;
2 |
3 | public partial class DialogWindow
4 | {
5 | public DialogWindow()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/WpfTools/Dialogs/AskInputDialogView.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace aemarcoCommons.WpfTools.Dialogs;
2 |
3 | public partial class AskInputDialogView
4 | {
5 | public AskInputDialogView()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Extensions/MonadExtensions/Mapping.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace aemarcoCommons.Extensions.MonadExtensions;
4 |
5 | public static class Mapping
6 | {
7 | public static TOut Map(this TIn @this, Func f) =>
8 | f(@this);
9 | }
--------------------------------------------------------------------------------
/Tests/WpfToolsManualTests/View/TestManualDialogView.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace WpfToolsManualTests.View;
2 |
3 | public partial class TestManualDialogView
4 | {
5 | public TestManualDialogView()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/WebTools/Configuration/CertSettingsBase.cs:
--------------------------------------------------------------------------------
1 | namespace aemarcoCommons.WebTools.Configuration;
2 |
3 | public class CertSettingsBase
4 | {
5 | public string? Authority { get; init; }
6 | public string? Path { get; init; }
7 | public string? Pwd { get; init; }
8 | }
--------------------------------------------------------------------------------
/Toolbox/SerializationTools/ITypeToFileStore.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace aemarcoCommons.Toolbox.SerializationTools;
4 |
5 | public interface ITypeToFileStore : IDisposable
6 | where T : class, ITypeToFileValue, new()
7 | {
8 | T Instance { get; }
9 | T CommitReset();
10 | void SaveChanges();
11 | }
--------------------------------------------------------------------------------
/WpfTools/BaseModels/Interfaces.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace aemarcoCommons.WpfTools.BaseModels;
4 |
5 | public interface IBaseNotifier : INotifyPropertyChanged;
6 |
7 | public interface IBaseViewModel : IBaseNotifier;
8 |
9 | public interface IWindow
10 | {
11 | void Show();
12 | bool? ShowDialog();
13 | }
--------------------------------------------------------------------------------
/Tests/ToolboxTopServiceManualTests/Program.cs:
--------------------------------------------------------------------------------
1 | await Host.CreateApplicationBuilder(args)
2 | .SetupSampleService()
3 | .RunAsTopService(x => x
4 | .ServiceName("SomeService")
5 | .DisplayName("Some Service")
6 | .Description("SampleService installed with TopService")
7 | .StartupType(StartupType.AutoDelayed));
--------------------------------------------------------------------------------
/WebTools/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "WebTools": {
4 | "commandName": "Project",
5 | "launchBrowser": true,
6 | "environmentVariables": {
7 | "ASPNETCORE_ENVIRONMENT": "Development"
8 | },
9 | "applicationUrl": "https://localhost:62751;http://localhost:62752"
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/Tests/ToolboxTopServiceManualTests/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using aemarcoCommons.ToolboxTopService;
4 | global using Microsoft.Extensions.DependencyInjection;
5 | global using Microsoft.Extensions.Hosting;
6 | global using System;
7 | global using System.Threading;
8 | global using System.Threading.Tasks;
9 | global using ToolboxTopServiceManualTests;
--------------------------------------------------------------------------------
/Toolbox/NetworkTools/IgnoreServerCertificateHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 |
3 | namespace aemarcoCommons.Toolbox.NetworkTools;
4 |
5 | public class IgnoreServerCertificateHandler : HttpClientHandler
6 | {
7 | public IgnoreServerCertificateHandler()
8 | {
9 | ServerCertificateCustomValidationCallback =
10 | (_, _, _, _) => true;
11 | }
12 | }
--------------------------------------------------------------------------------
/Tests/WpfToolsManualTests/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ConsoleTools/Power/Spectre/ProgressTask.cs:
--------------------------------------------------------------------------------
1 | // ReSharper disable once CheckNamespace
2 | namespace aemarcoCommons.ConsoleTools;
3 |
4 | public static partial class PowerConsole
5 | {
6 |
7 | public static void CompleteTask(this ProgressTask task)
8 | {
9 | task.Value = task.MaxValue;
10 | task.IsIndeterminate = false;
11 | task.StopTask();
12 | }
13 |
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/ConsoleTools/README.md:
--------------------------------------------------------------------------------
1 | # `aemarcoConsoleTools`
2 |
3 |
4 |
5 |
6 | ## Overview
7 |
8 | - Heavily makes use of Spectre.Console (https://spectreconsole.net/)
9 |
10 | ## Get Started
11 |
12 | - Use PowerConsole.... which brings a lot of stuff with it.
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/version.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3 | "version": "9.0",
4 | "versionHeightOffset": 6,
5 | "publicReleaseRefSpec": [
6 | "^refs/heads/main",
7 | "^refs/heads/v\\d+(?:\\.\\d+)?$"
8 | ],
9 | "cloudBuild": {
10 | "buildNumber": {
11 | "enabled": true
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/ConsoleTools/Power/Spectre/Json.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Spectre.Console.Json;
3 |
4 | // ReSharper disable once CheckNamespace
5 | namespace aemarcoCommons.ConsoleTools;
6 |
7 | public static partial class PowerConsole
8 | {
9 | public static void WriteAsJson(object o)
10 | {
11 | AnsiConsole.Write(new JsonText(JsonConvert.SerializeObject(o)));
12 | AnsiConsole.WriteLine();
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/Tests/ExtensionsTests/MonadExtensionTests/MappingTests.cs:
--------------------------------------------------------------------------------
1 | using aemarcoCommons.Extensions.MonadExtensions;
2 | using FluentAssertions;
3 | using NUnit.Framework;
4 |
5 | namespace ExtensionsTests.MonadExtensionTests;
6 |
7 | public class MappingTests
8 | {
9 | [Test]
10 | public void Map_Maps()
11 | {
12 | var r = 5.Map(x => x * 2);
13 | r.Should().Be(10);
14 | }
15 |
16 |
17 |
18 |
19 |
20 |
21 | }
--------------------------------------------------------------------------------
/Tests/ConsoleToolsManualTests/ConsoleToolsManualTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | net9.0-windows
6 | Exe
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Tests/ToolboxAppOptionsTests/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | // Global using directives
2 |
3 | global using aemarcoCommons.ToolboxAppOptions;
4 | global using FluentAssertions;
5 | global using FluentValidation;
6 | global using Microsoft.Extensions.Configuration;
7 | global using Microsoft.Extensions.DependencyInjection;
8 | global using Microsoft.Extensions.Options;
9 | global using NUnit.Framework;
10 | global using System;
11 | global using ToolboxAppOptionsTests.Bases;
--------------------------------------------------------------------------------
/WpfTools/Dialogs/DialogViewModel.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.ComponentModel;
2 | using System;
3 |
4 | namespace aemarcoCommons.WpfTools.Dialogs;
5 |
6 | public class DialogViewModel : ObservableObject
7 | {
8 |
9 | public virtual string Title => "Title";
10 |
11 | public event EventHandler? CloseDialog;
12 | protected virtual void OnCloseDialog(bool? dialogResult) =>
13 | CloseDialog?.Invoke(this, dialogResult);
14 |
15 | }
--------------------------------------------------------------------------------
/Extensions/TypeExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | namespace aemarcoCommons.Extensions;
5 |
6 | public static class TypeExtensions
7 | {
8 | public static string GetReadableTypeName(this Type type)
9 | {
10 | var result = type.IsGenericType
11 | ? $"{type.Name.Split('`')[0]}<{string.Join(",", type.GetGenericArguments().Select(x => x.Name))}>"
12 | : type.Name;
13 | return result;
14 | }
15 | }
--------------------------------------------------------------------------------
/Extensions/ExceptionExtensions/ReadingStuff.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace aemarcoCommons.Extensions.ExceptionExtensions;
4 |
5 | public static class ReadingStuff
6 | {
7 |
8 | public static Exception Unpack(this Exception exception)
9 | {
10 | var result = exception;
11 | while (result?.InnerException != null)
12 | {
13 | result = result.InnerException;
14 | }
15 | return result;
16 | }
17 |
18 |
19 |
20 |
21 | }
--------------------------------------------------------------------------------
/WebTools/webtools-schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/draft-07/schema#",
3 | "type": "object",
4 | "definitions": {
5 | //"WebPipeSettings": {
6 | // "type": "object",
7 | // "properties": {
8 | // "UseDeveloperExceptionPage": {
9 | // "type": "boolean",
10 | // "description": "Enables DeveloperExceptionPage"
11 | // }
12 | // },
13 | // "required": [ "UseDeveloperExceptionPage" ]
14 | //}
15 | }
16 | }
--------------------------------------------------------------------------------
/ConsoleTools/Power/Commands/Position.cs:
--------------------------------------------------------------------------------
1 | // ReSharper disable once CheckNamespace
2 | namespace aemarcoCommons.ConsoleTools;
3 |
4 | public static partial class PowerConsole
5 | {
6 | public static void ClearCurrentLine()
7 | {
8 | var currentLineCursor = Console.CursorTop;
9 | Console.SetCursorPosition(0, Console.CursorTop);
10 | Console.Write(new string(' ', Console.WindowWidth));
11 | Console.SetCursorPosition(0, currentLineCursor);
12 | }
13 |
14 | }
--------------------------------------------------------------------------------
/Extensions/TextExtensions/FormattingExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Linq;
3 |
4 | namespace aemarcoCommons.Extensions.TextExtensions;
5 |
6 | public static class FormattingExtensions
7 | {
8 | public static string PrettifyXml(this string xml)
9 | {
10 | return XElement.Parse(xml).ToString();
11 | }
12 |
13 |
14 | public static bool IsAbsoluteUri(this string uri)
15 | {
16 | return Uri.TryCreate(uri, UriKind.Absolute, out _);
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/WpfTools/Commands/OpenWindowCommand.cs:
--------------------------------------------------------------------------------
1 | using aemarcoCommons.WpfTools.BaseModels;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using System;
4 |
5 | namespace aemarcoCommons.WpfTools.Commands;
6 |
7 | public class OpenWindowCommand : DelegateCommand
8 | where T : IWindow
9 | {
10 | public OpenWindowCommand(IServiceProvider serviceProvider)
11 | {
12 | CommandAction = _ =>
13 | {
14 | serviceProvider.GetRequiredService().Show();
15 | };
16 | }
17 | }
--------------------------------------------------------------------------------
/WpfTools/Commands/OpenDialogCommand.cs:
--------------------------------------------------------------------------------
1 | using aemarcoCommons.WpfTools.BaseModels;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using System;
4 |
5 | namespace aemarcoCommons.WpfTools.Commands;
6 |
7 | public class OpenDialogCommand : DelegateCommand
8 | where T : IWindow
9 | {
10 | public OpenDialogCommand(IServiceProvider serviceProvider)
11 | {
12 | CommandAction = _ =>
13 | {
14 | serviceProvider.GetRequiredService().ShowDialog();
15 | };
16 | }
17 | }
--------------------------------------------------------------------------------
/Toolbox/README.md:
--------------------------------------------------------------------------------
1 | # `aemarcoToolbox`
2 |
3 | 
4 |
5 | ## Table of Contents
6 |
7 | 1. [Packages](#packages)
8 |
9 |
10 | ## Packages
11 |
12 | [CliWrap](https://github.com/Tyrrrz/CliWrap) is a library for interacting with external command line interfaces. It provides a convenient model for launching processes, redirecting input and output streams, awaiting completion, handling cancellation, and more.
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ToolboxAppOptions/ISettingsBase.cs:
--------------------------------------------------------------------------------
1 | namespace aemarcoCommons.ToolboxAppOptions;
2 |
3 | ///
4 | /// This interface is to mark setting classes, so they get recognized as such
5 | ///
6 | public interface ISettingsBase;
7 |
8 | ///
9 | /// Custom Path in IConfiguration
10 | /// ex. empty string means root,
11 | /// ex. "Abc:Def"
12 | ///
13 | [AttributeUsage(AttributeTargets.Class)]
14 | public class SettingsPathAttribute(string path) : Attribute
15 | {
16 | public readonly string Path = path;
17 | }
--------------------------------------------------------------------------------
/ConsoleTools/Power/Spectre/Status.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | // ReSharper disable once CheckNamespace
4 | namespace aemarcoCommons.ConsoleTools;
5 |
6 | public static partial class PowerConsole
7 | {
8 | public static async Task StartStatusAsync(
9 | Func> work)
10 | {
11 | return await AnsiConsole.Status()
12 | .SpinnerStyle(Style.Parse("green"))
13 | .StartAsync(
14 | "[purple]Doing stuff...[/]",
15 | work);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ConsoleTools/Power/Commands/Window.cs:
--------------------------------------------------------------------------------
1 | using aemarcoCommons.ConsoleTools.Interop;
2 | using System.Runtime.Versioning;
3 |
4 | // ReSharper disable once CheckNamespace
5 | namespace aemarcoCommons.ConsoleTools;
6 |
7 | public static partial class PowerConsole
8 | {
9 |
10 | [SupportedOSPlatform("windows")]
11 | public static void ShowWindow()
12 | {
13 | WindowVisibility.Show();
14 | }
15 |
16 | [SupportedOSPlatform("windows")]
17 | public static void HideWindow()
18 | {
19 | WindowVisibility.Hide();
20 | }
21 | }
--------------------------------------------------------------------------------
/Tests/ToolboxTopServiceManualTests/ToolboxTopServiceManualTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net9.0-windows
6 | enable
7 | false
8 |
9 | SomeServiceTest
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Tests/WpfToolsManualTests/WpfToolsManualTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | net9.0-windows10.0.19041.0
7 | 10.0
8 |
9 | WinExe
10 | true
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/WebTools/Filter/ValidationFilter.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc;
2 | using Microsoft.AspNetCore.Mvc.Filters;
3 |
4 | namespace aemarcoCommons.WebTools.Filter;
5 |
6 | public class ValidationFilter : IActionFilter
7 | {
8 | public void OnActionExecuting(ActionExecutingContext context)
9 | {
10 | if (!context.ModelState.IsValid)
11 | {
12 | context.Result = new BadRequestObjectResult(context.ModelState);
13 | }
14 | }
15 |
16 | public void OnActionExecuted(ActionExecutedContext context)
17 | {
18 |
19 | }
20 | }
--------------------------------------------------------------------------------
/Extensions/FileExtensions/FileSystemStuff.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.IO;
3 |
4 | namespace aemarcoCommons.Extensions.FileExtensions;
5 |
6 | public static class FileSystemStuff
7 | {
8 | public static Process OpenFileOrFolder(this FileInfo fileOrFolderPath)
9 | {
10 | var result = new Process
11 | {
12 | StartInfo = new ProcessStartInfo(fileOrFolderPath.FullName)
13 | {
14 | UseShellExecute = true
15 | }
16 | };
17 | result.Start();
18 | return result;
19 | }
20 | }
--------------------------------------------------------------------------------
/Tests/WpfToolsManualTests/View/TestWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Extensions/StorageExtensions/ReflectionStuff.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Reflection;
3 |
4 | namespace aemarcoCommons.Extensions.StorageExtensions;
5 |
6 | public static class ReflectionStuff
7 | {
8 |
9 | public static string GetEntryDirectory()
10 | {
11 | return Assembly.GetEntryAssembly().GetDirectory();
12 | }
13 |
14 |
15 | public static string GetDirectory(this Assembly assembly)
16 | {
17 | var assemblyLocation = assembly.Location;
18 | var di = new FileInfo(assemblyLocation).Directory;
19 | return di?.FullName;
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/Tests/ExtensionsTests/CryptoExtensionsTests/Base64StuffTests.cs:
--------------------------------------------------------------------------------
1 | using aemarcoCommons.Extensions.CryptoExtensions;
2 | using FluentAssertions;
3 | using NUnit.Framework;
4 |
5 | namespace ExtensionsTests.CryptoExtensionsTests;
6 |
7 | public class Base64StuffTests
8 | {
9 |
10 | [TestCase("test", "CY9rzUYh03PK3k6DJie09g==")]
11 | [TestCase("oMyDear", "d7gPbeNldisHAEjR9Zq7OQ==")]
12 | public void ToBase64HashString_Returns_Correctly(string text, string expected)
13 | {
14 |
15 | var result = text.ToBase64HashString();
16 | result.Should().Be(expected);
17 | }
18 |
19 |
20 | }
--------------------------------------------------------------------------------
/ConsoleTools/Progress/ConsoleInlineProgressBar.cs:
--------------------------------------------------------------------------------
1 | // ReSharper disable once CheckNamespace
2 | namespace aemarcoCommons.ConsoleTools;
3 |
4 | ///
5 | /// This progress bar fits, if console outputs are written in between progress steps
6 | ///
7 | public class ConsoleInlineProgressBar : ConsoleProgressBar
8 | {
9 | public override void UpdateProgress(long done, long total)
10 | {
11 | if (Console.CursorLeft > 0) Console.WriteLine();
12 | RememberColors();
13 | //draw progress bar
14 | DrawProgressLine(done, total);
15 | RestoreColors();
16 | }
17 | }
--------------------------------------------------------------------------------
/WebTools/Models/ErrorResponse.cs:
--------------------------------------------------------------------------------
1 | // ReSharper disable MemberCanBePrivate.Global
2 | // ReSharper disable UnusedAutoPropertyAccessor.Global
3 | namespace aemarcoCommons.WebTools.Models;
4 |
5 | public class ErrorResponse
6 | {
7 | public ErrorResponse(int statusCode, string message)
8 | {
9 | StatusCode = statusCode;
10 | Message = message;
11 | }
12 |
13 | ///
14 | /// Http Status Code
15 | ///
16 | public int StatusCode { get; }
17 |
18 | ///
19 | /// some message
20 | ///
21 | public string Message { get; }
22 | }
--------------------------------------------------------------------------------
/Tests/ExtensionsTests/CryptoExtensionsTests/HexStuffTests.cs:
--------------------------------------------------------------------------------
1 | using aemarcoCommons.Extensions.CryptoExtensions;
2 | using FluentAssertions;
3 | using NUnit.Framework;
4 |
5 | namespace ExtensionsTests.CryptoExtensionsTests;
6 |
7 | public class HexStuffTests
8 | {
9 |
10 |
11 | [TestCase("test", "098F6BCD4621D373CADE4E832627B4F6")]
12 | [TestCase("oMyDear", "77B80F6DE365762B070048D1F59ABB39")]
13 | public void ToHexHashString_Returns_Correctly(string text, string expected)
14 | {
15 |
16 | var result = text.ToHexHashString();
17 | result.Should().Be(expected);
18 | }
19 |
20 |
21 |
22 | }
--------------------------------------------------------------------------------
/WpfTools/Commands/DelegateCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 |
4 | namespace aemarcoCommons.WpfTools.Commands;
5 |
6 | ///
7 | /// Simplistic delegate command .
8 | ///
9 | public class DelegateCommand : BaseCommand
10 | {
11 | public Func