forked from sim0n00ps/OF-DL
23 lines
508 B
C#
23 lines
508 B
C#
using OF_DL.Services;
|
|
using Serilog;
|
|
|
|
namespace OF_DL.Helpers;
|
|
|
|
public class ExitHelper(IDownloadEventHandler eventHandler)
|
|
{
|
|
private readonly IDownloadEventHandler _eventHandler = eventHandler;
|
|
|
|
public void ExitWithCode(int exitCode)
|
|
{
|
|
Console.WriteLine();
|
|
|
|
_eventHandler?.OnMessage("Exiting run with Code '{exitCode}'..");
|
|
|
|
Log.CloseAndFlush();
|
|
Log.CloseAndFlush();
|
|
Task.Delay(5000).GetAwaiter().GetResult();
|
|
|
|
Environment.Exit(exitCode);
|
|
}
|
|
}
|