-
Notifications
You must be signed in to change notification settings - Fork 4k
/
OutputKind.cs
111 lines (93 loc) · 3.17 KB
/
OutputKind.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.Text;
using System;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Specifies output assembly kinds generated by compiler.
/// </summary>
public enum OutputKind
{
/// <summary>
/// An .exe with an entry point and a console.
/// </summary>
ConsoleApplication = 0,
/// <summary>
/// An .exe with an entry point but no console.
/// </summary>
WindowsApplication = 1,
/// <summary>
/// A .dll file.
/// </summary>
DynamicallyLinkedLibrary = 2,
/// <summary>
/// A .netmodule file.
/// </summary>
NetModule = 3,
/// <summary>
/// A .winmdobj file.
/// </summary>
WindowsRuntimeMetadata = 4,
/// <summary>
/// An .exe that can run in an app container.
/// <para>
/// Equivalent to a WindowsApplication, but with an extra bit set in the Portable Executable file
/// so that the application can only be run in an app container.
/// Also known as a "Windows Store app".
/// </para>
/// </summary>
WindowsRuntimeApplication = 5,
}
internal static partial class EnumBounds
{
internal static bool IsValid(this OutputKind value)
{
return value >= OutputKind.ConsoleApplication && value <= OutputKind.WindowsRuntimeApplication;
}
internal static string GetDefaultExtension(this OutputKind kind)
{
switch (kind)
{
case OutputKind.ConsoleApplication:
case OutputKind.WindowsApplication:
case OutputKind.WindowsRuntimeApplication:
return ".exe";
case OutputKind.DynamicallyLinkedLibrary:
return ".dll";
case OutputKind.NetModule:
return ".netmodule";
case OutputKind.WindowsRuntimeMetadata:
return ".winmdobj";
default:
return ".dll";
}
}
internal static bool IsApplication(this OutputKind kind)
{
switch (kind)
{
case OutputKind.ConsoleApplication:
case OutputKind.WindowsApplication:
case OutputKind.WindowsRuntimeApplication:
return true;
case OutputKind.DynamicallyLinkedLibrary:
case OutputKind.NetModule:
case OutputKind.WindowsRuntimeMetadata:
return false;
default:
return false;
}
}
internal static bool IsNetModule(this OutputKind kind)
{
return kind == OutputKind.NetModule;
}
internal static bool IsWindowsRuntime(this OutputKind kind)
{
return kind == OutputKind.WindowsRuntimeMetadata;
}
}
}