Repository navigation
Expand file tree
/
Copy pathQBRelayModeController.cs
More file actions
52 lines (47 loc) · 1.63 KB
/
Copy pathQBRelayModeController.cs
File metadata and controls
52 lines (47 loc) · 1.63 KB
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
namespace MiSideMultiplayer.RelayServer
{
internal enum QBRelayLobbyMode
{
DirectConnect = 1
}
/// <summary>
/// Protocol gate for the distributable Direct Connect relay. This build is
/// permanently Direct Connect-only; no command-line argument or console
/// command can enable Public/Private directory behavior.
/// </summary>
internal static class QBRelayModeController
{
public static QBRelayLobbyMode Mode { get { return QBRelayLobbyMode.DirectConnect; } }
public static string ModeName { get { return "directconnect"; } }
public static void Configure(string[] args)
{
// Intentionally ignore mode flags: this binary has one protocol mode.
}
public static bool AllowsVisibility(int visibility, string roomId, string code,
out string reason)
{
if (visibility != 2)
{
reason = "server_mode_mismatch";
return false;
}
if (!string.Equals(roomId, "default", System.StringComparison.OrdinalIgnoreCase))
{
reason = "direct_room_must_be_default";
return false;
}
if (!string.IsNullOrWhiteSpace(code))
{
reason = "direct_code_not_supported";
return false;
}
reason = string.Empty;
return true;
}
public static bool TrySetMode(QBRelayLobbyMode requested, out string reason)
{
reason = "Cannot do that in this current environment.";
return false;
}
}
}