-
-
Notifications
You must be signed in to change notification settings - Fork 299
/
DiscordVoiceRegion.cs
94 lines (78 loc) · 3.43 KB
/
DiscordVoiceRegion.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
using Newtonsoft.Json;
namespace DSharpPlus.Entities;
/// <summary>
/// Represents information about a Discord voice server region.
/// </summary>
public class DiscordVoiceRegion
{
/// <summary>
/// Gets the unique ID for the region.
/// </summary>
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
public string Id { get; internal set; }
/// <summary>
/// Gets the name of the region.
/// </summary>
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public string Name { get; internal set; }
/// <summary>
/// Gets an example server hostname for this region.
/// </summary>
[JsonProperty("sample_hostname", NullValueHandling = NullValueHandling.Ignore)]
public string SampleHostname { get; internal set; }
/// <summary>
/// Gets an example server port for this region.
/// </summary>
[JsonProperty("sample_port", NullValueHandling = NullValueHandling.Ignore)]
public int SamplePort { get; internal set; }
/// <summary>
/// Gets whether this is a VIP-only region.
/// </summary>
[JsonProperty("vip", NullValueHandling = NullValueHandling.Ignore)]
public bool IsVIP { get; internal set; }
/// <summary>
/// Gets whether this region is the most optimal for the current user.
/// </summary>
[JsonProperty("optimal", NullValueHandling = NullValueHandling.Ignore)]
public bool IsOptimal { get; internal set; }
/// <summary>
/// Gets whether this voice region is deprecated.
/// </summary>
[JsonProperty("deprecated", NullValueHandling = NullValueHandling.Ignore)]
public bool IsDeprecated { get; internal set; }
/// <summary>
/// Gets whether this is a custom voice region.
/// </summary>
[JsonProperty("custom", NullValueHandling = NullValueHandling.Ignore)]
public bool IsCustom { get; internal set; }
/// <summary>
/// Gets whether two <see cref="DiscordVoiceRegion"/>s are equal.
/// </summary>
/// <param name="region">The region to compare with.</param>
/// <returns></returns>
public bool Equals(DiscordVoiceRegion region)
=> this == region;
public override bool Equals(object obj) => Equals(obj as DiscordVoiceRegion);
public override int GetHashCode() => this.Id.GetHashCode();
/// <summary>
/// Gets whether the two <see cref="DiscordVoiceRegion"/> objects are equal.
/// </summary>
/// <param name="left">First voice region to compare.</param>
/// <param name="right">Second voice region to compare.</param>
/// <returns>Whether the two voice regions are equal.</returns>
public static bool operator ==(DiscordVoiceRegion left, DiscordVoiceRegion right)
{
object? o1 = left;
object? o2 = right;
return (o1 != null || o2 == null) && (o1 == null || o2 != null) && ((o1 == null && o2 == null) || left.Id == right.Id);
}
/// <summary>
/// Gets whether the two <see cref="DiscordVoiceRegion"/> objects are not equal.
/// </summary>
/// <param name="left">First voice region to compare.</param>
/// <param name="right">Second voice region to compare.</param>
/// <returns>Whether the two voice regions are not equal.</returns>
public static bool operator !=(DiscordVoiceRegion left, DiscordVoiceRegion right)
=> !(left == right);
internal DiscordVoiceRegion() { }
}