forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TargetPlatform.cs
133 lines (112 loc) · 3.08 KB
/
TargetPlatform.cs
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
using System.ComponentModel;
using System.Globalization;
namespace Microsoft.Xna.Framework.Content.Pipeline
{
/// <summary>
/// Identifiers for the target platform.
/// </summary>
[TypeConverter(typeof(TargetPlatformTypeConverter))]
public enum TargetPlatform
{
/// <summary>
/// All desktop versions of Windows using DirectX.
/// </summary>
Windows,
/// <summary>
/// Xbox 360 video game and entertainment system
/// </summary>
Xbox360,
// MonoGame-specific platforms listed below
/// <summary>
/// Apple iOS-based devices (iPod Touch, iPhone, iPad)
/// (MonoGame)
/// </summary>
iOS,
/// <summary>
/// Android-based devices
/// (MonoGame)
/// </summary>
Android,
/// <summary>
/// All desktop versions using OpenGL.
/// (MonoGame)
/// </summary>
DesktopGL,
/// <summary>
/// Apple Mac OSX-based devices (iMac, MacBook, MacBook Air, etc)
/// (MonoGame)
/// </summary>
MacOSX,
/// <summary>
/// Windows Store App
/// (MonoGame)
/// </summary>
WindowsStoreApp,
/// <summary>
/// Google Chrome Native Client
/// (MonoGame)
/// </summary>
NativeClient,
/// <summary>
/// Windows Phone 8
/// (MonoGame)
/// </summary>
WindowsPhone8,
/// <summary>
/// Raspberry Pi
/// (MonoGame)
/// </summary>
RaspberryPi,
/// <summary>
/// Sony PlayStation4
/// </summary>
PlayStation4,
/// <summary>
/// Sony PlayStation5
/// </summary>
PlayStation5,
/// <summary>
/// Xbox One
/// </summary>
XboxOne,
/// <summary>
/// Nintendo Switch
/// </summary>
Switch,
/// <summary>
/// Google Stadia
/// </summary>
Stadia,
/// <summary>
/// WebAssembly and Bridge.NET
/// </summary>
Web
}
/// <summary>
/// Deserialize legacy Platforms from .MGCB files.
/// </summary>
internal class TargetPlatformTypeConverter : EnumConverter
{
public TargetPlatformTypeConverter(Type type) : base(type)
{
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
try
{
return base.ConvertFrom(context, culture, value);
}
catch (FormatException fex)
{
// convert legacy Platforms
if (value.Equals("Linux") || value.Equals("WindowsGL"))
return TargetPlatform.DesktopGL;
else throw fex;
}
}
}
}