/// <summary>\r
/// PlatformのOSの種類をあらわす\r
/// </summary>\r
- public enum PlatformOSType\r
+ public enum PlatformOSType : ushort\r
{\r
- WIN95,\r
- WIN98,\r
- WINME,\r
+ WIN95 = 40,\r
+ WIN98 = 41,\r
+ WINME = 42,\r
\r
- WINNT4,\r
- WIN2K,\r
- WINXP,\r
- WIN2003,\r
- VISTA,\r
+ WINNT4 = 140,\r
+ WIN2K = 150,\r
+ WINXP = 151,\r
+ WIN2003 = 152,\r
+ VISTA = 160,\r
+ WIN7 = 161,\r
}\r
\r
public class Platform\r
return string.Join(",", strs);\r
}\r
set {\r
- string[] strs = (value ?? "").Split(',');\r
+ string[] strs = (value ?? string.Empty).Split(',');\r
System.Collections.Generic.List<PlatformOSType> list = new System.Collections.Generic.List<PlatformOSType>();\r
for (int i = 0; i < strs.Length; i++) {\r
try {\r
} catch (ArgumentException) {\r
}\r
}\r
+ list.Sort();\r
OsType = list.ToArray();\r
}\r
}\r
/// <returns>現在のマシンのアーキテクチャ</returns>\r
public static ProcessorArchitecture GetArch()\r
{\r
- Module[] moduleArray = Assembly.GetExecutingAssembly().GetModules();\r
- Module md = moduleArray[0];\r
- \r
+ Module[] moduleArray = Assembly.GetExecutingAssembly().GetModules();\r
+ Module md = moduleArray[0];\r
+\r
PortableExecutableKinds pekinds;\r
ImageFileMachine ifm;\r
md.GetPEKind(out pekinds, out ifm);\r
}\r
\r
/// <summary>\r
- /// ç\8f¾å\9c¨ã\81®ã\83\9eã\82·ã\83³ã\81®ã\82¢ã\83¼ã\82ã\83\86ã\82¯ã\83\81ã\83£ã\82\92å¾\97ã\82\8b\r
+ /// ç\8f¾å\9c¨ã\81®ã\83\9eã\82·ã\83³ã\81§å\8b\95ã\81\8fã\81\8bã\82\92è¿\94ã\81\99\r
/// </summary>\r
- /// <returns>ç\8f¾å\9c¨ã\81®ã\83\9eã\82·ã\83³ã\81®ã\82¢ã\83¼ã\82ã\83\86ã\82¯ã\83\81ã\83£</returns>\r
+ /// <returns>ç\8f¾å\9c¨ã\81®ã\83\9eã\82·ã\83³ã\81§å\8b\95ã\81\8fã\81\8b</returns>\r
public bool IsRunnableOS()\r
{\r
if (OsType == null || OsType.Length <= 0) {\r
return PlatformOSType.WIN2003;\r
}\r
} else if (osVer.Major == 6) {\r
- return PlatformOSType.VISTA;\r
+ switch (osVer.Minor) {\r
+ case 0:\r
+ return PlatformOSType.VISTA;\r
+ case 1:\r
+ return PlatformOSType.WIN7;\r
+ }\r
}\r
break;\r
// case PlatformID.WinCE:\r