diff --git a/.gitignore b/.gitignore index 805283c..6306472 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +bin/ +obj/ + # ---> VisualStudioCode .vscode/* !.vscode/settings.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..945096e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/bin/Debug/net6.0/deep-cms.dll", + "args": [], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..c94cf57 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,41 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/deep-cms.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/deep-cms.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/deep-cms.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..4033e0a --- /dev/null +++ b/Program.cs @@ -0,0 +1,20 @@ +using tias.deep.CMS; +using Microsoft.Extensions.Hosting; + +public class Program +{ + public static void Main(string[] args) + { + IHost host = Host.CreateDefaultBuilder(args) + .ConfigureServices(services => + { + services.AddHostedService(); + }) + .UseSystemd() + .UseWindowsService() + .Build(); + + + host.Run(); + } +} diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..dfe90d1 --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "deep_cms": { + "commandName": "Project", + "dotnetRunMessages": true, + "environmentVariables": { + "DOTNET_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Worker.cs b/Worker.cs new file mode 100644 index 0000000..c747407 --- /dev/null +++ b/Worker.cs @@ -0,0 +1,33 @@ +namespace tias.deep.CMS; + +public class Worker : BackgroundService +{ + private tias.deep.server.core.Init _server; + + public Worker() + { + this._server = new tias.deep.server.core.Init(); + } + + public override Task StartAsync(CancellationToken cancellationToken) + { + _server.StartServer(false); + + return base.StartAsync(cancellationToken); + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + while (!stoppingToken.IsCancellationRequested) + { + await Task.Delay(1000, stoppingToken); + } + } + + public override Task StopAsync(CancellationToken cancellationToken) + { + _server.StopServer(); + + return base.StopAsync(cancellationToken); + } +} diff --git a/appsettings.Development.json b/appsettings.Development.json new file mode 100644 index 0000000..6063737 --- /dev/null +++ b/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "None" + } + } +} diff --git a/appsettings.json b/appsettings.json new file mode 100644 index 0000000..6063737 --- /dev/null +++ b/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "None" + } + } +} diff --git a/deep-cms.csproj b/deep-cms.csproj new file mode 100644 index 0000000..f281cba --- /dev/null +++ b/deep-cms.csproj @@ -0,0 +1,30 @@ + + + + net6.0 + enable + enable + dotnet-deep_cms-101b2c8f-ab12-408d-95e1-fab0acc1536e + tias.deep.CMS + + + + + + + + + + + + + + + + + + + + + +