From 3980a8fd42942ba1292b7ef516efdfb9a4779ff0 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Mon, 26 Dec 2022 23:35:49 +0200 Subject: [PATCH] Add project files. --- GoDaddyDDNS.sln | 30 +++++++++++++++++++ src/GoDaddyDDNS/GoDaddyDDNS.csproj | 11 +++++++ src/GoDaddyDDNS/Program.cs | 24 +++++++++++++++ .../Properties/launchSettings.json | 11 +++++++ src/GoDaddyDDNS/Worker.cs | 29 ++++++++++++++++++ src/GoDaddyDDNS/appsettings.Development.json | 9 ++++++ src/GoDaddyDDNS/appsettings.json | 9 ++++++ 7 files changed, 123 insertions(+) create mode 100644 GoDaddyDDNS.sln create mode 100644 src/GoDaddyDDNS/GoDaddyDDNS.csproj create mode 100644 src/GoDaddyDDNS/Program.cs create mode 100644 src/GoDaddyDDNS/Properties/launchSettings.json create mode 100644 src/GoDaddyDDNS/Worker.cs create mode 100644 src/GoDaddyDDNS/appsettings.Development.json create mode 100644 src/GoDaddyDDNS/appsettings.json diff --git a/GoDaddyDDNS.sln b/GoDaddyDDNS.sln new file mode 100644 index 0000000..62af76a --- /dev/null +++ b/GoDaddyDDNS.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32526.322 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0935CA6B-5C67-4503-9700-849721AAA61E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoDaddyDDNS", "src\GoDaddyDDNS\GoDaddyDDNS.csproj", "{63210018-9CF9-48ED-A99B-BE6B29F2B080}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {63210018-9CF9-48ED-A99B-BE6B29F2B080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63210018-9CF9-48ED-A99B-BE6B29F2B080}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63210018-9CF9-48ED-A99B-BE6B29F2B080}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63210018-9CF9-48ED-A99B-BE6B29F2B080}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {63210018-9CF9-48ED-A99B-BE6B29F2B080} = {0935CA6B-5C67-4503-9700-849721AAA61E} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E63BBED3-135D-485D-B166-9EFB05C7AAA3} + EndGlobalSection +EndGlobal diff --git a/src/GoDaddyDDNS/GoDaddyDDNS.csproj b/src/GoDaddyDDNS/GoDaddyDDNS.csproj new file mode 100644 index 0000000..c52d18c --- /dev/null +++ b/src/GoDaddyDDNS/GoDaddyDDNS.csproj @@ -0,0 +1,11 @@ + + + + net5.0 + dotnet-GoDaddyDDNS-FB6B86D1-EE02-4695-9CFC-3552E66F6B4F + + + + + + diff --git a/src/GoDaddyDDNS/Program.cs b/src/GoDaddyDDNS/Program.cs new file mode 100644 index 0000000..c5c50ec --- /dev/null +++ b/src/GoDaddyDDNS/Program.cs @@ -0,0 +1,24 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace GoDaddyDDNS +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); + } +} diff --git a/src/GoDaddyDDNS/Properties/launchSettings.json b/src/GoDaddyDDNS/Properties/launchSettings.json new file mode 100644 index 0000000..dff8715 --- /dev/null +++ b/src/GoDaddyDDNS/Properties/launchSettings.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "GoDaddyDDNS": { + "commandName": "Project", + "dotnetRunMessages": "true", + "environmentVariables": { + "DOTNET_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/GoDaddyDDNS/Worker.cs b/src/GoDaddyDDNS/Worker.cs new file mode 100644 index 0000000..916db0e --- /dev/null +++ b/src/GoDaddyDDNS/Worker.cs @@ -0,0 +1,29 @@ +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace GoDaddyDDNS +{ + public class Worker : BackgroundService + { + private readonly ILogger _logger; + + public Worker(ILogger logger) + { + _logger = logger; + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + while (!stoppingToken.IsCancellationRequested) + { + _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); + await Task.Delay(1000, stoppingToken); + } + } + } +} diff --git a/src/GoDaddyDDNS/appsettings.Development.json b/src/GoDaddyDDNS/appsettings.Development.json new file mode 100644 index 0000000..8983e0f --- /dev/null +++ b/src/GoDaddyDDNS/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/src/GoDaddyDDNS/appsettings.json b/src/GoDaddyDDNS/appsettings.json new file mode 100644 index 0000000..8983e0f --- /dev/null +++ b/src/GoDaddyDDNS/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +}