initial commit

This commit is contained in:
Simon Diesenreiter
2025-04-15 13:14:56 +02:00
commit 216ebeaff5
7 changed files with 219 additions and 0 deletions

12
Demo/Demo.csproj Normal file
View File

@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net48;net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\CronTimer.csproj" />
</ItemGroup>
</Project>

22
Demo/Program.cs Normal file
View File

@@ -0,0 +1,22 @@
using System;
namespace Demo
{
class Program
{
static void Main()
{
var expression = "0-30/5 * * * * *";
Console.WriteLine(expression);
var timer = new CronTimer(expression, "Asia/Hong_Kong", includingSeconds: true);
timer.OnOccurence += (s, ea) => Console.WriteLine($"{ea.At:T} - {DateTime.Now}");
timer.Start();
while (Console.ReadKey().Key != ConsoleKey.Escape)
{
}
timer.Stop();
}
}
}