forked from BepInEx/BepInEx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDistributionTarget.cs
34 lines (30 loc) · 1.11 KB
/
DistributionTarget.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
using System;
readonly record struct DistributionTarget(string DistributionIdentifier, string RuntimeIndentifier)
{
public readonly string Arch = RuntimeIndentifier.Split('-')[1];
public readonly string Engine = DistributionIdentifier.Split('.')[0];
public readonly string Os = RuntimeIndentifier.Split('-')[0];
public readonly string Runtime = DistributionIdentifier.Split('.')[1];
public readonly string Target = $"{DistributionIdentifier}-{RuntimeIndentifier}";
public string ClearOsName => Os switch
{
"win" => "Windows",
"linux" => "Linux",
"macos" => "macOS",
var _ => throw new NotSupportedException($"OS {Os} is not supported")
};
public string DllExtension => Os switch
{
"win" => "dll",
"linux" => "so",
"macos" => "dylib",
var _ => throw new NotSupportedException($"Unsupported OS: {Os}")
};
public string DllPrefix => Os switch
{
"win" => "",
"linux" => "lib",
"macos" => "lib",
_ => throw new NotSupportedException($"Unsupported OS: {Os}")
};
}