// Copyright (c) Dapplo and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; namespace GreenshotPlugin.Core { /// /// Extension methods to test the windows version /// public static class WindowsVersion { /// /// Get the current windows version /// public static Version WinVersion { get; } = Environment.OSVersion.Version; /// /// Test if the current OS is Windows 10 /// /// true if we are running on Windows 10 public static bool IsWindows10 { get; } = WinVersion.Major == 10; /// /// Test if the current OS is Windows 10 or later /// /// true if we are running on Windows 10 or later public static bool IsWindows10OrLater { get; } = WinVersion.Major >= 10; /// /// Test if the current OS is Windows 8.1 or later /// /// true if we are running on Windows 8.1 or later public static bool IsWindows81OrLater { get; } = WinVersion.Major == 6 && WinVersion.Minor >= 3 || WinVersion.Major > 6; /// /// Test if the current OS is Windows 8 or later /// /// true if we are running on Windows 8 or later public static bool IsWindows8OrLater { get; } = WinVersion.Major == 6 && WinVersion.Minor >= 2 || WinVersion.Major > 6; /// /// Test if the current OS is Windows Vista or later /// /// true if we are running on Windows Vista or later public static bool IsWindowsVistaOrLater { get; } = WinVersion.Major >= 6; /// /// Returns the windows build number /// public static int BuildVersion => WinVersion.Build; /// /// Test if the current Windows version is 10 and the build number or later /// See the build numbers here /// /// int /// bool public static bool IsWindows10BuildOrLater(int minimalBuildNumber) { return IsWindows10 && WinVersion.Build >= minimalBuildNumber; } } }