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