From f428de3fd74b33edb4e05a194190ef1df396660f Mon Sep 17 00:00:00 2001 From: Space Time Date: Sun, 29 Dec 2024 22:16:58 +0800 Subject: [PATCH] =?UTF-8?q?1.1.4=20->=201.1.5=20=E7=AC=AC15=E6=AC=A1?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utils/DnsFlusher.cs | 11 +++++++++++ Wins/MainWin.xaml.cs | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 Utils/DnsFlusher.cs diff --git a/Utils/DnsFlusher.cs b/Utils/DnsFlusher.cs new file mode 100644 index 0000000..e6353bb --- /dev/null +++ b/Utils/DnsFlusher.cs @@ -0,0 +1,11 @@ +using System.Runtime.InteropServices; + +namespace Sheas_Cealer.Utils; + +internal static partial class DnsFlusher +{ + [LibraryImport("dnsapi.dll")] + private static partial void DnsFlushResolverCache(); + + internal static void FlushDns() => DnsFlushResolverCache(); +} diff --git a/Wins/MainWin.xaml.cs b/Wins/MainWin.xaml.cs index 16263e4..b72be1b 100644 --- a/Wins/MainWin.xaml.cs +++ b/Wins/MainWin.xaml.cs @@ -335,6 +335,8 @@ public partial class MainWin : Window if (sender == null) MihomoButtonHoldTimer_Tick(null, EventArgs.Empty); + + DnsFlusher.FlushDns(); } finally {