| | | 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.Note |
| | | 7 | | { |
| | | 8 | | internal class NotesPropertyParser : PropertyParserBase<TopLevelObjectDescriptor>, IPropertyParser<TopLevelObjectDes |
| | | 9 | | { |
| | 0 | 10 | | public NotesPropertyParser(List<Warning> warnings, TopLevelObjectDescriptor descriptor) : base(warnings, descrip |
| | | 11 | | { |
| | 0 | 12 | | } |
| | | 13 | | public void ParseProperty(JProperty property) |
| | | 14 | | { |
| | 0 | 15 | | if (property.Value.Type != JTokenType.Array) |
| | | 16 | | { |
| | 0 | 17 | | Warnings.Add(WarningFactory.GetArrayPropertyWrongValueWarning(property, property.Value.Type.ToString())) |
| | 0 | 18 | | Descriptor.notes = new ArrayProperty<NoteDescriptor>(new List<NoteDescriptor>()); |
| | | 19 | | } |
| | | 20 | | else |
| | | 21 | | { |
| | 0 | 22 | | List<NoteDescriptor> notesObjects = new List<NoteDescriptor>(); |
| | 0 | 23 | | foreach (var noteObject in property.Value) |
| | | 24 | | { |
| | 0 | 25 | | if (noteObject.Type == JTokenType.Object) |
| | | 26 | | { |
| | 0 | 27 | | var noteDescriptor = new NoteDescriptor(); |
| | 0 | 28 | | noteDescriptor.Note = new CommonProperty(null, noteObject); |
| | 0 | 29 | | notesObjects.Add(noteDescriptor); |
| | | 30 | | } |
| | | 31 | | |
| | | 32 | | } |
| | 0 | 33 | | Descriptor.notes = new ArrayProperty<NoteDescriptor>(notesObjects); |
| | | 34 | | } |
| | 0 | 35 | | } |
| | | 36 | | } |
| | | 37 | | } |