| | 1 | | using System; |
| | 2 | |
|
| | 3 | | namespace Variables.RealmsInfo |
| | 4 | | { |
| | 5 | | public class CurrentRealmVariable : BaseVariable<CurrentRealmModel> |
| | 6 | | { |
| | 7 | | public override bool Equals(CurrentRealmModel other) |
| | 8 | | { |
| | 9 | | if (value == null) |
| | 10 | | { |
| | 11 | | return other == null; |
| | 12 | | } |
| | 13 | |
|
| | 14 | | return value.Equals(other); |
| | 15 | | } |
| | 16 | | } |
| | 17 | |
|
| | 18 | | [Serializable] |
| | 19 | | public class CurrentRealmModel |
| | 20 | | { |
| | 21 | | public string layer; |
| | 22 | | public string serverName; |
| 6 | 23 | | public string domain = string.Empty; |
| 6 | 24 | | public string contentServerUrl = string.Empty; |
| | 25 | |
|
| 0 | 26 | | public bool isArchipelagoRealm => string.IsNullOrEmpty(layer); |
| | 27 | |
|
| | 28 | | public bool Equals(CurrentRealmModel other) |
| | 29 | | { |
| 6 | 30 | | if (other == null) |
| 1 | 31 | | return false; |
| 5 | 32 | | return Equals(other.serverName, other.layer, other.domain, other.contentServerUrl); |
| | 33 | | } |
| | 34 | |
|
| 5 | 35 | | public bool Equals(string serverName, string layer, string domain, string contentServerUrl) { return Equals(serv |
| | 36 | |
|
| | 37 | | public bool Equals(string serverName, string layer) |
| | 38 | | { |
| 5 | 39 | | if (isArchipelagoRealm) |
| 0 | 40 | | return this.serverName == serverName; |
| | 41 | | else |
| 5 | 42 | | return this.serverName == serverName && this.layer == layer; |
| | 43 | | } |
| | 44 | |
|
| | 45 | | public CurrentRealmModel Clone() |
| | 46 | | { |
| 4 | 47 | | return new CurrentRealmModel() |
| | 48 | | { |
| | 49 | | serverName = serverName, |
| | 50 | | layer = layer, |
| | 51 | | domain = domain, |
| | 52 | | contentServerUrl = contentServerUrl |
| | 53 | | }; |
| | 54 | | } |
| | 55 | | } |
| | 56 | | } |