From ee95ce38c156366614c3a2027e1894dd08fca1c2 Mon Sep 17 00:00:00 2001 From: hzhang Date: Sun, 9 Mar 2025 11:51:30 +0000 Subject: [PATCH] init --- .gitignore | 5 +++++ Alchegos.Developer.csproj | 13 +++++++++++++ Alchegos.Developer.sln | 16 ++++++++++++++++ Program.cs | 7 +++++++ Properties/launchSettings.json | 12 ++++++++++++ Worker.cs | 24 ++++++++++++++++++++++++ appsettings.Development.json | 8 ++++++++ appsettings.json | 8 ++++++++ 8 files changed, 93 insertions(+) create mode 100644 .gitignore create mode 100644 Alchegos.Developer.csproj create mode 100644 Alchegos.Developer.sln create mode 100644 Program.cs create mode 100644 Properties/launchSettings.json create mode 100644 Worker.cs create mode 100644 appsettings.Development.json create mode 100644 appsettings.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..add57be --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +bin/ +obj/ +/packages/ +riderModule.iml +/_ReSharper.Caches/ \ No newline at end of file diff --git a/Alchegos.Developer.csproj b/Alchegos.Developer.csproj new file mode 100644 index 0000000..c5e175e --- /dev/null +++ b/Alchegos.Developer.csproj @@ -0,0 +1,13 @@ + + + + net9.0 + enable + enable + dotnet-Alchegos.Developer-5cea2de1-4604-457a-91af-77f34a876606 + + + + + + diff --git a/Alchegos.Developer.sln b/Alchegos.Developer.sln new file mode 100644 index 0000000..c688ee4 --- /dev/null +++ b/Alchegos.Developer.sln @@ -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 diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..8dfada3 --- /dev/null +++ b/Program.cs @@ -0,0 +1,7 @@ +using Alchegos.Developer; + +var builder = Host.CreateApplicationBuilder(args); +builder.Services.AddHostedService(); + +var host = builder.Build(); +host.Run(); \ No newline at end of file diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..dc80a13 --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "Alchegos.Developer": { + "commandName": "Project", + "dotnetRunMessages": true, + "environmentVariables": { + "DOTNET_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Worker.cs b/Worker.cs new file mode 100644 index 0000000..cd3766f --- /dev/null +++ b/Worker.cs @@ -0,0 +1,24 @@ +namespace Alchegos.Developer; + +public class Worker : BackgroundService +{ + private readonly ILogger _logger; + + public Worker(ILogger 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); + } + } +} \ No newline at end of file diff --git a/appsettings.Development.json b/appsettings.Development.json new file mode 100644 index 0000000..b2dcdb6 --- /dev/null +++ b/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/appsettings.json b/appsettings.json new file mode 100644 index 0000000..b2dcdb6 --- /dev/null +++ b/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } + } +}