Beispiel #1
0
        public static T FromJson(string json)
        {
            TMemoryBuffer trans = new TMemoryBuffer(Encoding.UTF8.GetBytes(json));
            TProtocol     prot  = new TSimpleJSONProtocol(trans);

            return(Proto <T> .Read(prot));
        }
Beispiel #2
0
        public static T FromBytes(byte[] bytes)
        {
            TMemoryBuffer trans = new TMemoryBuffer(bytes);
            TProtocol     prot  = new TCompactProtocol(trans);

            return(Proto <T> .Read(prot));
        }
Beispiel #3
0
        public static T FromXml(string xml)
        {
            TMemoryBuffer trans = new TMemoryBuffer(Encoding.UTF8.GetBytes(xml));
            TProtocol     prot  = new TXmlProtocol(trans);

            return(Proto <T> .Read(prot));
        }
Beispiel #4
0
 public static T FromJson(string json)
 {
     using (StringReader stringReader = new StringReader(json))
     {
         JsonReader reader = new JsonTextReader(stringReader);
         reader.DateParseHandling = DateParseHandling.None;
         reader.Read();
         return(Proto <T> .Read(reader));
     }
 }
Beispiel #5
0
        public static T FromXml(string xml)
        {
            XmlReaderSettings readerSettings = new XmlReaderSettings
            {
                IgnoreProcessingInstructions = true,
                IgnoreWhitespace             = true,
                IgnoreComments = true,
            };

            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(xml));
            XmlReader    reader = XmlReader.Create(stream, readerSettings);

            reader.Read();

            return(Proto <T> .Read(reader));
        }
Beispiel #6
0
 public T Read(JsonReader reader)
 {
     return(Proto <T> .Read(reader));
 }
Beispiel #7
0
 public T Read(XmlReader reader)
 {
     return(Proto <T> .Read(reader));
 }
Beispiel #8
0
 public T Read(XElement xe)
 {
     return(Proto <T> .Read(xe));
 }
Beispiel #9
0
 public T Read(TProtocol iprot)
 {
     return(Proto <T> .Read(iprot));
 }
Beispiel #10
0
 public static T FromXDoc(XElement xe)
 {
     // XElement xe = XElement.Load(new StringReader(xml));
     return(Proto <T> .Read(xe));
 }
Beispiel #11
0
        public static T Read(TProtocol iprot)
        {
            T value = new T();

            return(Proto <T> .Read(iprot, value));
        }