| | 1 | | using Newtonsoft.Json.Linq; |
| | 2 | | using ValidateLib.ErrorsAndWarnings.Warnings; |
| | 3 | | using ValidateLib.Metadata.Descriptors; |
| | 4 | | using ValidateLib.Metadata.Properties.AtomicProperties; |
| | 5 | |
|
| | 6 | | namespace ValidateLib.Metadata.PropertyParsers.DIalect |
| | 7 | | { |
| | 8 | | internal class HeaderPropertyParser : PropertyParserBase<DialectDescriptor>, IPropertyParser<DialectDescriptor> |
| | 9 | | { |
| 1 | 10 | | public HeaderPropertyParser(List<Warning> warnings, DialectDescriptor descriptor) : base(warnings, descriptor) |
| | 11 | | { |
| 1 | 12 | | } |
| | 13 | |
|
| | 14 | | public void ParseProperty(JProperty property) |
| | 15 | | { |
| 1 | 16 | | if (property.Value.Type != JTokenType.Boolean) |
| | 17 | | { |
| 1 | 18 | | Warnings.Add(WarningFactory.GetAtomicPropertyBoolWrongValueWarning(property.Value, property.Name, proper |
| 1 | 19 | | Descriptor.header = new AtomicPropertyBoolean(true); |
| 1 | 20 | | if (Descriptor.headerRowCount!.IsDefault) Descriptor.headerRowCount = new AtomicPropertyInteger(1); |
| | 21 | | } |
| | 22 | | else |
| | 23 | | { |
| 1 | 24 | | bool boolValue = (bool)property.Value; |
| 1 | 25 | | Descriptor.header = new AtomicPropertyBoolean(boolValue); |
| 1 | 26 | | if (Descriptor.headerRowCount!.IsDefault) |
| 1 | 27 | | Descriptor.headerRowCount = new AtomicPropertyInteger(boolValue ? 1 : 0); |
| | 28 | | } |
| | 29 | |
|
| 1 | 30 | | } |
| | 31 | | } |
| | 32 | | } |