OSDN Git Service

Windows 8.1/10 version support
[applistation/AppliStation.git] / na-get-lib / NaGet.Packages / Platform.cs
index e058bc7..4fec91b 100644 (file)
@@ -20,6 +20,8 @@ namespace NaGet.Packages
                VISTA = 160,\r
                WIN7 = 161,\r
                WIN8 = 162,\r
+               WIN8_1 = 163,\r
+               WIN10 = 164,\r
        }\r
        \r
        public class Platform\r
@@ -172,13 +174,22 @@ namespace NaGet.Packages
                                                                return PlatformOSType.WIN2003;\r
                                                }\r
                                        } else if (osVer.Major == 6) {\r
-                                               switch (osVer.Minor) {\r
+                                               int osVerMinor = osVer.Minor;\r
+                                               NaGet.InteropServices.WindowsVersion.VersionInfo? verInfo = NaGet.InteropServices.WindowsVersion.GetVersionInfo();\r
+                                               if (verInfo.HasValue) {\r
+                                                       osVerMinor = (int) verInfo.Value.MinorVersion;\r
+                                               }\r
+                                               switch (osVerMinor) {\r
                                                        case 0:\r
                                                                return PlatformOSType.VISTA;\r
                                                        case 1:\r
                                                                return PlatformOSType.WIN7;\r
                                                        case 2:\r
                                                                return PlatformOSType.WIN8;\r
+                                                       case 3:\r
+                                                               return PlatformOSType.WIN8_1;\r
+                                                       case 4:\r
+                                                               return PlatformOSType.WIN10;\r
                                                }\r
                                        }\r
                                        break;\r