From 513667d983c7862ff904ef15131e9e67fe792af1 Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Tue, 6 Oct 2020 00:57:54 +0800 Subject: [PATCH] fix: IsWindows10Upper not assigned caused NetTraffic won't be displayed at the first start fix: SupportFakeDns flag lazyload --- Netch/Global.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Netch/Global.cs b/Netch/Global.cs index 53c5a7db..1877dc16 100644 --- a/Netch/Global.cs +++ b/Netch/Global.cs @@ -28,17 +28,10 @@ namespace Netch public static class Flags { - static Flags() - { - Task.Run(() => - { - SupportFakeDns = new TUNTAPController().TestFakeDNS(); - IsWindows10Upper = Environment.OSVersion.Version.Major >= 10; - }); - } + public static bool SupportFakeDns => _supportFakeDns ??= new TUNTAPController().TestFakeDNS(); + public static readonly bool IsWindows10Upper = Environment.OSVersion.Version.Major >= 10; - public static bool SupportFakeDns; - public static bool IsWindows10Upper; + private static bool? _supportFakeDns; } ///