예제 #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));
        }
예제 #2
0
        public static T FromBytes(byte[] bytes)
        {
            TMemoryBuffer trans = new TMemoryBuffer(bytes);
            TProtocol     prot  = new TCompactProtocol(trans);

            return(Proto <T> .Read(prot));
        }
예제 #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));
        }
예제 #4
0
파일: Proto.cs 프로젝트: xgray/dotnet
 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));
     }
 }
예제 #5
0
파일: Proto.cs 프로젝트: xgray/dotnet
        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));
        }
예제 #6
0
파일: StructValue.cs 프로젝트: xgray/dotnet
 public T Read(JsonReader reader)
 {
     return(Proto <T> .Read(reader));
 }
예제 #7
0
파일: StructValue.cs 프로젝트: xgray/dotnet
 public T Read(XmlReader reader)
 {
     return(Proto <T> .Read(reader));
 }
예제 #8
0
파일: StructValue.cs 프로젝트: xgray/dotnet
 public T Read(XElement xe)
 {
     return(Proto <T> .Read(xe));
 }
예제 #9
0
파일: StructValue.cs 프로젝트: xgray/dotnet
 public T Read(TProtocol iprot)
 {
     return(Proto <T> .Read(iprot));
 }
예제 #10
0
파일: Proto.cs 프로젝트: xgray/dotnet
 public static T FromXDoc(XElement xe)
 {
     // XElement xe = XElement.Load(new StringReader(xml));
     return(Proto <T> .Read(xe));
 }
예제 #11
0
파일: Proto.cs 프로젝트: xgray/dotnet
        public static T Read(TProtocol iprot)
        {
            T value = new T();

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