From 98b45c41e99e7864764c826a285754738d65214e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=93=9D=E7=82=B9lilac?= Date: Tue, 24 Nov 2020 05:15:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=B3=BB=E7=BB=9F=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WindowsOsVersion.cs | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 ContextMenuManager/BulePointLilac.Methods/WindowsOsVersion.cs diff --git a/ContextMenuManager/BulePointLilac.Methods/WindowsOsVersion.cs b/ContextMenuManager/BulePointLilac.Methods/WindowsOsVersion.cs new file mode 100644 index 0000000..43af51d --- /dev/null +++ b/ContextMenuManager/BulePointLilac.Methods/WindowsOsVersion.cs @@ -0,0 +1,47 @@ +using System; + +namespace BulePointLilac.Methods +{ + //判断Windows系统版本 + public static class WindowsOsVersion + { + public static readonly Version OsVersion = Environment.OSVersion.Version; + private static readonly float ShortVersion = OsVersion.Major + OsVersion.Minor / 10; + + private const float Win10 = 10.0F; + private const float Win8_1 = 6.3F; + private const float Win8 = 6.2F; + private const float Win7 = 6.1F; + private const float Vista = 6.0F; + + public static bool IsEqual10 = ShortVersion == Win10; + public static bool IsAfter10 = ShortVersion > Win10; + public static bool IsBefore10 = ShortVersion < Win10; + public static bool ISAfterOrEqual10 = ShortVersion >= Win10; + public static bool ISBeforeOrEqual10 = ShortVersion <= Win10; + + public static bool IsEqual8_1 = ShortVersion == Win8_1; + public static bool IsAfter8_1 = ShortVersion > Win8_1; + public static bool IsBefore8_1 = ShortVersion < Win8_1; + public static bool ISAfterOrEqual8_1 = ShortVersion >= Win8_1; + public static bool ISBeforeOrEqual8_1 = ShortVersion <= Win8_1; + + public static bool IsEqual8 = ShortVersion == Win8; + public static bool IsAfter8 = ShortVersion > Win8; + public static bool IsBefore8 = ShortVersion < Win8; + public static bool ISAfterOrEqual8 = ShortVersion >= Win8; + public static bool ISBeforeOrEqual8 = ShortVersion <= Win8; + + public static bool IsEqual7 = ShortVersion == Win7; + public static bool IsAfter7 = ShortVersion > Win7; + public static bool IsBefore7 = ShortVersion < Win7; + public static bool ISAfterOrEqual7 = ShortVersion >= Win7; + public static bool ISBeforeOrEqual7 = ShortVersion <= Win7; + + public static bool IsEqualVista = ShortVersion == Vista; + public static bool IsAfterVista = ShortVersion > Vista; + public static bool IsBeforeVista = ShortVersion < Vista; + public static bool ISAfterOrEqualVista = ShortVersion >= Vista; + public static bool ISBeforeOrEqualVista = ShortVersion <= Vista; + } +} \ No newline at end of file