Esempio n. 1
0
 public TargetItemReadHandler(
     JsonReader reader,
     JsonSerializer serializer,
     AConverterReadHandler parent,
     TargetItemAssets targetItemAssets)
     : base(reader, serializer, parent)
 {
     this.targetItemAssets = targetItemAssets;
 }
        protected override AConverterReadHandler Handle(JsonToken tknType)
        {
            switch (tknType)
            {
            case JsonToken.StartObject:
                break;

            case JsonToken.EndObject:
                return(this.Parent);

            case JsonToken.PropertyName:
                var targetItemName   = (string)this.Reader.Value;
                var targetItemAssets = new TargetItemAssets(targetItemName);
                this.targetAssets.AddTargetItem(targetItemAssets);
                return(new TargetItemReadHandler(this.Reader, this.Serializer, this, targetItemAssets));

            default:
                break;
            }

            return(this);
        }