This commit is contained in:
h z
2025-03-09 11:51:30 +00:00
commit ee95ce38c1
8 changed files with 93 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/

13
Alchegos.Developer.csproj Normal file
View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-Alchegos.Developer-5cea2de1-4604-457a-91af-77f34a876606</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.2"/>
</ItemGroup>
</Project>

16
Alchegos.Developer.sln Normal file
View File

@@ -0,0 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Alchegos.Developer", "Alchegos.Developer.csproj", "{A1475FCE-A06E-4E71-9B39-2317A476CA4B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A1475FCE-A06E-4E71-9B39-2317A476CA4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1475FCE-A06E-4E71-9B39-2317A476CA4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1475FCE-A06E-4E71-9B39-2317A476CA4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1475FCE-A06E-4E71-9B39-2317A476CA4B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

7
Program.cs Normal file
View File

@@ -0,0 +1,7 @@
using Alchegos.Developer;
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddHostedService<Worker>();
var host = builder.Build();
host.Run();

View File

@@ -0,0 +1,12 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"Alchegos.Developer": {
"commandName": "Project",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}

24
Worker.cs Normal file
View File

@@ -0,0 +1,24 @@
namespace Alchegos.Developer;
public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;
public Worker(ILogger<Worker> logger)
{
_logger = logger;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
if (_logger.IsEnabled(LogLevel.Information))
{
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
}
await Task.Delay(1000, stoppingToken);
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

8
appsettings.json Normal file
View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}