1 2 using System; 3 4 namespace ServiceStack.Text 5 { 6 public static class Env 7 { Env()8 static Env() 9 { 10 var platform = (int)Environment.OSVersion.Platform; 11 IsUnix = (platform == 4) || (platform == 6) || (platform == 128); 12 13 IsMono = Type.GetType("Mono.Runtime") != null; 14 15 IsMonoTouch = Type.GetType("MonoTouch.Foundation.NSObject") != null; 16 17 SupportsExpressions = SupportsEmit = !IsMonoTouch; 18 19 ServerUserAgent = "ServiceStack/" + 20 ServiceStackVersion + " " 21 + Environment.OSVersion.Platform 22 + (IsMono ? "/Mono" : "/.NET") 23 + (IsMonoTouch ? " MonoTouch" : ""); 24 } 25 26 public static decimal ServiceStackVersion = 3.55m; 27 28 public static bool IsUnix { get; set; } 29 30 public static bool IsMono { get; set; } 31 32 public static bool IsMonoTouch { get; set; } 33 34 public static bool SupportsExpressions { get; set; } 35 36 public static bool SupportsEmit { get; set; } 37 38 public static string ServerUserAgent { get; set; } 39 } 40 }