35 lines
756 B
C#
35 lines
756 B
C#
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...");
|
|
}
|