/// <summary> /// The inner type reader on complete event. /// </summary> private void InnerTypeReaderOnCompleteEvent() { this.reader.Listener = this; this.OnObject(this.innerTypeReader.Result()); this.innerTypeReader = null; }
/// <summary> /// The on array. /// </summary> /// <param name="size"> /// The size. /// </param> /// <exception cref="CborException"> /// </exception> public void OnArray(int size) { if (this.currentTag != 0) { throw new CborException("invalid tagging on type"); } this.innerTypeReader = new CborListReader(this.reader, size, this.nextType); this.innerTypeReader.CompleteEvent += this.InnerTypeReaderOnCompleteEvent; this.reader.Listener = this.innerTypeReader; }
/// <summary> /// The on map. /// </summary> /// <param name="size"> /// The size. /// </param> /// <exception cref="CborException"> /// </exception> public void OnMap(int size) { if (this.currentTag != 0) { // parse object CborTypeTemplate innerTemplate = CborTypeRegistry.Instance.GetTemplate(this.currentTag); if (innerTemplate == null) { throw new CborException("unknown object tag: " + this.currentTag); } this.currentTag = 0; this.innerTypeReader = new CborObjectReader(this.reader, innerTemplate, size); this.innerTypeReader.CompleteEvent += this.InnerTypeReaderOnCompleteEvent; this.reader.Listener = this.innerTypeReader; } else { // parse map this.innerTypeReader = new CborMapReader(this.reader, size, this.nextType); this.innerTypeReader.CompleteEvent += this.InnerTypeReaderOnCompleteEvent; this.reader.Listener = this.innerTypeReader; } }