处理用户`Ctrl+C` 显示光标

This commit is contained in:
nilaoda 2022-10-30 14:18:11 +08:00
parent a13d3c1f7a
commit 3a9784a5f9
1 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,7 @@ namespace N_m3u8DL_RE
{
static async Task Main(string[] args)
{
Console.CancelKeyPress += Console_CancelKeyPress;
ServicePointManager.DefaultConnectionLimit = 1024;
try { Console.CursorVisible = true; } catch { }
string loc = "en-US";
@ -44,6 +45,13 @@ namespace N_m3u8DL_RE
await CommandInvoker.InvokeArgs(args, DoWorkAsync);
}
private static void Console_CancelKeyPress(object? sender, ConsoleCancelEventArgs e)
{
Logger.WarnMarkUp("Force Exit...");
try { Console.CursorVisible = true; } catch { }
Environment.Exit(0);
}
static int GetOrder(StreamSpec streamSpec)
{
if (streamSpec.Channels == null) return 0;