using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace PlatformDetector_CS {
class PlatformDetector {
[DllImport("coredll.dll")]
private static extern bool SystemParametersInfo(int uiAction, int uiParam,
StringBuilder pvParam, int fWinIni);
private static int SPI_GETPLATFORMTYPE = 257;
public static Platform GetPlatform() {
Platform plat = Platform.Unknown;
switch (System.Environment.OSVersion.Platform) {
case PlatformID.Win32NT:
plat = Platform.Win32NT;
break;
case PlatformID.WinCE:
plat = CheckWinCEPlatform();
break;
}
return plat;
}
static Platform CheckWinCEPlatform() {
Platform plat = Platform.WindowsCE;
StringBuilder strbuild = new StringBuilder(200);
SystemParametersInfо(SPI_GETPLATFORMTYPE, 200, strbuild, 0);
string str = strbuild.ToString();
switch (str) {
case "PocketPC":
plat = Platform.PocketPC;
break;