forked from ppy/osu-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHost.cs
42 lines (36 loc) · 1.52 KB
/
Host.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
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Platform;
using osu.Framework.Platform.Linux;
using osu.Framework.Platform.MacOS;
using osu.Framework.Platform.Windows;
namespace osu.Framework
{
public static class Host
{
[Obsolete("Use GetSuitableDesktopHost(string, HostOptions) instead.")] // Can be removed 20220715
public static DesktopGameHost GetSuitableHost(string gameName, bool bindIPC = false, bool portableInstallation = false)
{
return GetSuitableDesktopHost(gameName, new HostOptions
{
BindIPC = bindIPC,
PortableInstallation = portableInstallation,
});
}
public static DesktopGameHost GetSuitableDesktopHost(string gameName, HostOptions hostOptions = null)
{
switch (RuntimeInfo.OS)
{
case RuntimeInfo.Platform.Windows:
return new WindowsGameHost(gameName, hostOptions);
case RuntimeInfo.Platform.Linux:
return new LinuxGameHost(gameName, hostOptions);
case RuntimeInfo.Platform.macOS:
return new MacOSGameHost(gameName, hostOptions);
default:
throw new InvalidOperationException($"Could not find a suitable host for the selected operating system ({RuntimeInfo.OS}).");
}
}
}
}