-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathTargetPlatformHelper.cs
65 lines (57 loc) · 1.43 KB
/
TargetPlatformHelper.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
#nullable enable
using System;
using System.Collections.Generic;
using System.Text;
namespace DotNetCheck
{
public static class TargetPlatformHelper
{
public static TargetPlatform GetTargetPlatformsFromFlags(string[]? targetPlatformFlags)
{
if (targetPlatformFlags == null || targetPlatformFlags.Length == 0)
{
return TargetPlatform.All;
}
var output = TargetPlatform.None;
foreach (var flag in targetPlatformFlags)
{
output |= GetTargetPlatformFromFlag(flag);
}
return output;
}
public static TargetPlatform GetTargetPlatformFromFlag(string flag)
{
switch (flag.ToLowerInvariant())
{
case "webassembly":
case "wasm":
return TargetPlatform.WebAssembly;
case "ios":
return TargetPlatform.iOS;
case "android":
case "droid":
return TargetPlatform.Android;
case "macos":
return TargetPlatform.macOS;
case "skiadesktop":
return TargetPlatform.SkiaDesktop;
case "windows":
case "wasdk":
return TargetPlatform.WinAppSDK;
case "win32desktop":
case "win32":
return TargetPlatform.Windows;
case "skia":
return TargetPlatform.SkiaDesktop;
case "linux":
return TargetPlatform.SkiaDesktop;
case "web":
return TargetPlatform.WebAssembly;
case "all":
return TargetPlatform.All;
default:
return TargetPlatform.None;
}
}
}
}