English 中文(简体)
B. 侦查不同的操作系统和平台
原标题:Detecting different operating systems and platforms

I am working on a Cross-Platform open-source project. My application is going to support Android, iOS, MAC OS X, Windows and Linux.

第一种想法是使用以下法典:

Environment.OSVersion.Platform

但是,这还不够,因为我无法涵盖SiOS和Andre。 我认为,最好检查监督厅的基础和版本,以决定哪类工作。 例如,SOS是一种基于UNIX的操作系统。 因此,我可以检查版本或其他一些特性,以确保其是Si。

页: 1 我无法接触安乐斯或里科,我的搜寻工作并不成功,我需要你帮助为每个顾问办公室提供这些版本。

Sincerely yours, Peyman Mortazavi

最佳回答

如何做到这一点?

public static bool IsAndroid {
   get {
      return (Type.GetType("Android.Runtime") != null);
   }
}

也许:

public static bool IsIphoneOS {
   get {
      return (Type.GetType("MonoTouch.Constants") != null);
   }
}

我只相信莫诺托什或莫奥安永的工作,但你可以采取同样的做法。 无论这种价值,还是依赖对您的建筑平台的正确标准价值。

问题回答

我热爱我的跨平台功能。 目前,我必须设立一个职能,每个平台都发出具体平台电话。

#ifdef Q_WS_MACX
 return "MAC";
#else
 return "LINUX";
#endif

Obviously I do this in C++ Qt





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签