| | | 1 | | using Newtonsoft.Json.Linq; |
| | | 2 | | using ValidateLib.ErrorsAndWarnings.Warnings; |
| | | 3 | | using ValidateLib.Metadata.Descriptors; |
| | | 4 | | using ValidateLib.Metadata.Properties; |
| | | 5 | | |
| | | 6 | | namespace ValidateLib.Metadata.PropertyParsers.TopLevelObject |
| | | 7 | | { |
| | | 8 | | public class NotesPropertyParser : PropertyParserBase<TopLevelObjectDescriptor>, IPropertyParser<TopLevelObjectDescr |
| | | 9 | | { |
| | 1 | 10 | | public NotesPropertyParser(List<Warning> warnings, TopLevelObjectDescriptor descriptor) : base(warnings, descrip |
| | | 11 | | { |
| | 1 | 12 | | } |
| | | 13 | | |
| | | 14 | | public void ParseProperty(JProperty property) |
| | | 15 | | { |
| | 1 | 16 | | if (property.Value.Type != JTokenType.Array) |
| | | 17 | | { |
| | 0 | 18 | | Warnings.Add(WarningFactory.GetArrayPropertyWrongValueWarning(property, property.Value.Type.ToString())) |
| | 0 | 19 | | Descriptor.notes = new ArrayProperty<NoteDescriptor>(new List<NoteDescriptor>()); |
| | | 20 | | } |
| | | 21 | | else |
| | | 22 | | { |
| | 1 | 23 | | List<NoteDescriptor> notesObjects = new List<NoteDescriptor>(); |
| | 1 | 24 | | foreach (var noteObject in property.Value) |
| | | 25 | | { |
| | 1 | 26 | | if (noteObject.Type == JTokenType.Object) |
| | | 27 | | { |
| | 1 | 28 | | var noteDescriptor = new NoteDescriptor(); |
| | 1 | 29 | | noteDescriptor.Note = new CommonProperty(null, noteObject); |
| | 1 | 30 | | notesObjects.Add(noteDescriptor); |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | } |
| | 1 | 34 | | Descriptor.notes = new ArrayProperty<NoteDescriptor>(notesObjects); |
| | | 35 | | } |
| | 1 | 36 | | } |
| | | 37 | | } |
| | | 38 | | } |