| | 1 | | using System; |
| | 2 | |
|
| | 3 | |
|
| | 4 | | namespace Morpho25.Settings |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Cloud class. |
| | 8 | | /// </summary> |
| | 9 | | public class Cloud |
| | 10 | | { |
| | 11 | | private uint _lowClouds; |
| | 12 | | private uint _middleClouds; |
| | 13 | | private uint _highClouds; |
| | 14 | |
|
| | 15 | | private void IsMoreThanEight(double value) |
| 8 | 16 | | { |
| 8 | 17 | | if (value < 0 || value > 8) |
| 1 | 18 | | throw new ArgumentException("Value must be in range (0, 8)."); |
| 7 | 19 | | } |
| | 20 | | /// <summary> |
| | 21 | | /// Fraction of LOW clouds (x/8). |
| | 22 | | /// </summary> |
| | 23 | | public uint LowClouds |
| | 24 | | { |
| 3 | 25 | | get { return _lowClouds; } |
| | 26 | | set |
| 2 | 27 | | { |
| 2 | 28 | | IsMoreThanEight(value); |
| 2 | 29 | | _lowClouds = value; |
| 2 | 30 | | } |
| | 31 | | } |
| | 32 | | /// <summary> |
| | 33 | | /// Fraction of MIDDLE clouds (x/8). |
| | 34 | | /// </summary> |
| | 35 | | public uint MiddleClouds |
| | 36 | | { |
| 3 | 37 | | get { return _middleClouds; } |
| | 38 | | set |
| 2 | 39 | | { |
| 2 | 40 | | IsMoreThanEight(value); |
| 2 | 41 | | _middleClouds = value; |
| 2 | 42 | | } |
| | 43 | | } |
| | 44 | | /// <summary> |
| | 45 | | /// Fraction of HIGH clouds (x/8). |
| | 46 | | /// </summary> |
| | 47 | | public uint HighClouds |
| | 48 | | { |
| 9 | 49 | | get { return _highClouds; } |
| | 50 | | set |
| 4 | 51 | | { |
| 4 | 52 | | IsMoreThanEight(value); |
| 3 | 53 | | _highClouds = value; |
| 3 | 54 | | } |
| | 55 | | } |
| | 56 | | /// <summary> |
| | 57 | | /// Create new Cloud object. |
| | 58 | | /// </summary> |
| 2 | 59 | | public Cloud() |
| 2 | 60 | | { |
| 2 | 61 | | LowClouds = 0; |
| 2 | 62 | | MiddleClouds = 0; |
| 2 | 63 | | HighClouds = 0; |
| | 64 | |
|
| 2 | 65 | | } |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// Title of the XML section |
| | 69 | | /// </summary> |
| 1 | 70 | | public string Title => "Clouds"; |
| | 71 | |
|
| | 72 | | /// <summary> |
| | 73 | | /// Values of the XML section |
| | 74 | | /// </summary> |
| 1 | 75 | | public string[] Values => new[] { |
| 1 | 76 | | LowClouds.ToString("n5"), |
| 1 | 77 | | MiddleClouds.ToString("n5"), |
| 1 | 78 | | HighClouds.ToString("n5") |
| 1 | 79 | | }; |
| | 80 | |
|
| | 81 | | /// <summary> |
| | 82 | | /// Tags of the XML section |
| | 83 | | /// </summary> |
| 1 | 84 | | public string[] Tags => new[] { |
| 1 | 85 | | "lowClouds", |
| 1 | 86 | | "middleClouds", |
| 1 | 87 | | "highClouds" |
| 1 | 88 | | }; |
| | 89 | |
|
| | 90 | | /// <summary> |
| | 91 | | /// String representation of Cloud object. |
| | 92 | | /// </summary> |
| | 93 | | /// <returns>String representation.</returns> |
| 0 | 94 | | public override string ToString() => $"Config::Cloud::{LowClouds},{MiddleClouds},{HighClouds}"; |
| | 95 | | } |
| | 96 | |
|
| | 97 | | } |