From 3a9784a5f9645a46aca3d27b62acb230648965c4 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Sun, 30 Oct 2022 14:18:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E7=94=A8=E6=88=B7`Ctrl+C`=20?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=85=89=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE/Program.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/N_m3u8DL-RE/Program.cs b/src/N_m3u8DL-RE/Program.cs index 0cb4994..b5432d3 100644 --- a/src/N_m3u8DL-RE/Program.cs +++ b/src/N_m3u8DL-RE/Program.cs @@ -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;