Added Cajetan OF-DL project

This commit is contained in:
Casper Sparre 2026-02-18 17:34:28 +01:00
parent 6cc09a2b0f
commit 977b8e8733
5 changed files with 94 additions and 0 deletions

8
Cajetan.OF-DL.slnx Normal file
View File

@ -0,0 +1,8 @@
<Solution>
<Folder Name="/Cajetan/">
<Project Path="Cajetan.OF-DL/Cajetan.OF-DL.csproj" />
</Folder>
<Project Path="OF DL.Core/OF DL.Core.csproj" />
<Project Path="OF DL.Tests/OF DL.Tests.csproj" />
<Project Path="OF DL/OF DL.csproj" />
</Solution>

View File

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>OF_DL</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ApplicationIcon>Icon\download.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Content Include="Icon\download.ico" />
</ItemGroup>
<ItemGroup>
<Reference Include="Spectre.Console">
<HintPath>..\OF DL\References\Spectre.Console.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OF DL\OF DL.csproj" />
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,51 @@
using Microsoft.Extensions.DependencyInjection;
AnsiConsole.Write(new FigletText("Welcome to OF-DL").Color(Color.Red));
ServiceCollection services = await ConfigureServices(args);
static async Task<ServiceCollection> ConfigureServices(string[] args)
{
// Set up dependency injection with LoggingService and ConfigService
ServiceCollection services = new();
services.AddSingleton<ILoggingService, SeqLoggingService>();
services.AddSingleton<IConfigService, ConfigService>();
services.AddSingleton(new ExitHelper(new SpectreDownloadEventHandler()));
ServiceProvider tempServiceProvider = services.BuildServiceProvider();
ILoggingService loggingService = tempServiceProvider.GetRequiredService<ILoggingService>();
IConfigService configService = tempServiceProvider.GetRequiredService<IConfigService>();
ExitHelper exitHelper = tempServiceProvider.GetRequiredService<ExitHelper>();
if (!await configService.LoadConfigurationAsync(args))
{
AnsiConsole.MarkupLine("\n[red]config.conf is not valid, check your syntax![/]\n");
if (!configService.IsCliNonInteractive)
{
AnsiConsole.MarkupLine("[red]Press any key to exit.[/]");
Console.ReadKey();
}
exitHelper.ExitWithCode(3);
}
AnsiConsole.Markup("[green]config.conf located successfully!\n[/]");
// Set up full dependency injection with loaded config
services = [];
services.AddSingleton(loggingService);
services.AddSingleton(configService);
services.AddSingleton(exitHelper);
services.AddSingleton<IAuthService, AuthService>();
services.AddSingleton<IApiService, ApiService>();
services.AddSingleton<IDbService, DbService>();
services.AddSingleton<IDownloadService, DownloadService>();
services.AddSingleton<IFileNameService, FileNameService>();
services.AddSingleton<IStartupService, StartupService>();
services.AddSingleton<IDownloadOrchestrationService, DownloadOrchestrationService>();
services.AddSingleton<Program>();
return services;
}

View File

@ -0,0 +1,9 @@
global using Spectre.Console;
global using OF_DL;
global using OF_DL.CLI;
global using OF_DL.Crypto;
global using OF_DL.Enumerations;
global using OF_DL.Helpers;
global using OF_DL.Models;
global using OF_DL.Services;
global using OF_DL.Utils;