forked from ServiceStack/ServiceStack.Text
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnv.cs
More file actions
53 lines (37 loc) · 1.35 KB
/
Env.cs
File metadata and controls
53 lines (37 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
namespace ServiceStack.Text
{
public static class Env
{
static Env()
{
string platformName = null;
#if NETFX_CORE
IsWinRT = true;
platformName = "WinRT";
#else
var platform = (int)Environment.OSVersion.Platform;
IsUnix = (platform == 4) || (platform == 6) || (platform == 128);
platformName = Environment.OSVersion.Platform.ToString();
#endif
IsMono = AssemblyUtils.FindType("Mono.Runtime") != null;
IsMonoTouch = AssemblyUtils.FindType("MonoTouch.Foundation.NSObject") != null;
IsWinRT = AssemblyUtils.FindType("Windows.ApplicationModel") != null;
SupportsExpressions = SupportsEmit = !IsMonoTouch;
ServerUserAgent = "ServiceStack/" +
ServiceStackVersion + " "
+ platformName
+ (IsMono ? "/Mono" : "/.NET")
+ (IsMonoTouch ? " MonoTouch" : "")
+ (IsWinRT ? ".NET WinRT" : "");
}
public static decimal ServiceStackVersion = 3.958m;
public static bool IsUnix { get; set; }
public static bool IsMono { get; set; }
public static bool IsMonoTouch { get; set; }
public static bool IsWinRT { get; set; }
public static bool SupportsExpressions { get; set; }
public static bool SupportsEmit { get; set; }
public static string ServerUserAgent { get; set; }
}
}