| | 1 | | using KernelConfigurationTypes; |
| | 2 | | using System; |
| | 3 | | using System.Collections.Generic; |
| | 4 | |
|
| | 5 | | [Serializable] |
| | 6 | | public class KernelConfigModel |
| | 7 | | { |
| | 8 | | private const string MAIN_NET = "mainnet"; |
| | 9 | | private const string ORG = ".org"; |
| | 10 | | private const string ZONE = ".zone"; |
| | 11 | |
|
| 50 | 12 | | public Features features = new Features(); |
| 50 | 13 | | public Comms comms = new Comms(); |
| 50 | 14 | | public Profiles profiles = new Profiles(); |
| | 15 | | public bool gifSupported = false; |
| 50 | 16 | | public string network = MAIN_NET; |
| 50 | 17 | | public List<WorldRange> validWorldRanges = new List<WorldRange>(); |
| 50 | 18 | | public string kernelVersion = string.Empty; |
| 50 | 19 | | public string rendererVersion = string.Empty; |
| 50 | 20 | | public Debugging debugConfig = new Debugging(); |
| 50 | 21 | | public ProceduralSkybox proceduralSkyboxConfig = new ProceduralSkybox(); |
| 50 | 22 | | public string avatarTextureAPIBaseUrl = string.Empty; |
| | 23 | | public bool urlParamsForWearablesDebug = false; |
| 50 | 24 | | public string builderUrl = string.Empty; |
| | 25 | |
|
| 0 | 26 | | public override bool Equals(object obj) { return obj is KernelConfigModel other && Equals(other); } |
| | 27 | |
|
| | 28 | | public bool Equals(KernelConfigModel other) |
| | 29 | | { |
| 49 | 30 | | if (other == null) |
| 0 | 31 | | return false; |
| | 32 | |
|
| 49 | 33 | | if (validWorldRanges.Count != other.validWorldRanges.Count) |
| 2 | 34 | | return false; |
| | 35 | |
|
| 96 | 36 | | for (var i = 0; i < validWorldRanges.Count; i++) |
| | 37 | | { |
| 1 | 38 | | if (!validWorldRanges[i].Equals(other.validWorldRanges[i])) |
| 0 | 39 | | return false; |
| | 40 | | } |
| | 41 | |
|
| 47 | 42 | | return comms.Equals(other.comms) |
| | 43 | | && profiles.Equals(other.profiles) |
| | 44 | | && features.Equals(other.features) |
| | 45 | | && gifSupported == other.gifSupported |
| | 46 | | && network == other.network |
| | 47 | | && kernelVersion == other.kernelVersion |
| | 48 | | && rendererVersion == other.rendererVersion |
| | 49 | | && debugConfig.Equals(other.debugConfig) |
| | 50 | | && proceduralSkyboxConfig.Equals(other.proceduralSkyboxConfig) |
| | 51 | | && avatarTextureAPIBaseUrl == other.avatarTextureAPIBaseUrl |
| | 52 | | && urlParamsForWearablesDebug == other.urlParamsForWearablesDebug |
| | 53 | | && builderUrl == other.builderUrl; |
| | 54 | | } |
| | 55 | |
|
| | 56 | | public string GetTld() => |
| 0 | 57 | | network.Equals(MAIN_NET, StringComparison.OrdinalIgnoreCase) ? ORG : ZONE; |
| | 58 | |
|
| | 59 | | public KernelConfigModel Clone() |
| | 60 | | { |
| | 61 | | // NOTE: We need to use deep clone |
| 2 | 62 | | KernelConfigModel clone = new KernelConfigModel(); |
| 2 | 63 | | clone.comms = comms.Clone(); |
| 2 | 64 | | clone.profiles = profiles.Clone(); |
| 2 | 65 | | clone.features = features.Clone(); |
| 2 | 66 | | clone.gifSupported = gifSupported; |
| 2 | 67 | | clone.network = network; |
| 2 | 68 | | clone.validWorldRanges = new List<WorldRange>(validWorldRanges); |
| 2 | 69 | | clone.kernelVersion = kernelVersion; |
| 2 | 70 | | clone.rendererVersion = rendererVersion; |
| 2 | 71 | | clone.debugConfig = debugConfig.Clone(); |
| 2 | 72 | | clone.proceduralSkyboxConfig = proceduralSkyboxConfig.Clone(); |
| 2 | 73 | | clone.avatarTextureAPIBaseUrl = avatarTextureAPIBaseUrl; |
| 2 | 74 | | clone.urlParamsForWearablesDebug = urlParamsForWearablesDebug; |
| 2 | 75 | | clone.builderUrl = builderUrl; |
| 2 | 76 | | return clone; |
| | 77 | | } |
| | 78 | | } |