/// <summary> /// Identifies the current platform and used frameworks. /// </summary> private static void IdentifyPlatform() { // find base platform. #if WINDOWS && DESKTOP Platform = Platforms.Windows; Handler = new Windows.WindowsPlatform(); Helper = new Windows.WindowsHelper(); #elif WINDOWS && METRO Platform = Platforms.WindowsMetro; Handler = new WindowsMetro.WindowsMetroPlatform(); Helper = new WindowsMetro.WindowsMetroHelper(); #elif LINUX && DESKTOP Platform = Platforms.Linux; Handler = new Linux.LinuxPlatform(); #elif MACOS && DESKTOP Platform = Platforms.MacOS; Handler = new MacOS.MacOSPlatform(); #elif WINPHONE7 Platform = Platforms.WindowsPhone7; Handler = new WindowsPhone7.WindowsPhone7Platform(); Helper = new WindowsPhone7.WindowsPhone7Helper(); #elif WINPHONE8 Platform = Platforms.WindowsPhone8; Handler = new WindowsPhone8.WindowsPhone8Platform(); Helper = new WindowsPhone8.WindowsPhone8Helper(); #elif ANDROID Platform = Platforms.Android; Handler = new Android.AndroidPlatform(); #elif IOS Platform = Platforms.IOS; Handler = new IOS.IOSPlatform(); #endif if (Handler == null) throw new Exception("Unsupported platform!"); // find dot.net framework. DotNetFramework = IsRunningOnMono() ? NetFrameworks.Mono : NetFrameworks.DotNet; // find dot.net framework and game framework version. #if METRO DotNetFrameworkVersion = System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(Object)).Assembly.GetName().Version; GameFrameworkVersion = System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(Microsoft.Xna.Framework.Game)).Assembly.GetName().Version; #else DotNetFrameworkVersion = Environment.Version; #if WINPHONE7 || WINPHONE8 GameFrameworkVersion = new Version(typeof(Microsoft.Xna.Framework.Game).Assembly.FullName.Split(',')[1].Split('=')[1]); #else GameFrameworkVersion = System.Reflection.Assembly.GetAssembly(typeof(Microsoft.Xna.Framework.Game)).GetName().Version; #endif #endif // find game framework & graphics-api. #if XNA GameFramework = GameFrameworks.XNA; GraphicsApi = GraphicsAPI.DirectX9; #elif MONOGAME GameFramework = GameFrameworks.MonoGame; #if DIRECTX11 GraphicsApi = GraphicsAPI.DirectX11; #elif OPENGL GraphicsApi = GraphicsAPI.OpenGL; #endif #endif }
/// <summary> /// Identifies the current platform and used frameworks. /// </summary> private static void IdentifyPlatform() { // find base platform. #if WINDOWS && DESKTOP Platform = Platforms.Windows; Handler = new Windows.WindowsPlatform(); Helper = new Windows.WindowsHelper(); #elif WINDOWS && METRO Platform = Platforms.WindowsMetro; Handler = new WindowsMetro.WindowsMetroPlatform(); Helper = new WindowsMetro.WindowsMetroHelper(); #elif LINUX && DESKTOP Platform = Platforms.Linux; Handler = new Linux.LinuxPlatform(); #elif MACOS && DESKTOP Platform = Platforms.MacOS; Handler = new MacOS.MacOSPlatform(); #elif WINPHONE7 Platform = Platforms.WindowsPhone7; Handler = new WindowsPhone7.WindowsPhone7Platform(); Helper = new WindowsPhone7.WindowsPhone7Helper(); #elif WINPHONE8 Platform = Platforms.WindowsPhone8; Handler = new WindowsPhone8.WindowsPhone8Platform(); Helper = new WindowsPhone8.WindowsPhone8Helper(); #elif ANDROID Platform = Platforms.Android; Handler = new Android.AndroidPlatform(); #elif IOS Platform = Platforms.IOS; Handler = new IOS.IOSPlatform(); #endif if (Handler == null) { throw new Exception("Unsupported platform!"); } // find dot.net framework. DotNetFramework = IsRunningOnMono() ? NetFrameworks.Mono : NetFrameworks.DotNet; // find dot.net framework and game framework version. #if METRO DotNetFrameworkVersion = System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(Object)).Assembly.GetName().Version; GameFrameworkVersion = System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(Microsoft.Xna.Framework.Game)).Assembly.GetName().Version; #else DotNetFrameworkVersion = Environment.Version; #if WINPHONE7 || WINPHONE8 GameFrameworkVersion = new Version(typeof(Microsoft.Xna.Framework.Game).Assembly.FullName.Split(',')[1].Split('=')[1]); #else GameFrameworkVersion = System.Reflection.Assembly.GetAssembly(typeof(Microsoft.Xna.Framework.Game)).GetName().Version; #endif #endif // find game framework & graphics-api. #if XNA GameFramework = GameFrameworks.XNA; GraphicsApi = GraphicsAPI.DirectX9; #elif MONOGAME GameFramework = GameFrameworks.MonoGame; #if DIRECTX11 GraphicsApi = GraphicsAPI.DirectX11; #elif OPENGL GraphicsApi = GraphicsAPI.OpenGL; #endif #endif }