ReadText() public method

Returns the text contents of the current token being parsed.
public ReadText ( ) : string
return string
        public DateTime Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            string text = context.ReadText();

            return(UnmarshallInternal(text, treatAsNullable: false).Value);
        }
        public MemoryStream Unmarshall(JsonUnmarshallerContext context)
        {
            byte[]       bytes  = Convert.FromBase64String(context.ReadText());
            MemoryStream stream = new MemoryStream(bytes);

            return(stream);
        }
Exemplo n.º 3
0
        public static T Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            string text = context.ReadText();

            if (text == null)
            {
                return(default(T));
            }
            return((T)Convert.ChangeType(text, typeof(T), CultureInfo.InvariantCulture));
        }
        public MemoryStream Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            byte[]       bytes  = Convert.FromBase64String(context.ReadText());
            MemoryStream stream = new MemoryStream(bytes);

            return(stream);
        }
Exemplo n.º 5
0
        public DateTime Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            string text = context.ReadText();

            if (double.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out double result))
            {
                return(new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(result));
            }
            if (text == null)
            {
                return(default(DateTime));
            }
            return((DateTime)Convert.ChangeType(text, typeof(DateTime), CultureInfo.InvariantCulture));
        }
        public DateTime Unmarshall(JsonUnmarshallerContext context)
        {
            DateTime ret;
            Double   seconds;

            if (Double.TryParse(context.ReadText(), NumberStyles.Any, CultureInfo.InvariantCulture, out seconds))
            {
                ret = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                ret = ret.AddSeconds(seconds);
            }
            else
            {
                ret = SimpleTypeUnmarshaller <DateTime> .Unmarshall(context);
            }
            return(ret);
        }
        public DateTime Unmarshall(JsonUnmarshallerContext context)
        {
            DateTime ret;
            Double   seconds;

            context.Read();
            string text = context.ReadText();

            if (Double.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out seconds))
            {
                ret = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                ret = ret.AddSeconds(seconds);
            }
            else
            {
                if (text == null)
                {
                    return(default(DateTime));
                }

                return((DateTime)Convert.ChangeType(text, typeof(DateTime), CultureInfo.InvariantCulture));
            }
            return(ret);
        }
 public MemoryStream Unmarshall(JsonUnmarshallerContext context)
 {
     context.Read();
     return(new MemoryStream(Convert.FromBase64String(context.ReadText())));
 }
        public static T Unmarshall(JsonUnmarshallerContext context)
        {
            string text = context.ReadText();

            return((T)Convert.ChangeType(text, typeof(T), System.Globalization.CultureInfo.InvariantCulture));
        }