Add project files.

master
Tudor Stanciu 2022-12-26 23:35:49 +02:00
parent ea95806354
commit 3980a8fd42
7 changed files with 123 additions and 0 deletions

30
GoDaddyDDNS.sln Normal file
View File

@ -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

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId>dotnet-GoDaddyDDNS-FB6B86D1-EE02-4695-9CFC-3552E66F6B4F</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
</ItemGroup>
</Project>

View File

@ -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<Worker>();
});
}
}

View File

@ -0,0 +1,11 @@
{
"profiles": {
"GoDaddyDDNS": {
"commandName": "Project",
"dotnetRunMessages": "true",
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}

29
src/GoDaddyDDNS/Worker.cs Normal file
View File

@ -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<Worker> _logger;
public Worker(ILogger<Worker> 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);
}
}
}
}

View File

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

View File

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