Esempio n. 1
0
 /// <inheritdoc />
 public async Task <TReturnType> DeserializeAsync <TReturnType>(IResponseBodyReader reader)
 {
     using (MemoryStream ms = new MemoryStream(await reader.ReadAsBytesAsync().ConfigureAwait(false)))
     {
         return(ProtoBuf.Serializer.Deserialize <TReturnType>(ms));
     }
 }
        /// <inheritdoc />
        public async Task <TReturnType> DeserializeAsync <TReturnType>(IResponseBodyReader reader)
        {
            string json = await reader.ReadAsStringAsync()
                          .ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <TReturnType>(json));
        }
Esempio n. 3
0
 /// <inheritdoc />
 public TReturnType Deserialize <TReturnType>(IResponseBodyReader reader)
 {
     using (MemoryStream ms = new MemoryStream(reader.ReadAsBytes()))
     {
         return(ProtoBuf.Serializer.Deserialize <TReturnType>(ms));
     }
 }
Esempio n. 4
0
        /// <inheritdoc />
        public TReturnType Deserialize <TReturnType>(IResponseBodyReader reader)
        {
            string xml = reader.ReadAsString();

            XmlSerializer serializer = new XmlSerializer(typeof(TReturnType));

            using (StringReader stringReader = new StringReader(xml))
            {
                using (XmlReader xmlReader = XmlReader.Create(stringReader))
                {
                    return((TReturnType)serializer.Deserialize(xmlReader));
                }
            }
        }
Esempio n. 5
0
        /// <inheritdoc />
        public async Task <TReturnType> DeserializeAsync <TReturnType>(IResponseBodyReader reader)
        {
            string xml = await reader.ReadAsStringAsync();

            //TODO: Can or should this be done async too?
            XmlSerializer serializer = new XmlSerializer(typeof(TReturnType));

            using (StringReader stringReader = new StringReader(xml))
            {
                using (XmlReader xmlReader = XmlReader.Create(stringReader))
                {
                    return((TReturnType)serializer.Deserialize(xmlReader));
                }
            }
        }
        /// <inheritdoc />
        public TReturnType Deserialize <TReturnType>(IResponseBodyReader reader)
        {
            string json = reader.ReadAsString();

            return(JsonConvert.DeserializeObject <TReturnType>(json));
        }
Esempio n. 7
0
 /// <inheritdoc />
 public async Task <TReturnType> DeserializeAsync <TReturnType>(IResponseBodyReader reader)
 {
     //This is ugly but we should TRUST that the caller knows what they are doing
     //but it is very likely that the TReturnType is a string
     return((TReturnType)(object)await reader.ReadAsStringAsync().ConfigureAwait(false));
 }
Esempio n. 8
0
 /// <inheritdoc />
 public TReturnType Deserialize <TReturnType>(IResponseBodyReader reader)
 {
     //This is ugly but we should TRUST that the caller knows what they are doing
     //but it is very likely that the TReturnType is a string
     return((TReturnType)(object)reader.ReadAsString());
 }
 /// <inheritdoc />
 public Task <TReturnType> DeserializeAsync <TReturnType>(IResponseBodyReader reader)
 {
     throw new NotImplementedException("TODO: Urlencoded response is not supported as a response type.");
 }