initial commit
This commit is contained in:
34
Lab505.Sim/Program.cs
Normal file
34
Lab505.Sim/Program.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
Console.WriteLine("=== Lab505 WAS Simulators ===");
|
||||
Console.WriteLine("Starting VDA5050 API Simulator...\n");
|
||||
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
// Add logging
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.AddConsole();
|
||||
builder.Logging.SetMinimumLevel(LogLevel.Information);
|
||||
|
||||
// Register simulator
|
||||
|
||||
var host = builder.Build();
|
||||
|
||||
// Wait for cancellation
|
||||
var cts = new CancellationTokenSource();
|
||||
Console.CancelKeyPress += (s, e) =>
|
||||
{
|
||||
e.Cancel = true;
|
||||
cts.Cancel();
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Delay(Timeout.Infinite, cts.Token);
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
Console.WriteLine("\nShutting down...");
|
||||
}
|
||||
Reference in New Issue
Block a user