Ejemplo n.º 1
0
        public void ParseValue()
        {
            JsonToken?token = null;

            switch (currentSlice.Type)
            {
            case SliceType.Binary:
                token = JsonToken.Bytes;
                break;

            case SliceType.Boolean:
                token = JsonToken.Boolean;
                break;

            case SliceType.Double:
                token = JsonToken.Float;
                break;

            case SliceType.Int:
            case SliceType.UInt:
            case SliceType.SmallInt:
                token = JsonToken.Integer;
                break;

            case SliceType.UtcDate:
                token = JsonToken.Date;
                break;

            case SliceType.String:
                token = JsonToken.String;
                break;

            case SliceType.Null:
                token = JsonToken.Null;
                break;
            }

            if (token.HasValue == false)
            {
                throw new InvalidOperationException($"Error at reading vpack slice parsing value");
            }

            SetToken(token.Value, currentSlice.Value());
        }